Skip to contentSkip to conversation

alpha: machine check handler for tsunami

PATCH Superseded Magnus Lindholm 3 participants 5 messages Apr 23, 2025 – May 6, 2025 Alpha port

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Magnus Lindholm

author maintainer
#0 lore raw

PATCH v2 1/1 alpha: machine check handler for tsunami

This patch is an attempt to implement a machine check handler with detailed information on error conditions in the event of a machine check exception on the tsunami platform. This work is inspired by how machine check exceptions are handled on the titan family. This patch implements processing of the logout frames that is generated in the event of a machine check. The logout frame contains platform specific information and is helpful in pinpointing the source that triggered the exception or fault. Some faults are recoverable, such as a correctable ECC error, but others may not be possible to recover from. As Alpha hardware is aging we may see more errors due to failing hardware and proper machine check handling can assist in detecting and diagnosing such errors. I hope that someone finds this useful, any feedback is much appreciated.

The second version of this patch has all the changes in a single commit. Many thanks to the guys at #gentoo-alpha for the feedback. below is a summary of changes and added files:

Move functions tsunami_pci_clr_err_1, tsunami_pci_clr_err, tsunami_machine_check to err_tsunami.c and enable pchip errors by seting perrmask in tsunami_init_arch().

Populate the el_TSUNAMI_sysdata_mcheck struct with the tsunami regs in core_tsunami.h

Add err_tsunami.h, which contains error messages and mask used to parse data from logout frames for the tsunami platform.

Add err_tsunami.c, based on err_titan.c and implementing machine check error handling for the tsunami/typhoon based platforms. The tsunami specifics for processing of logout frames is according to Tsunami/Typhoon 21272 Chipset Hardware Reference Manual and AlphaServer ES40 Service Guide: EK-ES239-SV A01

Add err_ev6 and err_tsunami obj files for CONFIG_ALPHA_TSUNAMI in Makefile

Add function declaration for err_tsunami.c to err_impl.h

In sys_dp264.c, install handlers for processing logout frames from SRM console on the tsunami platform.

---
 arch/alpha/include/asm/core_tsunami.h |   7 +
 arch/alpha/kernel/Makefile            |   2 +-
 arch/alpha/kernel/core_tsunami.c      |  37 +-
 arch/alpha/kernel/err_impl.h          |   8 +
 arch/alpha/kernel/err_tsunami.c       | 707 ++++++++++++++++++++++++++
 arch/alpha/kernel/err_tsunami.h       | 199 ++++++++
 arch/alpha/kernel/sys_dp264.c         |  17 +-
 7 files changed, 941 insertions(+), 36 deletions(-)
 create mode 100644 arch/alpha/kernel/err_tsunami.c
 create mode 100644 arch/alpha/kernel/err_tsunami.h
arch/alpha/include/asm/core_tsunami.h +7 -0
index 3391e95754f2..6fb6adcb6c4f 100644
@@ -283,6 +283,13 @@ union TPchipPERRMASK {
  * Data structure for handling TSUNAMI machine checks:
  */
 struct el_TSUNAMI_sysdata_mcheck {
+
+	u64 sesf;
+	u64 dir;
+	u64 misc;
+	u64 p0_perror;
+	u64 p1_perror;
+
 };
 
 
arch/alpha/kernel/Makefile +1 -1
index b6c862dff1f6..34c75e76ced4 100644
@@ -54,7 +54,7 @@ obj-$(CONFIG_ALPHA_MARVEL)	+= core_marvel.o gct.o
 obj-$(CONFIG_ALPHA_MCPCIA)	+= core_mcpcia.o
 obj-$(CONFIG_ALPHA_POLARIS)	+= core_polaris.o
 obj-$(CONFIG_ALPHA_T2)		+= core_t2.o
-obj-$(CONFIG_ALPHA_TSUNAMI)	+= core_tsunami.o
+obj-$(CONFIG_ALPHA_TSUNAMI)	+= core_tsunami.o err_ev6.o err_tsunami.o
 obj-$(CONFIG_ALPHA_TITAN)	+= core_titan.o
 obj-$(CONFIG_ALPHA_WILDFIRE)	+= core_wildfire.o
 
arch/alpha/kernel/core_tsunami.c +3 -34
index fc1ab73f23de..7a6c1aab5f8b 100644
@@ -346,6 +346,9 @@ tsunami_init_one_pchip(tsunami_pchip *pchip, int index)
 
 	pchip->wsba[3].csr = 0;
 
+	/* Enable pchip error */
+	pchip->perrmask.csr = 0x0fff;
+
 	/* Enable the Monster Window to make DAC pci64 possible. */
 	pchip->pctl.csr |= pctl_m_mwin;
 
@@ -448,37 +451,3 @@ tsunami_kill_arch(int mode)
 	if (TSUNAMI_cchip->csc.csr & 1L<<14)
 		tsunami_kill_one_pchip(TSUNAMI_pchip1, 1);
 }
-
-static inline void
-tsunami_pci_clr_err_1(tsunami_pchip *pchip)
-{
-	pchip->perror.csr;
-	pchip->perror.csr = 0x040;
-	mb();
-	pchip->perror.csr;
-}
-
-static inline void
-tsunami_pci_clr_err(void)
-{
-	tsunami_pci_clr_err_1(TSUNAMI_pchip0);
-
-	/* TSUNAMI and TYPHOON can have 2, but might only have 1 (DS10) */
-	if (TSUNAMI_cchip->csc.csr & 1L<<14)
-		tsunami_pci_clr_err_1(TSUNAMI_pchip1);
-}
-
-void
-tsunami_machine_check(unsigned long vector, unsigned long la_ptr)
-{
-	/* Clear error before any reporting.  */
-	mb();
-	mb();  /* magic */
-	draina();
-	tsunami_pci_clr_err();
-	wrmces(0x7);
-	mb();
-
-	process_mcheck_info(vector, la_ptr, "TSUNAMI",
-			    mcheck_expected(smp_processor_id()));
-}
arch/alpha/kernel/err_impl.h +8 -0
index 737b958a586d..64da787203ab 100644
@@ -86,3 +86,11 @@ extern void titan_machine_check(unsigned long, unsigned long);
 extern void titan_register_error_handlers(void);
 extern int privateer_process_logout_frame(struct el_common *, int);
 extern void privateer_machine_check(unsigned long, unsigned long);
+
+/*
+ * err_tsunami.c
+ */
+extern void tsunami_register_error_handlers(void);
+extern int tsunami_process_logout_frame(struct el_common *mchk_header, int print);
+extern void tsunami_machine_check(unsigned long vector, unsigned long la_ptr);
+extern int clipper_process_logout_frame(struct el_common *mchk_header, int print);
arch/alpha/kernel/err_tsunami.c new file +707 -0

707 lines not on this page · raw message

arch/alpha/kernel/err_tsunami.h new file +199 -0

199 lines not on this page · raw message

arch/alpha/kernel/sys_dp264.c +16 -1
index 9fb445d7dca5..bb1f5f05825b 100644
@@ -34,7 +34,7 @@
 #include "irq_impl.h"
 #include "pci_impl.h"
 #include "machvec_impl.h"
-
+#include "err_impl.h"
 
 /* Note mask bit is true for ENABLED irqs.  */
 static unsigned long cached_irq_mask;
@@ -282,6 +282,15 @@ dp264_init_irq(void)
 	init_i8259a_irqs();
 	init_tsunami_irqs(&dp264_irq_type, 16, 47);
 }
+static void __init
+tsunami_late_init(void)
+{
+	tsunami_register_error_handlers();
+	/*
+	 * Check if the console left us any error logs.
+	 */
+	cdl_check_console_data_log();
+}
 
 static void __init
 clipper_init_irq(void)
@@ -521,6 +530,12 @@ monet_init_pci(void)
 static void __init
 clipper_init_pci(void)
 {
+/*
+ * This isn't really the right place, but there's some init
+ * that needs to be done after everything is basically up.
+ */
+	tsunami_late_init();
+
 	common_init_pci();
 	locate_and_init_vga(NULL);
 }
Signature · 1 line
2.45.3
#1 lore raw
Quoted 4 lines · Magnus Lindholm

This patch is an attempt to implement a machine check handler with detailed information on error conditions in the event of a machine check exception on the tsunami platform. This work is inspired by how machine check exceptions are handled on the titan family. This patch implements

Quoted 8 lines

processing of the logout frames that is generated in the event of a machine check. The logout frame contains platform specific information and is helpful in pinpointing the source that triggered the exception or fault. Some faults are recoverable, such as a correctable ECC error, but others may not be possible to recover from. As Alpha hardware is aging we may see more errors due to failing hardware and proper machine check handling can assist in detecting and diagnosing such errors. I hope that someone finds this useful, any feedback is much appreciated.

Should this perhaps be part of drivers/edac/ ?

ARnd

author maintainer
#2 lore raw
Quoted 3 lines

Should this perhaps be part of drivers/edac/ ?

ARnd

In that case we should, for consistency, also move machine check code for other alpha families as well. Some of the machine check errors are for sure "edac" but the memory/ecc error is just a subset of all the possible machine check exceptions. Stuff like power supply errors, temperatures and such may not belong in edac? I guess it would be possible to handle machine check exceptions caused by memory errors through an edac driver and the rest of the machine check exceptions through the "regular" alpha machine check handlers.

/Magnus

#3 lore raw
In reply to Magnus Lindholm
kernel test robot noticed the following build errors:

Hi Magnus,

kernel test robot noticed the following build errors:

[auto build test ERROR on mattst88-alpha/for-linus]
[also build test ERROR on linus/master v6.15-rc4 next-20250502] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Magnus-Lindholm/alpha-machine-check-handler-for-tsunami/20250424-035141
base:   https://git.kernel.org/pub/scm/linux/kernel/git/mattst88/alpha.git for-linus
patch link:    https://lore.kernel.org/r/20250423194958.30715-1-linmag7%40gmail.com
patch subject: [PATCH v2] alpha: machine check handler for tsunami
config: alpha-allnoconfig (https://download.01.org/0day-ci/archive/20250505/[email protected]/config)
compiler: alpha-linux-gcc (GCC) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250505/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

>> alpha-linux-ld: arch/alpha/kernel/sys_eiger.o:(.init.data+0x118): undefined reference to `tsunami_machine_check'
   alpha-linux-ld: arch/alpha/kernel/sys_dp264.o: in function `clipper_init_pci':
>> (.init.text+0x394): undefined reference to `tsunami_register_error_handlers'
>> alpha-linux-ld: (.init.text+0x3a0): undefined reference to `tsunami_register_error_handlers'
>> alpha-linux-ld: arch/alpha/kernel/sys_dp264.o:(.init.data+0x118): undefined reference to `tsunami_machine_check'

alpha-linux-ld: arch/alpha/kernel/sys_dp264.o:(.init.data+0x298): undefined reference to `tsunami_machine_check'
alpha-linux-ld: arch/alpha/kernel/sys_dp264.o:(.init.data+0x418): undefined reference to `tsunami_machine_check'
alpha-linux-ld: arch/alpha/kernel/sys_dp264.o:(.init.data+0x598): undefined reference to `tsunami_machine_check'
alpha-linux-ld: arch/alpha/kernel/sys_dp264.o:(.init.data+0x718): undefined reference to `tsunami_machine_check'

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
author maintainer
#4 lore raw

Hi,

Sorry , my bad, thanks for the feedback. I'll fix this and send it out as a v3 for this patch.

Regards

Magnus

Quoted 39 lines · kernel test robot

Hi Magnus,

kernel test robot noticed the following build errors:

[auto build test ERROR on mattst88-alpha/for-linus]
[also build test ERROR on linus/master v6.15-rc4 next-20250502] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Magnus-Lindholm/alpha-machine-check-handler-for-tsunami/20250424-035141
base:   https://git.kernel.org/pub/scm/linux/kernel/git/mattst88/alpha.git for-linus
patch link:    https://lore.kernel.org/r/20250423194958.30715-1-linmag7%40gmail.com
patch subject: [PATCH v2] alpha: machine check handler for tsunami
config: alpha-allnoconfig (https://download.01.org/0day-ci/archive/20250505/[email protected]/config)
compiler: alpha-linux-gcc (GCC) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250505/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

Quoted 1 line
Quoted 1 line

alpha-linux-ld: arch/alpha/kernel/sys_eiger.o:(.init.data+0x118): undefined reference to `tsunami_machine_check'

alpha-linux-ld: arch/alpha/kernel/sys_dp264.o: in function `clipper_init_pci':

Quoted 3 lines
Quoted 3 lines

(.init.text+0x394): undefined reference to `tsunami_register_error_handlers'
alpha-linux-ld: (.init.text+0x3a0): undefined reference to `tsunami_register_error_handlers'
alpha-linux-ld: arch/alpha/kernel/sys_dp264.o:(.init.data+0x118): undefined reference to `tsunami_machine_check'

alpha-linux-ld: arch/alpha/kernel/sys_dp264.o:(.init.data+0x298): undefined reference to `tsunami_machine_check'
alpha-linux-ld: arch/alpha/kernel/sys_dp264.o:(.init.data+0x418): undefined reference to `tsunami_machine_check'
alpha-linux-ld: arch/alpha/kernel/sys_dp264.o:(.init.data+0x598): undefined reference to `tsunami_machine_check'
alpha-linux-ld: arch/alpha/kernel/sys_dp264.o:(.init.data+0x718): undefined reference to `tsunami_machine_check'

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki