mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-09 18:44:58 -06:00
vfio/pci: vfio_notifier_cleanup
Move event_notifier_cleanup calls to a helper vfio_notifier_cleanup. This version is trivial, and does not yet use the vdev and nr parameters. No functional change. Signed-off-by: Steve Sistare <steven.sistare@oracle.com> Reviewed-by: Cédric Le Goater <clg@redhat.com> Link: https://lore.kernel.org/qemu-devel/1749569991-25171-17-git-send-email-steven.sistare@oracle.com Signed-off-by: Cédric Le Goater <clg@redhat.com>
This commit is contained in:
parent
c2559182c8
commit
6d7696f329
1 changed files with 17 additions and 11 deletions
|
@ -68,6 +68,12 @@ static bool vfio_notifier_init(VFIOPCIDevice *vdev, EventNotifier *e,
|
|||
return !ret;
|
||||
}
|
||||
|
||||
static void vfio_notifier_cleanup(VFIOPCIDevice *vdev, EventNotifier *e,
|
||||
const char *name, int nr)
|
||||
{
|
||||
event_notifier_cleanup(e);
|
||||
}
|
||||
|
||||
/*
|
||||
* Disabling BAR mmaping can be slow, but toggling it around INTx can
|
||||
* also be a huge overhead. We try to get the best of both worlds by
|
||||
|
@ -180,7 +186,7 @@ fail_vfio:
|
|||
kvm_irqchip_remove_irqfd_notifier_gsi(kvm_state, &vdev->intx.interrupt,
|
||||
vdev->intx.route.irq);
|
||||
fail_irqfd:
|
||||
event_notifier_cleanup(&vdev->intx.unmask);
|
||||
vfio_notifier_cleanup(vdev, &vdev->intx.unmask, "intx-unmask", 0);
|
||||
fail:
|
||||
qemu_set_fd_handler(irq_fd, vfio_intx_interrupt, NULL, vdev);
|
||||
vfio_device_irq_unmask(&vdev->vbasedev, VFIO_PCI_INTX_IRQ_INDEX);
|
||||
|
@ -212,7 +218,7 @@ static void vfio_intx_disable_kvm(VFIOPCIDevice *vdev)
|
|||
}
|
||||
|
||||
/* We only need to close the eventfd for VFIO to cleanup the kernel side */
|
||||
event_notifier_cleanup(&vdev->intx.unmask);
|
||||
vfio_notifier_cleanup(vdev, &vdev->intx.unmask, "intx-unmask", 0);
|
||||
|
||||
/* QEMU starts listening for interrupt events. */
|
||||
qemu_set_fd_handler(event_notifier_get_fd(&vdev->intx.interrupt),
|
||||
|
@ -311,7 +317,7 @@ static bool vfio_intx_enable(VFIOPCIDevice *vdev, Error **errp)
|
|||
if (!vfio_device_irq_set_signaling(&vdev->vbasedev, VFIO_PCI_INTX_IRQ_INDEX, 0,
|
||||
VFIO_IRQ_SET_ACTION_TRIGGER, fd, errp)) {
|
||||
qemu_set_fd_handler(fd, NULL, NULL, vdev);
|
||||
event_notifier_cleanup(&vdev->intx.interrupt);
|
||||
vfio_notifier_cleanup(vdev, &vdev->intx.interrupt, "intx-interrupt", 0);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -338,7 +344,7 @@ static void vfio_intx_disable(VFIOPCIDevice *vdev)
|
|||
|
||||
fd = event_notifier_get_fd(&vdev->intx.interrupt);
|
||||
qemu_set_fd_handler(fd, NULL, NULL, vdev);
|
||||
event_notifier_cleanup(&vdev->intx.interrupt);
|
||||
vfio_notifier_cleanup(vdev, &vdev->intx.interrupt, "intx-interrupt", 0);
|
||||
|
||||
vdev->interrupt = VFIO_INT_NONE;
|
||||
|
||||
|
@ -501,7 +507,7 @@ static void vfio_connect_kvm_msi_virq(VFIOMSIVector *vector, int nr)
|
|||
return;
|
||||
|
||||
fail_kvm:
|
||||
event_notifier_cleanup(&vector->kvm_interrupt);
|
||||
vfio_notifier_cleanup(vector->vdev, &vector->kvm_interrupt, name, nr);
|
||||
fail_notifier:
|
||||
kvm_irqchip_release_virq(kvm_state, vector->virq);
|
||||
vector->virq = -1;
|
||||
|
@ -514,7 +520,7 @@ static void vfio_remove_kvm_msi_virq(VFIOPCIDevice *vdev, VFIOMSIVector *vector,
|
|||
vector->virq);
|
||||
kvm_irqchip_release_virq(kvm_state, vector->virq);
|
||||
vector->virq = -1;
|
||||
event_notifier_cleanup(&vector->kvm_interrupt);
|
||||
vfio_notifier_cleanup(vdev, &vector->kvm_interrupt, "kvm_interrupt", nr);
|
||||
}
|
||||
|
||||
static void vfio_update_kvm_msi_virq(VFIOMSIVector *vector, MSIMessage msg,
|
||||
|
@ -837,7 +843,7 @@ static void vfio_msi_disable_common(VFIOPCIDevice *vdev)
|
|||
}
|
||||
qemu_set_fd_handler(event_notifier_get_fd(&vector->interrupt),
|
||||
NULL, NULL, NULL);
|
||||
event_notifier_cleanup(&vector->interrupt);
|
||||
vfio_notifier_cleanup(vdev, &vector->interrupt, "interrupt", i);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2958,7 +2964,7 @@ void vfio_pci_register_err_notifier(VFIOPCIDevice *vdev)
|
|||
VFIO_IRQ_SET_ACTION_TRIGGER, fd, &err)) {
|
||||
error_reportf_err(err, VFIO_MSG_PREFIX, vdev->vbasedev.name);
|
||||
qemu_set_fd_handler(fd, NULL, NULL, vdev);
|
||||
event_notifier_cleanup(&vdev->err_notifier);
|
||||
vfio_notifier_cleanup(vdev, &vdev->err_notifier, "err_notifier", 0);
|
||||
vdev->pci_aer = false;
|
||||
}
|
||||
}
|
||||
|
@ -2977,7 +2983,7 @@ static void vfio_unregister_err_notifier(VFIOPCIDevice *vdev)
|
|||
}
|
||||
qemu_set_fd_handler(event_notifier_get_fd(&vdev->err_notifier),
|
||||
NULL, NULL, vdev);
|
||||
event_notifier_cleanup(&vdev->err_notifier);
|
||||
vfio_notifier_cleanup(vdev, &vdev->err_notifier, "err_notifier", 0);
|
||||
}
|
||||
|
||||
static void vfio_req_notifier_handler(void *opaque)
|
||||
|
@ -3025,7 +3031,7 @@ void vfio_pci_register_req_notifier(VFIOPCIDevice *vdev)
|
|||
VFIO_IRQ_SET_ACTION_TRIGGER, fd, &err)) {
|
||||
error_reportf_err(err, VFIO_MSG_PREFIX, vdev->vbasedev.name);
|
||||
qemu_set_fd_handler(fd, NULL, NULL, vdev);
|
||||
event_notifier_cleanup(&vdev->req_notifier);
|
||||
vfio_notifier_cleanup(vdev, &vdev->req_notifier, "req_notifier", 0);
|
||||
} else {
|
||||
vdev->req_enabled = true;
|
||||
}
|
||||
|
@ -3045,7 +3051,7 @@ static void vfio_unregister_req_notifier(VFIOPCIDevice *vdev)
|
|||
}
|
||||
qemu_set_fd_handler(event_notifier_get_fd(&vdev->req_notifier),
|
||||
NULL, NULL, vdev);
|
||||
event_notifier_cleanup(&vdev->req_notifier);
|
||||
vfio_notifier_cleanup(vdev, &vdev->req_notifier, "req_notifier", 0);
|
||||
|
||||
vdev->req_enabled = false;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue