Skip to content

Commit

Permalink
vfio/pci: Disable INTx in vfio_realize error path
Browse files Browse the repository at this point in the history
When vfio realize fails, INTx isn't disabled if it has been enabled.
This may confuse host side with unhandled interrupt report.

Fixes: c5478fe ("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>
(cherry picked from commit adee0da)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
  • Loading branch information
duanzhenzhong authored and Michael Tokarev committed Aug 5, 2023
1 parent 48be003 commit e85ab8f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions hw/vfio/pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit e85ab8f

Please sign in to comment.