mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-07 01:33:56 -06:00
vfio/pci: vfio_notifier_init cpr parameters
Pass vdev and nr to vfio_notifier_init, for use by CPR in a subsequent patch. 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-16-git-send-email-steven.sistare@oracle.com Signed-off-by: Cédric Le Goater <clg@redhat.com>
This commit is contained in:
parent
d364d802fe
commit
c2559182c8
1 changed files with 19 additions and 12 deletions
|
@ -57,7 +57,8 @@ static void vfio_disable_interrupts(VFIOPCIDevice *vdev);
|
||||||
static void vfio_mmap_set_enabled(VFIOPCIDevice *vdev, bool enabled);
|
static void vfio_mmap_set_enabled(VFIOPCIDevice *vdev, bool enabled);
|
||||||
static void vfio_msi_disable_common(VFIOPCIDevice *vdev);
|
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);
|
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);
|
pci_irq_deassert(&vdev->pdev);
|
||||||
|
|
||||||
/* Get an eventfd for resample/unmask */
|
/* 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;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -300,7 +301,8 @@ static bool vfio_intx_enable(VFIOPCIDevice *vdev, Error **errp)
|
||||||
}
|
}
|
||||||
#endif
|
#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;
|
return false;
|
||||||
}
|
}
|
||||||
fd = event_notifier_get_fd(&vdev->intx.interrupt);
|
fd = event_notifier_get_fd(&vdev->intx.interrupt);
|
||||||
|
@ -486,7 +488,8 @@ static void vfio_connect_kvm_msi_virq(VFIOMSIVector *vector, int nr)
|
||||||
return;
|
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;
|
goto fail_notifier;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -544,12 +547,13 @@ static void vfio_pci_vector_init(VFIOPCIDevice *vdev, int nr)
|
||||||
{
|
{
|
||||||
VFIOMSIVector *vector = &vdev->msi_vectors[nr];
|
VFIOMSIVector *vector = &vdev->msi_vectors[nr];
|
||||||
PCIDevice *pdev = &vdev->pdev;
|
PCIDevice *pdev = &vdev->pdev;
|
||||||
Error *err = NULL;
|
Error *local_err = NULL;
|
||||||
|
|
||||||
vector->vdev = vdev;
|
vector->vdev = vdev;
|
||||||
vector->virq = -1;
|
vector->virq = -1;
|
||||||
if (!vfio_notifier_init(&vector->interrupt, "interrupt", &err)) {
|
if (!vfio_notifier_init(vdev, &vector->interrupt, "interrupt", nr,
|
||||||
error_report_err(err);
|
&local_err)) {
|
||||||
|
error_report_err(local_err);
|
||||||
}
|
}
|
||||||
vector->use = true;
|
vector->use = true;
|
||||||
if (vdev->interrupt == VFIO_INT_MSIX) {
|
if (vdev->interrupt == VFIO_INT_MSIX) {
|
||||||
|
@ -765,14 +769,15 @@ retry:
|
||||||
|
|
||||||
for (i = 0; i < vdev->nr_vectors; i++) {
|
for (i = 0; i < vdev->nr_vectors; i++) {
|
||||||
VFIOMSIVector *vector = &vdev->msi_vectors[i];
|
VFIOMSIVector *vector = &vdev->msi_vectors[i];
|
||||||
Error *err = NULL;
|
Error *local_err = NULL;
|
||||||
|
|
||||||
vector->vdev = vdev;
|
vector->vdev = vdev;
|
||||||
vector->virq = -1;
|
vector->virq = -1;
|
||||||
vector->use = true;
|
vector->use = true;
|
||||||
|
|
||||||
if (!vfio_notifier_init(&vector->interrupt, "interrupt", &err)) {
|
if (!vfio_notifier_init(vdev, &vector->interrupt, "interrupt", i,
|
||||||
error_report_err(err);
|
&local_err)) {
|
||||||
|
error_report_err(local_err);
|
||||||
}
|
}
|
||||||
|
|
||||||
qemu_set_fd_handler(event_notifier_get_fd(&vector->interrupt),
|
qemu_set_fd_handler(event_notifier_get_fd(&vector->interrupt),
|
||||||
|
@ -2939,7 +2944,8 @@ void vfio_pci_register_err_notifier(VFIOPCIDevice *vdev)
|
||||||
return;
|
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);
|
error_report_err(err);
|
||||||
vdev->pci_aer = false;
|
vdev->pci_aer = false;
|
||||||
return;
|
return;
|
||||||
|
@ -3006,7 +3012,8 @@ void vfio_pci_register_req_notifier(VFIOPCIDevice *vdev)
|
||||||
return;
|
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);
|
error_report_err(err);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue