powerpc/kuap: Remove __kuap_assert_locked()
authorChristophe Leroy <christophe.leroy@csgroup.eu>
Tue, 19 Oct 2021 07:29:22 +0000 (09:29 +0200)
committerMichael Ellerman <mpe@ellerman.id.au>
Thu, 9 Dec 2021 11:41:18 +0000 (22:41 +1100)
__kuap_assert_locked() is redundant with
__kuap_get_and_assert_locked().

Move the verification of CONFIG_PPC_KUAP_DEBUG in kuap_assert_locked()
and make it call __kuap_get_and_assert_locked() directly.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/1a60198a25d2ba38a37f1b92bc7d096435df4224.1634627931.git.christophe.leroy@csgroup.eu
arch/powerpc/include/asm/book3s/32/kup.h
arch/powerpc/include/asm/book3s/64/kup.h
arch/powerpc/include/asm/kup.h
arch/powerpc/include/asm/nohash/32/kup-8xx.h

index 35ca48f7c293d263bec4e19de404dc6cf85aa556..bc245e9f0bcc04d9782ea24bc9321c92b6a091a5 100644 (file)
@@ -117,11 +117,6 @@ static inline unsigned long __kuap_get_and_assert_locked(void)
        return kuap;
 }
 
-static inline void __kuap_assert_locked(void)
-{
-       __kuap_get_and_assert_locked();
-}
-
 static __always_inline void __allow_user_access(void __user *to, const void __user *from,
                                                u32 size, unsigned long dir)
 {
index 9f20997906582993ef0f0fe48b6b4842db8ed9ff..503828709d55d0a4504058276b5b98fc0f7bc4b6 100644 (file)
@@ -298,12 +298,6 @@ static inline unsigned long __kuap_get_and_assert_locked(void)
        return amr;
 }
 
-static inline void __kuap_assert_locked(void)
-{
-       if (IS_ENABLED(CONFIG_PPC_KUAP_DEBUG))
-               WARN_ON_ONCE(mfspr(SPRN_AMR) != AMR_KUAP_BLOCKED);
-}
-
 /*
  * We support individually allowing read or write, but we don't support nesting
  * because that would require an expensive read/modify write of the AMR.
index 33e93a6c5d19f0cc87715bdf5222a6a1e52a78de..5d3c1e8060f93bb784a4ebb7422b301b04ed48cb 100644 (file)
@@ -86,7 +86,8 @@ static __always_inline void kuap_assert_locked(void)
        if (kuap_is_disabled())
                return;
 
-       __kuap_assert_locked();
+       if (IS_ENABLED(CONFIG_PPC_KUAP_DEBUG))
+               __kuap_get_and_assert_locked();
 }
 
 #ifdef CONFIG_PPC32
index 74f15c386476f2535885cf4f0f79be7e7af51168..37fe4b32b658d47222e32b68e38d89bb09363f0d 100644 (file)
@@ -47,12 +47,6 @@ static inline unsigned long __kuap_get_and_assert_locked(void)
        return kuap;
 }
 
-static inline void __kuap_assert_locked(void)
-{
-       if (IS_ENABLED(CONFIG_PPC_KUAP_DEBUG))
-               __kuap_get_and_assert_locked();
-}
-
 static inline void __allow_user_access(void __user *to, const void __user *from,
                                       unsigned long size, unsigned long dir)
 {