[PATCH 1/4] powerpc/32: Decode MPC745x L2 and L3 cache machine checks

From: Matt Turner

Date: Fri Nov 20 2026 - 14:33:54 EST


On the 745x, SRR1[MSS] means the memory subsystem detected an error, and
MSSSR0 says which: L2 tag or data parity, MPC7448 L2 ECC, or L3 tag or
data parity. machine_check_generic() reports these cache errors as "L2
data cache parity error" and never clears MSSSR0, whose bits are sticky.

Add machine_check_745x(), which decodes and clears the MSSSR0 cache
error bits, and use it for every 745x. Machine checks without one of
those bits still go to machine_check_generic().

Signed-off-by: Matt Turner <mattst88@xxxxxxxxx>
---
arch/powerpc/include/asm/cputable.h | 1 +
arch/powerpc/include/asm/reg.h | 5 +++++
arch/powerpc/kernel/cpu_specs_book3s_32.h | 22 +++++++++++-----------
arch/powerpc/kernel/traps.c | 28 ++++++++++++++++++++++++++++
4 files changed, 45 insertions(+), 11 deletions(-)

diff --git a/arch/powerpc/include/asm/cputable.h b/arch/powerpc/include/asm/cputable.h
index a3be81c47df3..8445533c946b 100644
--- a/arch/powerpc/include/asm/cputable.h
+++ b/arch/powerpc/include/asm/cputable.h
@@ -34,6 +34,7 @@ extern int machine_check_e500(struct pt_regs *regs);
extern int machine_check_47x(struct pt_regs *regs);
int machine_check_8xx(struct pt_regs *regs);
int machine_check_83xx(struct pt_regs *regs);
+int machine_check_745x(struct pt_regs *regs);

extern void cpu_down_flush_e500v2(void);
extern void cpu_down_flush_e500mc(void);
diff --git a/arch/powerpc/include/asm/reg.h b/arch/powerpc/include/asm/reg.h
index 541a493e13bf..82a85d44776e 100644
--- a/arch/powerpc/include/asm/reg.h
+++ b/arch/powerpc/include/asm/reg.h
@@ -729,6 +729,10 @@

#define SPRN_MSSCR0 0x3f6 /* Memory Subsystem Control Register 0 */
#define SPRN_MSSSR0 0x3f7 /* Memory Subsystem Status Register 1 */
+#define MSSSR0_L2TAG 0x00040000 /* L2 tag parity error */
+#define MSSSR0_L2DAT 0x00020000 /* L2 data parity/ECC error */
+#define MSSSR0_L3TAG 0x00010000 /* L3 tag parity error */
+#define MSSSR0_L3DAT 0x00008000 /* L3 data parity error */
#define SPRN_LDSTCR 0x3f8 /* Load/Store control register */
#define SPRN_LDSTDB 0x3f4 /* */
#define SPRN_LR 0x008 /* Link Register */
@@ -801,6 +805,7 @@
#define SRR1_PROGTRAP 0x00020000 /* Trap */
#define SRR1_PROGADDR 0x00010000 /* SRR0 contains subsequent addr */

+#define SRR1_MCE_MSS 0x00100000 /* 745x memory subsystem error (MSSSR0) */
#define SRR1_MCE_MCP 0x00080000 /* Machine check signal caused interrupt */
#define SRR1_BOUNDARY 0x10000000 /* Prefixed instruction crosses 64-byte boundary */
#define SRR1_PREFIXED 0x20000000 /* Exception caused by prefixed instruction */
diff --git a/arch/powerpc/kernel/cpu_specs_book3s_32.h b/arch/powerpc/kernel/cpu_specs_book3s_32.h
index 3714634d194a..90ca26405c1d 100644
--- a/arch/powerpc/kernel/cpu_specs_book3s_32.h
+++ b/arch/powerpc/kernel/cpu_specs_book3s_32.h
@@ -426,7 +426,7 @@ static struct cpu_spec cpu_specs[] __initdata = {
.num_pmcs = 6,
.pmc_type = PPC_PMC_G4,
.cpu_setup = __setup_cpu_745x,
- .machine_check = machine_check_generic,
+ .machine_check = machine_check_745x,
.platform = "ppc7450",
},
{ /* 7450 2.1 */
@@ -442,7 +442,7 @@ static struct cpu_spec cpu_specs[] __initdata = {
.num_pmcs = 6,
.pmc_type = PPC_PMC_G4,
.cpu_setup = __setup_cpu_745x,
- .machine_check = machine_check_generic,
+ .machine_check = machine_check_745x,
.platform = "ppc7450",
},
{ /* 7450 2.3 and newer */
@@ -458,7 +458,7 @@ static struct cpu_spec cpu_specs[] __initdata = {
.num_pmcs = 6,
.pmc_type = PPC_PMC_G4,
.cpu_setup = __setup_cpu_745x,
- .machine_check = machine_check_generic,
+ .machine_check = machine_check_745x,
.platform = "ppc7450",
},
{ /* 7455 rev 1.x */
@@ -474,7 +474,7 @@ static struct cpu_spec cpu_specs[] __initdata = {
.num_pmcs = 6,
.pmc_type = PPC_PMC_G4,
.cpu_setup = __setup_cpu_745x,
- .machine_check = machine_check_generic,
+ .machine_check = machine_check_745x,
.platform = "ppc7450",
},
{ /* 7455 rev 2.0 */
@@ -490,7 +490,7 @@ static struct cpu_spec cpu_specs[] __initdata = {
.num_pmcs = 6,
.pmc_type = PPC_PMC_G4,
.cpu_setup = __setup_cpu_745x,
- .machine_check = machine_check_generic,
+ .machine_check = machine_check_745x,
.platform = "ppc7450",
},
{ /* 7455 others */
@@ -506,7 +506,7 @@ static struct cpu_spec cpu_specs[] __initdata = {
.num_pmcs = 6,
.pmc_type = PPC_PMC_G4,
.cpu_setup = __setup_cpu_745x,
- .machine_check = machine_check_generic,
+ .machine_check = machine_check_745x,
.platform = "ppc7450",
},
{ /* 7447/7457 Rev 1.0 */
@@ -522,7 +522,7 @@ static struct cpu_spec cpu_specs[] __initdata = {
.num_pmcs = 6,
.pmc_type = PPC_PMC_G4,
.cpu_setup = __setup_cpu_745x,
- .machine_check = machine_check_generic,
+ .machine_check = machine_check_745x,
.platform = "ppc7450",
},
{ /* 7447/7457 Rev 1.1 */
@@ -538,7 +538,7 @@ static struct cpu_spec cpu_specs[] __initdata = {
.num_pmcs = 6,
.pmc_type = PPC_PMC_G4,
.cpu_setup = __setup_cpu_745x,
- .machine_check = machine_check_generic,
+ .machine_check = machine_check_745x,
.platform = "ppc7450",
},
{ /* 7447/7457 Rev 1.2 and later */
@@ -554,7 +554,7 @@ static struct cpu_spec cpu_specs[] __initdata = {
.num_pmcs = 6,
.pmc_type = PPC_PMC_G4,
.cpu_setup = __setup_cpu_745x,
- .machine_check = machine_check_generic,
+ .machine_check = machine_check_745x,
.platform = "ppc7450",
},
{ /* 7447A */
@@ -570,7 +570,7 @@ static struct cpu_spec cpu_specs[] __initdata = {
.num_pmcs = 6,
.pmc_type = PPC_PMC_G4,
.cpu_setup = __setup_cpu_745x,
- .machine_check = machine_check_generic,
+ .machine_check = machine_check_745x,
.platform = "ppc7450",
},
{ /* 7448 */
@@ -586,7 +586,7 @@ static struct cpu_spec cpu_specs[] __initdata = {
.num_pmcs = 6,
.pmc_type = PPC_PMC_G4,
.cpu_setup = __setup_cpu_745x,
- .machine_check = machine_check_generic,
+ .machine_check = machine_check_745x,
.platform = "ppc7450",
},
{ /* default match, we assume split I/D cache & TB (non-601)... */
diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c
index 3a8f5416e3f6..4fb1610baa51 100644
--- a/arch/powerpc/kernel/traps.c
+++ b/arch/powerpc/kernel/traps.c
@@ -788,6 +788,34 @@ int machine_check_generic(struct pt_regs *regs)
}
return 0;
}
+
+#ifdef CONFIG_PPC_BOOK3S_32
+#define MSSSR0_CACHE_ERR (MSSSR0_L2TAG | MSSSR0_L2DAT | MSSSR0_L3TAG | MSSSR0_L3DAT)
+
+/*
+ * On the 745x, SRR1[MSS] means the memory subsystem detected an error, and
+ * MSSSR0 says which. The MSSSR0 bits are sticky, so clear them.
+ */
+int machine_check_745x(struct pt_regs *regs)
+{
+ unsigned long reason = regs->msr;
+ unsigned long msssr0 = mfspr(SPRN_MSSSR0);
+
+ if (!(reason & SRR1_MCE_MSS) || !(msssr0 & MSSSR0_CACHE_ERR))
+ return machine_check_generic(regs);
+
+ mtspr(SPRN_MSSSR0, msssr0 & ~MSSSR0_CACHE_ERR);
+
+ pr_err("Machine check in kernel mode.\n");
+ pr_err("Caused by (from SRR1=%lx, MSSSR0=%lx):%s%s%s%s\n",
+ reason, msssr0,
+ msssr0 & MSSSR0_L2TAG ? " [L2 tag parity]" : "",
+ msssr0 & MSSSR0_L2DAT ? " [L2 data parity/ECC]" : "",
+ msssr0 & MSSSR0_L3TAG ? " [L3 tag parity]" : "",
+ msssr0 & MSSSR0_L3DAT ? " [L3 data parity]" : "");
+ return 0;
+}
+#endif
#endif /* everything else */

void die_mce(const char *str, struct pt_regs *regs, long err)

--
2.56.1