yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

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

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