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

[Xen-devel] [RFC PATCH] xen/arm: GICv3 support for domU



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

Update libxl tool for arm64 to generate GICv3 device
tree node for domU.

This patch is only for verifying DomU boot on hardware
with GICv3 support and hardcodes GICv3 node information
for DomU. Clean implementation is required using
domctl

Signed-off-by: Vijaya Kumar K <Vijaya.Kumar@xxxxxxxxxxxxxxxxxx>
---
 tools/libxl/libxl_arm.c       |   15 ++++++++++-----
 xen/arch/arm/gic-v3.c         |   11 ++++++++++-
 xen/include/public/arch-arm.h |    8 ++++++++
 3 files changed, 28 insertions(+), 6 deletions(-)

diff --git a/tools/libxl/libxl_arm.c b/tools/libxl/libxl_arm.c
index e19e2f4..c801c56 100644
--- a/tools/libxl/libxl_arm.c
+++ b/tools/libxl/libxl_arm.c
@@ -317,9 +317,8 @@ static int make_intc_node(libxl__gc *gc, void *fdt,
     res = fdt_begin_node(fdt, name);
     if (res) return res;
 
-    res = fdt_property_compat(gc, fdt, 2,
-                              "arm,cortex-a15-gic",
-                              "arm,cortex-a9-gic");
+    res = fdt_property_compat(gc, fdt, 1,
+                              "arm,gic-v3");
     if (res) return res;
 
 
@@ -332,6 +331,12 @@ static int make_intc_node(libxl__gc *gc, void *fdt,
     res = fdt_property(fdt, "interrupt-controller", NULL, 0);
     if (res) return res;
 
+    res = fdt_property_cell(fdt, "redistributor-stride", 
GUEST_GICV3_RDIST_STRIDE);
+    if (res) return res;
+
+    res = fdt_property_cell(fdt, "#redistributor-regions", 
GUEST_GICV3_RDIST_REGIONS);
+    if (res) return res;
+
     res = fdt_property_regs(gc, fdt, ROOT_ADDRESS_CELLS, ROOT_SIZE_CELLS,
                             2,
                             gicd_base, gicd_size,
@@ -521,8 +526,8 @@ next_resize:
 
         FDT( make_memory_nodes(gc, fdt, dom) );
         FDT( make_intc_node(gc, fdt,
-                            GUEST_GICD_BASE, GUEST_GICD_SIZE,
-                            GUEST_GICC_BASE, GUEST_GICD_SIZE) );
+                            GUEST_GICV3_GICD_BASE, GUEST_GICV3_GICD_SIZE,
+                            GUEST_GICV3_GICR_BASE, GUEST_GICV3_GICR_SIZE) );
 
         FDT( make_timer_node(gc, fdt, ainfo) );
         FDT( make_hypervisor_node(gc, fdt, vers) );
diff --git a/xen/arch/arm/gic-v3.c b/xen/arch/arm/gic-v3.c
index 9291a7a..d00561b 100644
--- a/xen/arch/arm/gic-v3.c
+++ b/xen/arch/arm/gic-v3.c
@@ -906,7 +906,16 @@ static int gicv_v3_init(struct domain *d)
         d->arch.vgic.rdist_count = gicv3.rdist_count;
     }
     else
-        d->arch.vgic.dbase = GUEST_GICD_BASE;
+    {
+        d->arch.vgic.dbase = GUEST_GICV3_GICD_BASE;
+        d->arch.vgic.dbase_size = GUEST_GICV3_GICD_SIZE;
+
+        d->arch.vgic.rbase[0] = GUEST_GICV3_GICR_BASE;
+        d->arch.vgic.rbase_size[0] = GUEST_GICV3_GICR_SIZE;
+        d->arch.vgic.rdist_stride = GUEST_GICV3_RDIST_STRIDE;
+        /* XXX: Only one Re-distributor region mapped for guest */
+        d->arch.vgic.rdist_count = GUEST_GICV3_RDIST_REGIONS;
+    }
 
     d->arch.vgic.nr_lines = 0;
 
diff --git a/xen/include/public/arch-arm.h b/xen/include/public/arch-arm.h
index ac54cd6..c7c12e0 100644
--- a/xen/include/public/arch-arm.h
+++ b/xen/include/public/arch-arm.h
@@ -369,6 +369,14 @@ typedef uint64_t xen_callback_t;
 #define GUEST_GICC_BASE   0x03002000ULL
 #define GUEST_GICC_SIZE   0x00000100ULL
 
+/* GICv3 address space */
+#define GUEST_GICV3_GICD_BASE     0x03001000ULL
+#define GUEST_GICV3_GICD_SIZE     0x10000ULL
+#define GUEST_GICV3_GICR_BASE     0x03020000ULL
+#define GUEST_GICV3_GICR_SIZE     0x200000ULL
+#define GUEST_GICV3_RDIST_STRIDE  0x20000ULL
+#define GUEST_GICV3_RDIST_REGIONS 0x1ULL
+
 /* 16MB == 4096 pages reserved for guest to use as a region to map its
  * grant table in.
  */
-- 
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®.