| Seq | Timestamp | Type | Name | Duration |
|---|---|---|---|---|
| 0/0 | 2026/09/25 01:35 | flow | patch-triage |
0mArgs:null Results: {
"EnableConfigs": null,
"FocusSymbols": [],
"KMSANReasoning": "",
"NeedsKMSAN": false,
"Reasoning": "All changes in this patch series are strictly confined to the ARM64 architecture (arch/arm64/). As the target architecture is amd64, none of the modified code is compiled or reachable.",
"WorthFuzzing": false
} |
| 1/1 | 2026/09/25 01:35 | action | read-patch-diff |
0mArgs:null Results: {
"PatchDiff": "commit 9f6d6550952e42e6576c84f9d9a74c7b0a317fc5\nAuthor: syz-cluster \u003ctriage@syzkaller.com\u003e\nDate: Fri Sep 25 01:35:18 2026 +0000\n\n syz-cluster: applied patch under review\n\ndiff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig\nindex b5a51b0ef9440..43be3f0d6e9ba 100644\n--- a/arch/arm64/Kconfig\n+++ b/arch/arm64/Kconfig\n@@ -31,6 +31,7 @@ config ARM64\n \tselect ARCH_HAS_FORTIFY_SOURCE\n \tselect ARCH_HAS_GCOV_PROFILE_ALL\n \tselect ARCH_HAS_GIGANTIC_PAGE\n+\tselect ARCH_HAS_HW_PTE_T\n \tselect ARCH_HAS_KCOV\n \tselect ARCH_HAS_KERNEL_FPU_SUPPORT if KERNEL_MODE_NEON\n \tselect ARCH_HAS_KEEPINITRD\ndiff --git a/arch/arm64/include/asm/hugetlb.h b/arch/arm64/include/asm/hugetlb.h\nindex d038ff14d16ca..15b3cf53aa2ca 100644\n--- a/arch/arm64/include/asm/hugetlb.h\n+++ b/arch/arm64/include/asm/hugetlb.h\n@@ -36,33 +36,34 @@ pte_t arch_make_huge_pte(pte_t entry, unsigned int shift, vm_flags_t flags);\n #define arch_make_huge_pte arch_make_huge_pte\n #define __HAVE_ARCH_HUGE_SET_HUGE_PTE_AT\n extern void set_huge_pte_at(struct mm_struct *mm, unsigned long addr,\n-\t\t\t pte_t *ptep, pte_t pte, unsigned long sz);\n+\t\t\t hw_pte_t *ptep, pte_t pte, unsigned long sz);\n #define __HAVE_ARCH_HUGE_PTEP_SET_ACCESS_FLAGS\n extern int huge_ptep_set_access_flags(struct vm_area_struct *vma,\n-\t\t\t\t unsigned long addr, pte_t *ptep,\n+\t\t\t\t unsigned long addr, hw_pte_t *ptep,\n \t\t\t\t pte_t pte, int dirty);\n #define __HAVE_ARCH_HUGE_PTEP_GET_AND_CLEAR\n extern pte_t huge_ptep_get_and_clear(struct mm_struct *mm, unsigned long addr,\n-\t\t\t\t pte_t *ptep, unsigned long sz);\n+\t\t\t\t hw_pte_t *ptep, unsigned long sz);\n #define __HAVE_ARCH_HUGE_PTEP_SET_WRPROTECT\n extern void huge_ptep_set_wrprotect(struct mm_struct *mm,\n-\t\t\t\t unsigned long addr, pte_t *ptep);\n+\t\t\t\t unsigned long addr, hw_pte_t *ptep);\n #define __HAVE_ARCH_HUGE_PTEP_CLEAR_FLUSH\n extern pte_t huge_ptep_clear_flush(struct vm_area_struct *vma,\n-\t\t\t\t unsigned long addr, pte_t *ptep);\n+\t\t\t\t unsigned long addr, hw_pte_t *ptep);\n #define __HAVE_ARCH_HUGE_PTE_CLEAR\n extern void huge_pte_clear(struct mm_struct *mm, unsigned long addr,\n-\t\t\t pte_t *ptep, unsigned long sz);\n+\t\t\t hw_pte_t *ptep, unsigned long sz);\n #define __HAVE_ARCH_HUGE_PTEP_GET\n-extern pte_t huge_ptep_get(struct mm_struct *mm, unsigned long addr, pte_t *ptep);\n+extern pte_t huge_ptep_get(struct mm_struct *mm, unsigned long addr,\n+\t\t\t hw_pte_t *ptep);\n \n #define huge_ptep_modify_prot_start huge_ptep_modify_prot_start\n extern pte_t huge_ptep_modify_prot_start(struct vm_area_struct *vma,\n-\t\t\t\t\t unsigned long addr, pte_t *ptep);\n+\t\t\t\t\t unsigned long addr, hw_pte_t *ptep);\n \n #define huge_ptep_modify_prot_commit huge_ptep_modify_prot_commit\n extern void huge_ptep_modify_prot_commit(struct vm_area_struct *vma,\n-\t\t\t\t\t unsigned long addr, pte_t *ptep,\n+\t\t\t\t\t unsigned long addr, hw_pte_t *ptep,\n \t\t\t\t\t pte_t old_pte, pte_t new_pte);\n \n #include \u003casm-generic/hugetlb.h\u003e\ndiff --git a/arch/arm64/include/asm/pgalloc.h b/arch/arm64/include/asm/pgalloc.h\nindex 1b4509d3382c6..80063dd4d2722 100644\n--- a/arch/arm64/include/asm/pgalloc.h\n+++ b/arch/arm64/include/asm/pgalloc.h\n@@ -106,7 +106,7 @@ static inline void __pmd_populate(pmd_t *pmdp, phys_addr_t ptep,\n * of the mm address space.\n */\n static inline void\n-pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmdp, pte_t *ptep)\n+pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmdp, hw_pte_t *ptep)\n {\n \tVM_BUG_ON(mm \u0026\u0026 mm != \u0026init_mm);\n \t__pmd_populate(pmdp, __pa(ptep),\ndiff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h\nindex 6000905a2e865..9a1d604e57eb2 100644\n--- a/arch/arm64/include/asm/pgtable.h\n+++ b/arch/arm64/include/asm/pgtable.h\n@@ -361,9 +361,9 @@ static inline pte_t pte_clear_uffd(pte_t pte)\n }\n #endif /* CONFIG_HAVE_ARCH_USERFAULTFD_WP */\n \n-static inline void __set_pte_nosync(pte_t *ptep, pte_t pte)\n+static inline void __set_pte_nosync(hw_pte_t *ptep, pte_t pte)\n {\n-\tWRITE_ONCE(*ptep, pte);\n+\tWRITE_ONCE(hw_pte_val(*ptep), pte_val(pte));\n }\n \n static inline void __set_pte_complete(pte_t pte)\n@@ -376,15 +376,15 @@ static inline void __set_pte_complete(pte_t pte)\n \t\tqueue_pte_barriers();\n }\n \n-static inline void __set_pte(pte_t *ptep, pte_t pte)\n+static inline void __set_pte(hw_pte_t *ptep, pte_t pte)\n {\n \t__set_pte_nosync(ptep, pte);\n \t__set_pte_complete(pte);\n }\n \n-static inline pte_t __ptep_get(pte_t *ptep)\n+static inline pte_t __ptep_get(hw_pte_t *ptep)\n {\n-\treturn READ_ONCE(*ptep);\n+\treturn __pte(READ_ONCE(hw_pte_val(*ptep)));\n }\n \n extern void __sync_icache_dcache(pte_t pteval);\n@@ -406,7 +406,8 @@ bool pgattr_change_is_safe(pteval_t old, pteval_t new);\n * PTE_DIRTY || (PTE_WRITE \u0026\u0026 !PTE_RDONLY)\n */\n \n-static inline void __check_safe_pte_update(struct mm_struct *mm, pte_t *ptep,\n+static inline void __check_safe_pte_update(struct mm_struct *mm,\n+\t\t\t\t\t hw_pte_t *ptep,\n \t\t\t\t\t pte_t pte)\n {\n \tpte_t old_pte;\n@@ -672,7 +673,8 @@ static inline pgprot_t pud_pgprot(pud_t pud)\n }\n \n static inline void __set_ptes_anysz(struct mm_struct *mm, unsigned long addr,\n-\t\t\t\t pte_t *ptep, pte_t pte, unsigned int nr,\n+\t\t\t\t hw_pte_t *ptep, pte_t pte,\n+\t\t\t\t unsigned int nr,\n \t\t\t\t unsigned long pgsize)\n {\n \tunsigned long stride = pgsize \u003e\u003e PAGE_SHIFT;\n@@ -710,7 +712,7 @@ static inline void __set_ptes_anysz(struct mm_struct *mm, unsigned long addr,\n }\n \n static inline void __set_ptes(struct mm_struct *mm, unsigned long addr,\n-\t\t\t pte_t *ptep, pte_t pte, unsigned int nr)\n+\t\t\t hw_pte_t *ptep, pte_t pte, unsigned int nr)\n {\n \t__set_ptes_anysz(mm, addr, ptep, pte, nr, PAGE_SIZE);\n }\n@@ -718,14 +720,16 @@ static inline void __set_ptes(struct mm_struct *mm, unsigned long addr,\n static inline void __set_pmds(struct mm_struct *mm, unsigned long addr,\n \t\t\t pmd_t *pmdp, pmd_t pmd, unsigned int nr)\n {\n-\t__set_ptes_anysz(mm, addr, (pte_t *)pmdp, pmd_pte(pmd), nr, PMD_SIZE);\n+\t__set_ptes_anysz(mm, addr, (hw_pte_t *)pmdp, pmd_pte(pmd), nr,\n+\t\t\t PMD_SIZE);\n }\n #define set_pmd_at(mm, addr, pmdp, pmd) __set_pmds(mm, addr, pmdp, pmd, 1)\n \n static inline void __set_puds(struct mm_struct *mm, unsigned long addr,\n \t\t\t pud_t *pudp, pud_t pud, unsigned int nr)\n {\n-\t__set_ptes_anysz(mm, addr, (pte_t *)pudp, pud_pte(pud), nr, PUD_SIZE);\n+\t__set_ptes_anysz(mm, addr, (hw_pte_t *)pudp, pud_pte(pud), nr,\n+\t\t\t PUD_SIZE);\n }\n #define set_pud_at(mm, addr, pudp, pud) __set_puds(mm, addr, pudp, pud, 1)\n \n@@ -853,16 +857,16 @@ static inline unsigned long pmd_page_vaddr(pmd_t pmd)\n }\n \n /* Find an entry in the third-level page table. */\n-#define pte_offset_phys(dir,addr)\t(pmd_page_paddr(READ_ONCE(*(dir))) + pte_index(addr) * sizeof(pte_t))\n+#define pte_offset_phys(dir, addr)\t(pmd_page_paddr(READ_ONCE(*(dir))) + pte_index(addr) * sizeof(hw_pte_t))\n \n-#define pte_set_fixmap(addr)\t\t((pte_t *)set_fixmap_offset(FIX_PTE, addr))\n+#define pte_set_fixmap(addr)\t\t((hw_pte_t *)set_fixmap_offset(FIX_PTE, addr))\n #define pte_set_fixmap_offset(pmd, addr)\tpte_set_fixmap(pte_offset_phys(pmd, addr))\n #define pte_clear_fixmap()\t\tclear_fixmap(FIX_PTE)\n \n #define pmd_page(pmd)\t\t\tphys_to_page(__pmd_to_phys(pmd))\n \n /* use ONLY for statically allocated translation tables */\n-#define pte_offset_kimg(dir,addr)\t((pte_t *)__phys_to_kimg(pte_offset_phys((dir), (addr))))\n+#define pte_offset_kimg(dir, addr)\t((hw_pte_t *)__phys_to_kimg(pte_offset_phys((dir), (addr))))\n \n #if CONFIG_PGTABLE_LEVELS \u003e 2\n \n@@ -1253,12 +1257,14 @@ static inline pmd_t pmd_modify(pmd_t pmd, pgprot_t newprot)\n }\n \n extern int __ptep_set_access_flags_anysz(struct vm_area_struct *vma,\n-\t\t\t\t\t unsigned long address, pte_t *ptep,\n+\t\t\t\t\t unsigned long address,\n+\t\t\t\t\t hw_pte_t *ptep,\n \t\t\t\t\t pte_t entry, int dirty,\n \t\t\t\t\t unsigned long pgsize);\n \n static inline int __ptep_set_access_flags(struct vm_area_struct *vma,\n-\t\t\t\t\t unsigned long address, pte_t *ptep,\n+\t\t\t\t\t unsigned long address,\n+\t\t\t\t\t hw_pte_t *ptep,\n \t\t\t\t\t pte_t entry, int dirty)\n {\n \treturn __ptep_set_access_flags_anysz(vma, address, ptep, entry, dirty,\n@@ -1271,7 +1277,7 @@ static inline int pmdp_set_access_flags(struct vm_area_struct *vma,\n \t\t\t\t\tunsigned long address, pmd_t *pmdp,\n \t\t\t\t\tpmd_t entry, int dirty)\n {\n-\treturn __ptep_set_access_flags_anysz(vma, address, (pte_t *)pmdp,\n+\treturn __ptep_set_access_flags_anysz(vma, address, (hw_pte_t *)pmdp,\n \t\t\t\t\t pmd_pte(entry), dirty, PMD_SIZE);\n }\n #endif\n@@ -1298,13 +1304,13 @@ static inline bool pud_user_accessible_page(struct mm_struct *mm, unsigned long\n */\n \n static inline void __pte_clear(struct mm_struct *mm,\n-\t\t\t unsigned long addr, pte_t *ptep)\n+\t\t\t unsigned long addr, hw_pte_t *ptep)\n {\n \t__set_pte(ptep, __pte(0));\n }\n \n static inline bool __ptep_test_and_clear_young(struct vm_area_struct *vma,\n-\t\tunsigned long address, pte_t *ptep)\n+\t\tunsigned long address, hw_pte_t *ptep)\n {\n \tpte_t old_pte, pte;\n \n@@ -1312,7 +1318,7 @@ static inline bool __ptep_test_and_clear_young(struct vm_area_struct *vma,\n \tdo {\n \t\told_pte = pte;\n \t\tpte = pte_mkold(pte);\n-\t\tpte_val(pte) = cmpxchg_relaxed(\u0026pte_val(*ptep),\n+\t\tpte_val(pte) = cmpxchg_relaxed(\u0026hw_pte_val(*ptep),\n \t\t\t\t\t pte_val(old_pte), pte_val(pte));\n \t} while (pte_val(pte) != pte_val(old_pte));\n \n@@ -1320,7 +1326,7 @@ static inline bool __ptep_test_and_clear_young(struct vm_area_struct *vma,\n }\n \n static inline bool __ptep_clear_flush_young(struct vm_area_struct *vma,\n-\t\tunsigned long address, pte_t *ptep)\n+\t\tunsigned long address, hw_pte_t *ptep)\n {\n \tbool young = __ptep_test_and_clear_young(vma, address, ptep);\n \n@@ -1346,16 +1352,16 @@ static inline bool pmdp_test_and_clear_young(struct vm_area_struct *vma,\n {\n \t/* Operation applies to PMD table entry only if FEAT_HAFT is enabled */\n \tVM_WARN_ON(pmd_table(READ_ONCE(*pmdp)) \u0026\u0026 !system_supports_haft());\n-\treturn __ptep_test_and_clear_young(vma, address, (pte_t *)pmdp);\n+\treturn __ptep_test_and_clear_young(vma, address, (hw_pte_t *)pmdp);\n }\n #endif /* CONFIG_TRANSPARENT_HUGEPAGE || CONFIG_ARCH_HAS_NONLEAF_PMD_YOUNG */\n \n static inline pte_t __ptep_get_and_clear_anysz(struct mm_struct *mm,\n \t\t\t\t\t unsigned long address,\n-\t\t\t\t\t pte_t *ptep,\n+\t\t\t\t\t hw_pte_t *ptep,\n \t\t\t\t\t unsigned long pgsize)\n {\n-\tpte_t pte = __pte(xchg_relaxed(\u0026pte_val(*ptep), 0));\n+\tpte_t pte = __pte(xchg_relaxed(\u0026hw_pte_val(*ptep), 0));\n \n \tswitch (pgsize) {\n \tcase PAGE_SIZE:\n@@ -1377,13 +1383,13 @@ static inline pte_t __ptep_get_and_clear_anysz(struct mm_struct *mm,\n }\n \n static inline pte_t __ptep_get_and_clear(struct mm_struct *mm,\n-\t\t\t\t unsigned long address, pte_t *ptep)\n+\t\t\t\t unsigned long address, hw_pte_t *ptep)\n {\n \treturn __ptep_get_and_clear_anysz(mm, address, ptep, PAGE_SIZE);\n }\n \n static inline void __clear_full_ptes(struct mm_struct *mm, unsigned long addr,\n-\t\t\t\tpte_t *ptep, unsigned int nr, int full)\n+\t\t\t\thw_pte_t *ptep, unsigned int nr, int full)\n {\n \tfor (;;) {\n \t\t__ptep_get_and_clear(mm, addr, ptep);\n@@ -1395,7 +1401,7 @@ static inline void __clear_full_ptes(struct mm_struct *mm, unsigned long addr,\n }\n \n static inline pte_t __get_and_clear_full_ptes(struct mm_struct *mm,\n-\t\t\t\tunsigned long addr, pte_t *ptep,\n+\t\t\t\tunsigned long addr, hw_pte_t *ptep,\n \t\t\t\tunsigned int nr, int full)\n {\n \tpte_t pte, tmp_pte;\n@@ -1418,12 +1424,12 @@ static inline pte_t __get_and_clear_full_ptes(struct mm_struct *mm,\n static inline pmd_t pmdp_huge_get_and_clear(struct mm_struct *mm,\n \t\t\t\t\t unsigned long address, pmd_t *pmdp)\n {\n-\treturn pte_pmd(__ptep_get_and_clear_anysz(mm, address, (pte_t *)pmdp, PMD_SIZE));\n+\treturn pte_pmd(__ptep_get_and_clear_anysz(mm, address, (hw_pte_t *)pmdp, PMD_SIZE));\n }\n #endif /* CONFIG_TRANSPARENT_HUGEPAGE */\n \n static inline void ___ptep_set_wrprotect(struct mm_struct *mm,\n-\t\t\t\t\tunsigned long address, pte_t *ptep,\n+\t\t\t\t\tunsigned long address, hw_pte_t *ptep,\n \t\t\t\t\tpte_t pte)\n {\n \tpte_t old_pte;\n@@ -1431,7 +1437,7 @@ static inline void ___ptep_set_wrprotect(struct mm_struct *mm,\n \tdo {\n \t\told_pte = pte;\n \t\tpte = pte_wrprotect(pte);\n-\t\tpte_val(pte) = cmpxchg_relaxed(\u0026pte_val(*ptep),\n+\t\tpte_val(pte) = cmpxchg_relaxed(\u0026hw_pte_val(*ptep),\n \t\t\t\t\t pte_val(old_pte), pte_val(pte));\n \t} while (pte_val(pte) != pte_val(old_pte));\n }\n@@ -1441,13 +1447,13 @@ static inline void ___ptep_set_wrprotect(struct mm_struct *mm,\n * dirty status (PTE_DBM \u0026\u0026 !PTE_RDONLY) to the software PTE_DIRTY bit.\n */\n static inline void __ptep_set_wrprotect(struct mm_struct *mm,\n-\t\t\t\t\tunsigned long address, pte_t *ptep)\n+\t\t\t\t\tunsigned long address, hw_pte_t *ptep)\n {\n \t___ptep_set_wrprotect(mm, address, ptep, __ptep_get(ptep));\n }\n \n static inline void __wrprotect_ptes(struct mm_struct *mm, unsigned long address,\n-\t\t\t\tpte_t *ptep, unsigned int nr)\n+\t\t\t\thw_pte_t *ptep, unsigned int nr)\n {\n \tunsigned int i;\n \n@@ -1456,7 +1462,7 @@ static inline void __wrprotect_ptes(struct mm_struct *mm, unsigned long address,\n }\n \n static inline void __clear_young_dirty_pte(struct vm_area_struct *vma,\n-\t\t\t\t\t unsigned long addr, pte_t *ptep,\n+\t\t\t\t\t unsigned long addr, hw_pte_t *ptep,\n \t\t\t\t\t pte_t pte, cydp_t flags)\n {\n \tpte_t old_pte;\n@@ -1469,13 +1475,14 @@ static inline void __clear_young_dirty_pte(struct vm_area_struct *vma,\n \t\tif (flags \u0026 CYDP_CLEAR_DIRTY)\n \t\t\tpte = pte_mkclean(pte);\n \n-\t\tpte_val(pte) = cmpxchg_relaxed(\u0026pte_val(*ptep),\n+\t\tpte_val(pte) = cmpxchg_relaxed(\u0026hw_pte_val(*ptep),\n \t\t\t\t\t pte_val(old_pte), pte_val(pte));\n \t} while (pte_val(pte) != pte_val(old_pte));\n }\n \n static inline void __clear_young_dirty_ptes(struct vm_area_struct *vma,\n-\t\t\t\t\t unsigned long addr, pte_t *ptep,\n+\t\t\t\t\t unsigned long addr,\n+\t\t\t\t\t hw_pte_t *ptep,\n \t\t\t\t\t unsigned int nr, cydp_t flags)\n {\n \tpte_t pte;\n@@ -1500,7 +1507,7 @@ static inline void __clear_young_dirty_ptes(struct vm_area_struct *vma,\n static inline void pmdp_set_wrprotect(struct mm_struct *mm,\n \t\t\t\t unsigned long address, pmd_t *pmdp)\n {\n-\t__ptep_set_wrprotect(mm, address, (pte_t *)pmdp);\n+\t__ptep_set_wrprotect(mm, address, (hw_pte_t *)pmdp);\n }\n \n #define pmdp_establish pmdp_establish\n@@ -1573,7 +1580,8 @@ extern void arch_swap_restore(swp_entry_t entry, struct folio *folio);\n * On AArch64, the cache coherency is handled via the __set_ptes() function.\n */\n static inline void update_mmu_cache_range(struct vm_fault *vmf,\n-\t\tstruct vm_area_struct *vma, unsigned long addr, pte_t *ptep,\n+\t\tstruct vm_area_struct *vma, unsigned long addr,\n+\t\thw_pte_t *ptep,\n \t\tunsigned int nr)\n {\n \t/*\n@@ -1628,21 +1636,21 @@ static inline bool pud_sect_supported(void)\n #define __HAVE_ARCH_PTEP_MODIFY_PROT_TRANSACTION\n #define ptep_modify_prot_start ptep_modify_prot_start\n extern pte_t ptep_modify_prot_start(struct vm_area_struct *vma,\n-\t\t\t\t unsigned long addr, pte_t *ptep);\n+\t\t\t\t unsigned long addr, hw_pte_t *ptep);\n \n #define ptep_modify_prot_commit ptep_modify_prot_commit\n extern void ptep_modify_prot_commit(struct vm_area_struct *vma,\n-\t\t\t\t unsigned long addr, pte_t *ptep,\n+\t\t\t\t unsigned long addr, hw_pte_t *ptep,\n \t\t\t\t pte_t old_pte, pte_t new_pte);\n \n #define modify_prot_start_ptes modify_prot_start_ptes\n extern pte_t modify_prot_start_ptes(struct vm_area_struct *vma,\n-\t\t\t\t unsigned long addr, pte_t *ptep,\n+\t\t\t\t unsigned long addr, hw_pte_t *ptep,\n \t\t\t\t unsigned int nr);\n \n #define modify_prot_commit_ptes modify_prot_commit_ptes\n extern void modify_prot_commit_ptes(struct vm_area_struct *vma, unsigned long addr,\n-\t\t\t\t pte_t *ptep, pte_t old_pte, pte_t pte,\n+\t\t\t\t hw_pte_t *ptep, pte_t old_pte, pte_t pte,\n \t\t\t\t unsigned int nr);\n \n #ifdef CONFIG_ARM64_CONTPTE\n@@ -1653,33 +1661,35 @@ extern void modify_prot_commit_ptes(struct vm_area_struct *vma, unsigned long ad\n * a private implementation detail of the public ptep API (see below).\n */\n extern void __contpte_try_fold(struct mm_struct *mm, unsigned long addr,\n-\t\t\t\tpte_t *ptep, pte_t pte);\n+\t\t\t\thw_pte_t *ptep, pte_t pte);\n extern void __contpte_try_unfold(struct mm_struct *mm, unsigned long addr,\n-\t\t\t\tpte_t *ptep, pte_t pte);\n-extern pte_t contpte_ptep_get(pte_t *ptep, pte_t orig_pte);\n-extern pte_t contpte_ptep_get_lockless(pte_t *orig_ptep);\n+\t\t\t\thw_pte_t *ptep, pte_t pte);\n+extern pte_t contpte_ptep_get(hw_pte_t *ptep, pte_t orig_pte);\n+extern pte_t contpte_ptep_get_lockless(hw_pte_t *orig_ptep);\n extern void contpte_set_ptes(struct mm_struct *mm, unsigned long addr,\n-\t\t\t\tpte_t *ptep, pte_t pte, unsigned int nr);\n+\t\t\t\thw_pte_t *ptep, pte_t pte, unsigned int nr);\n extern void contpte_clear_full_ptes(struct mm_struct *mm, unsigned long addr,\n-\t\t\t\tpte_t *ptep, unsigned int nr, int full);\n+\t\t\t\thw_pte_t *ptep, unsigned int nr, int full);\n extern pte_t contpte_get_and_clear_full_ptes(struct mm_struct *mm,\n-\t\t\t\tunsigned long addr, pte_t *ptep,\n+\t\t\t\tunsigned long addr, hw_pte_t *ptep,\n \t\t\t\tunsigned int nr, int full);\n bool contpte_test_and_clear_young_ptes(struct vm_area_struct *vma,\n-\t\t\t\tunsigned long addr, pte_t *ptep, unsigned int nr);\n+\t\t\t\tunsigned long addr, hw_pte_t *ptep,\n+\t\t\t\tunsigned int nr);\n bool contpte_clear_flush_young_ptes(struct vm_area_struct *vma,\n-\t\t\t\tunsigned long addr, pte_t *ptep, unsigned int nr);\n+\t\t\t\tunsigned long addr, hw_pte_t *ptep,\n+\t\t\t\tunsigned int nr);\n extern void contpte_wrprotect_ptes(struct mm_struct *mm, unsigned long addr,\n-\t\t\t\tpte_t *ptep, unsigned int nr);\n+\t\t\t\thw_pte_t *ptep, unsigned int nr);\n extern int contpte_ptep_set_access_flags(struct vm_area_struct *vma,\n-\t\t\t\tunsigned long addr, pte_t *ptep,\n+\t\t\t\tunsigned long addr, hw_pte_t *ptep,\n \t\t\t\tpte_t entry, int dirty);\n extern void contpte_clear_young_dirty_ptes(struct vm_area_struct *vma,\n-\t\t\t\tunsigned long addr, pte_t *ptep,\n+\t\t\t\tunsigned long addr, hw_pte_t *ptep,\n \t\t\t\tunsigned int nr, cydp_t flags);\n \n static __always_inline void contpte_try_fold(struct mm_struct *mm,\n-\t\t\t\tunsigned long addr, pte_t *ptep, pte_t pte)\n+\t\t\t\tunsigned long addr, hw_pte_t *ptep, pte_t pte)\n {\n \t/*\n \t * Only bother trying if both the virtual and physical addresses are\n@@ -1702,14 +1712,14 @@ static __always_inline void contpte_try_fold(struct mm_struct *mm,\n }\n \n static __always_inline void contpte_try_unfold(struct mm_struct *mm,\n-\t\t\t\tunsigned long addr, pte_t *ptep, pte_t pte)\n+\t\t\t\tunsigned long addr, hw_pte_t *ptep, pte_t pte)\n {\n \tif (unlikely(pte_valid_cont(pte)))\n \t\t__contpte_try_unfold(mm, addr, ptep, pte);\n }\n \n #define pte_batch_hint pte_batch_hint\n-static inline unsigned int pte_batch_hint(pte_t *ptep, pte_t pte)\n+static inline unsigned int pte_batch_hint(hw_pte_t *ptep, pte_t pte)\n {\n \tif (!pte_valid_cont(pte))\n \t\treturn 1;\n@@ -1736,7 +1746,7 @@ static inline unsigned int pte_batch_hint(pte_t *ptep, pte_t pte)\n */\n \n #define ptep_get ptep_get\n-static inline pte_t ptep_get(pte_t *ptep)\n+static inline pte_t ptep_get(hw_pte_t *ptep)\n {\n \tpte_t pte = __ptep_get(ptep);\n \n@@ -1747,7 +1757,7 @@ static inline pte_t ptep_get(pte_t *ptep)\n }\n \n #define ptep_get_lockless ptep_get_lockless\n-static inline pte_t ptep_get_lockless(pte_t *ptep)\n+static inline pte_t ptep_get_lockless(hw_pte_t *ptep)\n {\n \tpte_t pte = __ptep_get(ptep);\n \n@@ -1757,7 +1767,7 @@ static inline pte_t ptep_get_lockless(pte_t *ptep)\n \treturn contpte_ptep_get_lockless(ptep);\n }\n \n-static inline void set_pte(pte_t *ptep, pte_t pte)\n+static inline void set_pte(hw_pte_t *ptep, pte_t pte)\n {\n \t/*\n \t * We don't have the mm or vaddr so cannot unfold contig entries (since\n@@ -1774,7 +1784,7 @@ static inline void set_pte(pte_t *ptep, pte_t pte)\n \n #define set_ptes set_ptes\n static __always_inline void set_ptes(struct mm_struct *mm, unsigned long addr,\n-\t\t\t\tpte_t *ptep, pte_t pte, unsigned int nr)\n+\t\t\t\thw_pte_t *ptep, pte_t pte, unsigned int nr)\n {\n \tpte = pte_mknoncont(pte);\n \n@@ -1788,7 +1798,7 @@ static __always_inline void set_ptes(struct mm_struct *mm, unsigned long addr,\n }\n \n static inline void pte_clear(struct mm_struct *mm,\n-\t\t\t\tunsigned long addr, pte_t *ptep)\n+\t\t\t\tunsigned long addr, hw_pte_t *ptep)\n {\n \tcontpte_try_unfold(mm, addr, ptep, __ptep_get(ptep));\n \t__pte_clear(mm, addr, ptep);\n@@ -1796,7 +1806,7 @@ static inline void pte_clear(struct mm_struct *mm,\n \n #define clear_full_ptes clear_full_ptes\n static inline void clear_full_ptes(struct mm_struct *mm, unsigned long addr,\n-\t\t\t\tpte_t *ptep, unsigned int nr, int full)\n+\t\t\t\thw_pte_t *ptep, unsigned int nr, int full)\n {\n \tif (likely(nr == 1)) {\n \t\tcontpte_try_unfold(mm, addr, ptep, __ptep_get(ptep));\n@@ -1808,7 +1818,7 @@ static inline void clear_full_ptes(struct mm_struct *mm, unsigned long addr,\n \n #define get_and_clear_full_ptes get_and_clear_full_ptes\n static inline pte_t get_and_clear_full_ptes(struct mm_struct *mm,\n-\t\t\t\tunsigned long addr, pte_t *ptep,\n+\t\t\t\tunsigned long addr, hw_pte_t *ptep,\n \t\t\t\tunsigned int nr, int full)\n {\n \tpte_t pte;\n@@ -1825,17 +1835,17 @@ static inline pte_t get_and_clear_full_ptes(struct mm_struct *mm,\n \n #define __HAVE_ARCH_PTEP_GET_AND_CLEAR\n static inline pte_t ptep_get_and_clear(struct mm_struct *mm,\n-\t\t\t\tunsigned long addr, pte_t *ptep)\n+\t\t\t\tunsigned long addr, hw_pte_t *ptep)\n {\n \tcontpte_try_unfold(mm, addr, ptep, __ptep_get(ptep));\n \treturn __ptep_get_and_clear(mm, addr, ptep);\n }\n \n-static inline bool ptep_try_set(pte_t *ptep, pte_t new_pte)\n+static inline bool ptep_try_set(hw_pte_t *ptep, pte_t new_pte)\n {\n \tpteval_t old = 0;\n \n-\tif (!try_cmpxchg(\u0026pte_val(*ptep), \u0026old, pte_val(new_pte)))\n+\tif (!try_cmpxchg(\u0026hw_pte_val(*ptep), \u0026old, pte_val(new_pte)))\n \t\treturn false;\n \n \t/*\n@@ -1861,7 +1871,7 @@ static inline void flush_tlb_before_set(unsigned long addr)\n \n #define test_and_clear_young_ptes test_and_clear_young_ptes\n static inline bool test_and_clear_young_ptes(struct vm_area_struct *vma,\n-\t\tunsigned long addr, pte_t *ptep, unsigned int nr)\n+\t\tunsigned long addr, hw_pte_t *ptep, unsigned int nr)\n {\n \tif (likely(nr == 1 \u0026\u0026 !pte_cont(__ptep_get(ptep))))\n \t\treturn __ptep_test_and_clear_young(vma, addr, ptep);\n@@ -1871,14 +1881,14 @@ static inline bool test_and_clear_young_ptes(struct vm_area_struct *vma,\n \n #define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG\n static inline bool ptep_test_and_clear_young(struct vm_area_struct *vma,\n-\t\tunsigned long addr, pte_t *ptep)\n+\t\tunsigned long addr, hw_pte_t *ptep)\n {\n \treturn test_and_clear_young_ptes(vma, addr, ptep, 1);\n }\n \n #define __HAVE_ARCH_PTEP_CLEAR_YOUNG_FLUSH\n static inline bool ptep_clear_flush_young(struct vm_area_struct *vma,\n-\t\tunsigned long addr, pte_t *ptep)\n+\t\tunsigned long addr, hw_pte_t *ptep)\n {\n \tpte_t orig_pte = __ptep_get(ptep);\n \n@@ -1890,7 +1900,7 @@ static inline bool ptep_clear_flush_young(struct vm_area_struct *vma,\n \n #define clear_flush_young_ptes clear_flush_young_ptes\n static inline bool clear_flush_young_ptes(struct vm_area_struct *vma,\n-\t\tunsigned long addr, pte_t *ptep, unsigned int nr)\n+\t\tunsigned long addr, hw_pte_t *ptep, unsigned int nr)\n {\n \tif (likely(nr == 1 \u0026\u0026 !pte_cont(__ptep_get(ptep))))\n \t\treturn __ptep_clear_flush_young(vma, addr, ptep);\n@@ -1900,7 +1910,8 @@ static inline bool clear_flush_young_ptes(struct vm_area_struct *vma,\n \n #define wrprotect_ptes wrprotect_ptes\n static __always_inline void wrprotect_ptes(struct mm_struct *mm,\n-\t\t\t\tunsigned long addr, pte_t *ptep, unsigned int nr)\n+\t\t\t\tunsigned long addr, hw_pte_t *ptep,\n+\t\t\t\tunsigned int nr)\n {\n \tif (likely(nr == 1)) {\n \t\t/*\n@@ -1924,14 +1935,14 @@ static __always_inline void wrprotect_ptes(struct mm_struct *mm,\n \n #define __HAVE_ARCH_PTEP_SET_WRPROTECT\n static inline void ptep_set_wrprotect(struct mm_struct *mm,\n-\t\t\t\tunsigned long addr, pte_t *ptep)\n+\t\t\t\tunsigned long addr, hw_pte_t *ptep)\n {\n \twrprotect_ptes(mm, addr, ptep, 1);\n }\n \n #define __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS\n static inline int ptep_set_access_flags(struct vm_area_struct *vma,\n-\t\t\t\tunsigned long addr, pte_t *ptep,\n+\t\t\t\tunsigned long addr, hw_pte_t *ptep,\n \t\t\t\tpte_t entry, int dirty)\n {\n \tpte_t orig_pte = __ptep_get(ptep);\n@@ -1946,7 +1957,7 @@ static inline int ptep_set_access_flags(struct vm_area_struct *vma,\n \n #define clear_young_dirty_ptes clear_young_dirty_ptes\n static inline void clear_young_dirty_ptes(struct vm_area_struct *vma,\n-\t\t\t\t\t unsigned long addr, pte_t *ptep,\n+\t\t\t\t\t unsigned long addr, hw_pte_t *ptep,\n \t\t\t\t\t unsigned int nr, cydp_t flags)\n {\n \tif (likely(nr == 1 \u0026\u0026 !pte_cont(__ptep_get(ptep))))\ndiff --git a/arch/arm64/include/asm/vmalloc.h b/arch/arm64/include/asm/vmalloc.h\nindex 4ec1acd3c1b34..28d3e89f90e43 100644\n--- a/arch/arm64/include/asm/vmalloc.h\n+++ b/arch/arm64/include/asm/vmalloc.h\n@@ -45,7 +45,7 @@ static inline unsigned long arch_vmap_pte_range_map_size(unsigned long addr,\n \n #define arch_vmap_pte_range_unmap_size arch_vmap_pte_range_unmap_size\n static inline unsigned long arch_vmap_pte_range_unmap_size(unsigned long addr,\n-\t\t\t\t\t\t\t pte_t *ptep)\n+\t\t\t\t\t\t\t hw_pte_t *ptep)\n {\n \t/*\n \t * The caller handles alignment so it's sufficient just to check\ndiff --git a/arch/arm64/kernel/efi.c b/arch/arm64/kernel/efi.c\nindex 0ec90fd1754ed..68ff21310604d 100644\n--- a/arch/arm64/kernel/efi.c\n+++ b/arch/arm64/kernel/efi.c\n@@ -111,7 +111,8 @@ struct set_perm_data {\n \tbool\t\t\thas_bti;\n };\n \n-static int __init set_permissions(pte_t *ptep, unsigned long addr, void *data)\n+static int __init set_permissions(hw_pte_t *ptep, unsigned long addr,\n+\t\t\t\t void *data)\n {\n \tstruct set_perm_data *spd = data;\n \tconst efi_memory_desc_t *md = spd-\u003emd;\ndiff --git a/arch/arm64/kernel/pi/map_kernel.c b/arch/arm64/kernel/pi/map_kernel.c\nindex fb44cbdd2f292..2b7e7be5fd6f3 100644\n--- a/arch/arm64/kernel/pi/map_kernel.c\n+++ b/arch/arm64/kernel/pi/map_kernel.c\n@@ -26,7 +26,7 @@ static void __init map_segment(pgd_t *pg_dir, phys_addr_t *pgd, u64 va_offset,\n {\n \tmap_range(pgd, ((u64)start + va_offset) \u0026 ~PAGE_OFFSET,\n \t\t ((u64)end + va_offset) \u0026 ~PAGE_OFFSET, (u64)start,\n-\t\t prot, root_level, (pte_t *)pg_dir, may_use_cont, 0);\n+\t\t prot, root_level, (hw_pte_t *)pg_dir, may_use_cont, 0);\n }\n \n static void __init unmap_segment(pgd_t *pg_dir, u64 va_offset, void *start,\n@@ -209,7 +209,7 @@ static void *__init map_fdt(phys_addr_t fdt)\n \t */\n \tmap_range(\u0026ptep, fdt, (u64)_text \u003e fdt ? min((u64)_text, efdt) : efdt,\n \t\t fdt, PAGE_KERNEL, IDMAP_ROOT_LEVEL,\n-\t\t (pte_t *)init_idmap_pg_dir, false, 0);\n+\t\t (hw_pte_t *)init_idmap_pg_dir, false, 0);\n \tdsb(ishst);\n \n \treturn (void *)fdt;\ndiff --git a/arch/arm64/kernel/pi/map_range.c b/arch/arm64/kernel/pi/map_range.c\nindex 761b14893f748..9c4c8060c5df4 100644\n--- a/arch/arm64/kernel/pi/map_range.c\n+++ b/arch/arm64/kernel/pi/map_range.c\n@@ -27,7 +27,8 @@\n * \t\t\tin the VA space\n */\n void __init map_range(phys_addr_t *pte, u64 start, u64 end, phys_addr_t pa,\n-\t\t pgprot_t prot, int level, pte_t *tbl, bool may_use_cont,\n+\t\t pgprot_t prot, int level, hw_pte_t *tbl,\n+\t\t bool may_use_cont,\n \t\t u64 va_offset)\n {\n \tu64 cmask = (level == 3) ? CONT_PTE_SIZE - 1 : U64_MAX;\n@@ -50,19 +51,21 @@ void __init map_range(phys_addr_t *pte, u64 start, u64 end, phys_addr_t pa,\n \n \twhile (start \u003c end) {\n \t\tu64 next = min((start | lmask) + 1, PAGE_ALIGN(end));\n+\t\tpte_t entry = __ptep_get(tbl);\n \n \t\tif (level \u003c 2 || (level == 2 \u0026\u0026 (start | next | pa) \u0026 lmask)) {\n \t\t\t/*\n \t\t\t * This chunk needs a finer grained mapping. Create a\n \t\t\t * table mapping if necessary and recurse.\n \t\t\t */\n-\t\t\tif (pte_none(*tbl)) {\n-\t\t\t\t*tbl = __pte(__phys_to_pte_val(*pte) |\n+\t\t\tif (pte_none(entry)) {\n+\t\t\t\tentry = __pte(__phys_to_pte_val(*pte) |\n \t\t\t\t\t PMD_TYPE_TABLE | PMD_TABLE_UXN);\n-\t\t\t\t*pte += PTRS_PER_PTE * sizeof(pte_t);\n+\t\t\t\t__set_pte_nosync(tbl, entry);\n+\t\t\t\t*pte += PTRS_PER_PTE * sizeof(hw_pte_t);\n \t\t\t}\n \t\t\tmap_range(pte, start, next, pa, prot, level + 1,\n-\t\t\t\t (pte_t *)(__pte_to_phys(*tbl) + va_offset),\n+\t\t\t\t (hw_pte_t *)(__pte_to_phys(entry) + va_offset),\n \t\t\t\t may_use_cont, va_offset);\n \t\t} else {\n \t\t\t/*\n@@ -80,7 +83,8 @@ void __init map_range(phys_addr_t *pte, u64 start, u64 end, phys_addr_t pa,\n \t\t\t\tprotval \u0026= ~PTE_CONT;\n \n \t\t\t/* Put down a block or page mapping */\n-\t\t\t*tbl = __pte(__phys_to_pte_val(pa) | protval);\n+\t\t\tentry = __pte(__phys_to_pte_val(pa) | protval);\n+\t\t\t__set_pte_nosync(tbl, entry);\n \t\t}\n \t\tpa += next - start;\n \t\tstart = next;\n@@ -100,10 +104,10 @@ asmlinkage phys_addr_t __init create_init_idmap(pgd_t *pg_dir, ptval_t clrmask)\n \t/* MMU is off; pointer casts to phys_addr_t are safe */\n \tmap_range(\u0026ptep, (u64)_stext, (u64)__initdata_begin,\n \t\t (phys_addr_t)_stext, text_prot, IDMAP_ROOT_LEVEL,\n-\t\t (pte_t *)pg_dir, false, 0);\n+\t\t (hw_pte_t *)pg_dir, false, 0);\n \tmap_range(\u0026ptep, (u64)__initdata_begin, (u64)_end,\n \t\t (phys_addr_t)__initdata_begin, data_prot, IDMAP_ROOT_LEVEL,\n-\t\t (pte_t *)pg_dir, false, 0);\n+\t\t (hw_pte_t *)pg_dir, false, 0);\n \n \treturn ptep;\n }\ndiff --git a/arch/arm64/kernel/pi/pi.h b/arch/arm64/kernel/pi/pi.h\nindex 5dfd8484d2005..a7d09a2fa8f9f 100644\n--- a/arch/arm64/kernel/pi/pi.h\n+++ b/arch/arm64/kernel/pi/pi.h\n@@ -2,6 +2,7 @@\n // Copyright 2023 Google LLC\n // Author: Ard Biesheuvel \u003cardb@google.com\u003e\n \n+#include \u003clinux/pgtable_types.h\u003e\n #include \u003clinux/types.h\u003e\n \n #define __prel64_initconst\t__section(\".init.rodata.prel64\")\n@@ -30,7 +31,7 @@ void relocate_kernel(u64 offset);\n int scs_patch(const u8 eh_frame[], int size, bool skip_dry_run);\n \n void map_range(phys_addr_t *pte, u64 start, u64 end, phys_addr_t pa,\n-\t pgprot_t prot, int level, pte_t *tbl, bool may_use_cont,\n+\t pgprot_t prot, int level, hw_pte_t *tbl, bool may_use_cont,\n \t u64 va_offset);\n \n asmlinkage void early_map_kernel(u64 boot_status, phys_addr_t fdt);\ndiff --git a/arch/arm64/mm/contpte.c b/arch/arm64/mm/contpte.c\nindex 0acab179fc1a5..753267c0b41e5 100644\n--- a/arch/arm64/mm/contpte.c\n+++ b/arch/arm64/mm/contpte.c\n@@ -21,13 +21,14 @@ static inline bool mm_is_user(struct mm_struct *mm)\n \treturn mm != \u0026init_mm;\n }\n \n-static inline pte_t *contpte_align_down(pte_t *ptep)\n+static inline hw_pte_t *contpte_align_down(hw_pte_t *ptep)\n {\n \treturn PTR_ALIGN_DOWN(ptep, sizeof(*ptep) * CONT_PTES);\n }\n \n-static inline pte_t *contpte_align_addr_ptep(unsigned long *start,\n-\t\t\t\t\t unsigned long *end, pte_t *ptep,\n+static inline hw_pte_t *contpte_align_addr_ptep(unsigned long *start,\n+\t\t\t\t\t unsigned long *end,\n+\t\t\t\t\t hw_pte_t *ptep,\n \t\t\t\t\t unsigned int nr)\n {\n \t/*\n@@ -47,7 +48,7 @@ static inline pte_t *contpte_align_addr_ptep(unsigned long *start,\n }\n \n static void contpte_try_unfold_partial(struct mm_struct *mm, unsigned long addr,\n-\t\t\t\t\tpte_t *ptep, unsigned int nr)\n+\t\t\t\t\thw_pte_t *ptep, unsigned int nr)\n {\n \t/*\n \t * Unfold any partially covered contpte block at the beginning and end\n@@ -59,7 +60,7 @@ static void contpte_try_unfold_partial(struct mm_struct *mm, unsigned long addr,\n \n \tif (ptep + nr != contpte_align_down(ptep + nr)) {\n \t\tunsigned long last_addr = addr + PAGE_SIZE * (nr - 1);\n-\t\tpte_t *last_ptep = ptep + nr - 1;\n+\t\thw_pte_t *last_ptep = ptep + nr - 1;\n \n \t\tcontpte_try_unfold(mm, last_addr, last_ptep,\n \t\t\t\t __ptep_get(last_ptep));\n@@ -67,11 +68,11 @@ static void contpte_try_unfold_partial(struct mm_struct *mm, unsigned long addr,\n }\n \n static void contpte_convert(struct mm_struct *mm, unsigned long addr,\n-\t\t\t pte_t *ptep, pte_t pte)\n+\t\t\t hw_pte_t *ptep, pte_t pte)\n {\n \tstruct vm_area_struct vma = TLB_FLUSH_VMA(mm, 0);\n \tunsigned long start_addr;\n-\tpte_t *start_ptep;\n+\thw_pte_t *start_ptep;\n \tint i;\n \n \tstart_ptep = ptep = contpte_align_down(ptep);\n@@ -227,7 +228,7 @@ static void contpte_convert(struct mm_struct *mm, unsigned long addr,\n }\n \n void __contpte_try_fold(struct mm_struct *mm, unsigned long addr,\n-\t\t\tpte_t *ptep, pte_t pte)\n+\t\t\thw_pte_t *ptep, pte_t pte)\n {\n \t/*\n \t * We have already checked that the virtual and pysical addresses are\n@@ -253,7 +254,7 @@ void __contpte_try_fold(struct mm_struct *mm, unsigned long addr,\n \tstruct folio *folio;\n \tstruct page *page;\n \tunsigned long pfn;\n-\tpte_t *orig_ptep;\n+\thw_pte_t *orig_ptep;\n \tpgprot_t prot;\n \n \tint i;\n@@ -291,7 +292,7 @@ void __contpte_try_fold(struct mm_struct *mm, unsigned long addr,\n EXPORT_SYMBOL_GPL(__contpte_try_fold);\n \n void __contpte_try_unfold(struct mm_struct *mm, unsigned long addr,\n-\t\t\tpte_t *ptep, pte_t pte)\n+\t\t\thw_pte_t *ptep, pte_t pte)\n {\n \t/*\n \t * We have already checked that the ptes are contiguous in\n@@ -305,7 +306,7 @@ void __contpte_try_unfold(struct mm_struct *mm, unsigned long addr,\n }\n EXPORT_SYMBOL_GPL(__contpte_try_unfold);\n \n-pte_t contpte_ptep_get(pte_t *ptep, pte_t orig_pte)\n+pte_t contpte_ptep_get(hw_pte_t *ptep, pte_t orig_pte)\n {\n \t/*\n \t * Gather access/dirty bits, which may be populated in any of the ptes\n@@ -362,7 +363,7 @@ static inline bool contpte_is_consistent(pte_t pte, unsigned long pfn,\n \t\t\tpgprot_val(prot) == pgprot_val(orig_prot);\n }\n \n-pte_t contpte_ptep_get_lockless(pte_t *orig_ptep)\n+pte_t contpte_ptep_get_lockless(hw_pte_t *orig_ptep)\n {\n \t/*\n \t * The ptep_get_lockless() API requires us to read and return *orig_ptep\n@@ -384,7 +385,7 @@ pte_t contpte_ptep_get_lockless(pte_t *orig_ptep)\n \tpgprot_t orig_prot;\n \tunsigned long pfn;\n \tpte_t orig_pte;\n-\tpte_t *ptep;\n+\thw_pte_t *ptep;\n \tpte_t pte;\n \tint i;\n \n@@ -445,7 +446,8 @@ pte_t contpte_ptep_get_lockless(pte_t *orig_ptep)\n EXPORT_SYMBOL_GPL(contpte_ptep_get_lockless);\n \n void contpte_set_ptes(struct mm_struct *mm, unsigned long addr,\n-\t\t\t\t\tpte_t *ptep, pte_t pte, unsigned int nr)\n+\t\t\t\t\thw_pte_t *ptep, pte_t pte,\n+\t\t\t\t\tunsigned int nr)\n {\n \tunsigned long next;\n \tunsigned long end;\n@@ -488,7 +490,7 @@ void contpte_set_ptes(struct mm_struct *mm, unsigned long addr,\n EXPORT_SYMBOL_GPL(contpte_set_ptes);\n \n void contpte_clear_full_ptes(struct mm_struct *mm, unsigned long addr,\n-\t\t\t\tpte_t *ptep, unsigned int nr, int full)\n+\t\t\t\thw_pte_t *ptep, unsigned int nr, int full)\n {\n \tcontpte_try_unfold_partial(mm, addr, ptep, nr);\n \t__clear_full_ptes(mm, addr, ptep, nr, full);\n@@ -496,7 +498,7 @@ void contpte_clear_full_ptes(struct mm_struct *mm, unsigned long addr,\n EXPORT_SYMBOL_GPL(contpte_clear_full_ptes);\n \n pte_t contpte_get_and_clear_full_ptes(struct mm_struct *mm,\n-\t\t\t\tunsigned long addr, pte_t *ptep,\n+\t\t\t\tunsigned long addr, hw_pte_t *ptep,\n \t\t\t\tunsigned int nr, int full)\n {\n \tcontpte_try_unfold_partial(mm, addr, ptep, nr);\n@@ -505,7 +507,7 @@ pte_t contpte_get_and_clear_full_ptes(struct mm_struct *mm,\n EXPORT_SYMBOL_GPL(contpte_get_and_clear_full_ptes);\n \n bool contpte_test_and_clear_young_ptes(struct vm_area_struct *vma,\n-\t\tunsigned long addr, pte_t *ptep, unsigned int nr)\n+\t\tunsigned long addr, hw_pte_t *ptep, unsigned int nr)\n {\n \t/*\n \t * ptep_clear_flush_young() technically requires us to clear the access\n@@ -531,7 +533,7 @@ bool contpte_test_and_clear_young_ptes(struct vm_area_struct *vma,\n EXPORT_SYMBOL_GPL(contpte_test_and_clear_young_ptes);\n \n bool contpte_clear_flush_young_ptes(struct vm_area_struct *vma,\n-\t\tunsigned long addr, pte_t *ptep, unsigned int nr)\n+\t\tunsigned long addr, hw_pte_t *ptep, unsigned int nr)\n {\n \tbool young;\n \n@@ -554,7 +556,7 @@ bool contpte_clear_flush_young_ptes(struct vm_area_struct *vma,\n EXPORT_SYMBOL_GPL(contpte_clear_flush_young_ptes);\n \n void contpte_wrprotect_ptes(struct mm_struct *mm, unsigned long addr,\n-\t\t\t\t\tpte_t *ptep, unsigned int nr)\n+\t\t\t\t\thw_pte_t *ptep, unsigned int nr)\n {\n \t/*\n \t * If wrprotecting an entire contig range, we can avoid unfolding. Just\n@@ -572,7 +574,7 @@ void contpte_wrprotect_ptes(struct mm_struct *mm, unsigned long addr,\n EXPORT_SYMBOL_GPL(contpte_wrprotect_ptes);\n \n void contpte_clear_young_dirty_ptes(struct vm_area_struct *vma,\n-\t\t\t\t unsigned long addr, pte_t *ptep,\n+\t\t\t\t unsigned long addr, hw_pte_t *ptep,\n \t\t\t\t unsigned int nr, cydp_t flags)\n {\n \t/*\n@@ -593,9 +595,10 @@ void contpte_clear_young_dirty_ptes(struct vm_area_struct *vma,\n }\n EXPORT_SYMBOL_GPL(contpte_clear_young_dirty_ptes);\n \n-static bool contpte_all_subptes_match_access_flags(pte_t *ptep, pte_t entry)\n+static bool contpte_all_subptes_match_access_flags(hw_pte_t *ptep,\n+\t\t\t\t\t\t pte_t entry)\n {\n-\tpte_t *cont_ptep = contpte_align_down(ptep);\n+\thw_pte_t *cont_ptep = contpte_align_down(ptep);\n \t/*\n \t * PFNs differ per sub-PTE. Match only bits consumed by\n \t * __ptep_set_access_flags(): AF, DIRTY and write permission.\n@@ -615,7 +618,7 @@ static bool contpte_all_subptes_match_access_flags(pte_t *ptep, pte_t entry)\n }\n \n int contpte_ptep_set_access_flags(struct vm_area_struct *vma,\n-\t\t\t\t\tunsigned long addr, pte_t *ptep,\n+\t\t\t\t\tunsigned long addr, hw_pte_t *ptep,\n \t\t\t\t\tpte_t entry, int dirty)\n {\n \tunsigned long start_addr;\ndiff --git a/arch/arm64/mm/fault.c b/arch/arm64/mm/fault.c\nindex 0b52557652be6..3322f4e7174dc 100644\n--- a/arch/arm64/mm/fault.c\n+++ b/arch/arm64/mm/fault.c\n@@ -162,7 +162,8 @@ static void show_pte(unsigned long addr)\n \t\tp4d_t *p4dp, p4d;\n \t\tpud_t *pudp, pud;\n \t\tpmd_t *pmdp, pmd;\n-\t\tpte_t *ptep, pte;\n+\t\thw_pte_t *ptep;\n+\t\tpte_t pte;\n \n \t\tif (pgd_none(pgd) || pgd_bad(pgd))\n \t\t\tbreak;\n@@ -208,7 +209,7 @@ static void show_pte(unsigned long addr)\n * Returns whether or not the PTE actually changed.\n */\n int __ptep_set_access_flags_anysz(struct vm_area_struct *vma,\n-\t\t\t\t unsigned long address, pte_t *ptep,\n+\t\t\t\t unsigned long address, hw_pte_t *ptep,\n \t\t\t\t pte_t entry, int dirty, unsigned long pgsize)\n {\n \tpteval_t old_pteval, pteval;\n@@ -234,7 +235,7 @@ int __ptep_set_access_flags_anysz(struct vm_area_struct *vma,\n \t\tpteval ^= PTE_RDONLY;\n \t\tpteval |= pte_val(entry);\n \t\tpteval ^= PTE_RDONLY;\n-\t\tpteval = cmpxchg_relaxed(\u0026pte_val(*ptep), old_pteval, pteval);\n+\t\tpteval = cmpxchg_relaxed(\u0026hw_pte_val(*ptep), old_pteval, pteval);\n \t} while (pteval != old_pteval);\n \n \t/*\ndiff --git a/arch/arm64/mm/fixmap.c b/arch/arm64/mm/fixmap.c\nindex f66a0016dd02d..709a97fe327d8 100644\n--- a/arch/arm64/mm/fixmap.c\n+++ b/arch/arm64/mm/fixmap.c\n@@ -31,11 +31,11 @@ static_assert(NR_BM_PMD_TABLES == 1);\n \n #define BM_PTE_TABLE_IDX(addr)\t__BM_TABLE_IDX(addr, PMD_SHIFT)\n \n-static pte_t bm_pte[NR_BM_PTE_TABLES][PTRS_PER_PTE] __bss_pgtbl;\n+static hw_pte_t bm_pte[NR_BM_PTE_TABLES][PTRS_PER_PTE] __bss_pgtbl;\n static pmd_t bm_pmd[PTRS_PER_PMD] __bss_pgtbl __maybe_unused;\n static pud_t bm_pud[PTRS_PER_PUD] __bss_pgtbl __maybe_unused;\n \n-static inline pte_t *fixmap_pte(unsigned long addr)\n+static inline hw_pte_t *fixmap_pte(unsigned long addr)\n {\n \treturn \u0026bm_pte[BM_PTE_TABLE_IDX(addr)][pte_index(addr)];\n }\n@@ -43,7 +43,7 @@ static inline pte_t *fixmap_pte(unsigned long addr)\n static void __init early_fixmap_init_pte(pmd_t *pmdp, unsigned long addr)\n {\n \tpmd_t pmd = READ_ONCE(*pmdp);\n-\tpte_t *ptep;\n+\thw_pte_t *ptep;\n \n \tif (pmd_none(pmd)) {\n \t\tptep = bm_pte[BM_PTE_TABLE_IDX(addr)];\n@@ -120,7 +120,7 @@ void __set_fixmap(enum fixed_addresses idx,\n \t\t\t phys_addr_t phys, pgprot_t flags)\n {\n \tunsigned long addr = __fix_to_virt(idx);\n-\tpte_t *ptep;\n+\thw_pte_t *ptep;\n \n \tBUG_ON(idx \u003c= FIX_HOLE || idx \u003e= __end_of_fixed_addresses);\n \ndiff --git a/arch/arm64/mm/hugetlbpage.c b/arch/arm64/mm/hugetlbpage.c\nindex 8e799c1fe0aa6..560c0f16cd8e4 100644\n--- a/arch/arm64/mm/hugetlbpage.c\n+++ b/arch/arm64/mm/hugetlbpage.c\n@@ -76,7 +76,7 @@ bool arch_hugetlb_migration_supported(struct hstate *h)\n #endif\n \n static int find_num_contig(struct mm_struct *mm, unsigned long addr,\n-\t\t\t pte_t *ptep, size_t *pgsize)\n+\t\t\t hw_pte_t *ptep, size_t *pgsize)\n {\n \tpgd_t *pgdp = pgd_offset(mm, addr);\n \tp4d_t *p4dp;\n@@ -87,7 +87,7 @@ static int find_num_contig(struct mm_struct *mm, unsigned long addr,\n \tp4dp = p4d_offset(pgdp, addr);\n \tpudp = pud_offset(p4dp, addr);\n \tpmdp = pmd_offset(pudp, addr);\n-\tif ((pte_t *)PTR_ALIGN_DOWN(pmdp, sizeof(*pmdp) * CONT_PMDS) == ptep) {\n+\tif ((hw_pte_t *)PTR_ALIGN_DOWN(pmdp, sizeof(*pmdp) * CONT_PMDS) == ptep) {\n \t\t*pgsize = PMD_SIZE;\n \t\treturn CONT_PMDS;\n \t}\n@@ -116,7 +116,7 @@ static inline int num_contig_ptes(unsigned long size, size_t *pgsize)\n \treturn contig_ptes;\n }\n \n-pte_t huge_ptep_get(struct mm_struct *mm, unsigned long addr, pte_t *ptep)\n+pte_t huge_ptep_get(struct mm_struct *mm, unsigned long addr, hw_pte_t *ptep)\n {\n \tint ncontig, i;\n \tsize_t pgsize;\n@@ -148,7 +148,7 @@ pte_t huge_ptep_get(struct mm_struct *mm, unsigned long addr, pte_t *ptep)\n */\n static pte_t get_clear_contig(struct mm_struct *mm,\n \t\t\t unsigned long addr,\n-\t\t\t pte_t *ptep,\n+\t\t\t hw_pte_t *ptep,\n \t\t\t unsigned long pgsize,\n \t\t\t unsigned long ncontig)\n {\n@@ -173,7 +173,7 @@ static pte_t get_clear_contig(struct mm_struct *mm,\n \n static pte_t get_clear_contig_flush(struct mm_struct *mm,\n \t\t\t\t unsigned long addr,\n-\t\t\t\t pte_t *ptep,\n+\t\t\t\t hw_pte_t *ptep,\n \t\t\t\t unsigned long pgsize,\n \t\t\t\t unsigned long ncontig)\n {\n@@ -196,7 +196,7 @@ static pte_t get_clear_contig_flush(struct mm_struct *mm,\n */\n static void clear_flush(struct mm_struct *mm,\n \t\t\t unsigned long addr,\n-\t\t\t pte_t *ptep,\n+\t\t\t hw_pte_t *ptep,\n \t\t\t unsigned long pgsize,\n \t\t\t unsigned long ncontig)\n {\n@@ -213,7 +213,7 @@ static void clear_flush(struct mm_struct *mm,\n }\n \n void set_huge_pte_at(struct mm_struct *mm, unsigned long addr,\n-\t\t\t pte_t *ptep, pte_t pte, unsigned long sz)\n+\t\t\t hw_pte_t *ptep, pte_t pte, unsigned long sz)\n {\n \tsize_t pgsize;\n \tint i;\n@@ -234,14 +234,14 @@ void set_huge_pte_at(struct mm_struct *mm, unsigned long addr,\n \t__set_ptes_anysz(mm, addr, ptep, pte, ncontig, pgsize);\n }\n \n-pte_t *huge_pte_alloc(struct mm_struct *mm, struct vm_area_struct *vma,\n+hw_pte_t *huge_pte_alloc(struct mm_struct *mm, struct vm_area_struct *vma,\n \t\t unsigned long addr, unsigned long sz)\n {\n \tpgd_t *pgdp;\n \tp4d_t *p4dp;\n \tpud_t *pudp;\n \tpmd_t *pmdp;\n-\tpte_t *ptep = NULL;\n+\thw_pte_t *ptep = NULL;\n \n \tpgdp = pgd_offset(mm, addr);\n \tp4dp = p4d_alloc(mm, pgdp, addr);\n@@ -253,7 +253,7 @@ pte_t *huge_pte_alloc(struct mm_struct *mm, struct vm_area_struct *vma,\n \t\treturn NULL;\n \n \tif (sz == PUD_SIZE) {\n-\t\tptep = (pte_t *)pudp;\n+\t\tptep = (hw_pte_t *)pudp;\n \t} else if (sz == (CONT_PTE_SIZE)) {\n \t\tpmdp = pmd_alloc(mm, pudp, addr);\n \t\tif (!pmdp)\n@@ -265,17 +265,17 @@ pte_t *huge_pte_alloc(struct mm_struct *mm, struct vm_area_struct *vma,\n \t\tif (want_pmd_share(vma, addr) \u0026\u0026 pud_none(READ_ONCE(*pudp)))\n \t\t\tptep = huge_pmd_share(mm, vma, addr, pudp);\n \t\telse\n-\t\t\tptep = (pte_t *)pmd_alloc(mm, pudp, addr);\n+\t\t\tptep = (hw_pte_t *)pmd_alloc(mm, pudp, addr);\n \t} else if (sz == (CONT_PMD_SIZE)) {\n \t\tpmdp = pmd_alloc(mm, pudp, addr);\n \t\tWARN_ON(addr \u0026 (sz - 1));\n-\t\treturn (pte_t *)pmdp;\n+\t\treturn (hw_pte_t *)pmdp;\n \t}\n \n \treturn ptep;\n }\n \n-pte_t *huge_pte_offset(struct mm_struct *mm,\n+hw_pte_t *huge_pte_offset(struct mm_struct *mm,\n \t\t unsigned long addr, unsigned long sz)\n {\n \tpgd_t *pgdp;\n@@ -297,7 +297,7 @@ pte_t *huge_pte_offset(struct mm_struct *mm,\n \t\treturn NULL;\n \t/* hugepage or swap? */\n \tif (pud_leaf(pud) || !pud_present(pud))\n-\t\treturn (pte_t *)pudp;\n+\t\treturn (hw_pte_t *)pudp;\n \t/* table; check the next level */\n \n \tif (sz == CONT_PMD_SIZE)\n@@ -309,7 +309,7 @@ pte_t *huge_pte_offset(struct mm_struct *mm,\n \t pmd_none(pmd))\n \t\treturn NULL;\n \tif (pmd_leaf(pmd) || !pmd_present(pmd))\n-\t\treturn (pte_t *)pmdp;\n+\t\treturn (hw_pte_t *)pmdp;\n \n \tif (sz == CONT_PTE_SIZE)\n \t\treturn pte_offset_huge(pmdp, (addr \u0026 CONT_PTE_MASK));\n@@ -367,7 +367,7 @@ pte_t arch_make_huge_pte(pte_t entry, unsigned int shift, vm_flags_t flags)\n }\n \n void huge_pte_clear(struct mm_struct *mm, unsigned long addr,\n-\t\t pte_t *ptep, unsigned long sz)\n+\t\t hw_pte_t *ptep, unsigned long sz)\n {\n \tint i, ncontig;\n \tsize_t pgsize;\n@@ -379,7 +379,7 @@ void huge_pte_clear(struct mm_struct *mm, unsigned long addr,\n }\n \n pte_t huge_ptep_get_and_clear(struct mm_struct *mm, unsigned long addr,\n-\t\t\t pte_t *ptep, unsigned long sz)\n+\t\t\t hw_pte_t *ptep, unsigned long sz)\n {\n \tint ncontig;\n \tsize_t pgsize;\n@@ -397,7 +397,7 @@ pte_t huge_ptep_get_and_clear(struct mm_struct *mm, unsigned long addr,\n * all the contiguous ptes we need to check whether or not there is a\n * discrepancy between dirty or young.\n */\n-static int __cont_access_flags_changed(pte_t *ptep, pte_t pte, int ncontig)\n+static int __cont_access_flags_changed(hw_pte_t *ptep, pte_t pte, int ncontig)\n {\n \tint i;\n \n@@ -418,7 +418,7 @@ static int __cont_access_flags_changed(pte_t *ptep, pte_t pte, int ncontig)\n }\n \n int huge_ptep_set_access_flags(struct vm_area_struct *vma,\n-\t\t\t unsigned long addr, pte_t *ptep,\n+\t\t\t unsigned long addr, hw_pte_t *ptep,\n \t\t\t pte_t pte, int dirty)\n {\n \tint ncontig;\n@@ -451,7 +451,7 @@ int huge_ptep_set_access_flags(struct vm_area_struct *vma,\n }\n \n void huge_ptep_set_wrprotect(struct mm_struct *mm,\n-\t\t\t unsigned long addr, pte_t *ptep)\n+\t\t\t unsigned long addr, hw_pte_t *ptep)\n {\n \tint ncontig;\n \tsize_t pgsize;\n@@ -474,7 +474,7 @@ void huge_ptep_set_wrprotect(struct mm_struct *mm,\n }\n \n pte_t huge_ptep_clear_flush(struct vm_area_struct *vma,\n-\t\t\t unsigned long addr, pte_t *ptep)\n+\t\t\t unsigned long addr, hw_pte_t *ptep)\n {\n \tstruct mm_struct *mm = vma-\u003evm_mm;\n \tsize_t pgsize;\n@@ -514,7 +514,8 @@ bool __init arch_hugetlb_valid_size(unsigned long size)\n \treturn __hugetlb_valid_size(size);\n }\n \n-pte_t huge_ptep_modify_prot_start(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep)\n+pte_t huge_ptep_modify_prot_start(struct vm_area_struct *vma, unsigned long addr,\n+\t\t\t\t hw_pte_t *ptep)\n {\n \tunsigned long psize = huge_page_size(hstate_vma(vma));\n \n@@ -530,7 +531,8 @@ pte_t huge_ptep_modify_prot_start(struct vm_area_struct *vma, unsigned long addr\n \treturn huge_ptep_get_and_clear(vma-\u003evm_mm, addr, ptep, psize);\n }\n \n-void huge_ptep_modify_prot_commit(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep,\n+void huge_ptep_modify_prot_commit(struct vm_area_struct *vma, unsigned long addr,\n+\t\t\t\t hw_pte_t *ptep,\n \t\t\t\t pte_t old_pte, pte_t pte)\n {\n \tunsigned long psize = huge_page_size(hstate_vma(vma));\ndiff --git a/arch/arm64/mm/kasan_init.c b/arch/arm64/mm/kasan_init.c\nindex 45fbdce684c89..dccb736b32e9b 100644\n--- a/arch/arm64/mm/kasan_init.c\n+++ b/arch/arm64/mm/kasan_init.c\n@@ -59,7 +59,7 @@ static phys_addr_t __init kasan_alloc_raw_page(int node)\n \treturn __pa(p);\n }\n \n-static pte_t *__init kasan_pte_offset(pmd_t *pmdp, unsigned long addr, int node,\n+static hw_pte_t *__init kasan_pte_offset(pmd_t *pmdp, unsigned long addr, int node,\n \t\t\t\t bool early)\n {\n \tif (pmd_none(READ_ONCE(*pmdp))) {\n@@ -116,7 +116,7 @@ static void __init kasan_pte_populate(pmd_t *pmdp, unsigned long addr,\n \t\t\t\t unsigned long end, int node, bool early)\n {\n \tunsigned long next;\n-\tpte_t *ptep = kasan_pte_offset(pmdp, addr, node, early);\n+\thw_pte_t *ptep = kasan_pte_offset(pmdp, addr, node, early);\n \n \tdo {\n \t\tphys_addr_t page_phys = early ?\ndiff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c\nindex 79d90226fd5dc..f02b974ad64df 100644\n--- a/arch/arm64/mm/mmu.c\n+++ b/arch/arm64/mm/mmu.c\n@@ -159,7 +159,7 @@ static void init_clear_pgtable(void *table)\n \tdsb(ishst);\n }\n \n-static void init_pte(pte_t *ptep, unsigned long addr, unsigned long end,\n+static void init_pte(hw_pte_t *ptep, unsigned long addr, unsigned long end,\n \t\t phys_addr_t phys, pgprot_t prot)\n {\n \tdo {\n@@ -182,7 +182,7 @@ static void init_pte(pte_t *ptep, unsigned long addr, unsigned long end,\n \t} while (ptep++, addr += PAGE_SIZE, addr != end);\n }\n \n-static bool pte_range_has_valid_noncont(pte_t *ptep)\n+static bool pte_range_has_valid_noncont(hw_pte_t *ptep)\n {\n \tfor (int i = 0; i \u003c CONT_PTES; i++) {\n \t\tpte_t pte = __ptep_get(\u0026ptep[i]);\n@@ -201,7 +201,7 @@ static int alloc_init_cont_pte(pmd_t *pmdp, unsigned long addr,\n {\n \tunsigned long next;\n \tpmd_t pmd = READ_ONCE(*pmdp);\n-\tpte_t *ptep;\n+\thw_pte_t *ptep;\n \n \tBUG_ON(pmd_leaf(pmd));\n \tif (pmd_none(pmd)) {\n@@ -592,7 +592,7 @@ pgd_pgtable_alloc_special_mm(enum pgtable_level pgtable_level)\n \treturn __pgd_pgtable_alloc(NULL, GFP_PGTABLE_KERNEL, pgtable_level);\n }\n \n-static void split_contpte(pte_t *ptep)\n+static void split_contpte(hw_pte_t *ptep)\n {\n \tint i;\n \n@@ -607,13 +607,13 @@ static int split_pmd(pmd_t *pmdp, pmd_t pmd, gfp_t gfp, bool to_cont)\n \tunsigned long pfn = pmd_pfn(pmd);\n \tpgprot_t prot = pmd_pgprot(pmd);\n \tphys_addr_t pte_phys;\n-\tpte_t *ptep;\n+\thw_pte_t *ptep;\n \tint i;\n \n \tpte_phys = pgd_pgtable_alloc_init_mm_gfp(PGTABLE_LEVEL_PTE, gfp);\n \tif (pte_phys == INVALID_PHYS_ADDR)\n \t\treturn -ENOMEM;\n-\tptep = (pte_t *)phys_to_virt(pte_phys);\n+\tptep = (hw_pte_t *)phys_to_virt(pte_phys);\n \n \tif (pgprot_val(prot) \u0026 PMD_SECT_PXN)\n \t\ttableprot |= PMD_TABLE_PXN;\n@@ -691,7 +691,8 @@ static int split_kernel_leaf_mapping_locked(unsigned long addr)\n \tp4d_t *p4dp, p4d;\n \tpud_t *pudp, pud;\n \tpmd_t *pmdp, pmd;\n-\tpte_t *ptep, pte;\n+\thw_pte_t *ptep;\n+\tpte_t pte;\n \tint ret = 0;\n \n \t/*\n@@ -904,7 +905,7 @@ static int split_to_ptes_pmd_entry(pmd_t *pmdp, unsigned long addr,\n \treturn ret;\n }\n \n-static int split_to_ptes_pte_entry(pte_t *ptep, unsigned long addr,\n+static int split_to_ptes_pte_entry(hw_pte_t *ptep, unsigned long addr,\n \t\t\t\t unsigned long next, struct mm_walk *walk)\n {\n \tpte_t pte = __ptep_get(ptep);\n@@ -1438,7 +1439,8 @@ static void __init declare_kernel_vmas(void)\n }\n \n void __pi_map_range(phys_addr_t *pte, u64 start, u64 end, phys_addr_t pa,\n-\t\t pgprot_t prot, int level, pte_t *tbl, bool may_use_cont,\n+\t\t pgprot_t prot, int level, hw_pte_t *tbl,\n+\t\t bool may_use_cont,\n \t\t u64 va_offset);\n \n static u8 idmap_ptes[IDMAP_LEVELS - 1][PAGE_SIZE] __aligned(PAGE_SIZE) __ro_after_init,\n@@ -1451,7 +1453,7 @@ static void __init create_idmap(void)\n \tphys_addr_t ptep = __pa_symbol(idmap_ptes);\n \n \t__pi_map_range(\u0026ptep, start, end, start, PAGE_KERNEL_ROX,\n-\t\t IDMAP_ROOT_LEVEL, (pte_t *)idmap_pg_dir, false,\n+\t\t IDMAP_ROOT_LEVEL, (hw_pte_t *)idmap_pg_dir, false,\n \t\t __phys_to_virt(ptep) - ptep);\n \n \tif (linear_map_requires_bbml3 ||\n@@ -1466,7 +1468,8 @@ static void __init create_idmap(void)\n \t\t */\n \t\tptep = __pa_symbol(kpti_bbml3_ptes);\n \t\t__pi_map_range(\u0026ptep, pa, pa + sizeof(u32), pa, PAGE_KERNEL,\n-\t\t\t IDMAP_ROOT_LEVEL, (pte_t *)idmap_pg_dir, false,\n+\t\t\t IDMAP_ROOT_LEVEL, (hw_pte_t *)idmap_pg_dir,\n+\t\t\t false,\n \t\t\t __phys_to_virt(ptep) - ptep);\n \t}\n }\n@@ -1522,7 +1525,8 @@ static void unmap_hotplug_pte_range(pmd_t *pmdp, unsigned long addr,\n \t\t\t\t unsigned long end, bool free_mapped,\n \t\t\t\t struct vmem_altmap *altmap)\n {\n-\tpte_t *ptep, pte;\n+\thw_pte_t *ptep;\n+\tpte_t pte;\n \n \tdo {\n \t\tptep = pte_offset_kernel(pmdp, addr);\n@@ -1665,7 +1669,8 @@ static void free_empty_pte_table(pmd_t *pmdp, unsigned long addr,\n \t\t\t\t unsigned long end, unsigned long floor,\n \t\t\t\t unsigned long ceiling)\n {\n-\tpte_t *ptep, pte;\n+\thw_pte_t *ptep;\n+\tpte_t pte;\n \tunsigned long i, start = addr;\n \n \tdo {\n@@ -1914,7 +1919,7 @@ int pmd_clear_huge(pmd_t *pmdp)\n \n int pmd_free_pte_page(pmd_t *pmdp, unsigned long addr)\n {\n-\tpte_t *table;\n+\thw_pte_t *table;\n \tpmd_t pmd;\n \n \tpmd = READ_ONCE(*pmdp);\n@@ -2056,7 +2061,8 @@ static bool addr_splits_kernel_leaf(unsigned long addr)\n \tp4d_t *p4dp, p4d;\n \tpud_t *pudp, pud;\n \tpmd_t *pmdp, pmd;\n-\tpte_t *ptep, pte;\n+\thw_pte_t *ptep;\n+\tpte_t pte;\n \n \t/*\n \t * If the given address points at a the start address of\n@@ -2284,7 +2290,7 @@ early_initcall(prevent_memory_remove_init);\n #endif\n \n pte_t modify_prot_start_ptes(struct vm_area_struct *vma, unsigned long addr,\n-\t\t\t pte_t *ptep, unsigned int nr)\n+\t\t\t hw_pte_t *ptep, unsigned int nr)\n {\n \tpte_t pte = get_and_clear_ptes(vma-\u003evm_mm, addr, ptep, nr);\n \n@@ -2302,19 +2308,21 @@ pte_t modify_prot_start_ptes(struct vm_area_struct *vma, unsigned long addr,\n \treturn pte;\n }\n \n-pte_t ptep_modify_prot_start(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep)\n+pte_t ptep_modify_prot_start(struct vm_area_struct *vma, unsigned long addr,\n+\t\t\t hw_pte_t *ptep)\n {\n \treturn modify_prot_start_ptes(vma, addr, ptep, 1);\n }\n \n void modify_prot_commit_ptes(struct vm_area_struct *vma, unsigned long addr,\n-\t\t\t pte_t *ptep, pte_t old_pte, pte_t pte,\n+\t\t\t hw_pte_t *ptep, pte_t old_pte, pte_t pte,\n \t\t\t unsigned int nr)\n {\n \tset_ptes(vma-\u003evm_mm, addr, ptep, pte, nr);\n }\n \n-void ptep_modify_prot_commit(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep,\n+void ptep_modify_prot_commit(struct vm_area_struct *vma, unsigned long addr,\n+\t\t\t hw_pte_t *ptep,\n \t\t\t pte_t old_pte, pte_t pte)\n {\n \tmodify_prot_commit_ptes(vma, addr, ptep, old_pte, pte, 1);\ndiff --git a/arch/arm64/mm/pageattr.c b/arch/arm64/mm/pageattr.c\nindex bbe98ac9ad8c6..40edf6ff03235 100644\n--- a/arch/arm64/mm/pageattr.c\n+++ b/arch/arm64/mm/pageattr.c\n@@ -68,7 +68,7 @@ static int pageattr_pmd_entry(pmd_t *pmd, unsigned long addr,\n \treturn 0;\n }\n \n-static int pageattr_pte_entry(pte_t *pte, unsigned long addr,\n+static int pageattr_pte_entry(hw_pte_t *pte, unsigned long addr,\n \t\t\t unsigned long next, struct mm_walk *walk)\n {\n \tpte_t val = __ptep_get(pte);\n@@ -395,7 +395,7 @@ bool kernel_page_present(struct page *page)\n \tp4d_t *p4dp;\n \tpud_t *pudp, pud;\n \tpmd_t *pmdp, pmd;\n-\tpte_t *ptep;\n+\thw_pte_t *ptep;\n \tunsigned long addr = (unsigned long)page_address(page);\n \n \tpgdp = pgd_offset_k(addr);\ndiff --git a/arch/arm64/mm/trans_pgd.c b/arch/arm64/mm/trans_pgd.c\nindex cca9706a875c3..845417792ad48 100644\n--- a/arch/arm64/mm/trans_pgd.c\n+++ b/arch/arm64/mm/trans_pgd.c\n@@ -34,8 +34,8 @@ static void *trans_alloc(struct trans_pgd_info *info)\n static int copy_pte(struct trans_pgd_info *info, pmd_t *dst_pmdp,\n \t\t pmd_t *src_pmdp, unsigned long start, unsigned long end)\n {\n-\tpte_t *src_ptep;\n-\tpte_t *dst_ptep;\n+\thw_pte_t *src_ptep;\n+\thw_pte_t *dst_ptep;\n \tunsigned long addr = start;\n \n \tdst_ptep = trans_alloc(info);\n"
} |
| 2/1 | 2026/09/25 01:35 | agent | patch-evaluator |
0mModel:core Args: null Results: {
"EnableConfigs": null,
"FocusSymbols": [],
"Reasoning": "All changes in this patch series are strictly confined to the ARM64 architecture (arch/arm64/). As the target architecture is amd64, none of the modified code is compiled or reachable.",
"WorthFuzzing": false
}Instruction: You are an expert Linux kernel maintainer and security engineer.
Your job is to review a provided patch series and evaluate whether it warrants fuzzing with syzkaller.
IMPORTANT: The changes have ALREADY been applied and committed as the HEAD commit in
your workspace. Do NOT rely on internal assumptions. You must actively use your code access
tools to inspect the actual source code, callers, and surrounding context.
================================================================================
1. CORE TRIAGE PHILOSOPHY
================================================================================
The goal of patch fuzzing is to discover crashes, regressions, exposed latent bugs,
and newly triggered assertions introduced by the patch series.
- REACHABILITY IS THE PRIMARY GATE:
Fuzzing can only discover bugs in code that can actually execute in standard virtualized
environments (GCE or QEMU, utilizing software-emulated devices like USB gadgets, netdev, tun/tap).
If the modified code is structurally unreachable (see Section 2), it MUST NOT be fuzzed,
regardless of whether it adds assertions or complex logic.
- DO NOT BLINDLY TRUST "NO FUNCTIONAL CHANGE" (NFCI) OR "REFACTORING" CLAIMS:
Patch authors routinely label changes as "cleanups", "refactorings", or state
"No functional change intended". Do NOT take these claims at face value.
Code refactorings that rearrange logic, introduce helper functions, or alter state management
in core subsystems frequently introduce subtle semantic shifts or uncover latent kernel bugs.
If reachable executable code is modified or refactored, it MUST be fuzzed.
- NEW OR MODIFIED ASSERTIONS IN REACHABLE CODE MUST BE FUZZED:
When a patch introduces or modifies runtime checks or assertions (e.g., WARN_ON*, VM_WARN_ON*,
BUG_ON*, lockdep_assert*) in reachable code paths, it enforces new or stricter invariants.
Even if the author believes the invariant always holds, fuzzing is essential to verify whether
an unusual sequence of operations can violate it.
================================================================================
2. WHEN TO RETURN WorthFuzzing=false (NEGATIVE CRITERIA)
================================================================================
Return WorthFuzzing=false ONLY IF all modified code falls strictly into one or more of these categories:
- Non-kernel and non-executable changes:
* Modifications to Documentation/, comments, or spelling fixes.
* User-space directories, self-tests, samples, or scripts (e.g., tools/, samples/, scripts/, usr/)
that do not affect the compiled kernel image (vmlinux) or kernel modules.
* Purely decorative logging (e.g., message strings in pr_err, printk, dev_info) or tracepoints
that do not alter control flow or data structures.
* Build system or Kconfig changes that do not alter compiled C logic.
- Structurally unreachable hardware:
* Vendor-specific PCIe switches, SmartNICs, or GPU drivers (e.g., mlxsw, pds_core, qed,
ionic, amdgpu) requiring physical ASIC/PCIe cards not emulated in standard QEMU.
- Unreachable execution paths:
* Driver teardown callbacks (.remove, .shutdown, pci_unregister_driver) executed only during
physical PCI hot-unplug or manual sysfs driver unbinding.
* Code paths exclusive to architectures other than the target architecture.
================================================================================
3. WHEN TO RETURN WorthFuzzing=true (POSITIVE CRITERIA)
================================================================================
Return WorthFuzzing=true whenever the patch touches reachable executable code, including:
- Core Subsystems:
* Any logic modifications in memory management (mm/), synchronization/locking (kernel/locking/),
BPF, scheduler, core networking, VFS, or syscall handling.
- Refactorings and Code Cleanups:
* Any restructuring of reachable data structures, helper abstractions, or algorithm flows.
- Runtime Assertions and Defensive Checks:
* Any introduction or alteration of assertions (WARN_ON*, VM_WARN_ON*, BUG_ON*, etc.) in reachable paths.
- Reachable Drivers and Protocols:
* Drivers accessible via virtual buses (virtio, USB gadget, loopback, netlink, binder, sockets, etc.).
================================================================================
4. EXTRACTING FocusSymbols (PREVENTING DILUTION)
================================================================================
When WorthFuzzing=true, you must extract specific kernel functions into FocusSymbols to guide the fuzzer:
- AVOID UBIQUITOUS LIFECYCLE HOT-PATHS:
Do NOT list generic, ubiquitous functions called by almost every program in the corpus
(including, but not limited to: general memory allocators and deallocators, page fault
and trap handlers, or core synchronization primitives; this is not an exhaustive list).
Listing ubiquitous functions causes the fuzzer to classify thousands of unrelated tests as "focused",
which severely dilutes fuzzing effort away from the actual changes.
- TARGET SPECIFIC FEATURE LOGIC AND ENTRYPOINTS:
List functions that specifically implement the logic being added or altered, or direct API entrypoints
for the subsystem feature under review.
- HANDLING STATIC INLINE FUNCTIONS IN HEADERS (.h):
Compiler-inlined static functions (such as static inlines in mm/*.h or include/linux/*.h) lack
distinct symbol addresses in vmlinux and cannot be targeted directly by symbol coverage filters.
If the changes are primarily in static inline helpers, identify non-static, feature-specific caller
functions in .c files that exercise them (avoiding ubiquitous lifecycle wrappers).
================================================================================
5. IDENTIFYING EnableConfigs
================================================================================
Identify any specific CONFIG_ options required to properly compile and reach the modified code:
- Inspect Kconfig files and #ifdef guards; do not make assumptions.
- Check "depends on" lines in Kconfig to include any non-standard parent subsystem configs needed.
- Strip any 'CONFIG_' prefix (e.g., return "NET_IPV4" instead of "CONFIG_NET_IPV4").
Prefer calling several tools at the same time to save round-trips.
Use set-results tool to provide results of the analysis.
It must be called exactly once before the final reply.
Ignore results of this tool.
Prompt: Target architecture: amd64
For your convenience, here is the diff of the changes:
commit 9f6d6550952e42e6576c84f9d9a74c7b0a317fc5
Author: syz-cluster <triage@syzkaller.com>
Date: Fri Sep 25 01:35:18 2026 +0000
syz-cluster: applied patch under review
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index b5a51b0ef9440..43be3f0d6e9ba 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -31,6 +31,7 @@ config ARM64
select ARCH_HAS_FORTIFY_SOURCE
select ARCH_HAS_GCOV_PROFILE_ALL
select ARCH_HAS_GIGANTIC_PAGE
+ select ARCH_HAS_HW_PTE_T
select ARCH_HAS_KCOV
select ARCH_HAS_KERNEL_FPU_SUPPORT if KERNEL_MODE_NEON
select ARCH_HAS_KEEPINITRD
diff --git a/arch/arm64/include/asm/hugetlb.h b/arch/arm64/include/asm/hugetlb.h
index d038ff14d16ca..15b3cf53aa2ca 100644
--- a/arch/arm64/include/asm/hugetlb.h
+++ b/arch/arm64/include/asm/hugetlb.h
@@ -36,33 +36,34 @@ pte_t arch_make_huge_pte(pte_t entry, unsigned int shift, vm_flags_t flags);
#define arch_make_huge_pte arch_make_huge_pte
#define __HAVE_ARCH_HUGE_SET_HUGE_PTE_AT
extern void set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
- pte_t *ptep, pte_t pte, unsigned long sz);
+ hw_pte_t *ptep, pte_t pte, unsigned long sz);
#define __HAVE_ARCH_HUGE_PTEP_SET_ACCESS_FLAGS
extern int huge_ptep_set_access_flags(struct vm_area_struct *vma,
- unsigned long addr, pte_t *ptep,
+ unsigned long addr, hw_pte_t *ptep,
pte_t pte, int dirty);
#define __HAVE_ARCH_HUGE_PTEP_GET_AND_CLEAR
extern pte_t huge_ptep_get_and_clear(struct mm_struct *mm, unsigned long addr,
- pte_t *ptep, unsigned long sz);
+ hw_pte_t *ptep, unsigned long sz);
#define __HAVE_ARCH_HUGE_PTEP_SET_WRPROTECT
extern void huge_ptep_set_wrprotect(struct mm_struct *mm,
- unsigned long addr, pte_t *ptep);
+ unsigned long addr, hw_pte_t *ptep);
#define __HAVE_ARCH_HUGE_PTEP_CLEAR_FLUSH
extern pte_t huge_ptep_clear_flush(struct vm_area_struct *vma,
- unsigned long addr, pte_t *ptep);
+ unsigned long addr, hw_pte_t *ptep);
#define __HAVE_ARCH_HUGE_PTE_CLEAR
extern void huge_pte_clear(struct mm_struct *mm, unsigned long addr,
- pte_t *ptep, unsigned long sz);
+ hw_pte_t *ptep, unsigned long sz);
#define __HAVE_ARCH_HUGE_PTEP_GET
-extern pte_t huge_ptep_get(struct mm_struct *mm, unsigned long addr, pte_t *ptep);
+extern pte_t huge_ptep_get(struct mm_struct *mm, unsigned long addr,
+ hw_pte_t *ptep);
#define huge_ptep_modify_prot_start huge_ptep_modify_prot_start
extern pte_t huge_ptep_modify_prot_start(struct vm_area_struct *vma,
- unsigned long addr, pte_t *ptep);
+ unsigned long addr, hw_pte_t *ptep);
#define huge_ptep_modify_prot_commit huge_ptep_modify_prot_commit
extern void huge_ptep_modify_prot_commit(struct vm_area_struct *vma,
- unsigned long addr, pte_t *ptep,
+ unsigned long addr, hw_pte_t *ptep,
pte_t old_pte, pte_t new_pte);
#include <asm-generic/hugetlb.h>
diff --git a/arch/arm64/include/asm/pgalloc.h b/arch/arm64/include/asm/pgalloc.h
index 1b4509d3382c6..80063dd4d2722 100644
--- a/arch/arm64/include/asm/pgalloc.h
+++ b/arch/arm64/include/asm/pgalloc.h
@@ -106,7 +106,7 @@ static inline void __pmd_populate(pmd_t *pmdp, phys_addr_t ptep,
* of the mm address space.
*/
static inline void
-pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmdp, pte_t *ptep)
+pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmdp, hw_pte_t *ptep)
{
VM_BUG_ON(mm && mm != &init_mm);
__pmd_populate(pmdp, __pa(ptep),
diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h
index 6000905a2e865..9a1d604e57eb2 100644
--- a/arch/arm64/include/asm/pgtable.h
+++ b/arch/arm64/include/asm/pgtable.h
@@ -361,9 +361,9 @@ static inline pte_t pte_clear_uffd(pte_t pte)
}
#endif /* CONFIG_HAVE_ARCH_USERFAULTFD_WP */
-static inline void __set_pte_nosync(pte_t *ptep, pte_t pte)
+static inline void __set_pte_nosync(hw_pte_t *ptep, pte_t pte)
{
- WRITE_ONCE(*ptep, pte);
+ WRITE_ONCE(hw_pte_val(*ptep), pte_val(pte));
}
static inline void __set_pte_complete(pte_t pte)
@@ -376,15 +376,15 @@ static inline void __set_pte_complete(pte_t pte)
queue_pte_barriers();
}
-static inline void __set_pte(pte_t *ptep, pte_t pte)
+static inline void __set_pte(hw_pte_t *ptep, pte_t pte)
{
__set_pte_nosync(ptep, pte);
__set_pte_complete(pte);
}
-static inline pte_t __ptep_get(pte_t *ptep)
+static inline pte_t __ptep_get(hw_pte_t *ptep)
{
- return READ_ONCE(*ptep);
+ return __pte(READ_ONCE(hw_pte_val(*ptep)));
}
extern void __sync_icache_dcache(pte_t pteval);
@@ -406,7 +406,8 @@ bool pgattr_change_is_safe(pteval_t old, pteval_t new);
* PTE_DIRTY || (PTE_WRITE && !PTE_RDONLY)
*/
-static inline void __check_safe_pte_update(struct mm_struct *mm, pte_t *ptep,
+static inline void __check_safe_pte_update(struct mm_struct *mm,
+ hw_pte_t *ptep,
pte_t pte)
{
pte_t old_pte;
@@ -672,7 +673,8 @@ static inline pgprot_t pud_pgprot(pud_t pud)
}
static inline void __set_ptes_anysz(struct mm_struct *mm, unsigned long addr,
- pte_t *ptep, pte_t pte, unsigned int nr,
+ hw_pte_t *ptep, pte_t pte,
+ unsigned int nr,
unsigned long pgsize)
{
unsigned long stride = pgsize >> PAGE_SHIFT;
@@ -710,7 +712,7 @@ static inline void __set_ptes_anysz(struct mm_struct *mm, unsigned long addr,
}
static inline void __set_ptes(struct mm_struct *mm, unsigned long addr,
- pte_t *ptep, pte_t pte, unsigned int nr)
+ hw_pte_t *ptep, pte_t pte, unsigned int nr)
{
__set_ptes_anysz(mm, addr, ptep, pte, nr, PAGE_SIZE);
}
@@ -718,14 +720,16 @@ static inline void __set_ptes(struct mm_struct *mm, unsigned long addr,
static inline void __set_pmds(struct mm_struct *mm, unsigned long addr,
pmd_t *pmdp, pmd_t pmd, unsigned int nr)
{
- __set_ptes_anysz(mm, addr, (pte_t *)pmdp, pmd_pte(pmd), nr, PMD_SIZE);
+ __set_ptes_anysz(mm, addr, (hw_pte_t *)pmdp, pmd_pte(pmd), nr,
+ PMD_SIZE);
}
#define set_pmd_at(mm, addr, pmdp, pmd) __set_pmds(mm, addr, pmdp, pmd, 1)
static inline void __set_puds(struct mm_struct *mm, unsigned long addr,
pud_t *pudp, pud_t pud, unsigned int nr)
{
- __set_ptes_anysz(mm, addr, (pte_t *)pudp, pud_pte(pud), nr, PUD_SIZE);
+ __set_ptes_anysz(mm, addr, (hw_pte_t *)pudp, pud_pte(pud), nr,
+ PUD_SIZE);
}
#define set_pud_at(mm, addr, pudp, pud) __set_puds(mm, addr, pudp, pud, 1)
@@ -853,16 +857,16 @@ static inline unsigned long pmd_page_vaddr(pmd_t pmd)
}
/* Find an entry in the third-level page table. */
-#define pte_offset_phys(dir,addr) (pmd_page_paddr(READ_ONCE(*(dir))) + pte_index(addr) * sizeof(pte_t))
+#define pte_offset_phys(dir, addr) (pmd_page_paddr(READ_ONCE(*(dir))) + pte_index(addr) * sizeof(hw_pte_t))
-#define pte_set_fixmap(addr) ((pte_t *)set_fixmap_offset(FIX_PTE, addr))
+#define pte_set_fixmap(addr) ((hw_pte_t *)set_fixmap_offset(FIX_PTE, addr))
#define pte_set_fixmap_offset(pmd, addr) pte_set_fixmap(pte_offset_phys(pmd, addr))
#define pte_clear_fixmap() clear_fixmap(FIX_PTE)
#define pmd_page(pmd) phys_to_page(__pmd_to_phys(pmd))
/* use ONLY for statically allocated translation tables */
-#define pte_offset_kimg(dir,addr) ((pte_t *)__phys_to_kimg(pte_offset_phys((dir), (addr))))
+#define pte_offset_kimg(dir, addr) ((hw_pte_t *)__phys_to_kimg(pte_offset_phys((dir), (addr))))
#if CONFIG_PGTABLE_LEVELS > 2
@@ -1253,12 +1257,14 @@ static inline pmd_t pmd_modify(pmd_t pmd, pgprot_t newprot)
}
extern int __ptep_set_access_flags_anysz(struct vm_area_struct *vma,
- unsigned long address, pte_t *ptep,
+ unsigned long address,
+ hw_pte_t *ptep,
pte_t entry, int dirty,
unsigned long pgsize);
static inline int __ptep_set_access_flags(struct vm_area_struct *vma,
- unsigned long address, pte_t *ptep,
+ unsigned long address,
+ hw_pte_t *ptep,
pte_t entry, int dirty)
{
return __ptep_set_access_flags_anysz(vma, address, ptep, entry, dirty,
@@ -1271,7 +1277,7 @@ static inline int pmdp_set_access_flags(struct vm_area_struct *vma,
unsigned long address, pmd_t *pmdp,
pmd_t entry, int dirty)
{
- return __ptep_set_access_flags_anysz(vma, address, (pte_t *)pmdp,
+ return __ptep_set_access_flags_anysz(vma, address, (hw_pte_t *)pmdp,
pmd_pte(entry), dirty, PMD_SIZE);
}
#endif
@@ -1298,13 +1304,13 @@ static inline bool pud_user_accessible_page(struct mm_struct *mm, unsigned long
*/
static inline void __pte_clear(struct mm_struct *mm,
- unsigned long addr, pte_t *ptep)
+ unsigned long addr, hw_pte_t *ptep)
{
__set_pte(ptep, __pte(0));
}
static inline bool __ptep_test_and_clear_young(struct vm_area_struct *vma,
- unsigned long address, pte_t *ptep)
+ unsigned long address, hw_pte_t *ptep)
{
pte_t old_pte, pte;
@@ -1312,7 +1318,7 @@ static inline bool __ptep_test_and_clear_young(struct vm_area_struct *vma,
do {
old_pte = pte;
pte = pte_mkold(pte);
- pte_val(pte) = cmpxchg_relaxed(&pte_val(*ptep),
+ pte_val(pte) = cmpxchg_relaxed(&hw_pte_val(*ptep),
pte_val(old_pte), pte_val(pte));
} while (pte_val(pte) != pte_val(old_pte));
@@ -1320,7 +1326,7 @@ static inline bool __ptep_test_and_clear_young(struct vm_area_struct *vma,
}
static inline bool __ptep_clear_flush_young(struct vm_area_struct *vma,
- unsigned long address, pte_t *ptep)
+ unsigned long address, hw_pte_t *ptep)
{
bool young = __ptep_test_and_clear_young(vma, address, ptep);
@@ -1346,16 +1352,16 @@ static inline bool pmdp_test_and_clear_young(struct vm_area_struct *vma,
{
/* Operation applies to PMD table entry only if FEAT_HAFT is enabled */
VM_WARN_ON(pmd_table(READ_ONCE(*pmdp)) && !system_supports_haft());
- return __ptep_test_and_clear_young(vma, address, (pte_t *)pmdp);
+ return __ptep_test_and_clear_young(vma, address, (hw_pte_t *)pmdp);
}
#endif /* CONFIG_TRANSPARENT_HUGEPAGE || CONFIG_ARCH_HAS_NONLEAF_PMD_YOUNG */
static inline pte_t __ptep_get_and_clear_anysz(struct mm_struct *mm,
unsigned long address,
- pte_t *ptep,
+ hw_pte_t *ptep,
unsigned long pgsize)
{
- pte_t pte = __pte(xchg_relaxed(&pte_val(*ptep), 0));
+ pte_t pte = __pte(xchg_relaxed(&hw_pte_val(*ptep), 0));
switch (pgsize) {
case PAGE_SIZE:
@@ -1377,13 +1383,13 @@ static inline pte_t __ptep_get_and_clear_anysz(struct mm_struct *mm,
}
static inline pte_t __ptep_get_and_clear(struct mm_struct *mm,
- unsigned long address, pte_t *ptep)
+ unsigned long address, hw_pte_t *ptep)
{
return __ptep_get_and_clear_anysz(mm, address, ptep, PAGE_SIZE);
}
static inline void __clear_full_ptes(struct mm_struct *mm, unsigned long addr,
- pte_t *ptep, unsigned int nr, int full)
+ hw_pte_t *ptep, unsigned int nr, int full)
{
for (;;) {
__ptep_get_and_clear(mm, addr, ptep);
@@ -1395,7 +1401,7 @@ static inline void __clear_full_ptes(struct mm_struct *mm, unsigned long addr,
}
static inline pte_t __get_and_clear_full_ptes(struct mm_struct *mm,
- unsigned long addr, pte_t *ptep,
+ unsigned long addr, hw_pte_t *ptep,
unsigned int nr, int full)
{
pte_t pte, tmp_pte;
@@ -1418,12 +1424,12 @@ static inline pte_t __get_and_clear_full_ptes(struct mm_struct *mm,
static inline pmd_t pmdp_huge_get_and_clear(struct mm_struct *mm,
unsigned long address, pmd_t *pmdp)
{
- return pte_pmd(__ptep_get_and_clear_anysz(mm, address, (pte_t *)pmdp, PMD_SIZE));
+ return pte_pmd(__ptep_get_and_clear_anysz(mm, address, (hw_pte_t *)pmdp, PMD_SIZE));
}
#endif /* CONFIG_TRANSPARENT_HUGEPAGE */
static inline void ___ptep_set_wrprotect(struct mm_struct *mm,
- unsigned long address, pte_t *ptep,
+ unsigned long address, hw_pte_t *ptep,
pte_t pte)
{
pte_t old_pte;
@@ -1431,7 +1437,7 @@ static inline void ___ptep_set_wrprotect(struct mm_struct *mm,
do {
old_pte = pte;
pte = pte_wrprotect(pte);
- pte_val(pte) = cmpxchg_relaxed(&pte_val(*ptep),
+ pte_val(pte) = cmpxchg_relaxed(&hw_pte_val(*ptep),
pte_val(old_pte), pte_val(pte));
} while (pte_val(pte) != pte_val(old_pte));
}
@@ -1441,13 +1447,13 @@ static inline void ___ptep_set_wrprotect(struct mm_struct *mm,
* dirty status (PTE_DBM && !PTE_RDONLY) to the software PTE_DIRTY bit.
*/
static inline void __ptep_set_wrprotect(struct mm_struct *mm,
- unsigned long address, pte_t *ptep)
+ unsigned long address, hw_pte_t *ptep)
{
___ptep_set_wrprotect(mm, address, ptep, __ptep_get(ptep));
}
static inline void __wrprotect_ptes(struct mm_struct *mm, unsigned long address,
- pte_t *ptep, unsigned int nr)
+ hw_pte_t *ptep, unsigned int nr)
{
unsigned int i;
@@ -1456,7 +1462,7 @@ static inline void __wrprotect_ptes(struct mm_struct *mm, unsigned long address,
}
static inline void __clear_young_dirty_pte(struct vm_area_struct *vma,
- unsigned long addr, pte_t *ptep,
+ unsigned long addr, hw_pte_t *ptep,
pte_t pte, cydp_t flags)
{
pte_t old_pte;
@@ -1469,13 +1475,14 @@ static inline void __clear_young_dirty_pte(struct vm_area_struct *vma,
if (flags & CYDP_CLEAR_DIRTY)
pte = pte_mkclean(pte);
- pte_val(pte) = cmpxchg_relaxed(&pte_val(*ptep),
+ pte_val(pte) = cmpxchg_relaxed(&hw_pte_val(*ptep),
pte_val(old_pte), pte_val(pte));
} while (pte_val(pte) != pte_val(old_pte));
}
static inline void __clear_young_dirty_ptes(struct vm_area_struct *vma,
- unsigned long addr, pte_t *ptep,
+ unsigned long addr,
+ hw_pte_t *ptep,
unsigned int nr, cydp_t flags)
{
pte_t pte;
@@ -1500,7 +1507,7 @@ static inline void __clear_young_dirty_ptes(struct vm_area_struct *vma,
static inline void pmdp_set_wrprotect(struct mm_struct *mm,
unsigned long address, pmd_t *pmdp)
{
- __ptep_set_wrprotect(mm, address, (pte_t *)pmdp);
+ __ptep_set_wrprotect(mm, address, (hw_pte_t *)pmdp);
}
#define pmdp_establish pmdp_establish
@@ -1573,7 +1580,8 @@ extern void arch_swap_restore(swp_entry_t entry, struct folio *folio);
* On AArch64, the cache coherency is handled via the __set_ptes() function.
*/
static inline void update_mmu_cache_range(struct vm_fault *vmf,
- struct vm_area_struct *vma, unsigned long addr, pte_t *ptep,
+ struct vm_area_struct *vma, unsigned long addr,
+ hw_pte_t *ptep,
unsigned int nr)
{
/*
@@ -1628,21 +1636,21 @@ static inline bool pud_sect_supported(void)
#define __HAVE_ARCH_PTEP_MODIFY_PROT_TRANSACTION
#define ptep_modify_prot_start ptep_modify_prot_start
extern pte_t ptep_modify_prot_start(struct vm_area_struct *vma,
- unsigned long addr, pte_t *ptep);
+ unsigned long addr, hw_pte_t *ptep);
#define ptep_modify_prot_commit ptep_modify_prot_commit
extern void ptep_modify_prot_commit(struct vm_area_struct *vma,
- unsigned long addr, pte_t *ptep,
+ unsigned long addr, hw_pte_t *ptep,
pte_t old_pte, pte_t new_pte);
#define modify_prot_start_ptes modify_prot_start_ptes
extern pte_t modify_prot_start_ptes(struct vm_area_struct *vma,
- unsigned long addr, pte_t *ptep,
+ unsigned long addr, hw_pte_t *ptep,
unsigned int nr);
#define modify_prot_commit_ptes modify_prot_commit_ptes
extern void modify_prot_commit_ptes(struct vm_area_struct *vma, unsigned long addr,
- pte_t *ptep, pte_t old_pte, pte_t pte,
+ hw_pte_t *ptep, pte_t old_pte, pte_t pte,
unsigned int nr);
#ifdef CONFIG_ARM64_CONTPTE
@@ -1653,33 +1661,35 @@ extern void modify_prot_commit_ptes(struct vm_area_struct *vma, unsigned long ad
* a private implementation detail of the public ptep API (see below).
*/
extern void __contpte_try_fold(struct mm_struct *mm, unsigned long addr,
- pte_t *ptep, pte_t pte);
+ hw_pte_t *ptep, pte_t pte);
extern void __contpte_try_unfold(struct mm_struct *mm, unsigned long addr,
- pte_t *ptep, pte_t pte);
-extern pte_t contpte_ptep_get(pte_t *ptep, pte_t orig_pte);
-extern pte_t contpte_ptep_get_lockless(pte_t *orig_ptep);
+ hw_pte_t *ptep, pte_t pte);
+extern pte_t contpte_ptep_get(hw_pte_t *ptep, pte_t orig_pte);
+extern pte_t contpte_ptep_get_lockless(hw_pte_t *orig_ptep);
extern void contpte_set_ptes(struct mm_struct *mm, unsigned long addr,
- pte_t *ptep, pte_t pte, unsigned int nr);
+ hw_pte_t *ptep, pte_t pte, unsigned int nr);
extern void contpte_clear_full_ptes(struct mm_struct *mm, unsigned long addr,
- pte_t *ptep, unsigned int nr, int full);
+ hw_pte_t *ptep, unsigned int nr, int full);
extern pte_t contpte_get_and_clear_full_ptes(struct mm_struct *mm,
- unsigned long addr, pte_t *ptep,
+ unsigned long addr, hw_pte_t *ptep,
unsigned int nr, int full);
bool contpte_test_and_clear_young_ptes(struct vm_area_struct *vma,
- unsigned long addr, pte_t *ptep, unsigned int nr);
+ unsigned long addr, hw_pte_t *ptep,
+ unsigned int nr);
bool contpte_clear_flush_young_ptes(struct vm_area_struct *vma,
- unsigned long addr, pte_t *ptep, unsigned int nr);
+ unsigned long addr, hw_pte_t *ptep,
+ unsigned int nr);
extern void contpte_wrprotect_ptes(struct mm_struct *mm, unsigned long addr,
- pte_t *ptep, unsigned int nr);
+ hw_pte_t *ptep, unsigned int nr);
extern int contpte_ptep_set_access_flags(struct vm_area_struct *vma,
- unsigned long addr, pte_t *ptep,
+ unsigned long addr, hw_pte_t *ptep,
pte_t entry, int dirty);
extern void contpte_clear_young_dirty_ptes(struct vm_area_struct *vma,
- unsigned long addr, pte_t *ptep,
+ unsigned long addr, hw_pte_t *ptep,
unsigned int nr, cydp_t flags);
static __always_inline void contpte_try_fold(struct mm_struct *mm,
- unsigned long addr, pte_t *ptep, pte_t pte)
+ unsigned long addr, hw_pte_t *ptep, pte_t pte)
{
/*
* Only bother trying if both the virtual and physical addresses are
@@ -1702,14 +1712,14 @@ static __always_inline void contpte_try_fold(struct mm_struct *mm,
}
static __always_inline void contpte_try_unfold(struct mm_struct *mm,
- unsigned long addr, pte_t *ptep, pte_t pte)
+ unsigned long addr, hw_pte_t *ptep, pte_t pte)
{
if (unlikely(pte_valid_cont(pte)))
__contpte_try_unfold(mm, addr, ptep, pte);
}
#define pte_batch_hint pte_batch_hint
-static inline unsigned int pte_batch_hint(pte_t *ptep, pte_t pte)
+static inline unsigned int pte_batch_hint(hw_pte_t *ptep, pte_t pte)
{
if (!pte_valid_cont(pte))
return 1;
@@ -1736,7 +1746,7 @@ static inline unsigned int pte_batch_hint(pte_t *ptep, pte_t pte)
*/
#define ptep_get ptep_get
-static inline pte_t ptep_get(pte_t *ptep)
+static inline pte_t ptep_get(hw_pte_t *ptep)
{
pte_t pte = __ptep_get(ptep);
@@ -1747,7 +1757,7 @@ static inline pte_t ptep_get(pte_t *ptep)
}
#define ptep_get_lockless ptep_get_lockless
-static inline pte_t ptep_get_lockless(pte_t *ptep)
+static inline pte_t ptep_get_lockless(hw_pte_t *ptep)
{
pte_t pte = __ptep_get(ptep);
@@ -1757,7 +1767,7 @@ static inline pte_t ptep_get_lockless(pte_t *ptep)
return contpte_ptep_get_lockless(ptep);
}
-static inline void set_pte(pte_t *ptep, pte_t pte)
+static inline void set_pte(hw_pte_t *ptep, pte_t pte)
{
/*
* We don't have the mm or vaddr so cannot unfold contig entries (since
@@ -1774,7 +1784,7 @@ static inline void set_pte(pte_t *ptep, pte_t pte)
#define set_ptes set_ptes
static __always_inline void set_ptes(struct mm_struct *mm, unsigned long addr,
- pte_t *ptep, pte_t pte, unsigned int nr)
+ hw_pte_t *ptep, pte_t pte, unsigned int nr)
{
pte = pte_mknoncont(pte);
@@ -1788,7 +1798,7 @@ static __always_inline void set_ptes(struct mm_struct *mm, unsigned long addr,
}
static inline void pte_clear(struct mm_struct *mm,
- unsigned long addr, pte_t *ptep)
+ unsigned long addr, hw_pte_t *ptep)
{
contpte_try_unfold(mm, addr, ptep, __ptep_get(ptep));
__pte_clear(mm, addr, ptep);
@@ -1796,7 +1806,7 @@ static inline void pte_clear(struct mm_struct *mm,
#define clear_full_ptes clear_full_ptes
static inline void clear_full_ptes(struct mm_struct *mm, unsigned long addr,
- pte_t *ptep, unsigned int nr, int full)
+ hw_pte_t *ptep, unsigned int nr, int full)
{
if (likely(nr == 1)) {
contpte_try_unfold(mm, addr, ptep, __ptep_get(ptep));
@@ -1808,7 +1818,7 @@ static inline void clear_full_ptes(struct mm_struct *mm, unsigned long addr,
#define get_and_clear_full_ptes get_and_clear_full_ptes
static inline pte_t get_and_clear_full_ptes(struct mm_struct *mm,
- unsigned long addr, pte_t *ptep,
+ unsigned long addr, hw_pte_t *ptep,
unsigned int nr, int full)
{
pte_t pte;
@@ -1825,17 +1835,17 @@ static inline pte_t get_and_clear_full_ptes(struct mm_struct *mm,
#define __HAVE_ARCH_PTEP_GET_AND_CLEAR
static inline pte_t ptep_get_and_clear(struct mm_struct *mm,
- unsigned long addr, pte_t *ptep)
+ unsigned long addr, hw_pte_t *ptep)
{
contpte_try_unfold(mm, addr, ptep, __ptep_get(ptep));
return __ptep_get_and_clear(mm, addr, ptep);
}
-static inline bool ptep_try_set(pte_t *ptep, pte_t new_pte)
+static inline bool ptep_try_set(hw_pte_t *ptep, pte_t new_pte)
{
pteval_t old = 0;
- if (!try_cmpxchg(&pte_val(*ptep), &old, pte_val(new_pte)))
+ if (!try_cmpxchg(&hw_pte_val(*ptep), &old, pte_val(new_pte)))
return false;
/*
@@ -1861,7 +1871,7 @@ static inline void flush_tlb_before_set(unsigned long addr)
#define test_and_clear_young_ptes test_and_clear_young_ptes
static inline bool test_and_clear_young_ptes(struct vm_area_struct *vma,
- unsigned long addr, pte_t *ptep, unsigned int nr)
+ unsigned long addr, hw_pte_t *ptep, unsigned int nr)
{
if (likely(nr == 1 && !pte_cont(__ptep_get(ptep))))
return __ptep_test_and_clear_young(vma, addr, ptep);
@@ -1871,14 +1881,14 @@ static inline bool test_and_clear_young_ptes(struct vm_area_struct *vma,
#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG
static inline bool ptep_test_and_clear_young(struct vm_area_struct *vma,
- unsigned long addr, pte_t *ptep)
+ unsigned long addr, hw_pte_t *ptep)
{
return test_and_clear_young_ptes(vma, addr, ptep, 1);
}
#define __HAVE_ARCH_PTEP_CLEAR_YOUNG_FLUSH
static inline bool ptep_clear_flush_young(struct vm_area_struct *vma,
- unsigned long addr, pte_t *ptep)
+ unsigned long addr, hw_pte_t *ptep)
{
pte_t orig_pte = __ptep_get(ptep);
@@ -1890,7 +1900,7 @@ static inline bool ptep_clear_flush_young(struct vm_area_struct *vma,
#define clear_flush_young_ptes clear_flush_young_ptes
static inline bool clear_flush_young_ptes(struct vm_area_struct *vma,
- unsigned long addr, pte_t *ptep, unsigned int nr)
+ unsigned long addr, hw_pte_t *ptep, unsigned int nr)
{
if (likely(nr == 1 && !pte_cont(__ptep_get(ptep))))
return __ptep_clear_flush_young(vma, addr, ptep);
@@ -1900,7 +1910,8 @@ static inline bool clear_flush_young_ptes(struct vm_area_struct *vma,
#define wrprotect_ptes wrprotect_ptes
static __always_inline void wrprotect_ptes(struct mm_struct *mm,
- unsigned long addr, pte_t *ptep, unsigned int nr)
+ unsigned long addr, hw_pte_t *ptep,
+ unsigned int nr)
{
if (likely(nr == 1)) {
/*
@@ -1924,14 +1935,14 @@ static __always_inline void wrprotect_ptes(struct mm_struct *mm,
#define __HAVE_ARCH_PTEP_SET_WRPROTECT
static inline void ptep_set_wrprotect(struct mm_struct *mm,
- unsigned long addr, pte_t *ptep)
+ unsigned long addr, hw_pte_t *ptep)
{
wrprotect_ptes(mm, addr, ptep, 1);
}
#define __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS
static inline int ptep_set_access_flags(struct vm_area_struct *vma,
- unsigned long addr, pte_t *ptep,
+ unsigned long addr, hw_pte_t *ptep,
pte_t entry, int dirty)
{
pte_t orig_pte = __ptep_get(ptep);
@@ -1946,7 +1957,7 @@ static inline int ptep_set_access_flags(struct vm_area_struct *vma,
#define clear_young_dirty_ptes clear_young_dirty_ptes
static inline void clear_young_dirty_ptes(struct vm_area_struct *vma,
- unsigned long addr, pte_t *ptep,
+ unsigned long addr, hw_pte_t *ptep,
unsigned int nr, cydp_t flags)
{
if (likely(nr == 1 && !pte_cont(__ptep_get(ptep))))
diff --git a/arch/arm64/include/asm/vmalloc.h b/arch/arm64/include/asm/vmalloc.h
index 4ec1acd3c1b34..28d3e89f90e43 100644
--- a/arch/arm64/include/asm/vmalloc.h
+++ b/arch/arm64/include/asm/vmalloc.h
@@ -45,7 +45,7 @@ static inline unsigned long arch_vmap_pte_range_map_size(unsigned long addr,
#define arch_vmap_pte_range_unmap_size arch_vmap_pte_range_unmap_size
static inline unsigned long arch_vmap_pte_range_unmap_size(unsigned long addr,
- pte_t *ptep)
+ hw_pte_t *ptep)
{
/*
* The caller handles alignment so it's sufficient just to check
diff --git a/arch/arm64/kernel/efi.c b/arch/arm64/kernel/efi.c
index 0ec90fd1754ed..68ff21310604d 100644
--- a/arch/arm64/kernel/efi.c
+++ b/arch/arm64/kernel/efi.c
@@ -111,7 +111,8 @@ struct set_perm_data {
bool has_bti;
};
-static int __init set_permissions(pte_t *ptep, unsigned long addr, void *data)
+static int __init set_permissions(hw_pte_t *ptep, unsigned long addr,
+ void *data)
{
struct set_perm_data *spd = data;
const efi_memory_desc_t *md = spd->md;
diff --git a/arch/arm64/kernel/pi/map_kernel.c b/arch/arm64/kernel/pi/map_kernel.c
index fb44cbdd2f292..2b7e7be5fd6f3 100644
--- a/arch/arm64/kernel/pi/map_kernel.c
+++ b/arch/arm64/kernel/pi/map_kernel.c
@@ -26,7 +26,7 @@ static void __init map_segment(pgd_t *pg_dir, phys_addr_t *pgd, u64 va_offset,
{
map_range(pgd, ((u64)start + va_offset) & ~PAGE_OFFSET,
((u64)end + va_offset) & ~PAGE_OFFSET, (u64)start,
- prot, root_level, (pte_t *)pg_dir, may_use_cont, 0);
+ prot, root_level, (hw_pte_t *)pg_dir, may_use_cont, 0);
}
static void __init unmap_segment(pgd_t *pg_dir, u64 va_offset, void *start,
@@ -209,7 +209,7 @@ static void *__init map_fdt(phys_addr_t fdt)
*/
map_range(&ptep, fdt, (u64)_text > fdt ? min((u64)_text, efdt) : efdt,
fdt, PAGE_KERNEL, IDMAP_ROOT_LEVEL,
- (pte_t *)init_idmap_pg_dir, false, 0);
+ (hw_pte_t *)init_idmap_pg_dir, false, 0);
dsb(ishst);
return (void *)fdt;
diff --git a/arch/arm64/kernel/pi/map_range.c b/arch/arm64/kernel/pi/map_range.c
index 761b14893f748..9c4c8060c5df4 100644
--- a/arch/arm64/kernel/pi/map_range.c
+++ b/arch/arm64/kernel/pi/map_range.c
@@ -27,7 +27,8 @@
* in the VA space
*/
void __init map_range(phys_addr_t *pte, u64 start, u64 end, phys_addr_t pa,
- pgprot_t prot, int level, pte_t *tbl, bool may_use_cont,
+ pgprot_t prot, int level, hw_pte_t *tbl,
+ bool may_use_cont,
u64 va_offset)
{
u64 cmask = (level == 3) ? CONT_PTE_SIZE - 1 : U64_MAX;
@@ -50,19 +51,21 @@ void __init map_range(phys_addr_t *pte, u64 start, u64 end, phys_addr_t pa,
while (start < end) {
u64 next = min((start | lmask) + 1, PAGE_ALIGN(end));
+ pte_t entry = __ptep_get(tbl);
if (level < 2 || (level == 2 && (start | next | pa) & lmask)) {
/*
* This chunk needs a finer grained mapping. Create a
* table mapping if necessary and recurse.
*/
- if (pte_none(*tbl)) {
- *tbl = __pte(__phys_to_pte_val(*pte) |
+ if (pte_none(entry)) {
+ entry = __pte(__phys_to_pte_val(*pte) |
PMD_TYPE_TABLE | PMD_TABLE_UXN);
- *pte += PTRS_PER_PTE * sizeof(pte_t);
+ __set_pte_nosync(tbl, entry);
+ *pte += PTRS_PER_PTE * sizeof(hw_pte_t);
}
map_range(pte, start, next, pa, prot, level + 1,
- (pte_t *)(__pte_to_phys(*tbl) + va_offset),
+ (hw_pte_t *)(__pte_to_phys(entry) + va_offset),
may_use_cont, va_offset);
} else {
/*
@@ -80,7 +83,8 @@ void __init map_range(phys_addr_t *pte, u64 start, u64 end, phys_addr_t pa,
protval &= ~PTE_CONT;
/* Put down a block or page mapping */
- *tbl = __pte(__phys_to_pte_val(pa) | protval);
+ entry = __pte(__phys_to_pte_val(pa) | protval);
+ __set_pte_nosync(tbl, entry);
}
pa += next - start;
start = next;
@@ -100,10 +104,10 @@ asmlinkage phys_addr_t __init create_init_idmap(pgd_t *pg_dir, ptval_t clrmask)
/* MMU is off; pointer casts to phys_addr_t are safe */
map_range(&ptep, (u64)_stext, (u64)__initdata_begin,
(phys_addr_t)_stext, text_prot, IDMAP_ROOT_LEVEL,
- (pte_t *)pg_dir, false, 0);
+ (hw_pte_t *)pg_dir, false, 0);
map_range(&ptep, (u64)__initdata_begin, (u64)_end,
(phys_addr_t)__initdata_begin, data_prot, IDMAP_ROOT_LEVEL,
- (pte_t *)pg_dir, false, 0);
+ (hw_pte_t *)pg_dir, false, 0);
return ptep;
}
diff --git a/arch/arm64/kernel/pi/pi.h b/arch/arm64/kernel/pi/pi.h
index 5dfd8484d2005..a7d09a2fa8f9f 100644
--- a/arch/arm64/kernel/pi/pi.h
+++ b/arch/arm64/kernel/pi/pi.h
@@ -2,6 +2,7 @@
// Copyright 2023 Google LLC
// Author: Ard Biesheuvel <ardb@google.com>
+#include <linux/pgtable_types.h>
#include <linux/types.h>
#define __prel64_initconst __section(".init.rodata.prel64")
@@ -30,7 +31,7 @@ void relocate_kernel(u64 offset);
int scs_patch(const u8 eh_frame[], int size, bool skip_dry_run);
void map_range(phys_addr_t *pte, u64 start, u64 end, phys_addr_t pa,
- pgprot_t prot, int level, pte_t *tbl, bool may_use_cont,
+ pgprot_t prot, int level, hw_pte_t *tbl, bool may_use_cont,
u64 va_offset);
asmlinkage void early_map_kernel(u64 boot_status, phys_addr_t fdt);
diff --git a/arch/arm64/mm/contpte.c b/arch/arm64/mm/contpte.c
index 0acab179fc1a5..753267c0b41e5 100644
--- a/arch/arm64/mm/contpte.c
+++ b/arch/arm64/mm/contpte.c
@@ -21,13 +21,14 @@ static inline bool mm_is_user(struct mm_struct *mm)
return mm != &init_mm;
}
-static inline pte_t *contpte_align_down(pte_t *ptep)
+static inline hw_pte_t *contpte_align_down(hw_pte_t *ptep)
{
return PTR_ALIGN_DOWN(ptep, sizeof(*ptep) * CONT_PTES);
}
-static inline pte_t *contpte_align_addr_ptep(unsigned long *start,
- unsigned long *end, pte_t *ptep,
+static inline hw_pte_t *contpte_align_addr_ptep(unsigned long *start,
+ unsigned long *end,
+ hw_pte_t *ptep,
unsigned int nr)
{
/*
@@ -47,7 +48,7 @@ static inline pte_t *contpte_align_addr_ptep(unsigned long *start,
}
static void contpte_try_unfold_partial(struct mm_struct *mm, unsigned long addr,
- pte_t *ptep, unsigned int nr)
+ hw_pte_t *ptep, unsigned int nr)
{
/*
* Unfold any partially covered contpte block at the beginning and end
@@ -59,7 +60,7 @@ static void contpte_try_unfold_partial(struct mm_struct *mm, unsigned long addr,
if (ptep + nr != contpte_align_down(ptep + nr)) {
unsigned long last_addr = addr + PAGE_SIZE * (nr - 1);
- pte_t *last_ptep = ptep + nr - 1;
+ hw_pte_t *last_ptep = ptep + nr - 1;
contpte_try_unfold(mm, last_addr, last_ptep,
__ptep_get(last_ptep));
@@ -67,11 +68,11 @@ static void contpte_try_unfold_partial(struct mm_struct *mm, unsigned long addr,
}
static void contpte_convert(struct mm_struct *mm, unsigned long addr,
- pte_t *ptep, pte_t pte)
+ hw_pte_t *ptep, pte_t pte)
{
struct vm_area_struct vma = TLB_FLUSH_VMA(mm, 0);
unsigned long start_addr;
- pte_t *start_ptep;
+ hw_pte_t *start_ptep;
int i;
start_ptep = ptep = contpte_align_down(ptep);
@@ -227,7 +228,7 @@ static void contpte_convert(struct mm_struct *mm, unsigned long addr,
}
void __contpte_try_fold(struct mm_struct *mm, unsigned long addr,
- pte_t *ptep, pte_t pte)
+ hw_pte_t *ptep, pte_t pte)
{
/*
* We have already checked that the virtual and pysical addresses are
@@ -253,7 +254,7 @@ void __contpte_try_fold(struct mm_struct *mm, unsigned long addr,
struct folio *folio;
struct page *page;
unsigned long pfn;
- pte_t *orig_ptep;
+ hw_pte_t *orig_ptep;
pgprot_t prot;
int i;
@@ -291,7 +292,7 @@ void __contpte_try_fold(struct mm_struct *mm, unsigned long addr,
EXPORT_SYMBOL_GPL(__contpte_try_fold);
void __contpte_try_unfold(struct mm_struct *mm, unsigned long addr,
- pte_t *ptep, pte_t pte)
+ hw_pte_t *ptep, pte_t pte)
{
/*
* We have already checked that the ptes are contiguous in
@@ -305,7 +306,7 @@ void __contpte_try_unfold(struct mm_struct *mm, unsigned long addr,
}
EXPORT_SYMBOL_GPL(__contpte_try_unfold);
-pte_t contpte_ptep_get(pte_t *ptep, pte_t orig_pte)
+pte_t contpte_ptep_get(hw_pte_t *ptep, pte_t orig_pte)
{
/*
* Gather access/dirty bits, which may be populated in any of the ptes
@@ -362,7 +363,7 @@ static inline bool contpte_is_consistent(pte_t pte, unsigned long pfn,
pgprot_val(prot) == pgprot_val(orig_prot);
}
-pte_t contpte_ptep_get_lockless(pte_t *orig_ptep)
+pte_t contpte_ptep_get_lockless(hw_pte_t *orig_ptep)
{
/*
* The ptep_get_lockless() API requires us to read and return *orig_ptep
@@ -384,7 +385,7 @@ pte_t contpte_ptep_get_lockless(pte_t *orig_ptep)
pgprot_t orig_prot;
unsigned long pfn;
pte_t orig_pte;
- pte_t *ptep;
+ hw_pte_t *ptep;
pte_t pte;
int i;
@@ -445,7 +446,8 @@ pte_t contpte_ptep_get_lockless(pte_t *orig_ptep)
EXPORT_SYMBOL_GPL(contpte_ptep_get_lockless);
void contpte_set_ptes(struct mm_struct *mm, unsigned long addr,
- pte_t *ptep, pte_t pte, unsigned int nr)
+ hw_pte_t *ptep, pte_t pte,
+ unsigned int nr)
{
unsigned long next;
unsigned long end;
@@ -488,7 +490,7 @@ void contpte_set_ptes(struct mm_struct *mm, unsigned long addr,
EXPORT_SYMBOL_GPL(contpte_set_ptes);
void contpte_clear_full_ptes(struct mm_struct *mm, unsigned long addr,
- pte_t *ptep, unsigned int nr, int full)
+ hw_pte_t *ptep, unsigned int nr, int full)
{
contpte_try_unfold_partial(mm, addr, ptep, nr);
__clear_full_ptes(mm, addr, ptep, nr, full);
@@ -496,7 +498,7 @@ void contpte_clear_full_ptes(struct mm_struct *mm, unsigned long addr,
EXPORT_SYMBOL_GPL(contpte_clear_full_ptes);
pte_t contpte_get_and_clear_full_ptes(struct mm_struct *mm,
- unsigned long addr, pte_t *ptep,
+ unsigned long addr, hw_pte_t *ptep,
unsigned int nr, int full)
{
contpte_try_unfold_partial(mm, addr, ptep, nr);
@@ -505,7 +507,7 @@ pte_t contpte_get_and_clear_full_ptes(struct mm_struct *mm,
EXPORT_SYMBOL_GPL(contpte_get_and_clear_full_ptes);
bool contpte_test_and_clear_young_ptes(struct vm_area_struct *vma,
- unsigned long addr, pte_t *ptep, unsigned int nr)
+ unsigned long addr, hw_pte_t *ptep, unsigned int nr)
{
/*
* ptep_clear_flush_young() technically requires us to clear the access
@@ -531,7 +533,7 @@ bool contpte_test_and_clear_young_ptes(struct vm_area_struct *vma,
EXPORT_SYMBOL_GPL(contpte_test_and_clear_young_ptes);
bool contpte_clear_flush_young_ptes(struct vm_area_struct *vma,
- unsigned long addr, pte_t *ptep, unsigned int nr)
+ unsigned long addr, hw_pte_t *ptep, unsigned int nr)
{
bool young;
@@ -554,7 +556,7 @@ bool contpte_clear_flush_young_ptes(struct vm_area_struct *vma,
EXPORT_SYMBOL_GPL(contpte_clear_flush_young_ptes);
void contpte_wrprotect_ptes(struct mm_struct *mm, unsigned long addr,
- pte_t *ptep, unsigned int nr)
+ hw_pte_t *ptep, unsigned int nr)
{
/*
* If wrprotecting an entire contig range, we can avoid unfolding. Just
@@ -572,7 +574,7 @@ void contpte_wrprotect_ptes(struct mm_struct *mm, unsigned long addr,
EXPORT_SYMBOL_GPL(contpte_wrprotect_ptes);
void contpte_clear_young_dirty_ptes(struct vm_area_struct *vma,
- unsigned long addr, pte_t *ptep,
+ unsigned long addr, hw_pte_t *ptep,
unsigned int nr, cydp_t flags)
{
/*
@@ -593,9 +595,10 @@ void contpte_clear_young_dirty_ptes(struct vm_area_struct *vma,
}
EXPORT_SYMBOL_GPL(contpte_clear_young_dirty_ptes);
-static bool contpte_all_subptes_match_access_flags(pte_t *ptep, pte_t entry)
+static bool contpte_all_subptes_match_access_flags(hw_pte_t *ptep,
+ pte_t entry)
{
- pte_t *cont_ptep = contpte_align_down(ptep);
+ hw_pte_t *cont_ptep = contpte_align_down(ptep);
/*
* PFNs differ per sub-PTE. Match only bits consumed by
* __ptep_set_access_flags(): AF, DIRTY and write permission.
@@ -615,7 +618,7 @@ static bool contpte_all_subptes_match_access_flags(pte_t *ptep, pte_t entry)
}
int contpte_ptep_set_access_flags(struct vm_area_struct *vma,
- unsigned long addr, pte_t *ptep,
+ unsigned long addr, hw_pte_t *ptep,
pte_t entry, int dirty)
{
unsigned long start_addr;
diff --git a/arch/arm64/mm/fault.c b/arch/arm64/mm/fault.c
index 0b52557652be6..3322f4e7174dc 100644
--- a/arch/arm64/mm/fault.c
+++ b/arch/arm64/mm/fault.c
@@ -162,7 +162,8 @@ static void show_pte(unsigned long addr)
p4d_t *p4dp, p4d;
pud_t *pudp, pud;
pmd_t *pmdp, pmd;
- pte_t *ptep, pte;
+ hw_pte_t *ptep;
+ pte_t pte;
if (pgd_none(pgd) || pgd_bad(pgd))
break;
@@ -208,7 +209,7 @@ static void show_pte(unsigned long addr)
* Returns whether or not the PTE actually changed.
*/
int __ptep_set_access_flags_anysz(struct vm_area_struct *vma,
- unsigned long address, pte_t *ptep,
+ unsigned long address, hw_pte_t *ptep,
pte_t entry, int dirty, unsigned long pgsize)
{
pteval_t old_pteval, pteval;
@@ -234,7 +235,7 @@ int __ptep_set_access_flags_anysz(struct vm_area_struct *vma,
pteval ^= PTE_RDONLY;
pteval |= pte_val(entry);
pteval ^= PTE_RDONLY;
- pteval = cmpxchg_relaxed(&pte_val(*ptep), old_pteval, pteval);
+ pteval = cmpxchg_relaxed(&hw_pte_val(*ptep), old_pteval, pteval);
} while (pteval != old_pteval);
/*
diff --git a/arch/arm64/mm/fixmap.c b/arch/arm64/mm/fixmap.c
index f66a0016dd02d..709a97fe327d8 100644
--- a/arch/arm64/mm/fixmap.c
+++ b/arch/arm64/mm/fixmap.c
@@ -31,11 +31,11 @@ static_assert(NR_BM_PMD_TABLES == 1);
#define BM_PTE_TABLE_IDX(addr) __BM_TABLE_IDX(addr, PMD_SHIFT)
-static pte_t bm_pte[NR_BM_PTE_TABLES][PTRS_PER_PTE] __bss_pgtbl;
+static hw_pte_t bm_pte[NR_BM_PTE_TABLES][PTRS_PER_PTE] __bss_pgtbl;
static pmd_t bm_pmd[PTRS_PER_PMD] __bss_pgtbl __maybe_unused;
static pud_t bm_pud[PTRS_PER_PUD] __bss_pgtbl __maybe_unused;
-static inline pte_t *fixmap_pte(unsigned long addr)
+static inline hw_pte_t *fixmap_pte(unsigned long addr)
{
return &bm_pte[BM_PTE_TABLE_IDX(addr)][pte_index(addr)];
}
@@ -43,7 +43,7 @@ static inline pte_t *fixmap_pte(unsigned long addr)
static void __init early_fixmap_init_pte(pmd_t *pmdp, unsigned long addr)
{
pmd_t pmd = READ_ONCE(*pmdp);
- pte_t *ptep;
+ hw_pte_t *ptep;
if (pmd_none(pmd)) {
ptep = bm_pte[BM_PTE_TABLE_IDX(addr)];
@@ -120,7 +120,7 @@ void __set_fixmap(enum fixed_addresses idx,
phys_addr_t phys, pgprot_t flags)
{
unsigned long addr = __fix_to_virt(idx);
- pte_t *ptep;
+ hw_pte_t *ptep;
BUG_ON(idx <= FIX_HOLE || idx >= __end_of_fixed_addresses);
diff --git a/arch/arm64/mm/hugetlbpage.c b/arch/arm64/mm/hugetlbpage.c
index 8e799c1fe0aa6..560c0f16cd8e4 100644
--- a/arch/arm64/mm/hugetlbpage.c
+++ b/arch/arm64/mm/hugetlbpage.c
@@ -76,7 +76,7 @@ bool arch_hugetlb_migration_supported(struct hstate *h)
#endif
static int find_num_contig(struct mm_struct *mm, unsigned long addr,
- pte_t *ptep, size_t *pgsize)
+ hw_pte_t *ptep, size_t *pgsize)
{
pgd_t *pgdp = pgd_offset(mm, addr);
p4d_t *p4dp;
@@ -87,7 +87,7 @@ static int find_num_contig(struct mm_struct *mm, unsigned long addr,
p4dp = p4d_offset(pgdp, addr);
pudp = pud_offset(p4dp, addr);
pmdp = pmd_offset(pudp, addr);
- if ((pte_t *)PTR_ALIGN_DOWN(pmdp, sizeof(*pmdp) * CONT_PMDS) == ptep) {
+ if ((hw_pte_t *)PTR_ALIGN_DOWN(pmdp, sizeof(*pmdp) * CONT_PMDS) == ptep) {
*pgsize = PMD_SIZE;
return CONT_PMDS;
}
@@ -116,7 +116,7 @@ static inline int num_contig_ptes(unsigned long size, size_t *pgsize)
return contig_ptes;
}
-pte_t huge_ptep_get(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
+pte_t huge_ptep_get(struct mm_struct *mm, unsigned long addr, hw_pte_t *ptep)
{
int ncontig, i;
size_t pgsize;
@@ -148,7 +148,7 @@ pte_t huge_ptep_get(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
*/
static pte_t get_clear_contig(struct mm_struct *mm,
unsigned long addr,
- pte_t *ptep,
+ hw_pte_t *ptep,
unsigned long pgsize,
unsigned long ncontig)
{
@@ -173,7 +173,7 @@ static pte_t get_clear_contig(struct mm_struct *mm,
static pte_t get_clear_contig_flush(struct mm_struct *mm,
unsigned long addr,
- pte_t *ptep,
+ hw_pte_t *ptep,
unsigned long pgsize,
unsigned long ncontig)
{
@@ -196,7 +196,7 @@ static pte_t get_clear_contig_flush(struct mm_struct *mm,
*/
static void clear_flush(struct mm_struct *mm,
unsigned long addr,
- pte_t *ptep,
+ hw_pte_t *ptep,
unsigned long pgsize,
unsigned long ncontig)
{
@@ -213,7 +213,7 @@ static void clear_flush(struct mm_struct *mm,
}
void set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
- pte_t *ptep, pte_t pte, unsigned long sz)
+ hw_pte_t *ptep, pte_t pte, unsigned long sz)
{
size_t pgsize;
int i;
@@ -234,14 +234,14 @@ void set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
__set_ptes_anysz(mm, addr, ptep, pte, ncontig, pgsize);
}
-pte_t *huge_pte_alloc(struct mm_struct *mm, struct vm_area_struct *vma,
+hw_pte_t *huge_pte_alloc(struct mm_struct *mm, struct vm_area_struct *vma,
unsigned long addr, unsigned long sz)
{
pgd_t *pgdp;
p4d_t *p4dp;
pud_t *pudp;
pmd_t *pmdp;
- pte_t *ptep = NULL;
+ hw_pte_t *ptep = NULL;
pgdp = pgd_offset(mm, addr);
p4dp = p4d_alloc(mm, pgdp, addr);
@@ -253,7 +253,7 @@ pte_t *huge_pte_alloc(struct mm_struct *mm, struct vm_area_struct *vma,
return NULL;
if (sz == PUD_SIZE) {
- ptep = (pte_t *)pudp;
+ ptep = (hw_pte_t *)pudp;
} else if (sz == (CONT_PTE_SIZE)) {
pmdp = pmd_alloc(mm, pudp, addr);
if (!pmdp)
@@ -265,17 +265,17 @@ pte_t *huge_pte_alloc(struct mm_struct *mm, struct vm_area_struct *vma,
if (want_pmd_share(vma, addr) && pud_none(READ_ONCE(*pudp)))
ptep = huge_pmd_share(mm, vma, addr, pudp);
else
- ptep = (pte_t *)pmd_alloc(mm, pudp, addr);
+ ptep = (hw_pte_t *)pmd_alloc(mm, pudp, addr);
} else if (sz == (CONT_PMD_SIZE)) {
pmdp = pmd_alloc(mm, pudp, addr);
WARN_ON(addr & (sz - 1));
- return (pte_t *)pmdp;
+ return (hw_pte_t *)pmdp;
}
return ptep;
}
-pte_t *huge_pte_offset(struct mm_struct *mm,
+hw_pte_t *huge_pte_offset(struct mm_struct *mm,
unsigned long addr, unsigned long sz)
{
pgd_t *pgdp;
@@ -297,7 +297,7 @@ pte_t *huge_pte_offset(struct mm_struct *mm,
return NULL;
/* hugepage or swap? */
if (pud_leaf(pud) || !pud_present(pud))
- return (pte_t *)pudp;
+ return (hw_pte_t *)pudp;
/* table; check the next level */
if (sz == CONT_PMD_SIZE)
@@ -309,7 +309,7 @@ pte_t *huge_pte_offset(struct mm_struct *mm,
pmd_none(pmd))
return NULL;
if (pmd_leaf(pmd) || !pmd_present(pmd))
- return (pte_t *)pmdp;
+ return (hw_pte_t *)pmdp;
if (sz == CONT_PTE_SIZE)
return pte_offset_huge(pmdp, (addr & CONT_PTE_MASK));
@@ -367,7 +367,7 @@ pte_t arch_make_huge_pte(pte_t entry, unsigned int shift, vm_flags_t flags)
}
void huge_pte_clear(struct mm_struct *mm, unsigned long addr,
- pte_t *ptep, unsigned long sz)
+ hw_pte_t *ptep, unsigned long sz)
{
int i, ncontig;
size_t pgsize;
@@ -379,7 +379,7 @@ void huge_pte_clear(struct mm_struct *mm, unsigned long addr,
}
pte_t huge_ptep_get_and_clear(struct mm_struct *mm, unsigned long addr,
- pte_t *ptep, unsigned long sz)
+ hw_pte_t *ptep, unsigned long sz)
{
int ncontig;
size_t pgsize;
@@ -397,7 +397,7 @@ pte_t huge_ptep_get_and_clear(struct mm_struct *mm, unsigned long addr,
* all the contiguous ptes we need to check whether or not there is a
* discrepancy between dirty or young.
*/
-static int __cont_access_flags_changed(pte_t *ptep, pte_t pte, int ncontig)
+static int __cont_access_flags_changed(hw_pte_t *ptep, pte_t pte, int ncontig)
{
int i;
@@ -418,7 +418,7 @@ static int __cont_access_flags_changed(pte_t *ptep, pte_t pte, int ncontig)
}
int huge_ptep_set_access_flags(struct vm_area_struct *vma,
- unsigned long addr, pte_t *ptep,
+ unsigned long addr, hw_pte_t *ptep,
pte_t pte, int dirty)
{
int ncontig;
@@ -451,7 +451,7 @@ int huge_ptep_set_access_flags(struct vm_area_struct *vma,
}
void huge_ptep_set_wrprotect(struct mm_struct *mm,
- unsigned long addr, pte_t *ptep)
+ unsigned long addr, hw_pte_t *ptep)
{
int ncontig;
size_t pgsize;
@@ -474,7 +474,7 @@ void huge_ptep_set_wrprotect(struct mm_struct *mm,
}
pte_t huge_ptep_clear_flush(struct vm_area_struct *vma,
- unsigned long addr, pte_t *ptep)
+ unsigned long addr, hw_pte_t *ptep)
{
struct mm_struct *mm = vma->vm_mm;
size_t pgsize;
@@ -514,7 +514,8 @@ bool __init arch_hugetlb_valid_size(unsigned long size)
return __hugetlb_valid_size(size);
}
-pte_t huge_ptep_modify_prot_start(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep)
+pte_t huge_ptep_modify_prot_start(struct vm_area_struct *vma, unsigned long addr,
+ hw_pte_t *ptep)
{
unsigned long psize = huge_page_size(hstate_vma(vma));
@@ -530,7 +531,8 @@ pte_t huge_ptep_modify_prot_start(struct vm_area_struct *vma, unsigned long addr
return huge_ptep_get_and_clear(vma->vm_mm, addr, ptep, psize);
}
-void huge_ptep_modify_prot_commit(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep,
+void huge_ptep_modify_prot_commit(struct vm_area_struct *vma, unsigned long addr,
+ hw_pte_t *ptep,
pte_t old_pte, pte_t pte)
{
unsigned long psize = huge_page_size(hstate_vma(vma));
diff --git a/arch/arm64/mm/kasan_init.c b/arch/arm64/mm/kasan_init.c
index 45fbdce684c89..dccb736b32e9b 100644
--- a/arch/arm64/mm/kasan_init.c
+++ b/arch/arm64/mm/kasan_init.c
@@ -59,7 +59,7 @@ static phys_addr_t __init kasan_alloc_raw_page(int node)
return __pa(p);
}
-static pte_t *__init kasan_pte_offset(pmd_t *pmdp, unsigned long addr, int node,
+static hw_pte_t *__init kasan_pte_offset(pmd_t *pmdp, unsigned long addr, int node,
bool early)
{
if (pmd_none(READ_ONCE(*pmdp))) {
@@ -116,7 +116,7 @@ static void __init kasan_pte_populate(pmd_t *pmdp, unsigned long addr,
unsigned long end, int node, bool early)
{
unsigned long next;
- pte_t *ptep = kasan_pte_offset(pmdp, addr, node, early);
+ hw_pte_t *ptep = kasan_pte_offset(pmdp, addr, node, early);
do {
phys_addr_t page_phys = early ?
diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c
index 79d90226fd5dc..f02b974ad64df 100644
--- a/arch/arm64/mm/mmu.c
+++ b/arch/arm64/mm/mmu.c
@@ -159,7 +159,7 @@ static void init_clear_pgtable(void *table)
dsb(ishst);
}
-static void init_pte(pte_t *ptep, unsigned long addr, unsigned long end,
+static void init_pte(hw_pte_t *ptep, unsigned long addr, unsigned long end,
phys_addr_t phys, pgprot_t prot)
{
do {
@@ -182,7 +182,7 @@ static void init_pte(pte_t *ptep, unsigned long addr, unsigned long end,
} while (ptep++, addr += PAGE_SIZE, addr != end);
}
-static bool pte_range_has_valid_noncont(pte_t *ptep)
+static bool pte_range_has_valid_noncont(hw_pte_t *ptep)
{
for (int i = 0; i < CONT_PTES; i++) {
pte_t pte = __ptep_get(&ptep[i]);
@@ -201,7 +201,7 @@ static int alloc_init_cont_pte(pmd_t *pmdp, unsigned long addr,
{
unsigned long next;
pmd_t pmd = READ_ONCE(*pmdp);
- pte_t *ptep;
+ hw_pte_t *ptep;
BUG_ON(pmd_leaf(pmd));
if (pmd_none(pmd)) {
@@ -592,7 +592,7 @@ pgd_pgtable_alloc_special_mm(enum pgtable_level pgtable_level)
return __pgd_pgtable_alloc(NULL, GFP_PGTABLE_KERNEL, pgtable_level);
}
-static void split_contpte(pte_t *ptep)
+static void split_contpte(hw_pte_t *ptep)
{
int i;
@@ -607,13 +607,13 @@ static int split_pmd(pmd_t *pmdp, pmd_t pmd, gfp_t gfp, bool to_cont)
unsigned long pfn = pmd_pfn(pmd);
pgprot_t prot = pmd_pgprot(pmd);
phys_addr_t pte_phys;
- pte_t *ptep;
+ hw_pte_t *ptep;
int i;
pte_phys = pgd_pgtable_alloc_init_mm_gfp(PGTABLE_LEVEL_PTE, gfp);
if (pte_phys == INVALID_PHYS_ADDR)
return -ENOMEM;
- ptep = (pte_t *)phys_to_virt(pte_phys);
+ ptep = (hw_pte_t *)phys_to_virt(pte_phys);
if (pgprot_val(prot) & PMD_SECT_PXN)
tableprot |= PMD_TABLE_PXN;
@@ -691,7 +691,8 @@ static int split_kernel_leaf_mapping_locked(unsigned long addr)
p4d_t *p4dp, p4d;
pud_t *pudp, pud;
pmd_t *pmdp, pmd;
- pte_t *ptep, pte;
+ hw_pte_t *ptep;
+ pte_t pte;
int ret = 0;
/*
@@ -904,7 +905,7 @@ static int split_to_ptes_pmd_entry(pmd_t *pmdp, unsigned long addr,
return ret;
}
-static int split_to_ptes_pte_entry(pte_t *ptep, unsigned long addr,
+static int split_to_ptes_pte_entry(hw_pte_t *ptep, unsigned long addr,
unsigned long next, struct mm_walk *walk)
{
pte_t pte = __ptep_get(ptep);
@@ -1438,7 +1439,8 @@ static void __init declare_kernel_vmas(void)
}
void __pi_map_range(phys_addr_t *pte, u64 start, u64 end, phys_addr_t pa,
- pgprot_t prot, int level, pte_t *tbl, bool may_use_cont,
+ pgprot_t prot, int level, hw_pte_t *tbl,
+ bool may_use_cont,
u64 va_offset);
static u8 idmap_ptes[IDMAP_LEVELS - 1][PAGE_SIZE] __aligned(PAGE_SIZE) __ro_after_init,
@@ -1451,7 +1453,7 @@ static void __init create_idmap(void)
phys_addr_t ptep = __pa_symbol(idmap_ptes);
__pi_map_range(&ptep, start, end, start, PAGE_KERNEL_ROX,
- IDMAP_ROOT_LEVEL, (pte_t *)idmap_pg_dir, false,
+ IDMAP_ROOT_LEVEL, (hw_pte_t *)idmap_pg_dir, false,
__phys_to_virt(ptep) - ptep);
if (linear_map_requires_bbml3 ||
@@ -1466,7 +1468,8 @@ static void __init create_idmap(void)
*/
ptep = __pa_symbol(kpti_bbml3_ptes);
__pi_map_range(&ptep, pa, pa + sizeof(u32), pa, PAGE_KERNEL,
- IDMAP_ROOT_LEVEL, (pte_t *)idmap_pg_dir, false,
+ IDMAP_ROOT_LEVEL, (hw_pte_t *)idmap_pg_dir,
+ false,
__phys_to_virt(ptep) - ptep);
}
}
@@ -1522,7 +1525,8 @@ static void unmap_hotplug_pte_range(pmd_t *pmdp, unsigned long addr,
unsigned long end, bool free_mapped,
struct vmem_altmap *altmap)
{
- pte_t *ptep, pte;
+ hw_pte_t *ptep;
+ pte_t pte;
do {
ptep = pte_offset_kernel(pmdp, addr);
@@ -1665,7 +1669,8 @@ static void free_empty_pte_table(pmd_t *pmdp, unsigned long addr,
unsigned long end, unsigned long floor,
unsigned long ceiling)
{
- pte_t *ptep, pte;
+ hw_pte_t *ptep;
+ pte_t pte;
unsigned long i, start = addr;
do {
@@ -1914,7 +1919,7 @@ int pmd_clear_huge(pmd_t *pmdp)
int pmd_free_pte_page(pmd_t *pmdp, unsigned long addr)
{
- pte_t *table;
+ hw_pte_t *table;
pmd_t pmd;
pmd = READ_ONCE(*pmdp);
@@ -2056,7 +2061,8 @@ static bool addr_splits_kernel_leaf(unsigned long addr)
p4d_t *p4dp, p4d;
pud_t *pudp, pud;
pmd_t *pmdp, pmd;
- pte_t *ptep, pte;
+ hw_pte_t *ptep;
+ pte_t pte;
/*
* If the given address points at a the start address of
@@ -2284,7 +2290,7 @@ early_initcall(prevent_memory_remove_init);
#endif
pte_t modify_prot_start_ptes(struct vm_area_struct *vma, unsigned long addr,
- pte_t *ptep, unsigned int nr)
+ hw_pte_t *ptep, unsigned int nr)
{
pte_t pte = get_and_clear_ptes(vma->vm_mm, addr, ptep, nr);
@@ -2302,19 +2308,21 @@ pte_t modify_prot_start_ptes(struct vm_area_struct *vma, unsigned long addr,
return pte;
}
-pte_t ptep_modify_prot_start(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep)
+pte_t ptep_modify_prot_start(struct vm_area_struct *vma, unsigned long addr,
+ hw_pte_t *ptep)
{
return modify_prot_start_ptes(vma, addr, ptep, 1);
}
void modify_prot_commit_ptes(struct vm_area_struct *vma, unsigned long addr,
- pte_t *ptep, pte_t old_pte, pte_t pte,
+ hw_pte_t *ptep, pte_t old_pte, pte_t pte,
unsigned int nr)
{
set_ptes(vma->vm_mm, addr, ptep, pte, nr);
}
-void ptep_modify_prot_commit(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep,
+void ptep_modify_prot_commit(struct vm_area_struct *vma, unsigned long addr,
+ hw_pte_t *ptep,
pte_t old_pte, pte_t pte)
{
modify_prot_commit_ptes(vma, addr, ptep, old_pte, pte, 1);
diff --git a/arch/arm64/mm/pageattr.c b/arch/arm64/mm/pageattr.c
index bbe98ac9ad8c6..40edf6ff03235 100644
--- a/arch/arm64/mm/pageattr.c
+++ b/arch/arm64/mm/pageattr.c
@@ -68,7 +68,7 @@ static int pageattr_pmd_entry(pmd_t *pmd, unsigned long addr,
return 0;
}
-static int pageattr_pte_entry(pte_t *pte, unsigned long addr,
+static int pageattr_pte_entry(hw_pte_t *pte, unsigned long addr,
unsigned long next, struct mm_walk *walk)
{
pte_t val = __ptep_get(pte);
@@ -395,7 +395,7 @@ bool kernel_page_present(struct page *page)
p4d_t *p4dp;
pud_t *pudp, pud;
pmd_t *pmdp, pmd;
- pte_t *ptep;
+ hw_pte_t *ptep;
unsigned long addr = (unsigned long)page_address(page);
pgdp = pgd_offset_k(addr);
diff --git a/arch/arm64/mm/trans_pgd.c b/arch/arm64/mm/trans_pgd.c
index cca9706a875c3..845417792ad48 100644
--- a/arch/arm64/mm/trans_pgd.c
+++ b/arch/arm64/mm/trans_pgd.c
@@ -34,8 +34,8 @@ static void *trans_alloc(struct trans_pgd_info *info)
static int copy_pte(struct trans_pgd_info *info, pmd_t *dst_pmdp,
pmd_t *src_pmdp, unsigned long start, unsigned long end)
{
- pte_t *src_ptep;
- pte_t *dst_ptep;
+ hw_pte_t *src_ptep;
+ hw_pte_t *dst_ptep;
unsigned long addr = start;
dst_ptep = trans_alloc(info);
|
| 3/2 | 2026/09/25 01:35 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 25814 output: 72 thoughts: 1035 Thoughts: **Analysis of the Patch for Fuzzing Worthiness** Okay, let's break this down. The target architecture is amd64, so that's our baseline. I'm looking at a diff, and it's immediately apparent that all the modified files reside under `arch/arm64/`. My first instinct is to double-check, ensure there aren't any sneaky cross-architecture inclusions, so I'm mentally running through the typical build processes. Specifically, I'm verifying the initial assumption by manually scanning the list. The presence of `arch/arm64/` files immediately raises a red flag. I'm thinking about the negative criteria: "Code paths exclusive to architectures other than the target architecture." Bingo. This patch touches areas *only* relevant to ARM64. There's zero chance that any of this code will be compiled or executed on an amd64 system. Kernel builds are very strict about architecture boundaries. `arch/arm64/` headers? Not pulled into an amd64 build. `arch/arm64/` source code? Absolutely never compiled for x86_64. I'm confident. No need to dig any deeper with git commands. The diff is conclusive: nothing here applies to the amd64 target. Let's make sure we are not overlooking any details. Now, let's apply the negative criteria. The changes fall squarely into the category of "Code paths exclusive to architectures other than the target architecture." This means `WorthFuzzing` is unequivocally `false`. Now, let's assemble the `set-results` parameters. `WorthFuzzing` is `false`. Since this is an architecture-specific change, there are no focus symbols, and no configurations to enable. The arrays for `FocusSymbols` and `EnableConfigs` are empty. Here's the reasoning: All modifications are strictly within `arch/arm64/`, which is exclusive to the ARM64 architecture. The target architecture is amd64. Therefore, this patch is unreachable and not relevant for fuzzing on amd64. It’s a clear case for setting `WorthFuzzing` to `false`. Time to call `set-results`. |
| 4/2 | 2026/09/25 01:35 | tool | set-results |
0mArgs:{
"EnableConfigs": [],
"FocusSymbols": [],
"Reasoning": "All changes in this patch series are strictly confined to the ARM64 architecture (arch/arm64/). As the target architecture is amd64, none of the modified code is compiled or reachable.",
"WorthFuzzing": false
}Results: {
"EnableConfigs": null,
"FocusSymbols": [],
"Reasoning": "All changes in this patch series are strictly confined to the ARM64 architecture (arch/arm64/). As the target architecture is amd64, none of the modified code is compiled or reachable.",
"WorthFuzzing": false
} |
| 5/1 | 2026/09/25 01:35 | action | If |
0mArgs:{
"WorthFuzzing": false
}Results: null |
| Total Calls | Total Tokens | Avg Tokens | Total Duration (Seconds) | Avg Duration (Seconds) |
|---|
| Total Calls | Total Duration (Seconds) | Avg Duration (Seconds) |
|---|