powerpc/kuap: Remove __kuap_assert_locked()

__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
This commit is contained in:
Christophe Leroy 2021-10-19 09:29:22 +02:00 committed by Michael Ellerman
parent c252f3846d
commit 2341964e27
4 changed files with 2 additions and 18 deletions

View 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)
{

View 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.

View 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

View 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)
{