Blame SOURCES/kvm-ppc-spapr-re-assert-IRQs-during-event-scan-if-there-.patch

a19a21
From e4065c7739c8ea3f6f88898295ed899a1059806e Mon Sep 17 00:00:00 2001
a19a21
From: Greg Kurz <gkurz@redhat.com>
a19a21
Date: Fri, 4 Dec 2020 15:08:00 -0500
a19a21
Subject: [PATCH 02/14] ppc/spapr: re-assert IRQs during event-scan if there
a19a21
 are pending
a19a21
a19a21
RH-Author: Greg Kurz <gkurz@redhat.com>
a19a21
Message-id: <20201204150800.264829-3-gkurz@redhat.com>
a19a21
Patchwork-id: 100216
a19a21
O-Subject: [RHEL-8.4.0 qemu-kvm PATCH 2/2] ppc/spapr: re-assert IRQs during event-scan if there are pending
a19a21
Bugzilla: 1901837
a19a21
RH-Acked-by: Danilo de Paula <ddepaula@redhat.com>
a19a21
RH-Acked-by: David Gibson <dgibson@redhat.com>
a19a21
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
a19a21
a19a21
From: Laurent Vivier <lvivier@redhat.com>
a19a21
a19a21
If we hotplug a CPU during the first second of the kernel boot,
a19a21
the IRQ can be sent to the kernel while the RTAS event handler
a19a21
is not installed. The event is queued, but the kernel doesn't
a19a21
collect it and ignores the new CPU.
a19a21
a19a21
As the code relies on edge-triggered IRQ, we can re-assert it
a19a21
during the event-scan RTAS call if there are still pending
a19a21
events (as it is already done in check-exception).
a19a21
a19a21
Signed-off-by: Laurent Vivier <lvivier@redhat.com>
a19a21
Message-Id: <20201015210318.117386-1-lvivier@redhat.com>
a19a21
Reviewed-by: Greg Kurz <groug@kaod.org>
a19a21
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
a19a21
(cherry picked from commit dff669d6a15fb92b063cb5aa691b4bb498727404)
a19a21
Signed-off-by: Greg Kurz <gkurz@redhat.com>
a19a21
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
a19a21
---
a19a21
 hw/ppc/spapr_events.c | 12 ++++++++++++
a19a21
 1 file changed, 12 insertions(+)
a19a21
a19a21
diff --git a/hw/ppc/spapr_events.c b/hw/ppc/spapr_events.c
a19a21
index e355e000d07..15b92b63adb 100644
a19a21
--- a/hw/ppc/spapr_events.c
a19a21
+++ b/hw/ppc/spapr_events.c
a19a21
@@ -692,10 +692,22 @@ static void event_scan(PowerPCCPU *cpu, SpaprMachineState *spapr,
a19a21
                        target_ulong args,
a19a21
                        uint32_t nret, target_ulong rets)
a19a21
 {
a19a21
+    int i;
a19a21
     if (nargs != 4 || nret != 1) {
a19a21
         rtas_st(rets, 0, RTAS_OUT_PARAM_ERROR);
a19a21
         return;
a19a21
     }
a19a21
+
a19a21
+    for (i = 0; i < EVENT_CLASS_MAX; i++) {
a19a21
+        if (rtas_event_log_contains(EVENT_CLASS_MASK(i))) {
a19a21
+            const SpaprEventSource *source =
a19a21
+                spapr_event_sources_get_source(spapr->event_sources, i);
a19a21
+
a19a21
+            g_assert(source->enabled);
a19a21
+            qemu_irq_pulse(spapr_qirq(spapr, source->irq));
a19a21
+        }
a19a21
+    }
a19a21
+
a19a21
     rtas_st(rets, 0, RTAS_OUT_NO_ERRORS_FOUND);
a19a21
 }
a19a21
 
a19a21
-- 
a19a21
2.27.0
a19a21