powerpc: unify definition of M_IF_NEEDED
authorJason Yan <yanaijie@huawei.com>
Fri, 20 Sep 2019 09:45:35 +0000 (17:45 +0800)
committerMichael Ellerman <mpe@ellerman.id.au>
Wed, 13 Nov 2019 08:27:24 +0000 (19:27 +1100)
M_IF_NEEDED is defined too many times. Move it to a common place and
rename it to MAS2_M_IF_NEEDED which is much readable.

Signed-off-by: Jason Yan <yanaijie@huawei.com>
Reviewed-by: Christophe Leroy <christophe.leroy@c-s.fr>
Reviewed-by: Diana Craciun <diana.craciun@nxp.com>
Tested-by: Diana Craciun <diana.craciun@nxp.com>
Signed-off-by: Scott Wood <oss@buserror.net>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/include/asm/nohash/mmu-book3e.h
arch/powerpc/kernel/exceptions-64e.S
arch/powerpc/kernel/fsl_booke_entry_mapping.S
arch/powerpc/kernel/misc_64.S

index 4c9777d256fbe4dddfdf0ef4cb6c5a283f846322..fa3efc2d310fa960767824101badd3f75bbb5270 100644 (file)
 #define TLBILX_T_CLASS2                        6
 #define TLBILX_T_CLASS3                        7
 
+/*
+ * The mapping only needs to be cache-coherent on SMP, except on
+ * Freescale e500mc derivatives where it's also needed for coherent DMA.
+ */
+#if defined(CONFIG_SMP) || defined(CONFIG_PPC_E500MC)
+#define MAS2_M_IF_NEEDED       MAS2_M
+#else
+#define MAS2_M_IF_NEEDED       0
+#endif
+
 #ifndef __ASSEMBLY__
 #include <asm/bug.h>
 
index 829950b96d291220be8fd61902d9b0738cc032a2..e4076e3c072db392f7ab19b6a6495267e23029dc 100644 (file)
@@ -1346,16 +1346,6 @@ skpinv:  addi    r6,r6,1                         /* Increment */
        sync
        isync
 
-/*
- * The mapping only needs to be cache-coherent on SMP, except on
- * Freescale e500mc derivatives where it's also needed for coherent DMA.
- */
-#if defined(CONFIG_SMP) || defined(CONFIG_PPC_E500MC)
-#define M_IF_NEEDED    MAS2_M
-#else
-#define M_IF_NEEDED    0
-#endif
-
 /* 6. Setup KERNELBASE mapping in TLB[0]
  *
  * r3 = MAS0 w/TLBSEL & ESEL for the entry we started in
@@ -1368,7 +1358,7 @@ skpinv:   addi    r6,r6,1                         /* Increment */
        ori     r6,r6,(MAS1_TSIZE(BOOK3E_PAGESZ_1GB))@l
        mtspr   SPRN_MAS1,r6
 
-       LOAD_REG_IMMEDIATE(r6, PAGE_OFFSET | M_IF_NEEDED)
+       LOAD_REG_IMMEDIATE(r6, PAGE_OFFSET | MAS2_M_IF_NEEDED)
        mtspr   SPRN_MAS2,r6
 
        rlwinm  r5,r5,0,0,25
index ea065282b3035aee92f0586081d0654ee95639b3..f4d3eaae54a935db888d759272112c5e2e849706 100644 (file)
@@ -153,16 +153,6 @@ skpinv:    addi    r6,r6,1                         /* Increment */
        tlbivax 0,r9
        TLBSYNC
 
-/*
- * The mapping only needs to be cache-coherent on SMP, except on
- * Freescale e500mc derivatives where it's also needed for coherent DMA.
- */
-#if defined(CONFIG_SMP) || defined(CONFIG_PPC_E500MC)
-#define M_IF_NEEDED    MAS2_M
-#else
-#define M_IF_NEEDED    0
-#endif
-
 #if defined(ENTRY_MAPPING_BOOT_SETUP)
 
 /* 6. Setup KERNELBASE mapping in TLB1[0] */
@@ -171,8 +161,8 @@ skpinv:     addi    r6,r6,1                         /* Increment */
        lis     r6,(MAS1_VALID|MAS1_IPROT)@h
        ori     r6,r6,(MAS1_TSIZE(BOOK3E_PAGESZ_64M))@l
        mtspr   SPRN_MAS1,r6
-       lis     r6,MAS2_VAL(PAGE_OFFSET, BOOK3E_PAGESZ_64M, M_IF_NEEDED)@h
-       ori     r6,r6,MAS2_VAL(PAGE_OFFSET, BOOK3E_PAGESZ_64M, M_IF_NEEDED)@l
+       lis     r6,MAS2_VAL(PAGE_OFFSET, BOOK3E_PAGESZ_64M, MAS2_M_IF_NEEDED)@h
+       ori     r6,r6,MAS2_VAL(PAGE_OFFSET, BOOK3E_PAGESZ_64M, MAS2_M_IF_NEEDED)@l
        mtspr   SPRN_MAS2,r6
        mtspr   SPRN_MAS3,r8
        tlbwe
index b55a7b4cb543fde85838c0c223e8905358b2e78d..2062a299a22d3d41060ca8fd84caa4af3263c7d8 100644 (file)
@@ -432,18 +432,13 @@ kexec_create_tlb:
        rlwimi  r9,r10,16,4,15          /* Setup MAS0 = TLBSEL | ESEL(r9) */
 
 /* Set up a temp identity mapping v:0 to p:0 and return to it. */
-#if defined(CONFIG_SMP) || defined(CONFIG_PPC_E500MC)
-#define M_IF_NEEDED    MAS2_M
-#else
-#define M_IF_NEEDED    0
-#endif
        mtspr   SPRN_MAS0,r9
 
        lis     r9,(MAS1_VALID|MAS1_IPROT)@h
        ori     r9,r9,(MAS1_TSIZE(BOOK3E_PAGESZ_1GB))@l
        mtspr   SPRN_MAS1,r9
 
-       LOAD_REG_IMMEDIATE(r9, 0x0 | M_IF_NEEDED)
+       LOAD_REG_IMMEDIATE(r9, 0x0 | MAS2_M_IF_NEEDED)
        mtspr   SPRN_MAS2,r9
 
        LOAD_REG_IMMEDIATE(r9, 0x0 | MAS3_SR | MAS3_SW | MAS3_SX)