The name should reflect that this is an x86-only function. And it is a
PCI service, implemented in x86/pci.c. Thus the prototype rather belongs
into asm/pci.h.

Signed-off-by: Jan Kiszka <[email protected]>
---
 hypervisor/arch/x86/include/asm/apic.h |  4 ----
 hypervisor/arch/x86/include/asm/pci.h  |  5 +++++
 hypervisor/arch/x86/pci.c              | 10 +++++-----
 hypervisor/ivshmem.c                   |  3 ++-
 4 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/hypervisor/arch/x86/include/asm/apic.h 
b/hypervisor/arch/x86/include/asm/apic.h
index 27a4eef..cfff890 100644
--- a/hypervisor/arch/x86/include/asm/apic.h
+++ b/hypervisor/arch/x86/include/asm/apic.h
@@ -172,9 +172,5 @@ void x2apic_handle_read(void);
 
 u32 x2apic_filter_logical_dest(struct cell *cell, u32 destination);
 
-struct apic_irq_message
-pci_translate_msi_vector(struct pci_device *device, unsigned int vector,
-                        unsigned int legacy_vectors, union x86_msi_vector msi);
-
 /** @} */
 #endif /* !_JAILHOUSE_ASM_APIC_H */
diff --git a/hypervisor/arch/x86/include/asm/pci.h 
b/hypervisor/arch/x86/include/asm/pci.h
index 0458e4d..5d0c95c 100644
--- a/hypervisor/arch/x86/include/asm/pci.h
+++ b/hypervisor/arch/x86/include/asm/pci.h
@@ -15,6 +15,7 @@
 #define _JAILHOUSE_ASM_PCI_H
 
 #include <jailhouse/types.h>
+#include <asm/apic.h>
 
 /* --- PCI configuration ports --- */
 #define PCI_REG_ADDR_PORT              0xcf8
@@ -33,5 +34,9 @@
 
 int x86_pci_config_handler(u16 port, bool dir_in, unsigned int size);
 
+struct apic_irq_message
+x86_pci_translate_msi(struct pci_device *device, unsigned int vector,
+                     unsigned int legacy_vectors, union x86_msi_vector msi);
+
 /** @} */
 #endif /* !_JAILHOUSE_ASM_PCI_H */
diff --git a/hypervisor/arch/x86/pci.c b/hypervisor/arch/x86/pci.c
index c2b54ff..cd22742 100644
--- a/hypervisor/arch/x86/pci.c
+++ b/hypervisor/arch/x86/pci.c
@@ -242,8 +242,8 @@ static union x86_msi_vector pci_get_x86_msi_vector(struct 
pci_device *device)
  * @return an IRQ messages data structure
  */
 struct apic_irq_message
-pci_translate_msi_vector(struct pci_device *device, unsigned int vector,
-                        unsigned int legacy_vectors, union x86_msi_vector msi)
+x86_pci_translate_msi(struct pci_device *device, unsigned int vector,
+                     unsigned int legacy_vectors, union x86_msi_vector msi)
 {
        struct apic_irq_message irq_msg = { .valid = 0 };
        unsigned int idx;
@@ -304,7 +304,7 @@ void arch_pci_suppress_msi(struct pci_device *device,
         */
        msi = pci_get_x86_msi_vector(device);
        for (n = 0; n < vectors; n++) {
-               irq_msg = pci_translate_msi_vector(device, n, vectors, msi);
+               irq_msg = x86_pci_translate_msi(device, n, vectors, msi);
                if (irq_msg.valid)
                        apic_send_irq(irq_msg);
        }
@@ -337,7 +337,7 @@ int arch_pci_update_msi(struct pci_device *device,
                return 0;
 
        for (n = 0; n < vectors; n++) {
-               irq_msg = pci_translate_msi_vector(device, n, vectors, msi);
+               irq_msg = x86_pci_translate_msi(device, n, vectors, msi);
                result = iommu_map_interrupt(device->cell, bdf, n, irq_msg);
                // HACK for QEMU
                if (result == -ENOSYS) {
@@ -376,7 +376,7 @@ int arch_pci_update_msix_vector(struct pci_device *device, 
unsigned int index)
            device->msix_vectors[index].masked)
                return 0;
 
-       irq_msg = pci_translate_msi_vector(device, index, 0, msi);
+       irq_msg = x86_pci_translate_msi(device, index, 0, msi);
        result = iommu_map_interrupt(device->cell, device->info->bdf, index,
                                     irq_msg);
        // HACK for QEMU
diff --git a/hypervisor/ivshmem.c b/hypervisor/ivshmem.c
index a480ab5..cd4b6c1 100644
--- a/hypervisor/ivshmem.c
+++ b/hypervisor/ivshmem.c
@@ -26,6 +26,7 @@
 #include <jailhouse/string.h>
 #include <jailhouse/utils.h>
 #include <jailhouse/processor.h>
+#include <asm/pci.h>
 
 #define VIRTIO_VENDOR_ID       0x1af4
 #define IVSHMEM_DEVICE_ID      0x1110
@@ -168,7 +169,7 @@ int ivshmem_update_msix(struct pci_device *device)
        if (ivshmem_is_msix_masked(ive))
                return 0;
 
-       irq_msg = pci_translate_msi_vector(device, 0, 0, msi);
+       irq_msg = x86_pci_translate_msi(device, 0, 0, msi);
        if (!irq_msg.valid)
                return 0;
 
-- 
2.1.4

-- 
You received this message because you are subscribed to the Google Groups 
"Jailhouse" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to