[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v2 13/13] spapr/xive: fix device hotplug when VM is
From: |
Cédric Le Goater |
Subject: |
[Qemu-devel] [PATCH v2 13/13] spapr/xive: fix device hotplug when VM is stopped |
Date: |
Fri, 22 Feb 2019 14:13:22 +0100 |
Instead of switching off the sources, set their state to PENDING to
possibly catch a hotplug event occuring while the VM is stopped. At
resume, check the previous state and if an interrupt was queued,
generate a trigger.
Signed-off-by: Cédric Le Goater <address@hidden>
---
hw/intc/spapr_xive_kvm.c | 22 +++++++++++++++++++---
1 file changed, 19 insertions(+), 3 deletions(-)
diff --git a/hw/intc/spapr_xive_kvm.c b/hw/intc/spapr_xive_kvm.c
index 99a829fb3f60..64d160babb26 100644
--- a/hw/intc/spapr_xive_kvm.c
+++ b/hw/intc/spapr_xive_kvm.c
@@ -500,8 +500,16 @@ static void kvmppc_xive_change_state_handler(void *opaque,
int running,
if (running) {
for (i = 0; i < xsrc->nr_irqs; i++) {
uint8_t pq = xive_source_esb_get(xsrc, i);
- if (xive_esb_read(xsrc, i, XIVE_ESB_SET_PQ_00 + (pq << 8)) != 0x1)
{
- error_report("XIVE: IRQ %d has an invalid state", i);
+ uint8_t old_pq;
+
+ old_pq = xive_esb_read(xsrc, i, XIVE_ESB_SET_PQ_00 + (pq << 8));
+
+ /*
+ * If an interrupt was queued (hotplug event) while VM was
+ * stopped, generate a trigger.
+ */
+ if (pq == XIVE_ESB_RESET && old_pq == XIVE_ESB_QUEUED) {
+ xive_esb_trigger(xsrc, i);
}
}
@@ -515,7 +523,15 @@ static void kvmppc_xive_change_state_handler(void *opaque,
int running,
* migration is in progress.
*/
for (i = 0; i < xsrc->nr_irqs; i++) {
- uint8_t pq = xive_esb_read(xsrc, i, XIVE_ESB_SET_PQ_01);
+ uint8_t pq = xive_esb_read(xsrc, i, XIVE_ESB_GET);
+
+ /*
+ * PQ is set to PENDING to possibly catch a hotplug event
+ * occuring while the VM is stopped.
+ */
+ if (pq != XIVE_ESB_OFF) {
+ pq = xive_esb_read(xsrc, i, XIVE_ESB_SET_PQ_10);
+ }
xive_source_esb_set(xsrc, i, pq);
}
--
2.20.1
- [Qemu-devel] [PATCH v2 11/13] spapr: check for the activation of the KVM IRQ device, (continued)
- [Qemu-devel] [PATCH v2 11/13] spapr: check for the activation of the KVM IRQ device, Cédric Le Goater, 2019/02/22
- [Qemu-devel] [PATCH v2 08/13] spapr/rtas: modify spapr_rtas_register() to remove RTAS handlers, Cédric Le Goater, 2019/02/22
- [Qemu-devel] [PATCH v2 05/13] spapr/xive: introduce a VM state change handler, Cédric Le Goater, 2019/02/22
- [Qemu-devel] [PATCH v2 03/13] spapr/xive: activate KVM support, Cédric Le Goater, 2019/02/22
- [Qemu-devel] [PATCH v2 01/13] spapr/xive: add KVM support, Cédric Le Goater, 2019/02/22
- [Qemu-devel] [PATCH v2 13/13] spapr/xive: fix device hotplug when VM is stopped,
Cédric Le Goater <=
- [Qemu-devel] [PATCH v2 12/13] spapr: add KVM support to the 'dual' machine, Cédric Le Goater, 2019/02/22
- [Qemu-devel] [PATCH v2 02/13] spapr/xive: add hcall support when under KVM, Cédric Le Goater, 2019/02/22
- [Qemu-devel] [PATCH v2 07/13] spapr/xive: fix migration of the XiveTCTX under TCG, Cédric Le Goater, 2019/02/22
- [Qemu-devel] [PATCH v2 04/13] spapr/xive: add state synchronization with KVM, Cédric Le Goater, 2019/02/22
- [Qemu-devel] [PATCH v2 09/13] sysbus: add a sysbus_mmio_unmap() helper, Cédric Le Goater, 2019/02/22