From: Nicholas Piggin <npiggin@gmail•com>
To: linuxppc-dev@lists•ozlabs.org
Cc: Nicholas Piggin <npiggin@gmail•com>,
Alistair Popple <alistair@popple•id.au>
Subject: [PATCH 3/3] powerpc/pseries: implement nmi ipi with H_SIGNAL_SYS_RESET
Date: Wed, 9 Nov 2016 01:01:25 +1100 [thread overview]
Message-ID: <20161108140125.21455-4-npiggin@gmail.com> (raw)
In-Reply-To: <20161108140125.21455-1-npiggin@gmail.com>
H_SIGNAL_SYS_RESET can provide a hard NMI (it is not recoverable if
raised when the target has MSR_RI clear).
This patch makes a couple of changes to generic system_reset_exception
handler, which should be split out and platforms defining a handler
audited.
---
arch/powerpc/kernel/traps.c | 7 +++++--
arch/powerpc/platforms/pseries/ras.c | 4 ++++
arch/powerpc/platforms/pseries/smp.c | 12 +++++++++++-
3 files changed, 20 insertions(+), 3 deletions(-)
diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c
index 023a462..d1d7fd4 100644
--- a/arch/powerpc/kernel/traps.c
+++ b/arch/powerpc/kernel/traps.c
@@ -275,19 +275,22 @@ void _exception(int signr, struct pt_regs *regs, int code, unsigned long addr)
void system_reset_exception(struct pt_regs *regs)
{
+ nmi_enter();
+
/* See if any machine dependent calls */
if (ppc_md.system_reset_exception) {
if (ppc_md.system_reset_exception(regs))
- return;
+ goto done;
}
die("System Reset", regs, SIGABRT);
+done:
/* Must die if the interrupt is not recoverable */
if (!(regs->msr & MSR_RI))
panic("Unrecoverable System Reset");
- /* What should we do here? We could issue a shutdown or hard reset. */
+ nmi_exit();
}
#ifdef CONFIG_PPC64
diff --git a/arch/powerpc/platforms/pseries/ras.c b/arch/powerpc/platforms/pseries/ras.c
index 904a677..bb70b26 100644
--- a/arch/powerpc/platforms/pseries/ras.c
+++ b/arch/powerpc/platforms/pseries/ras.c
@@ -386,6 +386,10 @@ int pSeries_system_reset_exception(struct pt_regs *regs)
}
fwnmi_release_errinfo();
}
+
+ if (smp_handle_nmi_ipi(regs))
+ return 1;
+
return 0; /* need to perform reset */
}
diff --git a/arch/powerpc/platforms/pseries/smp.c b/arch/powerpc/platforms/pseries/smp.c
index 0f6522c..4534c5a 100644
--- a/arch/powerpc/platforms/pseries/smp.c
+++ b/arch/powerpc/platforms/pseries/smp.c
@@ -196,6 +196,16 @@ static void pSeries_cause_ipi_mux(int cpu, unsigned long data)
xics_cause_ipi(cpu, data);
}
+static int pseries_cause_nmi_ipi(int cpu, int type)
+{
+ if (type == SMP_OP_NMI_TYPE_HARD) {
+ if (plapr_signal_sys_reset(cpu) == H_SUCCESS)
+ return 1;
+ }
+
+ return 0;
+}
+
static __init void pSeries_smp_probe(void)
{
xics_smp_probe();
@@ -209,7 +219,7 @@ static __init void pSeries_smp_probe(void)
static struct smp_ops_t pseries_smp_ops = {
.message_pass = NULL, /* Use smp_muxed_ipi_message_pass */
.cause_ipi = NULL, /* Filled at runtime by pSeries_smp_probe() */
- .cause_nmi_ipi = NULL,
+ .cause_nmi_ipi = pseries_cause_nmi_ipi,
.probe = pSeries_smp_probe,
.kick_cpu = smp_pSeries_kick_cpu,
.setup_cpu = smp_setup_cpu,
--
2.10.2
next prev parent reply other threads:[~2016-11-08 14:01 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-08 14:01 [PATCH 0/3][RFC] powerpc: NMI IPIs Nicholas Piggin
2016-11-08 14:01 ` [PATCH 1/3] powerpc: add NMI IPI infrastructure Nicholas Piggin
2016-11-08 20:35 ` kbuild test robot
2016-11-08 14:01 ` [PATCH 2/3] powerpc: add struct smp_ops_t.cause_nmi_ipi operation Nicholas Piggin
2016-11-11 1:00 ` Alistair Popple
2016-11-11 1:35 ` Nicholas Piggin
2016-11-08 14:01 ` Nicholas Piggin [this message]
2016-11-08 18:38 ` [PATCH 3/3] powerpc/pseries: implement nmi ipi with H_SIGNAL_SYS_RESET kbuild test robot
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=20161108140125.21455-4-npiggin@gmail.com \
--to=npiggin@gmail$(echo .)com \
--cc=alistair@popple$(echo .)id.au \
--cc=linuxppc-dev@lists$(echo .)ozlabs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox