]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
powerpc/mm: Fix .long's in tlb-radix.c to more meaningful
authorBalbir Singh <bsingharora@gmail.com>
Wed, 13 Jul 2016 09:35:20 +0000 (15:05 +0530)
committerMichael Ellerman <mpe@ellerman.id.au>
Sun, 17 Jul 2016 06:42:50 +0000 (16:42 +1000)
The .longs with the shifts are harder to read, use more meaningful names
for the opcodes. PPC_TLBIE_5 is introduced for the 5 opcode variation of
the instruction due to an existing op-code for the 2 opcode variant.

Signed-off-by: Balbir Singh <bsingharora@gmail.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/include/asm/ppc-opcode.h
arch/powerpc/mm/tlb-radix.c

index 81657a1e03fe5fb3daac5a8fb8382a5a9e9abfb3..1c18a43e0d658dc7cfe9d75fa7122ade148b112c 100644 (file)
 #define PPC_INST_STSWX                 0x7c00052a
 #define PPC_INST_STXVD2X               0x7c000798
 #define PPC_INST_TLBIE                 0x7c000264
+#define PPC_INST_TLBIEL                        0x7c000224
 #define PPC_INST_TLBILX                        0x7c000024
 #define PPC_INST_WAIT                  0x7c00007c
 #define PPC_INST_TLBIVAX               0x7c000624
 #define ___PPC_RB(b)   (((b) & 0x1f) << 11)
 #define ___PPC_RS(s)   (((s) & 0x1f) << 21)
 #define ___PPC_RT(t)   ___PPC_RS(t)
+#define ___PPC_R(r)    (((r) & 0x1) << 16)
+#define ___PPC_PRS(prs)        (((prs) & 0x1) << 17)
+#define ___PPC_RIC(ric)        (((ric) & 0x3) << 18)
 #define __PPC_RA(a)    ___PPC_RA(__REG_##a)
 #define __PPC_RA0(a)   ___PPC_RA(__REGA0_##a)
 #define __PPC_RB(b)    ___PPC_RB(__REG_##b)
                                        __PPC_WC(w))
 #define PPC_TLBIE(lp,a)        stringify_in_c(.long PPC_INST_TLBIE | \
                                               ___PPC_RB(a) | ___PPC_RS(lp))
+#define        PPC_TLBIE_5(rb,rs,ric,prs,r) \
+                               stringify_in_c(.long PPC_INST_TLBIE | \
+                                       ___PPC_RB(rb) | ___PPC_RS(rs) | \
+                                       ___PPC_RIC(ric) | ___PPC_PRS(prs) | \
+                                       ___PPC_R(r))
+#define        PPC_TLBIEL(rb,rs,ric,prs,r) \
+                               stringify_in_c(.long PPC_INST_TLBIEL | \
+                                       ___PPC_RB(rb) | ___PPC_RS(rs) | \
+                                       ___PPC_RIC(ric) | ___PPC_PRS(prs) | \
+                                       ___PPC_R(r))
 #define PPC_TLBSRX_DOT(a,b)    stringify_in_c(.long PPC_INST_TLBSRX_DOT | \
                                        __PPC_RA0(a) | __PPC_RB(b))
 #define PPC_TLBIVAX(a,b)       stringify_in_c(.long PPC_INST_TLBIVAX | \
index ab2f60e812e2826badd47b0f03fd0eee12ed0051..35690c41f85d2f8c726a6d0a3d37fdac8af06aa7 100644 (file)
@@ -12,6 +12,7 @@
 #include <linux/mm.h>
 #include <linux/hugetlb.h>
 #include <linux/memblock.h>
+#include <asm/ppc-opcode.h>
 
 #include <asm/tlb.h>
 #include <asm/tlbflush.h>
@@ -34,8 +35,7 @@ static inline void __tlbiel_pid(unsigned long pid, int set,
        r = 1;   /* raidx format */
 
        asm volatile("ptesync": : :"memory");
-       asm volatile(".long 0x7c000224 | (%0 << 11) | (%1 << 16) |"
-                    "(%2 << 17) | (%3 << 18) | (%4 << 21)"
+       asm volatile(PPC_TLBIEL(%0, %4, %3, %2, %1)
                     : : "r"(rb), "i"(r), "i"(prs), "i"(ric), "r"(rs) : "memory");
        asm volatile("ptesync": : :"memory");
 }
@@ -63,8 +63,7 @@ static inline void _tlbie_pid(unsigned long pid, unsigned long ric)
        r = 1;   /* raidx format */
 
        asm volatile("ptesync": : :"memory");
-       asm volatile(".long 0x7c000264 | (%0 << 11) | (%1 << 16) |"
-                    "(%2 << 17) | (%3 << 18) | (%4 << 21)"
+       asm volatile(PPC_TLBIE_5(%0, %4, %3, %2, %1)
                     : : "r"(rb), "i"(r), "i"(prs), "i"(ric), "r"(rs) : "memory");
        asm volatile("eieio; tlbsync; ptesync": : :"memory");
 }
@@ -81,8 +80,7 @@ static inline void _tlbiel_va(unsigned long va, unsigned long pid,
        r = 1;   /* raidx format */
 
        asm volatile("ptesync": : :"memory");
-       asm volatile(".long 0x7c000224 | (%0 << 11) | (%1 << 16) |"
-                    "(%2 << 17) | (%3 << 18) | (%4 << 21)"
+       asm volatile(PPC_TLBIEL(%0, %4, %3, %2, %1)
                     : : "r"(rb), "i"(r), "i"(prs), "i"(ric), "r"(rs) : "memory");
        asm volatile("ptesync": : :"memory");
 }
@@ -99,8 +97,7 @@ static inline void _tlbie_va(unsigned long va, unsigned long pid,
        r = 1;   /* raidx format */
 
        asm volatile("ptesync": : :"memory");
-       asm volatile(".long 0x7c000264 | (%0 << 11) | (%1 << 16) |"
-                    "(%2 << 17) | (%3 << 18) | (%4 << 21)"
+       asm volatile(PPC_TLBIE_5(%0, %4, %3, %2, %1)
                     : : "r"(rb), "i"(r), "i"(prs), "i"(ric), "r"(rs) : "memory");
        asm volatile("eieio; tlbsync; ptesync": : :"memory");
 }