powerpc/44x: Don't support 440 when CONFIG_PPC_47x is set
authorChristophe Leroy <christophe.leroy@csgroup.eu>
Sun, 18 Oct 2020 17:25:17 +0000 (17:25 +0000)
committerMichael Ellerman <mpe@ellerman.id.au>
Thu, 3 Dec 2020 14:01:34 +0000 (01:01 +1100)
As stated in platform/44x/Kconfig, CONFIG_PPC_47x is not
compatible with 440 and 460 variants.

This is confirmed in asm/cache.h as L1_CACHE_SHIFT is different
for 47x, meaning a kernel built for 47x will not run correctly
on a 440.

In cputable, opt out all 440 and 460 variants when CONFIG_PPC_47x
is set. Also add a default match dedicated to 470.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/822833ce3dc10634339818f7d1ab616edf63b0c6.1603041883.git.christophe.leroy@csgroup.eu
arch/powerpc/include/asm/cputable.h
arch/powerpc/include/asm/mmu.h
arch/powerpc/kernel/cputable.c

index 7becef14759f9c89868885d8065ad01e4a2b67d8..845a338c8d3f76eee21ef629d5f40abf1ec951a8 100644 (file)
@@ -524,11 +524,10 @@ enum {
 #ifdef CONFIG_40x
            CPU_FTRS_40X |
 #endif
-#ifdef CONFIG_44x
-           CPU_FTRS_44X | CPU_FTRS_440x6 |
-#endif
 #ifdef CONFIG_PPC_47x
            CPU_FTRS_47X | CPU_FTR_476_DD2 |
+#elif defined(CONFIG_44x)
+           CPU_FTRS_44X | CPU_FTRS_440x6 |
 #endif
 #ifdef CONFIG_E200
            CPU_FTRS_E200 |
@@ -597,7 +596,9 @@ enum {
 #ifdef CONFIG_40x
            CPU_FTRS_40X &
 #endif
-#ifdef CONFIG_44x
+#ifdef CONFIG_PPC_47x
+           CPU_FTRS_47X &
+#elif defined(CONFIG_44x)
            CPU_FTRS_44X & CPU_FTRS_440x6 &
 #endif
 #ifdef CONFIG_E200
index 77aeb2079ad46aea139a31cfd88ba934a364d528..60aa420f414d42870163a1dab36db2fe12b0fd37 100644 (file)
@@ -166,15 +166,14 @@ enum {
 #ifdef CONFIG_40x
                MMU_FTR_TYPE_40x |
 #endif
-#ifdef CONFIG_44x
+#ifdef CONFIG_PPC_47x
+               MMU_FTR_TYPE_47x | MMU_FTR_USE_TLBIVAX_BCAST | MMU_FTR_LOCK_BCAST_INVAL |
+#elif defined(CONFIG_44x)
                MMU_FTR_TYPE_44x |
 #endif
 #if defined(CONFIG_E200) || defined(CONFIG_E500)
                MMU_FTR_TYPE_FSL_E | MMU_FTR_BIG_PHYS | MMU_FTR_USE_TLBILX |
 #endif
-#ifdef CONFIG_PPC_47x
-               MMU_FTR_TYPE_47x | MMU_FTR_USE_TLBIVAX_BCAST | MMU_FTR_LOCK_BCAST_INVAL |
-#endif
 #ifdef CONFIG_PPC_BOOK3S_32
                MMU_FTR_USE_HIGH_BATS |
 #endif
index 8fdb40ee86d11930e4bd25220d16672ffa1f21ce..b552e22dcdddf6a524fd3e260f08200f1eb0eb28 100644 (file)
@@ -1536,6 +1536,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
 
 #endif /* CONFIG_40x */
 #ifdef CONFIG_44x
+#ifndef CONFIG_PPC_47x
        {
                .pvr_mask               = 0xf0000fff,
                .pvr_value              = 0x40000850,
@@ -1818,7 +1819,19 @@ static struct cpu_spec __initdata cpu_specs[] = {
                .machine_check          = machine_check_440A,
                .platform               = "ppc440",
        },
-#ifdef CONFIG_PPC_47x
+       {       /* default match */
+               .pvr_mask               = 0x00000000,
+               .pvr_value              = 0x00000000,
+               .cpu_name               = "(generic 44x PPC)",
+               .cpu_features           = CPU_FTRS_44X,
+               .cpu_user_features      = COMMON_USER_BOOKE,
+               .mmu_features           = MMU_FTR_TYPE_44x,
+               .icache_bsize           = 32,
+               .dcache_bsize           = 32,
+               .machine_check          = machine_check_4xx,
+               .platform               = "ppc440",
+       }
+#else /* CONFIG_PPC_47x */
        { /* 476 DD2 core */
                .pvr_mask               = 0xffffffff,
                .pvr_value              = 0x11a52080,
@@ -1875,19 +1888,19 @@ static struct cpu_spec __initdata cpu_specs[] = {
                .machine_check          = machine_check_47x,
                .platform               = "ppc470",
        },
-#endif /* CONFIG_PPC_47x */
        {       /* default match */
                .pvr_mask               = 0x00000000,
                .pvr_value              = 0x00000000,
-               .cpu_name               = "(generic 44x PPC)",
-               .cpu_features           = CPU_FTRS_44X,
+               .cpu_name               = "(generic 47x PPC)",
+               .cpu_features           = CPU_FTRS_47X,
                .cpu_user_features      = COMMON_USER_BOOKE,
-               .mmu_features           = MMU_FTR_TYPE_44x,
+               .mmu_features           = MMU_FTR_TYPE_47x,
                .icache_bsize           = 32,
-               .dcache_bsize           = 32,
-               .machine_check          = machine_check_4xx,
-               .platform               = "ppc440",
+               .dcache_bsize           = 128,
+               .machine_check          = machine_check_47x,
+               .platform               = "ppc470",
        }
+#endif /* CONFIG_PPC_47x */
 #endif /* CONFIG_44x */
 #ifdef CONFIG_E200
        {       /* e200z5 */