thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone

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

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