From: Nicholas Piggin <npiggin@gmail.com>
To: qemu-ppc@nongnu.org
Cc: Aravinda Prasad <arawinda.p@gmail.com>,
Alexey Kardashevskiy <aik@ozlabs.ru>,
qemu-devel@nongnu.org, Nicholas Piggin <npiggin@gmail.com>,
Greg Kurz <groug@kaod.org>,
Ganesh Goudar <ganeshgr@linux.ibm.com>,
David Gibson <david@gibson.dropbear.id.au>
Subject: [PATCH v2 3/8] ppc/spapr: Add FWNMI System Reset state
Date: Tue, 17 Mar 2020 00:26:08 +1000 [thread overview]
Message-ID: <20200316142613.121089-4-npiggin@gmail.com> (raw)
In-Reply-To: <20200316142613.121089-1-npiggin@gmail.com>
The FWNMI option must deliver system reset interrupts to their
registered address, and there are a few constraints on the handler
addresses specified in PAPR. Add the system reset address state and
checks.
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
hw/ppc/spapr.c | 2 ++
hw/ppc/spapr_rtas.c | 14 +++++++++++++-
include/hw/ppc/spapr.h | 3 ++-
3 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index b03b26370d..5f93c49706 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -1704,6 +1704,7 @@ static void spapr_machine_reset(MachineState *machine)
spapr->cas_reboot = false;
+ spapr->fwnmi_system_reset_addr = -1;
spapr->fwnmi_machine_check_addr = -1;
spapr->fwnmi_machine_check_interlock = -1;
@@ -2023,6 +2024,7 @@ static const VMStateDescription vmstate_spapr_fwnmi = {
.needed = spapr_fwnmi_needed,
.pre_save = spapr_fwnmi_pre_save,
.fields = (VMStateField[]) {
+ VMSTATE_UINT64(fwnmi_system_reset_addr, SpaprMachineState),
VMSTATE_UINT64(fwnmi_machine_check_addr, SpaprMachineState),
VMSTATE_INT32(fwnmi_machine_check_interlock, SpaprMachineState),
VMSTATE_END_OF_LIST()
diff --git a/hw/ppc/spapr_rtas.c b/hw/ppc/spapr_rtas.c
index 0b8c481593..521e6b0b72 100644
--- a/hw/ppc/spapr_rtas.c
+++ b/hw/ppc/spapr_rtas.c
@@ -414,6 +414,7 @@ static void rtas_ibm_nmi_register(PowerPCCPU *cpu,
uint32_t nret, target_ulong rets)
{
hwaddr rtas_addr;
+ target_ulong sreset_addr, mce_addr;
if (spapr_get_cap(spapr, SPAPR_CAP_FWNMI) == SPAPR_CAP_OFF) {
rtas_st(rets, 0, RTAS_OUT_NOT_SUPPORTED);
@@ -426,7 +427,18 @@ static void rtas_ibm_nmi_register(PowerPCCPU *cpu,
return;
}
- spapr->fwnmi_machine_check_addr = rtas_ld(args, 1);
+ sreset_addr = rtas_ld(args, 0);
+ mce_addr = rtas_ld(args, 1);
+
+ /* PAPR requires these are in the first 32M of memory and within RMA */
+ if (sreset_addr >= 32 * MiB || sreset_addr >= spapr->rma_size ||
+ mce_addr >= 32 * MiB || mce_addr >= spapr->rma_size) {
+ rtas_st(rets, 0, RTAS_OUT_PARAM_ERROR);
+ return;
+ }
+
+ spapr->fwnmi_system_reset_addr = sreset_addr;
+ spapr->fwnmi_machine_check_addr = mce_addr;
rtas_st(rets, 0, RTAS_OUT_SUCCESS);
}
diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h
index 64b83402cb..42d64a0368 100644
--- a/include/hw/ppc/spapr.h
+++ b/include/hw/ppc/spapr.h
@@ -194,9 +194,10 @@ struct SpaprMachineState {
/* State related to FWNMI option */
- /* Machine Check Notification Routine address
+ /* System Reset and Machine Check Notification Routine addresses
* registered by "ibm,nmi-register" RTAS call.
*/
+ target_ulong fwnmi_system_reset_addr;
target_ulong fwnmi_machine_check_addr;
/* Machine Check FWNMI synchronization, fwnmi_machine_check_interlock is
--
2.23.0
next prev parent reply other threads:[~2020-03-16 16:06 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-16 14:26 [PATCH v2 0/8] FWNMI fixes / changes Nicholas Piggin
2020-03-16 14:26 ` [PATCH v2 1/8] ppc/spapr: Fix FWNMI machine check failure handling Nicholas Piggin
2020-03-16 15:27 ` Greg Kurz
2020-03-16 22:46 ` David Gibson
2020-03-16 14:26 ` [PATCH v2 2/8] ppc/spapr: Change FWNMI names Nicholas Piggin
2020-03-16 17:15 ` Greg Kurz
2020-03-16 17:18 ` Mahesh J Salgaonkar
2020-03-16 17:25 ` Greg Kurz
2020-03-16 17:32 ` Cédric Le Goater
2020-03-16 22:46 ` David Gibson
2020-03-16 14:26 ` Nicholas Piggin [this message]
2020-03-16 17:17 ` [PATCH v2 3/8] ppc/spapr: Add FWNMI System Reset state Greg Kurz
2020-03-16 17:29 ` Mahesh J Salgaonkar
2020-03-16 17:46 ` Cédric Le Goater
2020-03-16 22:47 ` David Gibson
2020-03-16 14:26 ` [PATCH v2 4/8] ppc/spapr: Fix FWNMI machine check interrupt delivery Nicholas Piggin
2020-03-16 17:59 ` Cédric Le Goater
2020-03-16 23:19 ` Nicholas Piggin
2020-03-16 23:27 ` David Gibson
2020-03-16 14:26 ` [PATCH v2 5/8] ppc/spapr: Allow FWNMI on TCG Nicholas Piggin
2020-03-16 18:00 ` Cédric Le Goater
2020-03-16 18:01 ` Greg Kurz
2020-03-16 23:26 ` Nicholas Piggin
2020-03-17 3:56 ` David? Gibson
2020-03-16 14:26 ` [PATCH v2 6/8] target/ppc: allow ppc_cpu_do_system_reset to take an alternate vector Nicholas Piggin
2020-03-16 18:04 ` Greg Kurz
2020-03-16 18:15 ` Cédric Le Goater
2020-03-16 23:28 ` Nicholas Piggin
2020-03-16 23:34 ` David Gibson
2020-03-17 10:47 ` Cédric Le Goater
2020-03-16 23:28 ` David Gibson
2020-03-16 14:26 ` [PATCH v2 7/8] ppc/spapr: Implement FWNMI System Reset delivery Nicholas Piggin
2020-03-16 17:35 ` Mahesh J Salgaonkar
2020-03-16 17:52 ` Greg Kurz
2020-03-16 23:31 ` David Gibson
2020-03-16 23:30 ` David Gibson
2020-03-16 14:26 ` [PATCH v2 8/8] ppc/spapr: Ignore common "ibm, nmi-interlock" Linux bug Nicholas Piggin
2020-03-16 23:32 ` [PATCH v2 8/8] ppc/spapr: Ignore common "ibm,nmi-interlock" " David Gibson
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=20200316142613.121089-4-npiggin@gmail.com \
--to=npiggin@gmail.com \
--cc=aik@ozlabs.ru \
--cc=arawinda.p@gmail.com \
--cc=david@gibson.dropbear.id.au \
--cc=ganeshgr@linux.ibm.com \
--cc=groug@kaod.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).