Export various MSI functions, for use by CPR in subsequent patches. No functional change.
Signed-off-by: Steve Sistare <steven.sist...@oracle.com> --- hw/vfio/pci.c | 21 ++++++++++----------- hw/vfio/pci.h | 12 ++++++++++++ 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c index fd51b9e..29a5b3d 100644 --- a/hw/vfio/pci.c +++ b/hw/vfio/pci.c @@ -277,7 +277,7 @@ static void vfio_irqchip_change(Notifier *notify, void *data) vfio_intx_update(vdev, &vdev->intx.route); } -static bool vfio_intx_enable(VFIOPCIDevice *vdev, Error **errp) +bool vfio_intx_enable(VFIOPCIDevice *vdev, Error **errp) { uint8_t pin = vfio_pci_read_config(&vdev->pdev, PCI_INTERRUPT_PIN, 1); Error *err = NULL; @@ -351,7 +351,7 @@ static void vfio_intx_disable(VFIOPCIDevice *vdev) /* * MSI/X */ -static void vfio_msi_interrupt(void *opaque) +void vfio_msi_interrupt(void *opaque) { VFIOMSIVector *vector = opaque; VFIOPCIDevice *vdev = vector->vdev; @@ -474,8 +474,8 @@ static int vfio_enable_vectors(VFIOPCIDevice *vdev, bool msix) return ret; } -static void vfio_add_kvm_msi_virq(VFIOPCIDevice *vdev, VFIOMSIVector *vector, - int vector_n, bool msix) +void vfio_add_kvm_msi_virq(VFIOPCIDevice *vdev, VFIOMSIVector *vector, + int vector_n, bool msix) { if ((msix && vdev->no_kvm_msix) || (!msix && vdev->no_kvm_msi)) { return; @@ -529,7 +529,7 @@ static void vfio_update_kvm_msi_virq(VFIOMSIVector *vector, MSIMessage msg, kvm_irqchip_commit_routes(kvm_state); } -static void vfio_vector_init(VFIOPCIDevice *vdev, int nr) +void vfio_vector_init(VFIOPCIDevice *vdev, int nr) { VFIOMSIVector *vector = &vdev->msi_vectors[nr]; PCIDevice *pdev = &vdev->pdev; @@ -640,13 +640,12 @@ static int vfio_msix_vector_do_use(PCIDevice *pdev, unsigned int nr, return 0; } -static int vfio_msix_vector_use(PCIDevice *pdev, - unsigned int nr, MSIMessage msg) +int vfio_msix_vector_use(PCIDevice *pdev, unsigned int nr, MSIMessage msg) { return vfio_msix_vector_do_use(pdev, nr, &msg, vfio_msi_interrupt); } -static void vfio_msix_vector_release(PCIDevice *pdev, unsigned int nr) +void vfio_msix_vector_release(PCIDevice *pdev, unsigned int nr) { VFIOPCIDevice *vdev = VFIO_PCI(pdev); VFIOMSIVector *vector = &vdev->msi_vectors[nr]; @@ -673,14 +672,14 @@ static void vfio_msix_vector_release(PCIDevice *pdev, unsigned int nr) } } -static void vfio_prepare_kvm_msi_virq_batch(VFIOPCIDevice *vdev) +void vfio_prepare_kvm_msi_virq_batch(VFIOPCIDevice *vdev) { assert(!vdev->defer_kvm_irq_routing); vdev->defer_kvm_irq_routing = true; vfio_route_change = kvm_irqchip_begin_route_changes(kvm_state); } -static void vfio_commit_kvm_msi_virq_batch(VFIOPCIDevice *vdev) +void vfio_commit_kvm_msi_virq_batch(VFIOPCIDevice *vdev) { int i; @@ -2587,7 +2586,7 @@ static Object *vfio_pci_get_object(VFIODevice *vbasedev) return OBJECT(vdev); } -static bool vfio_msix_present(void *opaque, int version_id) +bool vfio_msix_present(void *opaque, int version_id) { PCIDevice *pdev = opaque; diff --git a/hw/vfio/pci.h b/hw/vfio/pci.h index 43c1666..49faf57 100644 --- a/hw/vfio/pci.h +++ b/hw/vfio/pci.h @@ -197,6 +197,18 @@ static inline bool vfio_is_vga(VFIOPCIDevice *vdev) return class == PCI_CLASS_DISPLAY_VGA; } +/* MSI/MSI-X/INTx */ +void vfio_vector_init(VFIOPCIDevice *vdev, int nr); +void vfio_msi_interrupt(void *opaque); +void vfio_add_kvm_msi_virq(VFIOPCIDevice *vdev, VFIOMSIVector *vector, + int vector_n, bool msix); +int vfio_msix_vector_use(PCIDevice *pdev, unsigned int nr, MSIMessage msg); +void vfio_msix_vector_release(PCIDevice *pdev, unsigned int nr); +bool vfio_msix_present(void *opaque, int version_id); +void vfio_prepare_kvm_msi_virq_batch(VFIOPCIDevice *vdev); +void vfio_commit_kvm_msi_virq_batch(VFIOPCIDevice *vdev); +bool vfio_intx_enable(VFIOPCIDevice *vdev, Error **errp); + uint32_t vfio_pci_read_config(PCIDevice *pdev, uint32_t addr, int len); void vfio_pci_write_config(PCIDevice *pdev, uint32_t addr, uint32_t val, int len); -- 1.8.3.1