]> git.dujemihanovic.xyz Git - linux.git/commitdiff
powerpc/kuap: MMU_FTR_BOOK3S_KUAP becomes MMU_FTR_KUAP
authorChristophe Leroy <christophe.leroy@csgroup.eu>
Tue, 11 Jul 2023 15:59:17 +0000 (17:59 +0200)
committerMichael Ellerman <mpe@ellerman.id.au>
Wed, 2 Aug 2023 12:22:18 +0000 (22:22 +1000)
In order to reuse MMU_FTR_BOOK3S_KUAP for other targets than BOOK3S,
rename it MMU_FTR_KUAP.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/c8b6f7b8cd0eeaace96879ed0e0a157faa619451.1689091022.git.christophe.leroy@csgroup.eu
arch/powerpc/include/asm/book3s/64/hash-pkey.h
arch/powerpc/include/asm/book3s/64/kup.h
arch/powerpc/include/asm/mmu.h
arch/powerpc/kernel/syscall.c
arch/powerpc/mm/book3s64/pkeys.c

index f1e60d579f6c1628b475addc4f5014cee18f62fc..6c5564c4fae43670ecb789c996e2fcee402b46c4 100644 (file)
@@ -24,7 +24,7 @@ static inline u64 pte_to_hpte_pkey_bits(u64 pteflags, unsigned long flags)
                    ((pteflags & H_PTE_PKEY_BIT1) ? HPTE_R_KEY_BIT1 : 0x0UL) |
                    ((pteflags & H_PTE_PKEY_BIT0) ? HPTE_R_KEY_BIT0 : 0x0UL));
 
-       if (mmu_has_feature(MMU_FTR_BOOK3S_KUAP) ||
+       if (mmu_has_feature(MMU_FTR_KUAP) ||
            mmu_has_feature(MMU_FTR_BOOK3S_KUEP)) {
                if ((pte_pkey == 0) && (flags & HPTE_USE_KERNEL_KEY))
                        return HASH_DEFAULT_KERNEL_KEY;
index 2a7bd3ecc5565666fbe17e3a489477e38564ab54..72fc4263ed2673a3c945260f890f7ae26d72f7b4 100644 (file)
@@ -31,7 +31,7 @@
        mfspr   \gpr2, SPRN_AMR
        cmpd    \gpr1, \gpr2
        beq     99f
-       END_MMU_FTR_SECTION_NESTED_IFCLR(MMU_FTR_BOOK3S_KUAP, 68)
+       END_MMU_FTR_SECTION_NESTED_IFCLR(MMU_FTR_KUAP, 68)
 
        isync
        mtspr   SPRN_AMR, \gpr1
@@ -78,7 +78,7 @@
         * No need to restore IAMR when returning to kernel space.
         */
 100:
-       END_MMU_FTR_SECTION_NESTED_IFSET(MMU_FTR_BOOK3S_KUAP, 67)
+       END_MMU_FTR_SECTION_NESTED_IFSET(MMU_FTR_KUAP, 67)
 #endif
 .endm
 
@@ -91,7 +91,7 @@
        LOAD_REG_IMMEDIATE(\gpr2, AMR_KUAP_BLOCKED)
 999:   tdne    \gpr1, \gpr2
        EMIT_WARN_ENTRY 999b, __FILE__, __LINE__, (BUGFLAG_WARNING | BUGFLAG_ONCE)
-       END_MMU_FTR_SECTION_NESTED_IFSET(MMU_FTR_BOOK3S_KUAP, 67)
+       END_MMU_FTR_SECTION_NESTED_IFSET(MMU_FTR_KUAP, 67)
 #endif
 .endm
 #endif
         */
        BEGIN_MMU_FTR_SECTION_NESTED(68)
        b       100f  // skip_save_amr
-       END_MMU_FTR_SECTION_NESTED_IFCLR(MMU_FTR_PKEY | MMU_FTR_BOOK3S_KUAP, 68)
+       END_MMU_FTR_SECTION_NESTED_IFCLR(MMU_FTR_PKEY | MMU_FTR_KUAP, 68)
 
        /*
         * if pkey is disabled and we are entering from userspace
        mtspr   SPRN_AMR, \gpr2
        isync
 102:
-       END_MMU_FTR_SECTION_NESTED_IFSET(MMU_FTR_BOOK3S_KUAP, 69)
+       END_MMU_FTR_SECTION_NESTED_IFSET(MMU_FTR_KUAP, 69)
 
        /*
         * if entering from kernel we don't need save IAMR
@@ -232,7 +232,7 @@ static inline u64 current_thread_iamr(void)
 
 static __always_inline bool kuap_is_disabled(void)
 {
-       return !mmu_has_feature(MMU_FTR_BOOK3S_KUAP);
+       return !mmu_has_feature(MMU_FTR_KUAP);
 }
 
 static inline void kuap_user_restore(struct pt_regs *regs)
@@ -243,7 +243,7 @@ static inline void kuap_user_restore(struct pt_regs *regs)
        if (!mmu_has_feature(MMU_FTR_PKEY))
                return;
 
-       if (!mmu_has_feature(MMU_FTR_BOOK3S_KUAP)) {
+       if (!mmu_has_feature(MMU_FTR_KUAP)) {
                amr = mfspr(SPRN_AMR);
                if (amr != regs->amr)
                        restore_amr = true;
@@ -317,7 +317,7 @@ static inline unsigned long get_kuap(void)
         * This has no effect in terms of actually blocking things on hash,
         * so it doesn't break anything.
         */
-       if (!mmu_has_feature(MMU_FTR_BOOK3S_KUAP))
+       if (!mmu_has_feature(MMU_FTR_KUAP))
                return AMR_KUAP_BLOCKED;
 
        return mfspr(SPRN_AMR);
@@ -325,7 +325,7 @@ static inline unsigned long get_kuap(void)
 
 static __always_inline void set_kuap(unsigned long value)
 {
-       if (!mmu_has_feature(MMU_FTR_BOOK3S_KUAP))
+       if (!mmu_has_feature(MMU_FTR_KUAP))
                return;
 
        /*
index 94b981152667c8f9b5ed51620eeb835effc25bc9..82af2e2c5eca7704af5cf272296111986b3abede 100644 (file)
@@ -33,7 +33,7 @@
  * key 0 controlling userspace addresses on radix
  * Key 3 on hash
  */
-#define MMU_FTR_BOOK3S_KUAP            ASM_CONST(0x00000200)
+#define MMU_FTR_KUAP           ASM_CONST(0x00000200)
 
 /*
  * Supports KUEP feature
@@ -188,7 +188,7 @@ enum {
 #endif /* CONFIG_PPC_RADIX_MMU */
 #endif
 #ifdef CONFIG_PPC_KUAP
-       MMU_FTR_BOOK3S_KUAP |
+       MMU_FTR_KUAP |
 #endif /* CONFIG_PPC_KUAP */
 #ifdef CONFIG_PPC_MEM_KEYS
        MMU_FTR_PKEY |
index 18b9d325395f5e593930577ef178b1dd55abae99..77fedb190c936c77eb6dcdf872721caac82b7368 100644 (file)
@@ -46,7 +46,7 @@ notrace long system_call_exception(struct pt_regs *regs, unsigned long r0)
                iamr = mfspr(SPRN_IAMR);
                regs->amr  = amr;
                regs->iamr = iamr;
-               if (mmu_has_feature(MMU_FTR_BOOK3S_KUAP)) {
+               if (mmu_has_feature(MMU_FTR_KUAP)) {
                        mtspr(SPRN_AMR, AMR_KUAP_BLOCKED);
                        flush_needed = true;
                }
index 1d2675ab6711dd91ab9a5e21dc009b6d65ff22c6..12573396203381a0d1e400203bc9bdfe35d315b3 100644 (file)
@@ -291,7 +291,7 @@ void setup_kuap(bool disabled)
 
        if (smp_processor_id() == boot_cpuid) {
                pr_info("Activating Kernel Userspace Access Prevention\n");
-               cur_cpu_spec->mmu_features |= MMU_FTR_BOOK3S_KUAP;
+               cur_cpu_spec->mmu_features |= MMU_FTR_KUAP;
        }
 
        /*