[PATCH v5 1/5] alpha: move Tsunami machine check handling to err_tsunami.c

From: Magnus Lindholm

Date: Fri Oct 09 2026 - 08:23:17 EST


Move the existing handler and PCI error clearing helpers without changing
their behavior. Build the error objects for ALPHA_TSUNAMI so that all
Tsunami configurations, including non-generic Shark, can use them.

Signed-off-by: Magnus Lindholm <linmag7@xxxxxxxxx>
---
arch/alpha/kernel/Makefile | 4 ++-
arch/alpha/kernel/core_tsunami.c | 34 -----------------------
arch/alpha/kernel/err_tsunami.c | 47 ++++++++++++++++++++++++++++++++
3 files changed, 50 insertions(+), 35 deletions(-)
create mode 100644 arch/alpha/kernel/err_tsunami.c

diff --git a/arch/alpha/kernel/Makefile b/arch/alpha/kernel/Makefile
index 4ea5c189e60e..0178f6a5bdb8 100644
--- a/arch/alpha/kernel/Makefile
+++ b/arch/alpha/kernel/Makefile
@@ -39,7 +39,7 @@ obj-y += err_ev7.o err_titan.o err_marvel.o
endif

obj-y += irq_pyxis.o irq_i8259.o irq_srm.o
-obj-y += err_ev6.o
+obj-y += err_ev6.o err_tsunami.o
obj-y += es1888.o smc37c669.o smc37c93x.o pc873xx.o gct.o
obj-y += srmcons.o

@@ -89,4 +89,6 @@ obj-$(CONFIG_ALPHA_MARVEL) += err_ev7.o err_marvel.o
obj-$(CONFIG_ALPHA_NAUTILUS) += err_ev6.o
obj-$(CONFIG_ALPHA_TITAN) += err_ev6.o err_titan.o

+obj-$(CONFIG_ALPHA_TSUNAMI) += err_ev6.o err_tsunami.o
+
endif # GENERIC
diff --git a/arch/alpha/kernel/core_tsunami.c b/arch/alpha/kernel/core_tsunami.c
index fc1ab73f23de..d435ec9fb828 100644
--- a/arch/alpha/kernel/core_tsunami.c
+++ b/arch/alpha/kernel/core_tsunami.c
@@ -448,37 +448,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()));
-}
diff --git a/arch/alpha/kernel/err_tsunami.c b/arch/alpha/kernel/err_tsunami.c
new file mode 100644
index 000000000000..1045b920fa6b
--- /dev/null
+++ b/arch/alpha/kernel/err_tsunami.c
@@ -0,0 +1,47 @@
+// SPDX-License-Identifier: GPL-2.0
+/* Machine check handling for Tsunami/Typhoon systems. */
+#include <linux/init.h>
+#include <linux/pci.h>
+#include <linux/sched.h>
+#include <asm/io.h>
+#include <asm/core_tsunami.h>
+#include <asm/smp.h>
+#include <asm/err_common.h>
+#include <asm/irq_regs.h>
+#include "err_impl.h"
+#include "proto.h"
+#include "pci_impl.h"
+
+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()));
+}
--
2.43.0