Commit c2a2a5d0 authored by Michael Ellerman's avatar Michael Ellerman

powerpc/64s: Fold update_current_thread_[i]amr() into their only callers

lkp reported warnings in some configuration due to
update_current_thread_amr() being unused:

  arch/powerpc/mm/book3s64/pkeys.c:284:20: error: unused function 'update_current_thread_amr'
  static inline void update_current_thread_amr(u64 value)

Which is because it's only use is inside an ifdef. We could move it
inside the ifdef, but it's a single line function and only has one
caller, so just fold it in.

Similarly update_current_thread_iamr() is small and only called once,
so fold it in also.

Fixes: 48a8ab4e ("powerpc/book3s64/pkeys: Don't update SPRN_AMR when in kernel mode.")
Reported-by: default avatarkernel test robot <lkp@intel.com>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20210314093320.132331-1-mpe@ellerman.id.au
parent 7a7685ac
...@@ -301,19 +301,6 @@ void setup_kuap(bool disabled) ...@@ -301,19 +301,6 @@ void setup_kuap(bool disabled)
} }
#endif #endif
static inline void update_current_thread_amr(u64 value)
{
current->thread.regs->amr = value;
}
static inline void update_current_thread_iamr(u64 value)
{
if (!likely(pkey_execute_disable_supported))
return;
current->thread.regs->iamr = value;
}
#ifdef CONFIG_PPC_MEM_KEYS #ifdef CONFIG_PPC_MEM_KEYS
void pkey_mm_init(struct mm_struct *mm) void pkey_mm_init(struct mm_struct *mm)
{ {
...@@ -328,7 +315,7 @@ static inline void init_amr(int pkey, u8 init_bits) ...@@ -328,7 +315,7 @@ static inline void init_amr(int pkey, u8 init_bits)
u64 new_amr_bits = (((u64)init_bits & 0x3UL) << pkeyshift(pkey)); u64 new_amr_bits = (((u64)init_bits & 0x3UL) << pkeyshift(pkey));
u64 old_amr = current_thread_amr() & ~((u64)(0x3ul) << pkeyshift(pkey)); u64 old_amr = current_thread_amr() & ~((u64)(0x3ul) << pkeyshift(pkey));
update_current_thread_amr(old_amr | new_amr_bits); current->thread.regs->amr = old_amr | new_amr_bits;
} }
static inline void init_iamr(int pkey, u8 init_bits) static inline void init_iamr(int pkey, u8 init_bits)
...@@ -336,7 +323,10 @@ static inline void init_iamr(int pkey, u8 init_bits) ...@@ -336,7 +323,10 @@ static inline void init_iamr(int pkey, u8 init_bits)
u64 new_iamr_bits = (((u64)init_bits & 0x1UL) << pkeyshift(pkey)); u64 new_iamr_bits = (((u64)init_bits & 0x1UL) << pkeyshift(pkey));
u64 old_iamr = current_thread_iamr() & ~((u64)(0x1ul) << pkeyshift(pkey)); u64 old_iamr = current_thread_iamr() & ~((u64)(0x1ul) << pkeyshift(pkey));
update_current_thread_iamr(old_iamr | new_iamr_bits); if (!likely(pkey_execute_disable_supported))
return;
current->thread.regs->iamr = old_iamr | new_iamr_bits;
} }
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment