From e4065c7739c8ea3f6f88898295ed899a1059806e Mon Sep 17 00:00:00 2001 From: Greg Kurz Date: Fri, 4 Dec 2020 15:08:00 -0500 Subject: [PATCH 02/14] ppc/spapr: re-assert IRQs during event-scan if there are pending RH-Author: Greg Kurz Message-id: <20201204150800.264829-3-gkurz@redhat.com> Patchwork-id: 100216 O-Subject: [RHEL-8.4.0 qemu-kvm PATCH 2/2] ppc/spapr: re-assert IRQs during event-scan if there are pending Bugzilla: 1901837 RH-Acked-by: Danilo de Paula RH-Acked-by: David Gibson RH-Acked-by: Laurent Vivier From: 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 Message-Id: <20201015210318.117386-1-lvivier@redhat.com> Reviewed-by: Greg Kurz Signed-off-by: David Gibson (cherry picked from commit dff669d6a15fb92b063cb5aa691b4bb498727404) Signed-off-by: Greg Kurz Signed-off-by: Danilo C. L. de Paula --- hw/ppc/spapr_events.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/hw/ppc/spapr_events.c b/hw/ppc/spapr_events.c index e355e000d07..15b92b63adb 100644 --- a/hw/ppc/spapr_events.c +++ b/hw/ppc/spapr_events.c @@ -692,10 +692,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); } -- 2.27.0