This adds the required stubs and functions of physical PCI support on
ARM and ARM64. It also switches to building the generic PCI and ivshmem
modules unconditionally for all archs. Mapping the MMCONFIG space will
require a larger remapping region, so this is extended on both ARM and
ARM64.

This does not yet initialize PCI for the new archs, though. Moreover,
ivshmem interrupt delivery is not yet implemented.

Signed-off-by: Jan Kiszka <[email protected]>
---
 hypervisor/Makefile                              |  2 +-
 hypervisor/arch/arm-common/Kbuild                |  2 +-
 hypervisor/arch/arm-common/include/asm/ivshmem.h | 19 +++++++
 hypervisor/arch/arm-common/ivshmem.c             | 22 ++++++++
 hypervisor/arch/arm-common/pci.c                 | 65 ++++++++++++++++++++++++
 hypervisor/arch/arm/include/asm/paging.h         |  2 +-
 hypervisor/arch/arm/mmio.c                       |  1 +
 hypervisor/arch/arm64/include/asm/paging.h       |  2 +-
 hypervisor/arch/x86/Kbuild                       |  3 +-
 9 files changed, 112 insertions(+), 6 deletions(-)
 create mode 100644 hypervisor/arch/arm-common/include/asm/ivshmem.h
 create mode 100644 hypervisor/arch/arm-common/ivshmem.c
 create mode 100644 hypervisor/arch/arm-common/pci.c

diff --git a/hypervisor/Makefile b/hypervisor/Makefile
index e7ad925..5139991 100644
--- a/hypervisor/Makefile
+++ b/hypervisor/Makefile
@@ -30,7 +30,7 @@ ifneq ($(wildcard $(obj)/include/jailhouse/config.h),)
 KBUILD_CFLAGS += -include $(obj)/include/jailhouse/config.h
 endif
 
-CORE_OBJECTS = setup.o printk.o paging.o control.o lib.o mmio.o
+CORE_OBJECTS = setup.o printk.o paging.o control.o lib.o mmio.o pci.o ivshmem.o
 
 define filechk_config_mk
 (                                                                      \
diff --git a/hypervisor/arch/arm-common/Kbuild 
b/hypervisor/arch/arm-common/Kbuild
index bf23f57..b6930ae 100644
--- a/hypervisor/arch/arm-common/Kbuild
+++ b/hypervisor/arch/arm-common/Kbuild
@@ -13,7 +13,7 @@
 include $(CONFIG_MK)
 
 OBJS-y += dbg-write.o lib.o psci.o control.o paging.o mmu_cell.o
-OBJS-y += irqchip.o gic-common.o
+OBJS-y += irqchip.o gic-common.o pci.o ivshmem.o
 OBJS-$(CONFIG_ARM_GIC_V2) += gic-v2.o
 OBJS-$(CONFIG_SERIAL_8250) += uart-8250.o
 OBJS-$(CONFIG_SERIAL_AMBA_PL011) += uart-pl011.o
diff --git a/hypervisor/arch/arm-common/include/asm/ivshmem.h 
b/hypervisor/arch/arm-common/include/asm/ivshmem.h
new file mode 100644
index 0000000..a03ec0a
--- /dev/null
+++ b/hypervisor/arch/arm-common/include/asm/ivshmem.h
@@ -0,0 +1,19 @@
+/*
+ * Jailhouse, a Linux-based partitioning hypervisor
+ *
+ * Copyright (c) Siemens AG, 2016
+ *
+ * Authors:
+ *  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_ASM_IVSHMEM_H
+#define _JAILHOUSE_ASM_IVSHMEM_H
+
+struct arch_pci_ivshmem {
+};
+
+#endif /* !_JAILHOUSE_ASM_IVSHMEM_H */
diff --git a/hypervisor/arch/arm-common/ivshmem.c 
b/hypervisor/arch/arm-common/ivshmem.c
new file mode 100644
index 0000000..188e972
--- /dev/null
+++ b/hypervisor/arch/arm-common/ivshmem.c
@@ -0,0 +1,22 @@
+/*
+ * Jailhouse, a Linux-based partitioning hypervisor
+ *
+ * Copyright (c) Siemens AG, 2016
+ *
+ * Author:
+ *  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.
+ */
+
+#include <jailhouse/ivshmem.h>
+
+void arch_ivshmem_write_doorbell(struct ivshmem_endpoint *ive)
+{
+}
+
+int arch_ivshmem_update_msix(struct pci_device *device)
+{
+       return 0;
+}
diff --git a/hypervisor/arch/arm-common/pci.c b/hypervisor/arch/arm-common/pci.c
new file mode 100644
index 0000000..b9841c8
--- /dev/null
+++ b/hypervisor/arch/arm-common/pci.c
@@ -0,0 +1,65 @@
+/*
+ * Jailhouse, a Linux-based partitioning hypervisor
+ *
+ * Copyright (c) Siemens AG, 2016
+ *
+ * Authors:
+ *  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.
+ */
+
+#include <jailhouse/mmio.h>
+#include <jailhouse/pci.h>
+
+u32 arch_pci_read_config(u16 bdf, u16 address, unsigned int size)
+{
+       return -1;
+}
+
+void arch_pci_write_config(u16 bdf, u16 address, u32 value, unsigned int size)
+{
+}
+
+int arch_pci_add_physical_device(struct cell *cell, struct pci_device *device)
+{
+       return 0;
+}
+
+void arch_pci_remove_physical_device(struct pci_device *device)
+{
+}
+
+void arch_pci_suppress_msi(struct pci_device *device,
+                          const struct jailhouse_pci_capability *cap)
+{
+}
+
+int arch_pci_update_msi(struct pci_device *device,
+                       const struct jailhouse_pci_capability *cap)
+{
+       const struct jailhouse_pci_device *info = device->info;
+       unsigned int n;
+
+       /*
+        * NOTE: We don't have interrupt remapping yet. So we write the values
+        * the cell passed without modifications. Probably not safe on all
+        * platforms.
+        */
+       for (n = 1; n < (info->msi_64bits ? 4 : 3); n++)
+               pci_write_config(info->bdf, cap->start + n * 4,
+                                device->msi_registers.raw[n], 4);
+
+       return 0;
+}
+
+int arch_pci_update_msix_vector(struct pci_device *device, unsigned int index)
+{
+       /* NOTE: See arch_pci_update_msi. */
+       mmio_write64(&device->msix_table[index].address,
+                    device->msix_vectors[index].address);
+       mmio_write32(&device->msix_table[index].data,
+                    device->msix_vectors[index].data);
+       return 0;
+}
diff --git a/hypervisor/arch/arm/include/asm/paging.h 
b/hypervisor/arch/arm/include/asm/paging.h
index d43ad43..e6116a2 100644
--- a/hypervisor/arch/arm/include/asm/paging.h
+++ b/hypervisor/arch/arm/include/asm/paging.h
@@ -164,7 +164,7 @@
 #define INVALID_PHYS_ADDR      (~0UL)
 
 #define REMAP_BASE             0x00100000UL
-#define NUM_REMAP_BITMAP_PAGES 1
+#define NUM_REMAP_BITMAP_PAGES 4
 
 #define NUM_TEMPORARY_PAGES    16
 
diff --git a/hypervisor/arch/arm/mmio.c b/hypervisor/arch/arm/mmio.c
index eccba8d..b3f7669 100644
--- a/hypervisor/arch/arm/mmio.c
+++ b/hypervisor/arch/arm/mmio.c
@@ -11,6 +11,7 @@
  */
 
 #include <jailhouse/mmio.h>
+#include <jailhouse/pci.h>
 #include <jailhouse/printk.h>
 #include <asm/bitops.h>
 #include <asm/irqchip.h>
diff --git a/hypervisor/arch/arm64/include/asm/paging.h 
b/hypervisor/arch/arm64/include/asm/paging.h
index ee74ce2..1d2ff06 100644
--- a/hypervisor/arch/arm64/include/asm/paging.h
+++ b/hypervisor/arch/arm64/include/asm/paging.h
@@ -164,7 +164,7 @@
 #define JAILHOUSE_BASE         0xffffc0200000
 
 #define REMAP_BASE             0x00100000UL
-#define NUM_REMAP_BITMAP_PAGES 1
+#define NUM_REMAP_BITMAP_PAGES 4
 
 #define NUM_TEMPORARY_PAGES    16
 
diff --git a/hypervisor/arch/x86/Kbuild b/hypervisor/arch/x86/Kbuild
index 8fe595f..99c75e8 100644
--- a/hypervisor/arch/x86/Kbuild
+++ b/hypervisor/arch/x86/Kbuild
@@ -14,8 +14,7 @@
 
 BUILT_IN_OBJECTS := built-in-amd.o built-in-intel.o
 COMMON_OBJECTS := apic.o dbg-write.o entry.o setup.o control.o mmio.o iommu.o \
-                 paging.o ../../pci.o pci.o ioapic.o i8042.o vcpu.o \
-                 uart.o vga.o ../../ivshmem.o ivshmem.o
+                 paging.o pci.o ioapic.o i8042.o vcpu.o uart.o vga.o ivshmem.o
 
 always := $(BUILT_IN_OBJECTS)
 
-- 
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