diff options
| author | Steve Sistare <steven.sistare@oracle.com> | 2025-07-16 11:06:08 -0700 |
|---|---|---|
| committer | Cédric Le Goater <clg@redhat.com> | 2025-08-09 00:06:48 +0200 |
| commit | 76cfb87f5fcad4008359e44bf37508c265da1221 (patch) | |
| tree | 8608e6a773ed748e01e9a010ab8597416da51678 /hw/vfio/pci.c | |
| parent | a74434580e1051bff12ab5eee5586058295c497f (diff) | |
| download | focaccia-qemu-76cfb87f5fcad4008359e44bf37508c265da1221.tar.gz focaccia-qemu-76cfb87f5fcad4008359e44bf37508c265da1221.zip | |
vfio/pci: augment set_handler
Extend vfio_pci_msi_set_handler() so it can set or clear the handler. Add a similar accessor for INTx. 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/1752689169-233452-2-git-send-email-steven.sistare@oracle.com Signed-off-by: Cédric Le Goater <clg@redhat.com>
Diffstat (limited to 'hw/vfio/pci.c')
| -rw-r--r-- | hw/vfio/pci.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c index 4fa692c1a3..4cd6894ca8 100644 --- a/hw/vfio/pci.c +++ b/hw/vfio/pci.c @@ -413,6 +413,14 @@ bool vfio_pci_intx_enable(VFIOPCIDevice *vdev, Error **errp) return vfio_intx_enable(vdev, errp); } +void vfio_pci_intx_set_handler(VFIOPCIDevice *vdev, bool enable) +{ + int fd = event_notifier_get_fd(&vdev->intx.interrupt); + IOHandler *handler = (enable ? vfio_intx_interrupt : NULL); + + qemu_set_fd_handler(fd, handler, NULL, vdev); +} + /* * MSI/X */ @@ -451,12 +459,13 @@ static void vfio_msi_interrupt(void *opaque) notify(&vdev->pdev, nr); } -void vfio_pci_msi_set_handler(VFIOPCIDevice *vdev, int nr) +void vfio_pci_msi_set_handler(VFIOPCIDevice *vdev, int nr, bool enable) { VFIOMSIVector *vector = &vdev->msi_vectors[nr]; int fd = event_notifier_get_fd(&vector->interrupt); + IOHandler *handler = (enable ? vfio_msi_interrupt : NULL); - qemu_set_fd_handler(fd, vfio_msi_interrupt, NULL, vector); + qemu_set_fd_handler(fd, handler, NULL, vector); } /* |