mirror of
https://github.com/torvalds/linux.git
synced 2024-11-27 06:31:52 +00:00
powerpc/32s: mfsrin()/mtsrin() become mfsr()/mtsr()
Function names should tell what the function does, not how. mfsrin() and mtsrin() are read/writing segment registers. They are called that way because they are using mfsrin and mtsrin instructions, but it doesn't matter for the caller. In preparation of following patch, change their name to mfsr() and mtsr() in order to make it obvious they manipulate segment registers without messing up with how they do it. Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/f92d99f4349391b77766745900231aa880a0efb5.1612612022.git.christophe.leroy@csgroup.eu
This commit is contained in:
parent
fd659e8f2c
commit
179ae57dba
@ -95,12 +95,12 @@ static inline void kuap_update_sr(u32 sr, u32 addr, u32 end)
|
||||
addr &= 0xf0000000; /* align addr to start of segment */
|
||||
barrier(); /* make sure thread.kuap is updated before playing with SRs */
|
||||
while (addr < end) {
|
||||
mtsrin(sr, addr);
|
||||
mtsr(sr, addr);
|
||||
sr += 0x111; /* next VSID */
|
||||
sr &= 0xf0ffffff; /* clear VSID overflow */
|
||||
addr += 0x10000000; /* address of next segment */
|
||||
}
|
||||
isync(); /* Context sync required after mtsrin() */
|
||||
isync(); /* Context sync required after mtsr() */
|
||||
}
|
||||
|
||||
static __always_inline void allow_user_access(void __user *to, const void __user *from,
|
||||
@ -122,7 +122,7 @@ static __always_inline void allow_user_access(void __user *to, const void __user
|
||||
end = min(addr + size, TASK_SIZE);
|
||||
|
||||
current->thread.kuap = (addr & 0xf0000000) | ((((end - 1) >> 28) + 1) & 0xf);
|
||||
kuap_update_sr(mfsrin(addr) & ~SR_KS, addr, end); /* Clear Ks */
|
||||
kuap_update_sr(mfsr(addr) & ~SR_KS, addr, end); /* Clear Ks */
|
||||
}
|
||||
|
||||
static __always_inline void prevent_user_access(void __user *to, const void __user *from,
|
||||
@ -151,7 +151,7 @@ static __always_inline void prevent_user_access(void __user *to, const void __us
|
||||
}
|
||||
|
||||
current->thread.kuap = 0;
|
||||
kuap_update_sr(mfsrin(addr) | SR_KS, addr, end); /* set Ks */
|
||||
kuap_update_sr(mfsr(addr) | SR_KS, addr, end); /* set Ks */
|
||||
}
|
||||
|
||||
static inline unsigned long prevent_user_access_return(void)
|
||||
|
@ -1413,7 +1413,7 @@ static inline void msr_check_and_clear(unsigned long bits)
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PPC32
|
||||
static inline u32 mfsrin(u32 idx)
|
||||
static inline u32 mfsr(u32 idx)
|
||||
{
|
||||
u32 val;
|
||||
|
||||
@ -1422,7 +1422,7 @@ static inline u32 mfsrin(u32 idx)
|
||||
return val;
|
||||
}
|
||||
|
||||
static inline void mtsrin(u32 val, u32 idx)
|
||||
static inline void mtsr(u32 val, u32 idx)
|
||||
{
|
||||
asm volatile("mtsrin %0, %1" : : "r" (val), "r" (idx));
|
||||
}
|
||||
|
@ -234,7 +234,7 @@ void mmu_mark_initmem_nx(void)
|
||||
if (is_module_segment(i << 28))
|
||||
continue;
|
||||
|
||||
mtsrin(mfsrin(i << 28) | 0x10000000, i << 28);
|
||||
mtsr(mfsr(i << 28) | 0x10000000, i << 28);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
static void seg_show(struct seq_file *m, int i)
|
||||
{
|
||||
u32 val = mfsrin(i << 28);
|
||||
u32 val = mfsr(i << 28);
|
||||
|
||||
seq_printf(m, "0x%01x0000000-0x%01xfffffff ", i, i);
|
||||
seq_printf(m, "Kern key %d ", (val >> 30) & 1);
|
||||
|
@ -3719,7 +3719,7 @@ void dump_segments(void)
|
||||
|
||||
printf("sr0-15 =");
|
||||
for (i = 0; i < 16; ++i)
|
||||
printf(" %x", mfsrin(i << 28));
|
||||
printf(" %x", mfsr(i << 28));
|
||||
printf("\n");
|
||||
}
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user