All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Christophe Leroy (CS GROUP)" <chleroy@kernel.org>
To: Matt Turner <mattst88@gmail.com>,
	Madhavan Srinivasan <maddy@linux.ibm.com>,
	Michael Ellerman <mpe@ellerman.id.au>,
	Nicholas Piggin <npiggin@gmail.com>,
	"Ritesh Harjani (IBM)" <ritesh.list@gmail.com>,
	Shrikanth Hegde <sshegde@linux.ibm.com>,
	Borislav Petkov <bp@alien8.de>, Tony Luck <tony.luck@intel.com>
Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org,
	linux-edac@vger.kernel.org
Subject: Re: [PATCH 1/4] powerpc/32: Decode MPC745x L2 and L3 cache machine checks
Date: Sat, 21 Nov 2026 12:25:57 +0100	[thread overview]
Message-ID: <9ecda3f8-13f7-4bd3-81b9-cf7deafdbcb2@kernel.org> (raw)
In-Reply-To: <20261120-ppc32-l2-ecc-v1-1-98fc8e6e0a32@gmail.com>



Le 20/11/2026 à 20:33, Matt Turner a écrit :
> 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@gmail.com>
> ---
>   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 ++++++++++++++++++++++++++++

Can we avoid machine specific code in traps.c ?

Other machine_check functions are in dedicated locations except e500 
because it is common to mpc85xx and 64e

platforms/44x/machine_check.c:int machine_check_4xx(struct pt_regs *regs)
platforms/44x/machine_check.c:int machine_check_440A(struct pt_regs *regs)
platforms/44x/machine_check.c:int machine_check_47x(struct pt_regs *regs)
platforms/83xx/misc.c:int machine_check_83xx(struct pt_regs *regs)
platforms/8xx/machine_check.c:int machine_check_8xx(struct pt_regs *regs)




>   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)
> 


  reply	other threads:[~2026-11-21 11:26 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-20 19:33 [PATCH 0/4] powerpc/32: Report MPC7448 L2 cache errors Matt Turner
2026-11-20 19:33 ` [PATCH 1/4] powerpc/32: Decode MPC745x L2 and L3 cache machine checks Matt Turner
2026-11-21 11:25   ` Christophe Leroy (CS GROUP) [this message]
2026-11-20 19:33 ` [PATCH 2/4] powerpc/32: Enable and decode MPC7448 L2 ECC " Matt Turner
2026-11-20 19:33 ` [PATCH 3/4] EDAC/mpc7448_l2: Add a driver for the MPC7448 L2 cache Matt Turner
2026-11-20 19:33 ` [PATCH 4/4] EDAC/mpc7448_l2: Add error injection Matt Turner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9ecda3f8-13f7-4bd3-81b9-cf7deafdbcb2@kernel.org \
    --to=chleroy@kernel.org \
    --cc=bp@alien8.de \
    --cc=linux-edac@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=maddy@linux.ibm.com \
    --cc=mattst88@gmail.com \
    --cc=mpe@ellerman.id.au \
    --cc=npiggin@gmail.com \
    --cc=ritesh.list@gmail.com \
    --cc=sshegde@linux.ibm.com \
    --cc=tony.luck@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.