From c2559182c88ab997727e0f4ef2c0f7faeb24d5a9 Mon Sep 17 00:00:00 2001 From: Steve Sistare Date: Tue, 10 Jun 2025 08:39:28 -0700 Subject: [PATCH] vfio/pci: vfio_notifier_init cpr parameters MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Pass vdev and nr to vfio_notifier_init, for use by CPR in a subsequent patch. No functional change. Signed-off-by: Steve Sistare Reviewed-by: Cédric Le Goater Link: https://lore.kernel.org/qemu-devel/1749569991-25171-16-git-send-email-steven.sistare@oracle.com Signed-off-by: Cédric Le Goater --- hw/vfio/pci.c | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c index 1d22c41efb..9ee36da626 100644 --- a/hw/vfio/pci.c +++ b/hw/vfio/pci.c @@ -57,7 +57,8 @@ static void vfio_disable_interrupts(VFIOPCIDevice *vdev); static void vfio_mmap_set_enabled(VFIOPCIDevice *vdev, bool enabled); static void vfio_msi_disable_common(VFIOPCIDevice *vdev); -static bool vfio_notifier_init(EventNotifier *e, const char *name, Error **errp) +static bool vfio_notifier_init(VFIOPCIDevice *vdev, EventNotifier *e, + const char *name, int nr, Error **errp) { int ret = event_notifier_init(e, 0); @@ -147,7 +148,7 @@ static bool vfio_intx_enable_kvm(VFIOPCIDevice *vdev, Error **errp) pci_irq_deassert(&vdev->pdev); /* Get an eventfd for resample/unmask */ - if (!vfio_notifier_init(&vdev->intx.unmask, "intx-unmask", errp)) { + if (!vfio_notifier_init(vdev, &vdev->intx.unmask, "intx-unmask", 0, errp)) { goto fail; } @@ -300,7 +301,8 @@ static bool vfio_intx_enable(VFIOPCIDevice *vdev, Error **errp) } #endif - if (!vfio_notifier_init(&vdev->intx.interrupt, "intx-interrupt", errp)) { + if (!vfio_notifier_init(vdev, &vdev->intx.interrupt, "intx-interrupt", 0, + errp)) { return false; } fd = event_notifier_get_fd(&vdev->intx.interrupt); @@ -486,7 +488,8 @@ static void vfio_connect_kvm_msi_virq(VFIOMSIVector *vector, int nr) return; } - if (!vfio_notifier_init(&vector->kvm_interrupt, name, NULL)) { + if (!vfio_notifier_init(vector->vdev, &vector->kvm_interrupt, name, nr, + NULL)) { goto fail_notifier; } @@ -544,12 +547,13 @@ static void vfio_pci_vector_init(VFIOPCIDevice *vdev, int nr) { VFIOMSIVector *vector = &vdev->msi_vectors[nr]; PCIDevice *pdev = &vdev->pdev; - Error *err = NULL; + Error *local_err = NULL; vector->vdev = vdev; vector->virq = -1; - if (!vfio_notifier_init(&vector->interrupt, "interrupt", &err)) { - error_report_err(err); + if (!vfio_notifier_init(vdev, &vector->interrupt, "interrupt", nr, + &local_err)) { + error_report_err(local_err); } vector->use = true; if (vdev->interrupt == VFIO_INT_MSIX) { @@ -765,14 +769,15 @@ retry: for (i = 0; i < vdev->nr_vectors; i++) { VFIOMSIVector *vector = &vdev->msi_vectors[i]; - Error *err = NULL; + Error *local_err = NULL; vector->vdev = vdev; vector->virq = -1; vector->use = true; - if (!vfio_notifier_init(&vector->interrupt, "interrupt", &err)) { - error_report_err(err); + if (!vfio_notifier_init(vdev, &vector->interrupt, "interrupt", i, + &local_err)) { + error_report_err(local_err); } qemu_set_fd_handler(event_notifier_get_fd(&vector->interrupt), @@ -2939,7 +2944,8 @@ void vfio_pci_register_err_notifier(VFIOPCIDevice *vdev) return; } - if (!vfio_notifier_init(&vdev->err_notifier, "err_notifier", &err)) { + if (!vfio_notifier_init(vdev, &vdev->err_notifier, "err_notifier", 0, + &err)) { error_report_err(err); vdev->pci_aer = false; return; @@ -3006,7 +3012,8 @@ void vfio_pci_register_req_notifier(VFIOPCIDevice *vdev) return; } - if (!vfio_notifier_init(&vdev->req_notifier, "req_notifier", &err)) { + if (!vfio_notifier_init(vdev, &vdev->req_notifier, "req_notifier", 0, + &err)) { error_report_err(err); return; } -- 2.39.5