mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 15:53:54 -06:00
vfio/pci: vfio_pci_vector_init
Extract a subroutine vfio_pci_vector_init. 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-13-git-send-email-steven.sistare@oracle.com Signed-off-by: Cédric Le Goater <clg@redhat.com>
This commit is contained in:
parent
031fbb7110
commit
906f524ef1
1 changed files with 17 additions and 7 deletions
|
@ -531,6 +531,22 @@ static void set_irq_signalling(VFIODevice *vbasedev, VFIOMSIVector *vector,
|
|||
}
|
||||
}
|
||||
|
||||
static void vfio_pci_vector_init(VFIOPCIDevice *vdev, int nr)
|
||||
{
|
||||
VFIOMSIVector *vector = &vdev->msi_vectors[nr];
|
||||
PCIDevice *pdev = &vdev->pdev;
|
||||
|
||||
vector->vdev = vdev;
|
||||
vector->virq = -1;
|
||||
if (event_notifier_init(&vector->interrupt, 0)) {
|
||||
error_report("vfio: Error: event_notifier_init failed");
|
||||
}
|
||||
vector->use = true;
|
||||
if (vdev->interrupt == VFIO_INT_MSIX) {
|
||||
msix_vector_use(pdev, nr);
|
||||
}
|
||||
}
|
||||
|
||||
static int vfio_msix_vector_do_use(PCIDevice *pdev, unsigned int nr,
|
||||
MSIMessage *msg, IOHandler *handler)
|
||||
{
|
||||
|
@ -544,13 +560,7 @@ static int vfio_msix_vector_do_use(PCIDevice *pdev, unsigned int nr,
|
|||
vector = &vdev->msi_vectors[nr];
|
||||
|
||||
if (!vector->use) {
|
||||
vector->vdev = vdev;
|
||||
vector->virq = -1;
|
||||
if (event_notifier_init(&vector->interrupt, 0)) {
|
||||
error_report("vfio: Error: event_notifier_init failed");
|
||||
}
|
||||
vector->use = true;
|
||||
msix_vector_use(pdev, nr);
|
||||
vfio_pci_vector_init(vdev, nr);
|
||||
}
|
||||
|
||||
qemu_set_fd_handler(event_notifier_get_fd(&vector->interrupt),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue