arm64: traps: Support for registering SError hooks
Subsystems (2)
PATCH 1/2 arm64: traps: Support for registering SError hooks
Add the ability for drivers to register SError hooks to be run on a fatal SError interrupt. This allows printing of system-specific error information to aid with debugging.
--- arch/arm64/include/asm/traps.h | 6 ++++++ arch/arm64/kernel/traps.c | 20 ++++++++++++++++++++ 2 files changed, 26 insertions(+)
arch/arm64/include/asm/traps.h +6 -0
@@ -22,8 +22,14 @@ struct undef_hook {int (*fn)(struct pt_regs *regs,u32 instr); }; +struct serror_hook { +struct list_head node; +void (*fn)(void ); +}; +void register_undef_hook (struct undef_hook *hook);void unregister_undef_hook (struct undef_hook *hook); +void register_serror_hook (struct serror_hook *hook);void force_signal_inject (int signal,int code,unsigned long address,unsigned int err);void arm64_notify_segfault (unsigned long addr);void arm64_force_sig_fault (int signo,int code,unsigned long far,const char *str);
arch/arm64/kernel/traps.c +20 -0
@@ -890,8 +890,23 @@ void panic_bad_stack(struct pt_regs *regs, unsigned int esr, unsigned long far) }#endif +static LIST_HEAD (serror_hook); +static DEFINE_RAW_SPINLOCK (serror_lock); + +void register_serror_hook (struct serror_hook *hook) +{ +unsigned long flags; + +raw_spin_lock_irqsave (&serror_lock, flags); +list_add (&hook->node, &serror_hook); +raw_spin_unlock_irqrestore (&serror_lock, flags); +} +void __noreturn arm64_serror_panic (struct pt_regs *regs,u32 esr) { +struct serror_hook *hook; +unsigned long flags; +console_verbose (); pr_crit("SError Interrupt on CPU%d, code 0x%08x -- %s\n",
@@ -899,6 +914,11 @@ void __noreturn arm64_serror_panic(struct pt_regs *regs, u32 esr)if (regs)__show_regs (regs); +raw_spin_lock_irqsave (&serror_lock, flags); +list_for_each_entry (hook, &serror_hook, node) + hook->fn (); +raw_spin_unlock_irqrestore (&serror_lock, flags); +nmi_panic (regs,"Asynchronous SError Interrupt" );cpu_park_loop ();
Signature · 1 line
2.30.1
PATCH 2/2 soc: tegra: Add Tegra186 ARI driver
Add a driver to hook into SError interrupts and print machine check status for debugging. Status information is retrieved via SMC. This is supported by upstream ARM Trusted Firmware.
--- drivers/soc/tegra/Makefile | 1 + drivers/soc/tegra/ari-tegra186.c | 78 ++++++++++++++++++++++++++++++++ 2 files changed, 79 insertions(+) create mode 100644 drivers/soc/tegra/ari-tegra186.c
drivers/soc/tegra/Makefile +1 -0
@@ -7,3 +7,4 @@ obj-$(CONFIG_SOC_TEGRA_PMC) += pmc.o obj-$(CONFIG_SOC_TEGRA_POWERGATE_BPMP) += powergate-bpmp.o obj-$(CONFIG_SOC_TEGRA20_VOLTAGE_COUPLER) += regulators-tegra20.o obj-$(CONFIG_SOC_TEGRA30_VOLTAGE_COUPLER) += regulators-tegra30.o +obj-$(CONFIG_ARCH_TEGRA_186_SOC) += ari-tegra186.o
drivers/soc/tegra/ari-tegra186.c new file +78 -0
78 lines not on this page · raw message
Signature · 1 line
2.30.1
Mark Rutland
reviewerQuoted 5 lines · Mikko Perttunen
Add the ability for drivers to register SError hooks to be run on a fatal SError interrupt. This allows printing of system-specific error information to aid with debugging.
Signed-off-by Mikko Perttunen <[email protected]>
Can't you dump information unconditionally in a panic notifier?
That wouldn't require any new infrastructure.
Thanks,
Mark.
Quoted 67 lines
--- arch/arm64/include/asm/traps.h | 6 ++++++ arch/arm64/kernel/traps.c | 20 ++++++++++++++++++++ 2 files changed, 26 insertions(+)arch/arm64/include/asm/traps.h +6
-0@@ -22,8 +22,14 @@ struct undef_hook {int (*fn)(struct pt_regs *regs,u32 instr); }; +struct serror_hook { +struct list_head node; +void (*fn)(void ); +}; +void register_undef_hook (struct undef_hook *hook);void unregister_undef_hook (struct undef_hook *hook); +void register_serror_hook (struct serror_hook *hook);void force_signal_inject (int signal,int code,unsigned long address,unsigned int err);void arm64_notify_segfault (unsigned long addr);void arm64_force_sig_fault (int signo,int code,unsigned long far,const char *str);arch/arm64/kernel/traps.c +20
-0@@ -890,8 +890,23 @@ void panic_bad_stack(struct pt_regs *regs, unsigned int esr, unsigned long far) }#endif +static LIST_HEAD (serror_hook); +static DEFINE_RAW_SPINLOCK (serror_lock); + +void register_serror_hook (struct serror_hook *hook) +{ +unsigned long flags; + +raw_spin_lock_irqsave (&serror_lock, flags); +list_add (&hook->node, &serror_hook); +raw_spin_unlock_irqrestore (&serror_lock, flags); +} +void __noreturn arm64_serror_panic (struct pt_regs *regs,u32 esr) { +struct serror_hook *hook; +unsigned long flags; +console_verbose (); pr_crit("SError Interrupt on CPU%d, code 0x%08x -- %s\n",@@ -899,6 +914,11 @@ void __noreturn arm64_serror_panic(struct pt_regs *regs, u32 esr)if (regs)__show_regs (regs); +raw_spin_lock_irqsave (&serror_lock, flags); +list_for_each_entry (hook, &serror_hook, node) + hook->fn (); +raw_spin_unlock_irqrestore (&serror_lock, flags); +nmi_panic (regs,"Asynchronous SError Interrupt" );cpu_park_loop ();Signature · 1 line
2.30.1
Quoted 10 lines · Mark Rutland
Quoted 5 lines · Mikko Perttunen
Add the ability for drivers to register SError hooks to be run on a fatal SError interrupt. This allows printing of system-specific error information to aid with debugging.
Signed-off-by Mikko Perttunen <[email protected]>Can't you dump information unconditionally in a panic notifier?
That wouldn't require any new infrastructure.
That does indeed work also, thanks for the tip! Will change to use those.
Thanks,
Mikko
Quoted 71 lines
Thanks,
Mark.Quoted 67 lines
--- arch/arm64/include/asm/traps.h | 6 ++++++ arch/arm64/kernel/traps.c | 20 ++++++++++++++++++++ 2 files changed, 26 insertions(+)arch/arm64/include/asm/traps.h +6
-0@@ -22,8 +22,14 @@ struct undef_hook {int (*fn)(struct pt_regs *regs,u32 instr); }; +struct serror_hook { +struct list_head node; +void (*fn)(void ); +}; +void register_undef_hook (struct undef_hook *hook);void unregister_undef_hook (struct undef_hook *hook); +void register_serror_hook (struct serror_hook *hook);void force_signal_inject (int signal,int code,unsigned long address,unsigned int err);void arm64_notify_segfault (unsigned long addr);void arm64_force_sig_fault (int signo,int code,unsigned long far,const char *str);arch/arm64/kernel/traps.c +20
-0@@ -890,8 +890,23 @@ void panic_bad_stack(struct pt_regs *regs, unsigned int esr, unsigned long far) }#endif +static LIST_HEAD (serror_hook); +static DEFINE_RAW_SPINLOCK (serror_lock); + +void register_serror_hook (struct serror_hook *hook) +{ +unsigned long flags; + +raw_spin_lock_irqsave (&serror_lock, flags); +list_add (&hook->node, &serror_hook); +raw_spin_unlock_irqrestore (&serror_lock, flags); +} +void __noreturn arm64_serror_panic (struct pt_regs *regs,u32 esr) { +struct serror_hook *hook; +unsigned long flags; +console_verbose (); pr_crit("SError Interrupt on CPU%d, code 0x%08x -- %s\n",@@ -899,6 +914,11 @@ void __noreturn arm64_serror_panic(struct pt_regs *regs, u32 esr)if (regs)__show_regs (regs); +raw_spin_lock_irqsave (&serror_lock, flags); +list_for_each_entry (hook, &serror_hook, node) + hook->fn (); +raw_spin_unlock_irqrestore (&serror_lock, flags); +nmi_panic (regs,"Asynchronous SError Interrupt" );cpu_park_loop ();Signature · 1 line
2.30.1