Skip to content

Commit 1b4037d

Browse files
Ram Paimpe
authored andcommitted
powerpc: helper function to read, write AMR, IAMR, UAMOR registers
Implements helper functions to read and write the key related registers; AMR, IAMR, UAMOR. AMR register tracks the read,write permission of a key IAMR register tracks the execute permission of a key UAMOR register enables and disables a key Acked-by: Balbir Singh <[email protected]> Reviewed-by: Thiago Jung Bauermann <[email protected]> Signed-off-by: Ram Pai <[email protected]> Signed-off-by: Michael Ellerman <[email protected]>
1 parent 4fb158f commit 1b4037d

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

arch/powerpc/mm/pkeys.c

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,3 +67,39 @@ void pkey_mm_init(struct mm_struct *mm)
6767
return;
6868
mm_pkey_allocation_map(mm) = initial_allocation_mask;
6969
}
70+
71+
static inline u64 read_amr(void)
72+
{
73+
return mfspr(SPRN_AMR);
74+
}
75+
76+
static inline void write_amr(u64 value)
77+
{
78+
mtspr(SPRN_AMR, value);
79+
}
80+
81+
static inline u64 read_iamr(void)
82+
{
83+
if (!likely(pkey_execute_disable_supported))
84+
return 0x0UL;
85+
86+
return mfspr(SPRN_IAMR);
87+
}
88+
89+
static inline void write_iamr(u64 value)
90+
{
91+
if (!likely(pkey_execute_disable_supported))
92+
return;
93+
94+
mtspr(SPRN_IAMR, value);
95+
}
96+
97+
static inline u64 read_uamor(void)
98+
{
99+
return mfspr(SPRN_UAMOR);
100+
}
101+
102+
static inline void write_uamor(u64 value)
103+
{
104+
mtspr(SPRN_UAMOR, value);
105+
}

0 commit comments

Comments
 (0)