Skip to contentSkip to conversation

xen/arm: GICv3 support for domU

RFC PATCH In review [email protected] 3 participants 7 messages Aug 20, 2014 – Sep 22, 2014

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 xen/arm: GICv3 support for domU

From: Vijaya Kumar K <[email protected]>

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

---
 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(-)
tools/libxl/libxl_arm.c +10 -5
index e19e2f4..c801c56 100644
@@ -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) );
xen/arch/arm/gic-v3.c +10 -1
index 9291a7a..d00561b 100644
@@ -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;
 
xen/include/public/arch-arm.h +8 -0
index ac54cd6..c7c12e0 100644
@@ -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.
  */
Signature · 1 line
1.7.9.5
#1 lore raw

Hi Vijay,

Quoted 9 lines · On 20/08/14 03:09, [email protected] wrote:

From: Vijaya Kumar K <[email protected]>

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

Thank you for this patch. Do you plan to send a clean implementation soon?

Regards,

Signature · 1 line
Julien Grall
#2 lore raw

Hi Julien,

Quoted 9 lines · Julien Grall

Hi Vijay,

Quoted 6 lines · On 20/08/14 03:09, [email protected] wrote:

From: Vijaya Kumar K <[email protected]>

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

Quoted 7 lines
Quoted 4 lines

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

Thank you for this patch. Do you plan to send a clean implementation soon?

I plan to implemented generic gicv2/gicv3 dt node
based on your patch "xen/dts: Add hypercalls to retrieve device node information"
to read gic device compatibility.

#3 lore raw

Hi Julien,

Quoted 18 lines · Vijay Kilari

Hi Julien,

Quoted 15 lines · Julien Grall

Hi Vijay,

Quoted 10 lines · On 20/08/14 03:09, [email protected] wrote:

From: Vijaya Kumar K <[email protected]>

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

Quoted 6 lines
Quoted 1 line

Thank you for this patch. Do you plan to send a clean implementation soon?

I plan to implemented generic gicv2/gicv3 dt node
based on your patch "xen/dts: Add hypercalls to retrieve device node information"
to read gic device compatibility.

Your patch "xen/dts: Add hypercalls to retrieve device node information" always relies on full node patch to read device node information.

But in some cases, like GIC we don't have full patch. Here we need to fetch node information like compatibility and other properties like number of re-distributor regions, re-distributor offset etc., from node name.

So new set of hypercalls which take node name instead of path is required.

Regards
Vijay

#4 lore raw

Hello Vijay,

Quoted 26 lines · Vijay Kilari
Quoted 18 lines · Vijay Kilari

Hi Julien,

Quoted 15 lines · Julien Grall

Hi Vijay,

Quoted 10 lines · On 20/08/14 03:09, [email protected] wrote:

From: Vijaya Kumar K <[email protected]>

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

Quoted 6 lines
Quoted 1 line

Thank you for this patch. Do you plan to send a clean implementation soon?

I plan to implemented generic gicv2/gicv3 dt node
based on your patch "xen/dts: Add hypercalls to retrieve device node information"
to read gic device compatibility.

Quoted 8 lines

Your patch "xen/dts: Add hypercalls to retrieve device node information" always relies on full node patch to read device node information.

But in some cases, like GIC we don't have full patch. Here we need to fetch node information like compatibility and other properties like number of re-distributor regions, re-distributor offset etc., from node name.

So new set of hypercalls which take node name instead of path is required.

I guess when you said "patch", you meant "path", right?

Why do you need to get those information? You should define yourself the regions of the GICv3 in the guest layout and not relying on the host DT.

In anycase, using the name of the node would be be broken as it could be duplicated and it's not standardize.

Lastly, I don't plan to keep the patch "xen/dts: Add hypercalls to retrieve device node information" in my series. See the discussion on the cover letter.

Regards,

Signature · 1 line
Julien Grall
#5 lore raw
Quoted 32 lines · Julien Grall

Hello Vijay,

Quoted 29 lines · Vijay Kilari
Quoted 18 lines · Vijay Kilari

Hi Julien,

Quoted 15 lines · Julien Grall

Hi Vijay,

Quoted 10 lines · On 20/08/14 03:09, [email protected] wrote:

From: Vijaya Kumar K <[email protected]>

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

Quoted 6 lines
Quoted 1 line

Thank you for this patch. Do you plan to send a clean implementation soon?

I plan to implemented generic gicv2/gicv3 dt node
based on your patch "xen/dts: Add hypercalls to retrieve device node information"
to read gic device compatibility.

Your patch "xen/dts: Add hypercalls to retrieve device node information" always relies on full node patch to read device node information.

Quoted 7 lines
Quoted 5 lines

But in some cases, like GIC we don't have full patch. Here we need to fetch node information like compatibility and other properties like number of re-distributor regions, re-distributor offset etc., from node name.

So new set of hypercalls which take node name instead of path is required.

I guess when you said "patch", you meant "path", right?

Yes path

Quoted 3 lines

Why do you need to get those information? You should define yourself the regions of the GICv3 in the guest layout and not relying on the host DT.

In make_intc_node() in llibxl_arm.c the compatibility and mmio regions are hardcoded to GICv2. So to make it GICv3 I think of two options

1) Generate GIC node for domU that host DT supports.
With this approach I thought of using the hypercalls that you have created.
2) Parse domU config file and generate GIC accordingly?

Regards
Vijay

#6 lore raw
Quoted 9 lines · Vijay Kilari
Quoted 2 lines

Why do you need to get those information? You should define yourself the regions of the GICv3 in the guest layout and not relying on the host DT.

In make_intc_node() in llibxl_arm.c the compatibility and mmio regions are hardcoded to GICv2. So to make it GICv3 I think of two options

1) Generate GIC node for domU that host DT supports.
With this approach I thought of using the hypercalls that you have created.
2) Parse domU config file and generate GIC accordingly?

You should do 2, but with the default (v2 vs v3) set based on what the host supports (i.e. it's two or three-ness, not the actual properties/addresses which should be made up for the virtual platform not the host).

Ian.