diff options
| author | Steve Sistare <steven.sistare@oracle.com> | 2025-07-16 11:06:09 -0700 |
|---|---|---|
| committer | Cédric Le Goater <clg@redhat.com> | 2025-08-09 00:06:48 +0200 |
| commit | 322ee16824dc3d301477812a5dacb0249e1efe8c (patch) | |
| tree | f66983ee024db6255b28095e62d3d4f7114dc048 /hw/vfio/pci.h | |
| parent | 76cfb87f5fcad4008359e44bf37508c265da1221 (diff) | |
| download | focaccia-qemu-322ee16824dc3d301477812a5dacb0249e1efe8c.tar.gz focaccia-qemu-322ee16824dc3d301477812a5dacb0249e1efe8c.zip | |
vfio/pci: preserve pending interrupts
cpr-transfer may lose a VFIO interrupt because the KVM instance is destroyed and recreated. If an interrupt arrives in the middle, it is dropped. To fix, stop pending new interrupts during cpr save, and pick up the pieces. In more detail: Stop the VCPUs. Call kvm_irqchip_remove_irqfd_notifier_gsi --> KVM_IRQFD to deassign the irqfd gsi that routes interrupts directly to the VCPU and KVM. After this call, interrupts fall back to the kernel vfio_msihandler, which writes to QEMU's kvm_interrupt eventfd. CPR already preserves that eventfd. When the route is re-established in new QEMU, the kernel tests the eventfd and injects an interrupt to KVM if necessary. Deassign INTx in a similar manner. For both MSI and INTx, remove the eventfd handler so old QEMU does not consume an event. If an interrupt was already pended to KVM prior to the completion of kvm_irqchip_remove_irqfd_notifier_gsi, it will be recovered by the subsequent call to cpu_synchronize_all_states, which pulls KVM interrupt state to userland prior to saving it in vmstate. Signed-off-by: Steve Sistare <steven.sistare@oracle.com> Reviewed-by: Zhenzhong Duan <zhenzhong.duan@intel.com> Link: https://lore.kernel.org/qemu-devel/1752689169-233452-3-git-send-email-steven.sistare@oracle.com Signed-off-by: Cédric Le Goater <clg@redhat.com>
Diffstat (limited to 'hw/vfio/pci.h')
| -rw-r--r-- | hw/vfio/pci.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/hw/vfio/pci.h b/hw/vfio/pci.h index 2b564baf88..810a842f4a 100644 --- a/hw/vfio/pci.h +++ b/hw/vfio/pci.h @@ -188,6 +188,7 @@ struct VFIOPCIDevice { bool skip_vsc_check; VFIODisplay *dpy; Notifier irqchip_change_notifier; + VFIOPCICPR cpr; }; /* Use uin32_t for vendor & device so PCI_ANY_ID expands and cannot match hw */ |