[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [RFC PATCH 02/13] ppc/spapr: Add FWNMI System Reset state
From: |
Nicholas Piggin |
Subject: |
Re: [RFC PATCH 02/13] ppc/spapr: Add FWNMI System Reset state |
Date: |
Thu, 05 Mar 2020 13:46:42 +1000 |
User-agent: |
astroid/0.15.0 (https://github.com/astroidmail/astroid) |
David Gibson's on March 4, 2020 3:53 pm:
> On Wed, Mar 04, 2020 at 03:28:39PM +1000, Nicholas Piggin wrote:
>> 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>
>> ---
>> 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 27b0c2c425..a8c6dbc5bd 100644
>> --- a/hw/ppc/spapr.c
>> +++ b/hw/ppc/spapr.c
>> @@ -1696,6 +1696,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;
>>
>> @@ -2015,6 +2016,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 571615445a..2315505181 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 32MB of memory and within RMA */
>> + if (sreset_addr >= 32*1024*1024 || sreset_addr >= spapr->rma_size ||
>
> Use 32 * MiB please.
Sure.
>> + mce_addr >= 32*1024*1024 || mce_addr >= spapr->rma_size) {
>
> In practice the RMA limit can never be hit - we always have at least
> 128 MiB of RMA, or SLOF won't start. It's nice to be explicit about
> the limitation regardless, though.
Okay, and yes I agree about being explicit. I don't think there's a
reason why we couldn't accept up to rma_size, but PAPR says 32MB so
it probably helps test compatibility with other hypervisors.
Thanks,
Nick
[RFC PATCH 05/13] ppc/spapr: Fix FWNMI machine check interrupt delivery, Nicholas Piggin, 2020/03/04
[RFC PATCH 06/13] ppc/spapr: Fix FWNMI machine check failure handling, Nicholas Piggin, 2020/03/04