[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 39/45] ppc/spapr: Add FWNMI System Reset state
From: |
David Gibson |
Subject: |
[PULL 39/45] ppc/spapr: Add FWNMI System Reset state |
Date: |
Tue, 17 Mar 2020 21:04:17 +1100 |
From: Nicholas Piggin <address@hidden>
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 <address@hidden>
Message-Id: <address@hidden>
Reviewed-by: Greg Kurz <address@hidden>
Reviwed-by: Mahesh Salgaonkar <address@hidden>
Reviewed-by: Cédric Le Goater <address@hidden>
Signed-off-by: David Gibson <address@hidden>
---
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 822dea8118..d22bf54baf 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -1688,6 +1688,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;
@@ -2007,6 +2008,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.24.1
- [PULL 21/45] spapr: Clean up RMA size calculation, (continued)
- [PULL 21/45] spapr: Clean up RMA size calculation, David Gibson, 2020/03/17
- [PULL 25/45] hw/scsi/spapr_vscsi: Introduce req_iu() helper, David Gibson, 2020/03/17
- [PULL 29/45] spapr/xive: use SPAPR_IRQ_IPI to define IPI ranges exposed to the guest, David Gibson, 2020/03/17
- [PULL 36/45] spapr: Rename DT functions to newer naming convention, David Gibson, 2020/03/17
- [PULL 30/45] target/ppc: Fix rlwinm on ppc64, David Gibson, 2020/03/17
- [PULL 40/45] ppc/spapr: Fix FWNMI machine check interrupt delivery, David Gibson, 2020/03/17
- [PULL 33/45] spapr/rtas: Reserve space for RTAS blob and log, David Gibson, 2020/03/17
- [PULL 37/45] ppc/spapr: Fix FWNMI machine check failure handling, David Gibson, 2020/03/17
- [PULL 35/45] spapr: Move creation of ibm,architecture-vec-5 property, David Gibson, 2020/03/17
- [PULL 43/45] ppc/spapr: Implement FWNMI System Reset delivery, David Gibson, 2020/03/17
- [PULL 39/45] ppc/spapr: Add FWNMI System Reset state,
David Gibson <=
- [PULL 32/45] pseries: Update SLOF firmware image, David Gibson, 2020/03/17
- [PULL 38/45] ppc/spapr: Change FWNMI names, David Gibson, 2020/03/17
- [PULL 34/45] spapr: Move creation of ibm, dynamic-reconfiguration-memory dt node, David Gibson, 2020/03/17
- [PULL 41/45] ppc/spapr: Allow FWNMI on TCG, David Gibson, 2020/03/17
- [PULL 42/45] target/ppc: allow ppc_cpu_do_system_reset to take an alternate vector, David Gibson, 2020/03/17
- [PULL 44/45] ppc/spapr: Ignore common "ibm,nmi-interlock" Linux bug, David Gibson, 2020/03/17
- [PULL 45/45] pseries: Update SLOF firmware image, David Gibson, 2020/03/17
- Re: [PULL 00/45] ppc-for-5.0 queue 20200317, Paolo Bonzini, 2020/03/17