diff options
| author | Jani Nikula <jani.nikula@intel.com> | 2023-09-15 11:23:38 +0300 |
|---|---|---|
| committer | Jani Nikula <jani.nikula@intel.com> | 2023-09-15 11:23:38 +0300 |
| commit | a3f9e4bc1ec9d8f1e352eb7c1cbaea3168246be7 (patch) | |
| tree | 5a2ad89248d8fe7a2da8904dd29042abb9f71739 /include/linux/mm_inline.h | |
| parent | 3106c34df6ace8a123027b9afdc73bb05d530052 (diff) | |
| parent | 0bb80ecc33a8fb5a682236443c1e740d5c917d1d (diff) | |
Merge drm/drm-next into drm-intel-next
Sync to v6.6-rc1.
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Diffstat (limited to 'include/linux/mm_inline.h')
| -rw-r--r-- | include/linux/mm_inline.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/include/linux/mm_inline.h b/include/linux/mm_inline.h index 21d6c72bcc71..8148b30a9df1 100644 --- a/include/linux/mm_inline.h +++ b/include/linux/mm_inline.h @@ -523,6 +523,27 @@ static inline bool mm_tlb_flush_nested(struct mm_struct *mm) return atomic_read(&mm->tlb_flush_pending) > 1; } +#ifdef CONFIG_MMU +/* + * Computes the pte marker to copy from the given source entry into dst_vma. + * If no marker should be copied, returns 0. + * The caller should insert a new pte created with make_pte_marker(). + */ +static inline pte_marker copy_pte_marker( + swp_entry_t entry, struct vm_area_struct *dst_vma) +{ + pte_marker srcm = pte_marker_get(entry); + /* Always copy error entries. */ + pte_marker dstm = srcm & PTE_MARKER_POISONED; + + /* Only copy PTE markers if UFFD register matches. */ + if ((srcm & PTE_MARKER_UFFD_WP) && userfaultfd_wp(dst_vma)) + dstm |= PTE_MARKER_UFFD_WP; + + return dstm; +} +#endif + /* * If this pte is wr-protected by uffd-wp in any form, arm the special pte to * replace a none pte. NOTE! This should only be called when *pte is already |
