Stop piggybacking with PCI for ivshmem-specific prototypes. This will
help making non-x86 support for ivshmem cleaner.

We already move the struct pci_ivshmem_endpoint into the header because
the arch-specific code will need it.

Signed-off-by: Jan Kiszka <[email protected]>
---
 hypervisor/arch/x86/vtd.c              |  1 +
 hypervisor/include/jailhouse/ivshmem.h | 48 ++++++++++++++++++++++++++++++++++
 hypervisor/include/jailhouse/pci.h     | 12 ---------
 hypervisor/pci.c                       |  1 +
 hypervisor/pci_ivshmem.c               | 16 +-----------
 5 files changed, 51 insertions(+), 27 deletions(-)
 create mode 100644 hypervisor/include/jailhouse/ivshmem.h

diff --git a/hypervisor/arch/x86/vtd.c b/hypervisor/arch/x86/vtd.c
index 55435f0..fa23f19 100644
--- a/hypervisor/arch/x86/vtd.c
+++ b/hypervisor/arch/x86/vtd.c
@@ -13,6 +13,7 @@
  */
 
 #include <jailhouse/control.h>
+#include <jailhouse/ivshmem.h>
 #include <jailhouse/mmio.h>
 #include <jailhouse/paging.h>
 #include <jailhouse/pci.h>
diff --git a/hypervisor/include/jailhouse/ivshmem.h 
b/hypervisor/include/jailhouse/ivshmem.h
new file mode 100644
index 0000000..265a561
--- /dev/null
+++ b/hypervisor/include/jailhouse/ivshmem.h
@@ -0,0 +1,48 @@
+/*
+ * Jailhouse, a Linux-based partitioning hypervisor
+ *
+ * Copyright (c) Siemens AG, 2014-2016
+ *
+ * Authors:
+ *  Henning Schild <[email protected]>
+ *  Jan Kiszka <[email protected]>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2.  See
+ * the COPYING file in the top-level directory.
+ */
+
+#ifndef _JAILHOUSE_IVSHMEM_H
+#define _JAILHOUSE_IVSHMEM_H
+
+#include <jailhouse/pci.h>
+#include <asm/apic.h>
+
+#define IVSHMEM_CFG_MSIX_CAP   0x50
+#define IVSHMEM_CFG_SIZE       (IVSHMEM_CFG_MSIX_CAP + 12)
+
+/**
+ * @defgroup PCI-IVSHMEM ivshmem
+ * @{
+ */
+
+struct pci_ivshmem_endpoint {
+       u32 cspace[IVSHMEM_CFG_SIZE / sizeof(u32)];
+       u32 ivpos;
+       u32 state;
+       u64 bar0_address;
+       u64 bar4_address;
+       struct pci_device *device;
+       struct pci_ivshmem_endpoint *remote;
+       struct apic_irq_message irq_msg;
+};
+
+int pci_ivshmem_init(struct cell *cell, struct pci_device *device);
+void pci_ivshmem_exit(struct pci_device *device);
+int pci_ivshmem_update_msix(struct pci_device *device);
+enum pci_access pci_ivshmem_cfg_write(struct pci_device *device,
+                                     unsigned int row, u32 mask, u32 value);
+enum pci_access pci_ivshmem_cfg_read(struct pci_device *device, u16 address,
+                                    u32 *value);
+
+/** @} PCI-IVSHMEM */
+#endif /* !_JAILHOUSE_IVSHMEM_H */
diff --git a/hypervisor/include/jailhouse/pci.h 
b/hypervisor/include/jailhouse/pci.h
index fef8dc2..027875c 100644
--- a/hypervisor/include/jailhouse/pci.h
+++ b/hypervisor/include/jailhouse/pci.h
@@ -243,17 +243,5 @@ int arch_pci_update_msi(struct pci_device *device,
  */
 int arch_pci_update_msix_vector(struct pci_device *device, unsigned int index);
 
-/**
- * @defgroup PCI-IVSHMEM ivshmem
- * @{
- */
-int pci_ivshmem_init(struct cell *cell, struct pci_device *device);
-void pci_ivshmem_exit(struct pci_device *device);
-int pci_ivshmem_update_msix(struct pci_device *device);
-enum pci_access pci_ivshmem_cfg_write(struct pci_device *device,
-                                     unsigned int row, u32 mask, u32 value);
-enum pci_access pci_ivshmem_cfg_read(struct pci_device *device, u16 address,
-                                    u32 *value);
-/** @} PCI-IVSHMEM */
 /** @} PCI */
 #endif /* !_JAILHOUSE_PCI_H */
diff --git a/hypervisor/pci.c b/hypervisor/pci.c
index b80cf5e..d11d9c3 100644
--- a/hypervisor/pci.c
+++ b/hypervisor/pci.c
@@ -12,6 +12,7 @@
  */
 
 #include <jailhouse/control.h>
+#include <jailhouse/ivshmem.h>
 #include <jailhouse/mmio.h>
 #include <jailhouse/pci.h>
 #include <jailhouse/printk.h>
diff --git a/hypervisor/pci_ivshmem.c b/hypervisor/pci_ivshmem.c
index 9d75b00..22cdbc7 100644
--- a/hypervisor/pci_ivshmem.c
+++ b/hypervisor/pci_ivshmem.c
@@ -19,13 +19,13 @@
  * choosing the same BDF, memory location, and memory size.
  */
 
+#include <jailhouse/ivshmem.h>
 #include <jailhouse/mmio.h>
 #include <jailhouse/pci.h>
 #include <jailhouse/printk.h>
 #include <jailhouse/string.h>
 #include <jailhouse/utils.h>
 #include <jailhouse/processor.h>
-#include <asm/apic.h>
 
 #define VIRTIO_VENDOR_ID       0x1af4
 #define IVSHMEM_DEVICE_ID      0x1110
@@ -37,29 +37,15 @@
 #define IVSHMEM_CFG_SHMEM_SZ   0x48
 
 #define IVSHMEM_MSIX_VECTORS   1
-#define IVSHMEM_CFG_MSIX_CAP   0x50
 
 #define IVSHMEM_REG_IVPOS      8
 #define IVSHMEM_REG_DBELL      12
 #define IVSHMEM_REG_LSTATE     16
 #define IVSHMEM_REG_RSTATE     20
 
-#define IVSHMEM_CFG_SIZE       (IVSHMEM_CFG_MSIX_CAP + 12)
-
 #define IVSHMEM_BAR0_SIZE      256
 #define IVSHMEM_BAR4_SIZE      ((0x18 * IVSHMEM_MSIX_VECTORS + 0xf) & ~0xf)
 
-struct pci_ivshmem_endpoint {
-       u32 cspace[IVSHMEM_CFG_SIZE / sizeof(u32)];
-       u32 ivpos;
-       u32 state;
-       u64 bar0_address;
-       u64 bar4_address;
-       struct pci_device *device;
-       struct pci_ivshmem_endpoint *remote;
-       struct apic_irq_message irq_msg;
-};
-
 struct pci_ivshmem_data {
        struct pci_ivshmem_endpoint eps[2];
        struct pci_ivshmem_data *next;
-- 
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