From: Zhenzhong Duan Date: Mon, 3 Jul 2023 07:15:06 +0000 (+0800) Subject: vfio/pci: Disable INTx in vfio_realize error path X-Git-Tag: qemu-xen-4.18.0-rc5~9 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=e85ab8f753112c96f81fbd7cae08a5753b477b26;p=qemu-xen.git 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 Reviewed-by: Joao Martins Reviewed-by: Cédric Le Goater Signed-off-by: Cédric Le Goater (cherry picked from commit adee0da0368f50b3ee934cdeeb6076466dabb268) Signed-off-by: Michael Tokarev --- diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c index 53dcb3efaa..62013c672f 100644 --- a/hw/vfio/pci.c +++ b/hw/vfio/pci.c @@ -3160,6 +3160,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);