powerpc/32s: mfsrin()/mtsrin() become mfsr()/mtsr()
authorChristophe Leroy <christophe.leroy@csgroup.eu>
Sat, 6 Feb 2021 11:47:27 +0000 (11:47 +0000)
committerMichael Ellerman <mpe@ellerman.id.au>
Mon, 8 Feb 2021 14:10:15 +0000 (01:10 +1100)
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
arch/powerpc/include/asm/book3s/32/kup.h
arch/powerpc/include/asm/reg.h
arch/powerpc/mm/book3s32/mmu.c
arch/powerpc/mm/ptdump/segment_regs.c
arch/powerpc/xmon/xmon.c

index a0117a9..73bc5d2 100644 (file)
@@ -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)
index c006f33..83a7fc3 100644 (file)
@@ -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));
 }
index 859e5bd..d7eb266 100644 (file)
@@ -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);
        }
 }
 
index dde2fe8..565048a 100644 (file)
@@ -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);
index cec432e..3fe3749 100644 (file)
@@ -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