ppc/spapr: re-assert IRQs during event-scan if there are pending
PATCH 1/1 ppc/spapr: re-assert IRQs during event-scan if there are pending
If we hotplug a CPU during the first second of the kernel boot, the IRQ can be sent to the kernel while the RTAS event handler is not installed. The event is queued, but the kernel doesn't collect it and ignores the new CPU.
As the code relies on edge-triggered IRQ, we can re-assert it during the event-scan RTAS call if there are still pending events (as it is already done in check-exception).
--- hw/ppc/spapr_events.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
hw/ppc/spapr_events.c +12 -0
@@ -1000,10 +1000,22 @@ static void event_scan(PowerPCCPU *cpu, SpaprMachineState *spapr,target_ulong args, uint32_t nret, target_ulong rets) { + int i;if (nargs !=4 || nret !=1 ) {rtas_st (rets,0 ,RTAS_OUT_PARAM_ERROR );return ; } + +for (i =0 ; i <EVENT_CLASS_MAX ; i++) { +if (rtas_event_log_contains (EVENT_CLASS_MASK (i))) { +const SpaprEventSource *source = +spapr_event_sources_get_source (spapr->event_sources, i); + +g_assert (source->enabled); +qemu_irq_pulse (spapr_qirq (spapr, source->irq)); + } + } +rtas_st (rets,0 ,RTAS_OUT_NO_ERRORS_FOUND ); }
Signature · 1 line
2.26.2
Quoted 11 lines · On Thu, 15 Oct 2020 23:03:18 +0200 Laurent Vivier <[email protected]> wrote:
If we hotplug a CPU during the first second of the kernel boot, the IRQ can be sent to the kernel while the RTAS event handler is not installed. The event is queued, but the kernel doesn't collect it and ignores the new CPU.
As the code relies on edge-triggered IRQ, we can re-assert it during the event-scan RTAS call if there are still pending events (as it is already done in check-exception).
Signed-off-by Laurent Vivier <[email protected]>---
Any BugId to share ?
Quoted 17 lines
hw/ppc/spapr_events.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)hw/ppc/spapr_events.c +2
-0@@ -1000,10 +1000,22 @@ static void event_scan(PowerPCCPU *cpu, SpaprMachineState *spapr,target_ulong args, uint32_t nret, target_ulong rets) { + int i;if (nargs !=4 || nret !=1 ) {rtas_st (rets,0 ,RTAS_OUT_PARAM_ERROR );return ; } +
hw/ppc/spapr_events.c static void event_scan(PowerPCCPU *cpu, SpaprMachineState *spapr, · line 1018
Quoted 10 lines
hw/ppc/spapr_events.c +10
-0+for (i =0 ; i <EVENT_CLASS_MAX ; i++) { +if (rtas_event_log_contains (EVENT_CLASS_MASK (i))) { +const SpaprEventSource *source = +spapr_event_sources_get_source (spapr->event_sources, i); + +g_assert (source->enabled); +qemu_irq_pulse (spapr_qirq (spapr, source->irq)); + } + } +
This looks good but any reason for not putting this in a function called by both event_scan() and check_exception() ?
Anyway, this can be done as a follow-up:
Quoted 3 lines
hw/ppc/spapr_events.c +0
-0rtas_st (rets,0 ,RTAS_OUT_NO_ERRORS_FOUND ); }
David Gibson
AppliedQuoted 10 lines · Laurent Vivier
If we hotplug a CPU during the first second of the kernel boot, the IRQ can be sent to the kernel while the RTAS event handler is not installed. The event is queued, but the kernel doesn't collect it and ignores the new CPU.
As the code relies on edge-triggered IRQ, we can re-assert it during the event-scan RTAS call if there are still pending events (as it is already done in check-exception).
Signed-off-by Laurent Vivier <[email protected]>
Applied to ppc-for-5.2.
Quoted 31 lines
--- hw/ppc/spapr_events.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)hw/ppc/spapr_events.c +12
-0@@ -1000,10 +1000,22 @@ static void event_scan(PowerPCCPU *cpu, SpaprMachineState *spapr,target_ulong args, uint32_t nret, target_ulong rets) { + int i;if (nargs !=4 || nret !=1 ) {rtas_st (rets,0 ,RTAS_OUT_PARAM_ERROR );return ; } + +for (i =0 ; i <EVENT_CLASS_MAX ; i++) { +if (rtas_event_log_contains (EVENT_CLASS_MASK (i))) { +const SpaprEventSource *source = +spapr_event_sources_get_source (spapr->event_sources, i); + +g_assert (source->enabled); +qemu_irq_pulse (spapr_qirq (spapr, source->irq)); + } + } +rtas_st (rets,0 ,RTAS_OUT_NO_ERRORS_FOUND ); }
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson