summary refs log tree commit diff stats
path: root/hw/vfio/pci.c
diff options
context:
space:
mode:
authorZhenzhong Duan <zhenzhong.duan@intel.com>2023-07-03 15:15:06 +0800
committerCédric Le Goater <clg@redhat.com>2023-07-10 09:52:52 +0200
commitadee0da0368f50b3ee934cdeeb6076466dabb268 (patch)
tree21f05127fabdb8fde2f70ce8831313099e21bd43 /hw/vfio/pci.c
parent0ddcb39c93571da4fdcc39fc770500d2d275376d (diff)
downloadfocaccia-qemu-adee0da0368f50b3ee934cdeeb6076466dabb268.tar.gz
focaccia-qemu-adee0da0368f50b3ee934cdeeb6076466dabb268.zip
vfio/pci: Disable INTx in vfio_realize error path
When vfio realize fails, INTx isn't disabled if it has been enabled.
This may confuse host side with unhandled interrupt report.

Fixes: c5478fea27ac ("vfio/pci: Respond to KVM irqchip change notifier")
Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
Reviewed-by: Joao Martins <joao.m.martins@oracle.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Signed-off-by: Cédric Le Goater <clg@redhat.com>
Diffstat (limited to 'hw/vfio/pci.c')
-rw-r--r--hw/vfio/pci.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c
index ab6645ba60..31c4ab250f 100644
--- a/hw/vfio/pci.c
+++ b/hw/vfio/pci.c
@@ -3220,6 +3220,9 @@ static void vfio_realize(PCIDevice *pdev, Error **errp)
     return;
 
 out_deregister:
+    if (vdev->interrupt == VFIO_INT_INTx) {
+        vfio_intx_disable(vdev);
+    }
     pci_device_set_intx_routing_notifier(&vdev->pdev, NULL);
     if (vdev->irqchip_change_notifier.notify) {
         kvm_irqchip_remove_change_notifier(&vdev->irqchip_change_notifier);