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

[Xen-devel] [PATCH v4 17/17] xen/arm: ITS: Add pci devices in ThunderX



From: Vijaya Kumar K <Vijaya.Kumar@xxxxxxxxxxxxxxxxxx>

ITS initialization required for all PCI devices in
ThunderX platform are done by calling from specific
mapping function.

This patch can be reverted once XEN PCI passthrough
framework for arm64 is in available.

For now all the PCI devices are assigned to Dom0

Signed-off-by: Vijaya Kumar K <Vijaya.Kumar@xxxxxxxxxxxxxxxxxx>
---
 xen/arch/arm/platforms/thunderx.c |   77 +++++++++++++++++++++++++++++++++++++
 1 file changed, 77 insertions(+)

diff --git a/xen/arch/arm/platforms/thunderx.c 
b/xen/arch/arm/platforms/thunderx.c
index be6f24f..6bd21d2 100644
--- a/xen/arch/arm/platforms/thunderx.c
+++ b/xen/arch/arm/platforms/thunderx.c
@@ -18,6 +18,82 @@
  */
 
 #include <asm/platform.h>
+#include <asm/gic-its.h>
+
+struct pci_dev_list 
+{
+   uint32_t seg;
+   uint32_t bus;
+   uint32_t dev;
+   uint32_t func;
+};
+
+#define NUM_DEVIDS   39
+
+static struct pci_dev_list bdf[NUM_DEVIDS] =
+{
+    {0, 0, 2, 0}, /* 1 */
+    {0, 0, 6, 0},
+    {0, 0, 7, 0},
+    {0, 0, 10, 0},
+    {0, 0, 11, 0},
+    {0, 1, 0, 0},
+    {0, 1, 0, 1},
+    {0, 1, 0, 5},
+    {0, 1, 1, 4},
+    {0, 1, 9, 0}, /* 10 */
+    {0, 1, 9, 1},
+    {0, 1, 9, 2},
+    {0, 1, 9, 3},
+    {0, 1, 9, 4},
+    {0, 1, 9, 5},
+    {0, 1, 10, 0},
+    {0, 1, 10, 1},
+    {0, 1, 10, 2},
+    {0, 1, 10, 3},
+    {0, 1, 14, 0}, /* 20 */
+    {0, 1, 14, 2},
+    {0, 1, 14, 4},
+    {0, 1, 16, 0},
+    {0, 1, 16, 1},
+    {0, 2, 0, 0},
+    {0, 3, 0, 0},
+    {0, 4, 0, 0},
+    {1, 0, 8, 0},
+    {1, 0, 9, 0},
+    {1, 0, 10, 0},  /* 30 */
+    {1, 0, 11, 0},
+    {2, 0, 1, 0},
+    {2, 0, 2, 0},
+    {2, 0, 3, 0},
+    {2, 1, 0, 0},
+    {2, 1, 0, 1},
+    {2, 1, 0, 2},
+    {2, 1, 0, 3},
+    {3, 0, 1, 0}, /* 39 */
+};
+
+#define BDF_TO_DEVID(seg, bus, dev, func) (seg << 16 | bus << 8 | dev << 3| 
func)
+
+/* TODO: add and assign devices using PCI framework */
+static int thunderx_specific_mapping(struct domain *d)
+{
+    uint32_t devid, i;
+    int res;
+
+    for ( i = 0; i < NUM_DEVIDS; i++ )
+    {
+        devid = BDF_TO_DEVID(bdf[i].seg, bdf[i].bus,bdf[i].dev, bdf[i].func);
+        res = its_add_device(devid);
+        if ( res )
+            return res;
+        res = its_assign_device(d, devid, devid);
+        if ( res )
+            return res;
+    }
+
+    return 0;
+}
 
 static const char * const thunderx_dt_compat[] __initconst =
 {
@@ -27,6 +103,7 @@ static const char * const thunderx_dt_compat[] __initconst =
 
 PLATFORM_START(thunderx, "THUNDERX")
     .compatible = thunderx_dt_compat,
+    .specific_mapping = thunderx_specific_mapping,
     .dom0_gnttab_start = 0x40000000000,
     .dom0_gnttab_size = 0x20000,
 PLATFORM_END
-- 
1.7.9.5


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

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