Commit f2086386 authored by Ram Pai's avatar Ram Pai Committed by Michael Ellerman

powerpc/mm: Fix thread_pkey_regs_init()

thread_pkey_regs_init() initializes the pkey related registers
instead of initializing the fields in the task structures.  Fortunately
those key related registers are re-set to zero when the task
gets scheduled on the cpu. However its good to fix this glaringly
visible error.

Fixes: 06bb53b3 ("powerpc: store and restore the pkey state across context switches")
Signed-off-by: default avatarRam Pai <linuxram@us.ibm.com>
Signed-off-by: default avatarThiago Jung Bauermann <bauerman@linux.vnet.ibm.com>
Acked-by: default avatarBalbir Singh <bsingharora@gmail.com>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
parent e6e133c4
...@@ -308,9 +308,9 @@ void thread_pkey_regs_init(struct thread_struct *thread) ...@@ -308,9 +308,9 @@ void thread_pkey_regs_init(struct thread_struct *thread)
if (static_branch_likely(&pkey_disabled)) if (static_branch_likely(&pkey_disabled))
return; return;
write_amr(read_amr() & pkey_amr_uamor_mask); thread->amr = read_amr() & pkey_amr_uamor_mask;
write_iamr(read_iamr() & pkey_iamr_mask); thread->iamr = read_iamr() & pkey_iamr_mask;
write_uamor(read_uamor() & pkey_amr_uamor_mask); thread->uamor = read_uamor() & pkey_amr_uamor_mask;
} }
static inline bool pkey_allows_readwrite(int pkey) static inline bool pkey_allows_readwrite(int pkey)
......
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