powerpc/64s: Fix radix MMU when MMU_FTR_HPTE_TABLE is clear
authorNicholas Piggin <npiggin@gmail.com>
Wed, 1 Dec 2021 14:41:49 +0000 (00:41 +1000)
committerMichael Ellerman <mpe@ellerman.id.au>
Thu, 9 Dec 2021 11:40:24 +0000 (22:40 +1100)
There are a few places that require MMU_FTR_HPTE_TABLE to be set even
when running in radix mode. Fix those up.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20211201144153.2456614-15-npiggin@gmail.com
arch/powerpc/mm/pgtable.c

index ce94823..abb3198 100644 (file)
@@ -81,9 +81,6 @@ static struct page *maybe_pte_to_page(pte_t pte)
 
 static pte_t set_pte_filter_hash(pte_t pte)
 {
-       if (radix_enabled())
-               return pte;
-
        pte = __pte(pte_val(pte) & ~_PAGE_HPTEFLAGS);
        if (pte_looks_normal(pte) && !(cpu_has_feature(CPU_FTR_COHERENT_ICACHE) ||
                                       cpu_has_feature(CPU_FTR_NOEXECUTE))) {
@@ -112,6 +109,9 @@ static inline pte_t set_pte_filter(pte_t pte)
 {
        struct page *pg;
 
+       if (radix_enabled())
+               return pte;
+
        if (mmu_has_feature(MMU_FTR_HPTE_TABLE))
                return set_pte_filter_hash(pte);
 
@@ -144,6 +144,9 @@ static pte_t set_access_flags_filter(pte_t pte, struct vm_area_struct *vma,
 {
        struct page *pg;
 
+       if (IS_ENABLED(CONFIG_PPC_BOOK3S_64))
+               return pte;
+
        if (mmu_has_feature(MMU_FTR_HPTE_TABLE))
                return pte;