[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[RFC PATCH v1 2/5] xen/public: arch-arm: reserve resources for virtio-pci



From: Oleksandr Tyshchenko <oleksandr_tyshchenko@xxxxxxxx>

In order to enable more use-cases such as having multiple
device-models (Qemu) running in different backend domains which provide
virtio-pci devices for the same guest, we allocate and expose one
PCI host bridge for every virtio backend domain for that guest.

For that purpose we reserve separate virtio-pci resources (memory and SPI range
for Legacy PCI interrupts) for up to 8 possible PCI host bridges
(to be aligned with MAX_NR_IOREQ_SERVERS) and allocate one host bridge per
backend domain. We'll need at most 32 interrupts (INTA..INTD legacy PCI
interrupts per each of 8 host bridges), and at most 32MB of memory
(since as it was observed virtio-pci devices use up to 16KB each, this can
be different for physical PCI devices ofc).

The details of PCI host bridge (including its host_id)
are to be written to dedicated Xenstore node for the device-model to retrieve.

Signed-off-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@xxxxxxxx>
Signed-off-by: Sergiy Kibrik <Sergiy_Kibrik@xxxxxxxx>
---
 xen/include/public/arch-arm.h | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/xen/include/public/arch-arm.h b/xen/include/public/arch-arm.h
index a25e87dbda..caa4e92b55 100644
--- a/xen/include/public/arch-arm.h
+++ b/xen/include/public/arch-arm.h
@@ -466,6 +466,28 @@ typedef uint64_t xen_callback_t;
 #define GUEST_VPCI_MEM_ADDR                 xen_mk_ullong(0x23000000)
 #define GUEST_VPCI_MEM_SIZE                 xen_mk_ullong(0x10000000)
 
+/*
+ * 8 MB is reserved for virtio-pci configuration space based on calculation
+ * 8 bridges x 32 devices x 8 functions x 4 KB = 8 MB
+ */
+#define GUEST_VIRTIO_PCI_ECAM_BASE          xen_mk_ullong(0x33000000)
+#define GUEST_VIRTIO_PCI_TOTAL_ECAM_SIZE    xen_mk_ullong(0x00800000)
+#define GUEST_VIRTIO_PCI_HOST_ECAM_SIZE     xen_mk_ullong(0x00100000)
+
+/* 32 MB is reserved for virtio-pci memory based on calculation
+ * 8 bridges x 32 devices x 8 functions x 16 KB per virtio-pci device = 32 MB
+ */
+#define GUEST_VIRTIO_PCI_ADDR_TYPE_MEM    xen_mk_ullong(0x02000000)
+#define GUEST_VIRTIO_PCI_MEM_ADDR         xen_mk_ullong(0x33800000)
+#define GUEST_VIRTIO_PCI_MEM_SIZE         xen_mk_ullong(0x02000000)
+
+/* 32 MB is reserved for virtio-pci Prefetch memory based on calculation
+ * 8 bridges x 32 devices x 8 functions x 16 KB per virtio-pci device = 32 MB
+ */
+#define GUEST_VIRTIO_PCI_ADDR_TYPE_PREFETCH_MEM    xen_mk_ullong(0x42000000)
+#define GUEST_VIRTIO_PCI_PREFETCH_MEM_ADDR         xen_mk_ullong(0x35800000)
+#define GUEST_VIRTIO_PCI_PREFETCH_MEM_SIZE         xen_mk_ullong(0x02000000)
+
 /*
  * 16MB == 4096 pages reserved for guest to use as a region to map its
  * grant table in.
@@ -515,6 +537,10 @@ typedef uint64_t xen_callback_t;
 #define GUEST_VIRTIO_MMIO_SPI_FIRST   33
 #define GUEST_VIRTIO_MMIO_SPI_LAST    43
 
+/* 8 bridges x 4 #INTA..#INTD interrupts = 32 SPIs to reserve for virtio-pci */
+#define GUEST_VIRTIO_PCI_SPI_FIRST   44
+#define GUEST_VIRTIO_PCI_SPI_LAST    76
+
 /* PSCI functions */
 #define PSCI_cpu_suspend 0
 #define PSCI_cpu_off     1
-- 
2.25.1




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.