OSDN Git Service

powerpc/fsl_booke: Take exec flag into account when setting TLBCAMs
authorChristophe Leroy <christophe.leroy@csgroup.eu>
Fri, 15 Oct 2021 10:02:44 +0000 (12:02 +0200)
committerMichael Ellerman <mpe@ellerman.id.au>
Fri, 22 Oct 2021 04:22:03 +0000 (15:22 +1100)
Don't force MAS3_SX and MAS3_UX at all time. Take into account the
exec flag.

While at it, fix a couple of closeby style problems (indent with space
and unnecessary parenthesis), it keeps more readability.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/5467044e59f27f9fcf709b9661779e3ce5f784f6.1634292136.git.christophe.leroy@csgroup.eu
arch/powerpc/mm/nohash/fsl_book3e.c

index 03dacbe..fdf1029 100644 (file)
@@ -122,15 +122,17 @@ static void settlbcam(int index, unsigned long virt, phys_addr_t phys,
        TLBCAM[index].MAS2 |= (flags & _PAGE_GUARDED) ? MAS2_G : 0;
        TLBCAM[index].MAS2 |= (flags & _PAGE_ENDIAN) ? MAS2_E : 0;
 
-       TLBCAM[index].MAS3 = (phys & MAS3_RPN) | MAS3_SX | MAS3_SR;
-       TLBCAM[index].MAS3 |= ((flags & _PAGE_RW) ? MAS3_SW : 0);
+       TLBCAM[index].MAS3 = (phys & MAS3_RPN) | MAS3_SR;
+       TLBCAM[index].MAS3 |= (flags & _PAGE_BAP_SX) ? MAS3_SX : 0;
+       TLBCAM[index].MAS3 |= (flags & _PAGE_RW) ? MAS3_SW : 0;
        if (mmu_has_feature(MMU_FTR_BIG_PHYS))
                TLBCAM[index].MAS7 = (u64)phys >> 32;
 
        /* Below is unlikely -- only for large user pages or similar */
        if (pte_user(__pte(flags))) {
-          TLBCAM[index].MAS3 |= MAS3_UX | MAS3_UR;
-          TLBCAM[index].MAS3 |= ((flags & _PAGE_RW) ? MAS3_UW : 0);
+               TLBCAM[index].MAS3 |= MAS3_UR;
+               TLBCAM[index].MAS3 |= (flags & _PAGE_EXEC) ? MAS3_UX : 0;
+               TLBCAM[index].MAS3 |= (flags & _PAGE_RW) ? MAS3_UW : 0;
        }
 
        tlbcam_addrs[index].start = virt;