]> git.proxmox.com Git - mirror_qemu.git/commitdiff
vfio/pci: Disable INTx in vfio_realize error path
authorZhenzhong Duan <zhenzhong.duan@intel.com>
Mon, 3 Jul 2023 07:15:06 +0000 (15:15 +0800)
committerCédric Le Goater <clg@redhat.com>
Mon, 10 Jul 2023 07:52:52 +0000 (09:52 +0200)
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>
hw/vfio/pci.c

index ab6645ba60af436e58b15ecc92e354e3b8e996b7..31c4ab250fbe1ea67660e6eaf07f25ddc5b312cc 100644 (file)
@@ -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);