Skip to contentSkip to conversation

xen/arm: Add support for GICv3 for domU

RFC PATCH In review [email protected] 4 participants 12 messages Oct 6, 2014 – Oct 29, 2014

lore
Share & tools
lore
#0 lore raw

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

From: Vijaya Kumar K <[email protected]>

With this patch gic version can be specified in cfg file. If no gic version is specified, xl tool queries host supported gic version and generate gic dt node accordingly.
Ex: If gic_version is 3, gic dt node for GICv3 is generated.

Specify gic version in cfg as 'gic_version = <version>'

This patch is based on Julien's non-pci passthrough patch series.

---
v2: - Used domainconfigure domctl to fetch gic version
- domainconfigure return error if gic version is not compatible
- Remove register data parameters in make_intc_node() and add pass gic version as parameter

---
 tools/libxc/include/xenctrl.h |    2 +-
 tools/libxc/xc_domain.c       |   10 +++++--
 tools/libxl/libxl_arm.c       |   60 ++++++++++++++++++++++++++++++-----------
 tools/libxl/libxl_types.idl   |    1 +
 tools/libxl/xl_cmdimpl.c      |    3 +++
 xen/arch/arm/domctl.c         |   33 +++++++++++++++++++++--
 xen/arch/arm/gic-v3.c         |   13 ++++++---
 xen/include/public/arch-arm.h |    8 ++++++
 xen/include/public/domctl.h   |    2 ++
 9 files changed, 108 insertions(+), 24 deletions(-)
tools/libxc/include/xenctrl.h +1 -1
index 51cba70..56fe74c 100644
@@ -484,7 +484,7 @@ int xc_domain_create(xc_interface *xch,
 
 #if defined(__arm__) || defined(__aarch64__)
 int xc_domain_configure(xc_interface *xch, uint32_t domid,
-                        uint32_t nr_spis);
+                        uint32_t nr_spis, uint32_t *gic_version);
 #endif
 
 /* Functions to produce a dump of a given domain
tools/libxc/xc_domain.c +8 -2
index a55b5a8..b96c178 100644
@@ -50,13 +50,19 @@ int xc_domain_create(xc_interface *xch,
 
 #if defined(__arm__) || defined(__arch64__)
 int xc_domain_configure(xc_interface *xch, uint32_t domid,
-                        uint32_t nr_spis)
+                        uint32_t nr_spis, uint32_t *version)
 {
+    int err;
     DECLARE_DOMCTL;
+
     domctl.cmd = XEN_DOMCTL_configure_domain;
     domctl.domain = (domid_t)domid;
     domctl.u.configuredomain.nr_spis = nr_spis;
-    return do_domctl(xch, &domctl);
+    domctl.u.configuredomain.gic_version = *version;
+    if ( (err = do_domctl(xch, &domctl)) != 0 )
+        return err;
+    *version = domctl.u.configuredomain.gic_version;
+    return 0;
 }
 #endif
 
tools/libxl/libxl_arm.c +44 -16

100 lines not on this page · raw message

tools/libxl/libxl_types.idl +1 -0
index 7d9eec2..8f3f074 100644
@@ -349,6 +349,7 @@ libxl_domain_build_info = Struct("domain_build_info",[
     ("disable_migrate", libxl_defbool),
     ("cpuid",           libxl_cpuid_policy_list),
     ("blkdev_start",    string),
+    ("gic_version",     uint32),
     
     ("device_model_version", libxl_device_model_version),
     ("device_model_stubdomain", libxl_defbool),
tools/libxl/xl_cmdimpl.c +3 -0
index 2ec17ca..5fcb396 100644
@@ -1523,6 +1523,9 @@ skip_vfb:
     if (!xlu_cfg_get_long (config, "pci_seize", &l, 0))
         pci_seize = l;
 
+    if (!xlu_cfg_get_long (config, "gic_version", &l, 0))
+        b_info->gic_version = l;
+
     /* To be reworked (automatically enabled) once the auto ballooning
      * after guest starts is done (with PCI devices passed in). */
     if (c_info->type == LIBXL_DOMAIN_TYPE_PV) {
xen/arch/arm/domctl.c +31 -2
index 370dd99..1bea026 100644
@@ -10,6 +10,8 @@
 #include <xen/errno.h>
 #include <xen/sched.h>
 #include <xen/hypercall.h>
+#include <asm/gic.h>
+#include <xen/guest_access.h>
 #include <public/domctl.h>
 
 long arch_do_domctl(struct xen_domctl *domctl, struct domain *d,
@@ -39,9 +41,36 @@ long arch_do_domctl(struct xen_domctl *domctl, struct domain *d,
         if ( domctl->u.configuredomain.nr_spis > (gic_number_lines() - 32) )
             return -EINVAL;
 
-        return domain_configure_vgic(d, domctl->u.configuredomain.nr_spis);
-    }
+        if ( domain_configure_vgic(d, domctl->u.configuredomain.nr_spis) )
+            return -EINVAL;
 
+        switch ( gic_hw_version() )
+        {
+#ifdef CONFIG_ARM_64
+        case GIC_V3:
+            if ( domctl->u.configuredomain.gic_version == 0 )
+            {
+                domctl->u.configuredomain.gic_version = 3;
+                return __copy_to_guest(u_domctl, domctl, 1);
+            }
+            /* XXX: Support only v3 gic emulation */
+            if ( domctl->u.configuredomain.gic_version != 3 )
+                return -EINVAL;
+            break;
+#endif
+        case GIC_V2:
+            if ( domctl->u.configuredomain.gic_version == 0 )
+            {
+                domctl->u.configuredomain.gic_version = 2;
+                return __copy_to_guest(u_domctl, domctl, 1);
+            }
+            if ( domctl->u.configuredomain.gic_version != 2 )
+                return -EINVAL;
+            break;
+        default:
+            return -EINVAL;
+        }
+    }
     default:
     {
         int rc;
xen/arch/arm/gic-v3.c +10 -1
index 9bdda32..059b60e 100644
@@ -907,9 +907,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;
+
+        /* XXX: Only one Re-distributor region mapped for guest */
+        d->arch.vgic.rdist_count = 1;
+        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;
+    }
 
     return 0;
 }
xen/include/public/arch-arm.h +8 -0
index cebb349..6f80c99 100644
@@ -363,6 +363,14 @@ typedef uint64_t xen_callback_t;
  * should instead use the FDT.
  */
 
+/* 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
+
 /* Physical Address Space */
 #define GUEST_GICD_BASE   0x03001000ULL
 #define GUEST_GICD_SIZE   0x00001000ULL
xen/include/public/domctl.h +2 -0
index 8adb8e2..502cfb6 100644
@@ -73,6 +73,8 @@ DEFINE_XEN_GUEST_HANDLE(xen_domctl_createdomain_t);
 struct xen_domctl_configuredomain {
     /* IN parameters */
     uint32_t nr_spis;
+    /* IN/OUT parameter */
+    uint32_t gic_version;
 };
 typedef struct xen_domctl_configuredomain xen_domctl_configuredomain_t;
 DEFINE_XEN_GUEST_HANDLE(xen_domctl_configuredomain_t);
Signature · 1 line
1.7.9.5
#1 lore raw
Quoted 7 lines · On Mon, 6 Oct 2014, [email protected] wrote:

From: Vijaya Kumar K <[email protected]>

With this patch gic version can be specified in cfg file. If no gic version is specified, xl tool queries host supported gic version and generate gic dt node accordingly.
Ex: If gic_version is 3, gic dt node for GICv3 is generated.

Quoted 6 lines

Specify gic version in cfg as 'gic_version = <version>'

This patch is based on Julien's non-pci passthrough patch series.

The patch looks all right.

Quoted 181 lines

v2: - Used domainconfigure domctl to fetch gic version
- domainconfigure return error if gic version is not compatible
- Remove register data parameters in make_intc_node() and add pass gic version as parameter

---
 tools/libxc/include/xenctrl.h |    2 +-
 tools/libxc/xc_domain.c       |   10 +++++--
 tools/libxl/libxl_arm.c       |   60 ++++++++++++++++++++++++++++++-----------
 tools/libxl/libxl_types.idl   |    1 +
 tools/libxl/xl_cmdimpl.c      |    3 +++
 xen/arch/arm/domctl.c         |   33 +++++++++++++++++++++--
 xen/arch/arm/gic-v3.c         |   13 ++++++---
 xen/include/public/arch-arm.h |    8 ++++++
 xen/include/public/domctl.h   |    2 ++
 9 files changed, 108 insertions(+), 24 deletions(-)
tools/libxc/include/xenctrl.h +1 -1
index 51cba70..56fe74c 100644
@@ -484,7 +484,7 @@ int xc_domain_create(xc_interface *xch,
 
 #if defined(__arm__) || defined(__aarch64__)
 int xc_domain_configure(xc_interface *xch, uint32_t domid,
-                        uint32_t nr_spis);
+                        uint32_t nr_spis, uint32_t *gic_version);
 #endif
 
 /* Functions to produce a dump of a given domain
tools/libxc/xc_domain.c +8 -2
index a55b5a8..b96c178 100644
@@ -50,13 +50,19 @@ int xc_domain_create(xc_interface *xch,
 
 #if defined(__arm__) || defined(__arch64__)
 int xc_domain_configure(xc_interface *xch, uint32_t domid,
-                        uint32_t nr_spis)
+                        uint32_t nr_spis, uint32_t *version)
 {
+    int err;
     DECLARE_DOMCTL;
+
     domctl.cmd = XEN_DOMCTL_configure_domain;
     domctl.domain = (domid_t)domid;
     domctl.u.configuredomain.nr_spis = nr_spis;
-    return do_domctl(xch, &domctl);
+    domctl.u.configuredomain.gic_version = *version;
+    if ( (err = do_domctl(xch, &domctl)) != 0 )
+        return err;
+    *version = domctl.u.configuredomain.gic_version;
+    return 0;
 }
 #endif
 
tools/libxl/libxl_arm.c +44 -16
index 9605953..8475d1e 100644
@@ -29,6 +29,7 @@ int libxl__arch_domain_create_pre(libxl__gc *gc, libxl_domain_config *d_config,
 {
     int dev_index;
     uint32_t nr_spis = 0;
+    uint32_t gic_version = d_config->b_info.gic_version;
 
     for (dev_index = 0; dev_index < d_config->num_dtdevs; dev_index++)
         nr_spis += state->dtdevs_info[dev_index].num_irqs;
@@ -37,10 +38,14 @@ int libxl__arch_domain_create_pre(libxl__gc *gc, libxl_domain_config *d_config,
 
     LOG(DEBUG, "Allocate %u SPIs\n", nr_spis);
 
-    if (xc_domain_configure(CTX->xch, domid, nr_spis) != 0) {
+    if (xc_domain_configure(CTX->xch, domid, nr_spis, &gic_version) != 0) {
         LOG(ERROR, "Couldn't configure the domain");
         return ERROR_FAIL;
     }
+    LOG(DEBUG, "Specified GIC version %d GIC version supported %d\n",
+               d_config->b_info.gic_version, gic_version);
+
+    d_config->b_info.gic_version = gic_version;
 
     return 0;
 }
@@ -382,19 +387,26 @@ static int make_memory_nodes(libxl__gc *gc, void *fdt,
     return 0;
 }
 
-static int make_intc_node(libxl__gc *gc, void *fdt,
-                          uint64_t gicd_base, uint64_t gicd_size,
-                          uint64_t gicc_base, uint64_t gicc_size)
+static int make_intc_node(libxl__gc *gc, void *fdt, int version)
 {
     int res;
-    const char *name = GCSPRINTF("interrupt-controller@%"PRIx64, gicd_base);
+    const char *name;
+
+    if (version == 3)
+        name = GCSPRINTF("interrupt-controller@%"PRIx64, (uint64_t)GUEST_GICV3_GICD_BASE);
+    else
+        name = GCSPRINTF("interrupt-controller@%"PRIx64, (uint64_t)GUEST_GICD_BASE);
 
     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");
+    if (version == 3)
+        res = fdt_property_compat(gc, fdt, 1,
+                                  "arm,gic-v3");
+    else
+        res = fdt_property_compat(gc, fdt, 2,
+                                  "arm,cortex-a15-gic",
+                                  "arm,cortex-a9-gic");
     if (res) return res;
 
 
@@ -407,11 +419,29 @@ 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_regs(gc, fdt, ROOT_ADDRESS_CELLS, ROOT_SIZE_CELLS,
-                            2,
-                            gicd_base, gicd_size,
-                            gicc_base, gicc_size);
-    if (res) return res;
+    if (version == 3) {
+        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,
+                                GUEST_GICV3_GICD_BASE, GUEST_GICV3_GICD_SIZE,
+                                GUEST_GICV3_GICR_BASE, GUEST_GICV3_GICR_SIZE);
+        if (res) return res;
+    }
+    else
+    {
+        res = fdt_property_regs(gc, fdt, ROOT_ADDRESS_CELLS, ROOT_SIZE_CELLS,
+                                2,
+                                GUEST_GICD_BASE, GUEST_GICD_SIZE,
+                                GUEST_GICC_BASE, GUEST_GICD_SIZE);
+        if (res) return res;
+    }
 
     res = fdt_property_cell(fdt, "linux,phandle", PHANDLE_GIC);
     if (res) return res;
@@ -662,10 +692,8 @@ next_resize:
         FDT( make_psci_node(gc, fdt) );
 
         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) );
 
+        FDT( make_intc_node(gc, fdt, info->gic_version) );
         FDT( make_timer_node(gc, fdt, ainfo) );
         FDT( make_hypervisor_node(gc, fdt, vers) );
 
tools/libxl/libxl_types.idl +1 -0
index 7d9eec2..8f3f074 100644
@@ -349,6 +349,7 @@ libxl_domain_build_info = Struct("domain_build_info",[
     ("disable_migrate", libxl_defbool),
     ("cpuid",           libxl_cpuid_policy_list),
     ("blkdev_start",    string),
+    ("gic_version",     uint32),
 
     ("device_model_version", libxl_device_model_version),
     ("device_model_stubdomain", libxl_defbool),
tools/libxl/xl_cmdimpl.c +0 -0
index 2ec17ca..5fcb396 100644

tools/libxl/xl_cmdimpl.c skip_vfb: · line 1531

Quoted 9 lines
tools/libxl/xl_cmdimpl.c +3 -0
@@ -1523,6 +1523,9 @@ skip_vfb:
     if (!xlu_cfg_get_long (config, "pci_seize", &l, 0))
         pci_seize = l;
 
+    if (!xlu_cfg_get_long (config, "gic_version", &l, 0))
+        b_info->gic_version = l;
+
     /* To be reworked (automatically enabled) once the auto ballooning
      * after guest starts is done (with PCI devices passed in). */
     if (c_info->type == LIBXL_DOMAIN_TYPE_PV) {

We really need to start having a concept of arch-specific options for xl. For example we don't want to parse "viridian" on ARM and we don't want to parse "gic_version" on x86. However we don't have this concept at the moment and this patch is targeting 4.5, so let's leave it as is for now.

Quoted 22 lines
xen/arch/arm/domctl.c +4 -2
index 370dd99..1bea026 100644
@@ -10,6 +10,8 @@
 #include <xen/errno.h>
 #include <xen/sched.h>
 #include <xen/hypercall.h>
+#include <asm/gic.h>
+#include <xen/guest_access.h>
 #include <public/domctl.h>
 
 long arch_do_domctl(struct xen_domctl *domctl, struct domain *d,
@@ -39,9 +41,36 @@ long arch_do_domctl(struct xen_domctl *domctl, struct domain *d,
         if ( domctl->u.configuredomain.nr_spis > (gic_number_lines() - 32) )
             return -EINVAL;
 
-        return domain_configure_vgic(d, domctl->u.configuredomain.nr_spis);
-    }
+        if ( domain_configure_vgic(d, domctl->u.configuredomain.nr_spis) )
+            return -EINVAL;
 

xen/arch/arm/domctl.c long arch_do_domctl(struct xen_domctl *domctl, struct domain *d, · line 56

Quoted 10 lines
xen/arch/arm/domctl.c +10 -0
+        switch ( gic_hw_version() )
+        {
+#ifdef CONFIG_ARM_64
+        case GIC_V3:
+            if ( domctl->u.configuredomain.gic_version == 0 )
+            {
+                domctl->u.configuredomain.gic_version = 3;
+                return __copy_to_guest(u_domctl, domctl, 1);
+            }
+            /* XXX: Support only v3 gic emulation */

It is worth printing out this warning I think

Quoted 77 lines
xen/arch/arm/domctl.c +17 -0
+            if ( domctl->u.configuredomain.gic_version != 3 )
+                return -EINVAL;
+            break;
+#endif
+        case GIC_V2:
+            if ( domctl->u.configuredomain.gic_version == 0 )
+            {
+                domctl->u.configuredomain.gic_version = 2;
+                return __copy_to_guest(u_domctl, domctl, 1);
+            }
+            if ( domctl->u.configuredomain.gic_version != 2 )
+                return -EINVAL;
+            break;
+        default:
+            return -EINVAL;
+        }
+    }
     default:
     {
         int rc;
xen/arch/arm/gic-v3.c +10 -1
index 9bdda32..059b60e 100644
@@ -907,9 +907,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;
+
+        /* XXX: Only one Re-distributor region mapped for guest */
+        d->arch.vgic.rdist_count = 1;
+        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;
+    }
 
     return 0;
 }
xen/include/public/arch-arm.h +8 -0
index cebb349..6f80c99 100644
@@ -363,6 +363,14 @@ typedef uint64_t xen_callback_t;
  * should instead use the FDT.
  */
 
+/* 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
+
 /* Physical Address Space */
 #define GUEST_GICD_BASE   0x03001000ULL
 #define GUEST_GICD_SIZE   0x00001000ULL
xen/include/public/domctl.h +2 -0
index 8adb8e2..502cfb6 100644
@@ -73,6 +73,8 @@ DEFINE_XEN_GUEST_HANDLE(xen_domctl_createdomain_t);
 struct xen_domctl_configuredomain {
     /* IN parameters */
     uint32_t nr_spis;
+    /* IN/OUT parameter */
+    uint32_t gic_version;
 };
 typedef struct xen_domctl_configuredomain xen_domctl_configuredomain_t;
 DEFINE_XEN_GUEST_HANDLE(xen_domctl_configuredomain_t);
Signature · 1 line
1.7.9.5
#2 lore raw
In reply to [email protected]

Hello Vijay,

tools/libxl/libxl_types.idl libxl_domain_build_info = Struct("domain_build_info",[ · line 352

Quoted 9 lines · On 10/06/2014 01:46 PM, [email protected] wrote:
tools/libxl/libxl_types.idl +1 -0
index 7d9eec2..8f3f074 100644
@@ -349,6 +349,7 @@ libxl_domain_build_info = Struct("domain_build_info",[
     ("disable_migrate", libxl_defbool),
     ("cpuid",           libxl_cpuid_policy_list),
     ("blkdev_start",    string),
+    ("gic_version",     uint32),

How would you differentiate GICv2 from GICv2m with an integer? I think an enum would be better to describe the GIC version.

tools/libxl/xl_cmdimpl.c skip_vfb: · line 1528

Quoted 11 lines
tools/libxl/xl_cmdimpl.c +3 -0
index 2ec17ca..5fcb396 100644
@@ -1523,6 +1523,9 @@ skip_vfb:
     if (!xlu_cfg_get_long (config, "pci_seize", &l, 0))
         pci_seize = l;
 
+    if (!xlu_cfg_get_long (config, "gic_version", &l, 0))
+        b_info->gic_version = l;
+

You have to document this new option in docs/man/xl.cfg.pod.5

[..]

Quoted 14 lines
xen/arch/arm/domctl.c +2 -0
index 370dd99..1bea026 100644
@@ -10,6 +10,8 @@
 #include <xen/errno.h>
 #include <xen/sched.h>
 #include <xen/hypercall.h>
+#include <asm/gic.h>
+#include <xen/guest_access.h>
 #include <public/domctl.h>
 
 long arch_do_domctl(struct xen_domctl *domctl, struct domain *d,

xen/arch/arm/domctl.c long arch_do_domctl(struct xen_domctl *domctl, struct domain *d, · line 45

Quoted 7 lines
xen/arch/arm/domctl.c +2 -2
@@ -39,9 +41,36 @@ long arch_do_domctl(struct xen_domctl *domctl, struct domain *d,
         if ( domctl->u.configuredomain.nr_spis > (gic_number_lines() - 32) )
             return -EINVAL;
 
-        return domain_configure_vgic(d, domctl->u.configuredomain.nr_spis);
-    }
+        if ( domain_configure_vgic(d, domctl->u.configuredomain.nr_spis) )
+            return -EINVAL;

domain_configure_vgic should be called after we check that current version of GIC match. The user may want to chose to emulate a GICv2 on GICv3 hardware.

Quoted 6 lines
xen/include/public/arch-arm.h +0 -0
index cebb349..6f80c99 100644
@@ -363,6 +363,14 @@ typedef uint64_t xen_callback_t;
  * should instead use the FDT.

xen/include/public/arch-arm.h typedef uint64_t xen_callback_t; · line 373

Quoted 10 lines
xen/include/public/arch-arm.h +8 -0
  */
 
+/* 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
+

This should go after "/* Physical Address Space */

xen/include/public/arch-arm.h typedef uint64_t xen_callback_t; · line 376

Quoted 3 lines
xen/include/public/arch-arm.h +0 -0
 /* Physical Address Space */
 #define GUEST_GICD_BASE   0x03001000ULL
 #define GUEST_GICD_SIZE   0x00001000ULL

Please modify those defines, along *GICC* to add GICV2 in the name.

xen/include/public/domctl.h DEFINE_XEN_GUEST_HANDLE(xen_domctl_createdomain_t); · line 77

Quoted 10 lines
xen/include/public/domctl.h +2 -0
index 8adb8e2..502cfb6 100644
@@ -73,6 +73,8 @@ DEFINE_XEN_GUEST_HANDLE(xen_domctl_createdomain_t);
 struct xen_domctl_configuredomain {
     /* IN parameters */
     uint32_t nr_spis;
+    /* IN/OUT parameter */
+    uint32_t gic_version;

uint32_t sounds a bit too much for the gic_version. Maybe a uint8_t? Also a better name would be vgic_version.

Futhermore, people reading the structure don't know what value should be expected in this field. I would introduce define to specify the different value.

Regards,

Signature · 1 line
Julien Grall
#3 lore raw

I have just realized that this patch didn't make RC1 last Friday.

What should we do about it?

Without it, I am not sure we should really claim that Xen 4.5 has GICv3 support, given that we wouldn't be able to start any guests on a GICv3 platform.

I don't think is so risky it couldn't make RC2, but that's not entirely up to me.

Quoted 106 lines · Julien Grall

Hello Vijay,

tools/libxl/libxl_types.idl libxl_domain_build_info = Struct("domain_build_info",[ · line 352

Quoted 9 lines · On 10/06/2014 01:46 PM, [email protected] wrote:
tools/libxl/libxl_types.idl +1 -0
index 7d9eec2..8f3f074 100644
@@ -349,6 +349,7 @@ libxl_domain_build_info = Struct("domain_build_info",[
     ("disable_migrate", libxl_defbool),
     ("cpuid",           libxl_cpuid_policy_list),
     ("blkdev_start",    string),
+    ("gic_version",     uint32),

How would you differentiate GICv2 from GICv2m with an integer? I think an enum would be better to describe the GIC version.

tools/libxl/xl_cmdimpl.c skip_vfb: · line 1528

Quoted 11 lines
tools/libxl/xl_cmdimpl.c +3 -0
index 2ec17ca..5fcb396 100644
@@ -1523,6 +1523,9 @@ skip_vfb:
     if (!xlu_cfg_get_long (config, "pci_seize", &l, 0))
         pci_seize = l;
 
+    if (!xlu_cfg_get_long (config, "gic_version", &l, 0))
+        b_info->gic_version = l;
+

You have to document this new option in docs/man/xl.cfg.pod.5

[..]

Quoted 14 lines
xen/arch/arm/domctl.c +2 -0
index 370dd99..1bea026 100644
@@ -10,6 +10,8 @@
 #include <xen/errno.h>
 #include <xen/sched.h>
 #include <xen/hypercall.h>
+#include <asm/gic.h>
+#include <xen/guest_access.h>
 #include <public/domctl.h>
 
 long arch_do_domctl(struct xen_domctl *domctl, struct domain *d,

xen/arch/arm/domctl.c long arch_do_domctl(struct xen_domctl *domctl, struct domain *d, · line 45

Quoted 7 lines
xen/arch/arm/domctl.c +2 -2
@@ -39,9 +41,36 @@ long arch_do_domctl(struct xen_domctl *domctl, struct domain *d,
         if ( domctl->u.configuredomain.nr_spis > (gic_number_lines() - 32) )
             return -EINVAL;
 
-        return domain_configure_vgic(d, domctl->u.configuredomain.nr_spis);
-    }
+        if ( domain_configure_vgic(d, domctl->u.configuredomain.nr_spis) )
+            return -EINVAL;

domain_configure_vgic should be called after we check that current version of GIC match. The user may want to chose to emulate a GICv2 on GICv3 hardware.

Quoted 6 lines
xen/include/public/arch-arm.h +0 -0
index cebb349..6f80c99 100644
@@ -363,6 +363,14 @@ typedef uint64_t xen_callback_t;
  * should instead use the FDT.

xen/include/public/arch-arm.h typedef uint64_t xen_callback_t; · line 373

Quoted 10 lines
xen/include/public/arch-arm.h +8 -0
  */
 
+/* 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
+

This should go after "/* Physical Address Space */

xen/include/public/arch-arm.h typedef uint64_t xen_callback_t; · line 376

Quoted 3 lines
xen/include/public/arch-arm.h +0 -0
 /* Physical Address Space */
 #define GUEST_GICD_BASE   0x03001000ULL
 #define GUEST_GICD_SIZE   0x00001000ULL

Please modify those defines, along *GICC* to add GICV2 in the name.

xen/include/public/domctl.h DEFINE_XEN_GUEST_HANDLE(xen_domctl_createdomain_t); · line 77

Quoted 10 lines
xen/include/public/domctl.h +2 -0
index 8adb8e2..502cfb6 100644
@@ -73,6 +73,8 @@ DEFINE_XEN_GUEST_HANDLE(xen_domctl_createdomain_t);
 struct xen_domctl_configuredomain {
     /* IN parameters */
     uint32_t nr_spis;
+    /* IN/OUT parameter */
+    uint32_t gic_version;

uint32_t sounds a bit too much for the gic_version. Maybe a uint8_t? Also a better name would be vgic_version.

Futhermore, people reading the structure don't know what value should be expected in this field. I would introduce define to specify the different value.

Regards,

Signature · 1 line
Julien Grall
#4 lore raw

Hi Stefano,

Quoted 1 line · Stefano Stabellini

I have just realized that this patch didn't make RC1 last Friday.

I asked for few changes: documentation, way to implement the check... but Vijay never came back with a new version.

Quoted 8 lines

What should we do about it?

Without it, I am not sure we should really claim that Xen 4.5 has GICv3 support, given that we wouldn't be able to start any guests on a GICv3 platform.

I don't think is so risky it couldn't make RC2, but that's not entirely up to me.

This patch series requires to defer the VGIC initialization later.

The patch [1] to implement this feature has been deferred to Xen 4.6 because it was only necessary to my non-pci passthrough series (which has not reached Xen 4.5 for various reasons).

I don't think this patch should go in Xen 4.5 at this stage of the release (RC1 went out last week), because it modify too much the way to initialize the domain (VGIC has been deferred). Furthermore it has been reworked in a private branch [2] to address the comments.

By side effect, the toolstack part for the GICv3 would have to be defer.

Regards,

[1] https://patches.linaro.org/34664/
[2] http://xenbits.xen.org/gitweb/?p=people/julieng/xen-unstable.git;a=commitdiff;h=002b216707ae90b669ffebf009042d5e42b26dc0;hp=30e15fa1f52aa790bf13b5f40dc62d832443846c

Quoted 107 lines · Julien Grall
Quoted 106 lines

Hello Vijay,

tools/libxl/libxl_types.idl libxl_domain_build_info = Struct("domain_build_info",[ · line 352

Quoted 9 lines · On 10/06/2014 01:46 PM, [email protected] wrote:
tools/libxl/libxl_types.idl +1 -0
index 7d9eec2..8f3f074 100644
@@ -349,6 +349,7 @@ libxl_domain_build_info = Struct("domain_build_info",[
      ("disable_migrate", libxl_defbool),
      ("cpuid",           libxl_cpuid_policy_list),
      ("blkdev_start",    string),
+    ("gic_version",     uint32),

How would you differentiate GICv2 from GICv2m with an integer? I think an enum would be better to describe the GIC version.

tools/libxl/xl_cmdimpl.c skip_vfb: · line 1528

Quoted 11 lines
tools/libxl/xl_cmdimpl.c +3 -0
index 2ec17ca..5fcb396 100644
@@ -1523,6 +1523,9 @@ skip_vfb:
      if (!xlu_cfg_get_long (config, "pci_seize", &l, 0))
          pci_seize = l;
 
+    if (!xlu_cfg_get_long (config, "gic_version", &l, 0))
+        b_info->gic_version = l;
+

You have to document this new option in docs/man/xl.cfg.pod.5

[..]

Quoted 14 lines
xen/arch/arm/domctl.c +2 -0
index 370dd99..1bea026 100644
@@ -10,6 +10,8 @@
  #include <xen/errno.h>
  #include <xen/sched.h>
  #include <xen/hypercall.h>
+#include <asm/gic.h>
+#include <xen/guest_access.h>
  #include <public/domctl.h>
 
  long arch_do_domctl(struct xen_domctl *domctl, struct domain *d,

xen/arch/arm/domctl.c long arch_do_domctl(struct xen_domctl *domctl, struct domain *d, · line 45

Quoted 7 lines
xen/arch/arm/domctl.c +2 -2
@@ -39,9 +41,36 @@ long arch_do_domctl(struct xen_domctl *domctl, struct domain *d,
          if ( domctl->u.configuredomain.nr_spis > (gic_number_lines() - 32) )
              return -EINVAL;
 
-        return domain_configure_vgic(d, domctl->u.configuredomain.nr_spis);
-    }
+        if ( domain_configure_vgic(d, domctl->u.configuredomain.nr_spis) )
+            return -EINVAL;

domain_configure_vgic should be called after we check that current version of GIC match. The user may want to chose to emulate a GICv2 on GICv3 hardware.

Quoted 6 lines
xen/include/public/arch-arm.h +0 -0
index cebb349..6f80c99 100644
@@ -363,6 +363,14 @@ typedef uint64_t xen_callback_t;
   * should instead use the FDT.

xen/include/public/arch-arm.h typedef uint64_t xen_callback_t; · line 373

Quoted 10 lines
xen/include/public/arch-arm.h +8 -0
   */
 
+/* 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
+

This should go after "/* Physical Address Space */

xen/include/public/arch-arm.h typedef uint64_t xen_callback_t; · line 376

Quoted 3 lines
xen/include/public/arch-arm.h +0 -0
  /* Physical Address Space */
  #define GUEST_GICD_BASE   0x03001000ULL
  #define GUEST_GICD_SIZE   0x00001000ULL

Please modify those defines, along *GICC* to add GICV2 in the name.

xen/include/public/domctl.h DEFINE_XEN_GUEST_HANDLE(xen_domctl_createdomain_t); · line 77

Quoted 10 lines
xen/include/public/domctl.h +2 -0
index 8adb8e2..502cfb6 100644
@@ -73,6 +73,8 @@ DEFINE_XEN_GUEST_HANDLE(xen_domctl_createdomain_t);
  struct xen_domctl_configuredomain {
      /* IN parameters */
      uint32_t nr_spis;
+    /* IN/OUT parameter */
+    uint32_t gic_version;

uint32_t sounds a bit too much for the gic_version. Maybe a uint8_t? Also a better name would be vgic_version.

Futhermore, people reading the structure don't know what value should be expected in this field. I would introduce define to specify the different value.

Regards,

--
Julien Grall

Signature · 1 line
Julien Grall
#5 lore raw

FYI we talked f2f about this and we reached the conclusion that we should rework this patch to be non-intrusive and acceptable for 4.5. After all without it we cannot boot guests on GICv3 systems.

Quoted 153 lines · Julien Grall

Hi Stefano,

Quoted 1 line · Stefano Stabellini

I have just realized that this patch didn't make RC1 last Friday.

I asked for few changes: documentation, way to implement the check... but Vijay never came back with a new version.

Quoted 8 lines

What should we do about it?

Without it, I am not sure we should really claim that Xen 4.5 has GICv3 support, given that we wouldn't be able to start any guests on a GICv3 platform.

I don't think is so risky it couldn't make RC2, but that's not entirely up to me.

This patch series requires to defer the VGIC initialization later.

The patch [1] to implement this feature has been deferred to Xen 4.6 because it was only necessary to my non-pci passthrough series (which has not reached Xen 4.5 for various reasons).

I don't think this patch should go in Xen 4.5 at this stage of the release (RC1 went out last week), because it modify too much the way to initialize the domain (VGIC has been deferred). Furthermore it has been reworked in a private branch [2] to address the comments.

By side effect, the toolstack part for the GICv3 would have to be defer.

Regards,

[1] https://patches.linaro.org/34664/
[2]
http://xenbits.xen.org/gitweb/?p=people/julieng/xen-unstable.git;a=commitdiff;h=002b216707ae90b669ffebf009042d5e42b26dc0;hp=30e15fa1f52aa790bf13b5f40dc62d832443846c

Quoted 113 lines · Julien Grall
Quoted 112 lines

Hello Vijay,

Quoted 10 lines · On 10/06/2014 01:46 PM, [email protected] wrote:
tools/libxl/libxl_types.idl +0 -0
index 7d9eec2..8f3f074 100644
@@ -349,6 +349,7 @@ libxl_domain_build_info =

Struct("domain_build_info",[
("disable_migrate", libxl_defbool),
("cpuid", libxl_cpuid_policy_list),
("blkdev_start", string),
+ ("gic_version", uint32),

How would you differentiate GICv2 from GICv2m with an integer? I think an enum would be better to describe the GIC version.

tools/libxl/xl_cmdimpl.c skip_vfb: · line 1528

Quoted 11 lines
tools/libxl/xl_cmdimpl.c +3 -0
index 2ec17ca..5fcb396 100644
@@ -1523,6 +1523,9 @@ skip_vfb:
      if (!xlu_cfg_get_long (config, "pci_seize", &l, 0))
          pci_seize = l;
 
+    if (!xlu_cfg_get_long (config, "gic_version", &l, 0))
+        b_info->gic_version = l;
+

You have to document this new option in docs/man/xl.cfg.pod.5

[..]

Quoted 15 lines
xen/arch/arm/domctl.c +2 -0
index 370dd99..1bea026 100644
@@ -10,6 +10,8 @@
  #include <xen/errno.h>
  #include <xen/sched.h>
  #include <xen/hypercall.h>
+#include <asm/gic.h>
+#include <xen/guest_access.h>
  #include <public/domctl.h>
 
  long arch_do_domctl(struct xen_domctl *domctl, struct domain *d,
@@ -39,9 +41,36 @@ long arch_do_domctl(struct xen_domctl *domctl, struct
 domain *d,

xen/arch/arm/domctl.c long arch_do_domctl(struct xen_domctl *domctl, struct · line 49

Quoted 10 lines
xen/arch/arm/domctl.c +2 -2
          if ( domctl->u.configuredomain.nr_spis > (gic_number_lines() -
 32) )
              return -EINVAL;
 
-        return domain_configure_vgic(d,
 domctl->u.configuredomain.nr_spis);
-    }
+        if ( domain_configure_vgic(d,
 domctl->u.configuredomain.nr_spis) )
+            return -EINVAL;

domain_configure_vgic should be called after we check that current version of GIC match. The user may want to chose to emulate a GICv2 on GICv3 hardware.

Quoted 7 lines
xen/include/public/arch-arm.h +0 -0
index cebb349..6f80c99 100644
@@ -363,6 +363,14 @@ typedef uint64_t xen_callback_t;
   * should instead use the FDT.

xen/include/public/arch-arm.h typedef uint64_t xen_callback_t; · line 373

Quoted 10 lines
xen/include/public/arch-arm.h +8 -0
   */
 
+/* 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
+

This should go after "/* Physical Address Space */

xen/include/public/arch-arm.h typedef uint64_t xen_callback_t; · line 376

Quoted 3 lines
xen/include/public/arch-arm.h +0 -0
  /* Physical Address Space */
  #define GUEST_GICD_BASE   0x03001000ULL
  #define GUEST_GICD_SIZE   0x00001000ULL

Please modify those defines, along *GICC* to add GICV2 in the name.

xen/include/public/domctl.h DEFINE_XEN_GUEST_HANDLE(xen_domctl_createdomain_t); · line 77

Quoted 10 lines
xen/include/public/domctl.h +2 -0
index 8adb8e2..502cfb6 100644
@@ -73,6 +73,8 @@ DEFINE_XEN_GUEST_HANDLE(xen_domctl_createdomain_t);
  struct xen_domctl_configuredomain {
      /* IN parameters */
      uint32_t nr_spis;
+    /* IN/OUT parameter */
+    uint32_t gic_version;

uint32_t sounds a bit too much for the gic_version. Maybe a uint8_t? Also a better name would be vgic_version.

Futhermore, people reading the structure don't know what value should be expected in this field. I would introduce define to specify the different value.

Regards,

--
Julien Grall

Signature · 1 line
Julien Grall
#6 lore raw

Hi Stefano,

Quoted 3 lines · Stefano Stabellini

FYI we talked f2f about this and we reached the conclusion that we should rework this patch to be non-intrusive and acceptable for 4.5. After all without it we cannot boot guests on GICv3 systems.

I am on travel for rest of the week. Is it ok if I look at it next week?
Can we plan for 4.5 RC2?

Quoted 155 lines · Julien Grall
Quoted 153 lines

Hi Stefano,

Quoted 1 line · Stefano Stabellini

I have just realized that this patch didn't make RC1 last Friday.

I asked for few changes: documentation, way to implement the check... but Vijay never came back with a new version.

Quoted 8 lines

What should we do about it?

Without it, I am not sure we should really claim that Xen 4.5 has GICv3 support, given that we wouldn't be able to start any guests on a GICv3 platform.

I don't think is so risky it couldn't make RC2, but that's not entirely up to me.

This patch series requires to defer the VGIC initialization later.

The patch [1] to implement this feature has been deferred to Xen 4.6 because it was only necessary to my non-pci passthrough series (which has not reached Xen 4.5 for various reasons).

I don't think this patch should go in Xen 4.5 at this stage of the release (RC1 went out last week), because it modify too much the way to initialize the domain (VGIC has been deferred). Furthermore it has been reworked in a private branch [2] to address the comments.

By side effect, the toolstack part for the GICv3 would have to be defer.

Regards,

[1] https://patches.linaro.org/34664/
[2]
http://xenbits.xen.org/gitweb/?p=people/julieng/xen-unstable.git;a=commitdiff;h=002b216707ae90b669ffebf009042d5e42b26dc0;hp=30e15fa1f52aa790bf13b5f40dc62d832443846c

Quoted 108 lines · Julien Grall
Quoted 107 lines

Hello Vijay,

Quoted 10 lines · On 10/06/2014 01:46 PM, [email protected] wrote:
tools/libxl/libxl_types.idl +0 -0
index 7d9eec2..8f3f074 100644
@@ -349,6 +349,7 @@ libxl_domain_build_info =

Struct("domain_build_info",[
("disable_migrate", libxl_defbool),
("cpuid", libxl_cpuid_policy_list),
("blkdev_start", string),
+ ("gic_version", uint32),

How would you differentiate GICv2 from GICv2m with an integer? I think an enum would be better to describe the GIC version.

tools/libxl/xl_cmdimpl.c skip_vfb: · line 1528

Quoted 11 lines
tools/libxl/xl_cmdimpl.c +3 -0
index 2ec17ca..5fcb396 100644
@@ -1523,6 +1523,9 @@ skip_vfb:
      if (!xlu_cfg_get_long (config, "pci_seize", &l, 0))
          pci_seize = l;
 
+    if (!xlu_cfg_get_long (config, "gic_version", &l, 0))
+        b_info->gic_version = l;
+

You have to document this new option in docs/man/xl.cfg.pod.5

[..]

Quoted 15 lines
xen/arch/arm/domctl.c +2 -0
index 370dd99..1bea026 100644
@@ -10,6 +10,8 @@
  #include <xen/errno.h>
  #include <xen/sched.h>
  #include <xen/hypercall.h>
+#include <asm/gic.h>
+#include <xen/guest_access.h>
  #include <public/domctl.h>
 
  long arch_do_domctl(struct xen_domctl *domctl, struct domain *d,
@@ -39,9 +41,36 @@ long arch_do_domctl(struct xen_domctl *domctl, struct
 domain *d,

xen/arch/arm/domctl.c long arch_do_domctl(struct xen_domctl *domctl, struct · line 49

Quoted 10 lines
xen/arch/arm/domctl.c +2 -2
          if ( domctl->u.configuredomain.nr_spis > (gic_number_lines() -
 32) )
              return -EINVAL;
 
-        return domain_configure_vgic(d,
 domctl->u.configuredomain.nr_spis);
-    }
+        if ( domain_configure_vgic(d,
 domctl->u.configuredomain.nr_spis) )
+            return -EINVAL;

domain_configure_vgic should be called after we check that current version of GIC match. The user may want to chose to emulate a GICv2 on GICv3 hardware.

Quoted 7 lines
xen/include/public/arch-arm.h +0 -0
index cebb349..6f80c99 100644
@@ -363,6 +363,14 @@ typedef uint64_t xen_callback_t;
   * should instead use the FDT.

xen/include/public/arch-arm.h typedef uint64_t xen_callback_t; · line 373

Quoted 10 lines
xen/include/public/arch-arm.h +8 -0
   */
 
+/* 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
+

This should go after "/* Physical Address Space */

xen/include/public/arch-arm.h typedef uint64_t xen_callback_t; · line 376

Quoted 3 lines
xen/include/public/arch-arm.h +0 -0
  /* Physical Address Space */
  #define GUEST_GICD_BASE   0x03001000ULL
  #define GUEST_GICD_SIZE   0x00001000ULL

Please modify those defines, along *GICC* to add GICV2 in the name.

xen/include/public/domctl.h DEFINE_XEN_GUEST_HANDLE(xen_domctl_createdomain_t); · line 77

Quoted 10 lines
xen/include/public/domctl.h +2 -0
index 8adb8e2..502cfb6 100644
@@ -73,6 +73,8 @@ DEFINE_XEN_GUEST_HANDLE(xen_domctl_createdomain_t);
  struct xen_domctl_configuredomain {
      /* IN parameters */
      uint32_t nr_spis;
+    /* IN/OUT parameter */
+    uint32_t gic_version;

uint32_t sounds a bit too much for the gic_version. Maybe a uint8_t? Also a better name would be vgic_version.

Futhermore, people reading the structure don't know what value should be expected in this field. I would introduce define to specify the different value.

Quoted 5 lines
Quoted 5 lines

Regards,

--
Julien Grall

--
Julien Grall

#7 lore raw
Quoted 10 lines · Vijay Kilari

Hi Stefano,

Quoted 3 lines · Stefano Stabellini

FYI we talked f2f about this and we reached the conclusion that we should rework this patch to be non-intrusive and acceptable for 4.5. After all without it we cannot boot guests on GICv3 systems.

I am on travel for rest of the week. Is it ok if I look at it next week?
Can we plan for 4.5 RC2?

That's ok. I can rework the patch for you.

Regards,

Quoted 155 lines
Quoted 155 lines · Julien Grall
Quoted 153 lines

Hi Stefano,

Quoted 1 line · Stefano Stabellini

I have just realized that this patch didn't make RC1 last Friday.

I asked for few changes: documentation, way to implement the check... but Vijay never came back with a new version.

Quoted 8 lines

What should we do about it?

Without it, I am not sure we should really claim that Xen 4.5 has GICv3 support, given that we wouldn't be able to start any guests on a GICv3 platform.

I don't think is so risky it couldn't make RC2, but that's not entirely up to me.

This patch series requires to defer the VGIC initialization later.

The patch [1] to implement this feature has been deferred to Xen 4.6 because it was only necessary to my non-pci passthrough series (which has not reached Xen 4.5 for various reasons).

I don't think this patch should go in Xen 4.5 at this stage of the release (RC1 went out last week), because it modify too much the way to initialize the domain (VGIC has been deferred). Furthermore it has been reworked in a private branch [2] to address the comments.

By side effect, the toolstack part for the GICv3 would have to be defer.

Regards,

[1] https://patches.linaro.org/34664/
[2]
http://xenbits.xen.org/gitweb/?p=people/julieng/xen-unstable.git;a=commitdiff;h=002b216707ae90b669ffebf009042d5e42b26dc0;hp=30e15fa1f52aa790bf13b5f40dc62d832443846c

Quoted 108 lines · Julien Grall
Quoted 107 lines

Hello Vijay,

Quoted 10 lines · On 10/06/2014 01:46 PM, [email protected] wrote:
tools/libxl/libxl_types.idl +0 -0
index 7d9eec2..8f3f074 100644
@@ -349,6 +349,7 @@ libxl_domain_build_info =

Struct("domain_build_info",[
("disable_migrate", libxl_defbool),
("cpuid", libxl_cpuid_policy_list),
("blkdev_start", string),
+ ("gic_version", uint32),

How would you differentiate GICv2 from GICv2m with an integer? I think an enum would be better to describe the GIC version.

tools/libxl/xl_cmdimpl.c skip_vfb: · line 1528

Quoted 11 lines
tools/libxl/xl_cmdimpl.c +3 -0
index 2ec17ca..5fcb396 100644
@@ -1523,6 +1523,9 @@ skip_vfb:
      if (!xlu_cfg_get_long (config, "pci_seize", &l, 0))
          pci_seize = l;
 
+    if (!xlu_cfg_get_long (config, "gic_version", &l, 0))
+        b_info->gic_version = l;
+

You have to document this new option in docs/man/xl.cfg.pod.5

[..]

Quoted 15 lines
xen/arch/arm/domctl.c +2 -0
index 370dd99..1bea026 100644
@@ -10,6 +10,8 @@
  #include <xen/errno.h>
  #include <xen/sched.h>
  #include <xen/hypercall.h>
+#include <asm/gic.h>
+#include <xen/guest_access.h>
  #include <public/domctl.h>
 
  long arch_do_domctl(struct xen_domctl *domctl, struct domain *d,
@@ -39,9 +41,36 @@ long arch_do_domctl(struct xen_domctl *domctl, struct
 domain *d,

xen/arch/arm/domctl.c long arch_do_domctl(struct xen_domctl *domctl, struct · line 49

Quoted 10 lines
xen/arch/arm/domctl.c +2 -2
          if ( domctl->u.configuredomain.nr_spis > (gic_number_lines() -
 32) )
              return -EINVAL;
 
-        return domain_configure_vgic(d,
 domctl->u.configuredomain.nr_spis);
-    }
+        if ( domain_configure_vgic(d,
 domctl->u.configuredomain.nr_spis) )
+            return -EINVAL;

domain_configure_vgic should be called after we check that current version of GIC match. The user may want to chose to emulate a GICv2 on GICv3 hardware.

Quoted 7 lines
xen/include/public/arch-arm.h +0 -0
index cebb349..6f80c99 100644
@@ -363,6 +363,14 @@ typedef uint64_t xen_callback_t;
   * should instead use the FDT.

xen/include/public/arch-arm.h typedef uint64_t xen_callback_t; · line 373

Quoted 10 lines
xen/include/public/arch-arm.h +8 -0
   */
 
+/* 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
+

This should go after "/* Physical Address Space */

xen/include/public/arch-arm.h typedef uint64_t xen_callback_t; · line 376

Quoted 3 lines
xen/include/public/arch-arm.h +0 -0
  /* Physical Address Space */
  #define GUEST_GICD_BASE   0x03001000ULL
  #define GUEST_GICD_SIZE   0x00001000ULL

Please modify those defines, along *GICC* to add GICV2 in the name.

xen/include/public/domctl.h DEFINE_XEN_GUEST_HANDLE(xen_domctl_createdomain_t); · line 77

Quoted 10 lines
xen/include/public/domctl.h +2 -0
index 8adb8e2..502cfb6 100644
@@ -73,6 +73,8 @@ DEFINE_XEN_GUEST_HANDLE(xen_domctl_createdomain_t);
  struct xen_domctl_configuredomain {
      /* IN parameters */
      uint32_t nr_spis;
+    /* IN/OUT parameter */
+    uint32_t gic_version;

uint32_t sounds a bit too much for the gic_version. Maybe a uint8_t? Also a better name would be vgic_version.

Futhermore, people reading the structure don't know what value should be expected in this field. I would introduce define to specify the different value.

Quoted 5 lines
Quoted 5 lines

Regards,

--
Julien Grall

--
Julien Grall

Signature · 1 line
Julien Grall
#8 lore raw
Quoted 5 lines · Julien Grall
Quoted 4 lines · Vijay Kilari

Hi Stefano,

On Wed, Oct 29, 2014 at 9:43 PM, Stefano Stabellini <[email protected]> wrote:

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

FYI we talked f2f about this and we reached the conclusion that we should rework this patch to be non-intrusive and acceptable for 4.5. After all without it we cannot boot guests on GICv3 systems.

I am on travel for rest of the week. Is it ok if I look at it next week?
Can we plan for 4.5 RC2?

That's ok. I can rework the patch for you.

RC2 is Nov 12.

Quoted 162 lines

Regards,

Quoted 155 lines
Quoted 155 lines · Julien Grall
Quoted 153 lines

Hi Stefano,

Quoted 1 line · Stefano Stabellini

I have just realized that this patch didn't make RC1 last Friday.

I asked for few changes: documentation, way to implement the check... but Vijay never came back with a new version.

Quoted 8 lines

What should we do about it?

Without it, I am not sure we should really claim that Xen 4.5 has GICv3 support, given that we wouldn't be able to start any guests on a GICv3 platform.

I don't think is so risky it couldn't make RC2, but that's not entirely up to me.

This patch series requires to defer the VGIC initialization later.

The patch [1] to implement this feature has been deferred to Xen 4.6 because it was only necessary to my non-pci passthrough series (which has not reached Xen 4.5 for various reasons).

I don't think this patch should go in Xen 4.5 at this stage of the release (RC1 went out last week), because it modify too much the way to initialize the domain (VGIC has been deferred). Furthermore it has been reworked in a private branch [2] to address the comments.

By side effect, the toolstack part for the GICv3 would have to be defer.

Regards,

[1] https://patches.linaro.org/34664/
[2]
http://xenbits.xen.org/gitweb/?p=people/julieng/xen-unstable.git;a=commitdiff;h=002b216707ae90b669ffebf009042d5e42b26dc0;hp=30e15fa1f52aa790bf13b5f40dc62d832443846c

Quoted 108 lines · Julien Grall
Quoted 107 lines

Hello Vijay,

Quoted 10 lines · On 10/06/2014 01:46 PM, [email protected] wrote:
tools/libxl/libxl_types.idl +0 -0
index 7d9eec2..8f3f074 100644
@@ -349,6 +349,7 @@ libxl_domain_build_info =

Struct("domain_build_info",[
("disable_migrate", libxl_defbool),
("cpuid", libxl_cpuid_policy_list),
("blkdev_start", string),
+ ("gic_version", uint32),

How would you differentiate GICv2 from GICv2m with an integer? I think an enum would be better to describe the GIC version.

tools/libxl/xl_cmdimpl.c skip_vfb: · line 1528

Quoted 11 lines
tools/libxl/xl_cmdimpl.c +3 -0
index 2ec17ca..5fcb396 100644
@@ -1523,6 +1523,9 @@ skip_vfb:
      if (!xlu_cfg_get_long (config, "pci_seize", &l, 0))
          pci_seize = l;
 
+    if (!xlu_cfg_get_long (config, "gic_version", &l, 0))
+        b_info->gic_version = l;
+

You have to document this new option in docs/man/xl.cfg.pod.5

[..]

Quoted 15 lines
xen/arch/arm/domctl.c +2 -0
index 370dd99..1bea026 100644
@@ -10,6 +10,8 @@
  #include <xen/errno.h>
  #include <xen/sched.h>
  #include <xen/hypercall.h>
+#include <asm/gic.h>
+#include <xen/guest_access.h>
  #include <public/domctl.h>
 
  long arch_do_domctl(struct xen_domctl *domctl, struct domain *d,
@@ -39,9 +41,36 @@ long arch_do_domctl(struct xen_domctl *domctl, struct
 domain *d,

xen/arch/arm/domctl.c long arch_do_domctl(struct xen_domctl *domctl, struct · line 49

Quoted 10 lines
xen/arch/arm/domctl.c +2 -2
          if ( domctl->u.configuredomain.nr_spis > (gic_number_lines() -
 32) )
              return -EINVAL;
 
-        return domain_configure_vgic(d,
 domctl->u.configuredomain.nr_spis);
-    }
+        if ( domain_configure_vgic(d,
 domctl->u.configuredomain.nr_spis) )
+            return -EINVAL;

domain_configure_vgic should be called after we check that current version of GIC match. The user may want to chose to emulate a GICv2 on GICv3 hardware.

Quoted 7 lines
xen/include/public/arch-arm.h +0 -0
index cebb349..6f80c99 100644
@@ -363,6 +363,14 @@ typedef uint64_t xen_callback_t;
   * should instead use the FDT.

xen/include/public/arch-arm.h typedef uint64_t xen_callback_t; · line 373

Quoted 10 lines
xen/include/public/arch-arm.h +8 -0
   */
 
+/* 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
+

This should go after "/* Physical Address Space */

xen/include/public/arch-arm.h typedef uint64_t xen_callback_t; · line 376

Quoted 3 lines
xen/include/public/arch-arm.h +0 -0
  /* Physical Address Space */
  #define GUEST_GICD_BASE   0x03001000ULL
  #define GUEST_GICD_SIZE   0x00001000ULL

Please modify those defines, along *GICC* to add GICV2 in the name.

xen/include/public/domctl.h DEFINE_XEN_GUEST_HANDLE(xen_domctl_createdomain_t); · line 77

Quoted 10 lines
xen/include/public/domctl.h +2 -0
index 8adb8e2..502cfb6 100644
@@ -73,6 +73,8 @@ DEFINE_XEN_GUEST_HANDLE(xen_domctl_createdomain_t);
  struct xen_domctl_configuredomain {
      /* IN parameters */
      uint32_t nr_spis;
+    /* IN/OUT parameter */
+    uint32_t gic_version;

uint32_t sounds a bit too much for the gic_version. Maybe a uint8_t? Also a better name would be vgic_version.

Futhermore, people reading the structure don't know what value should be expected in this field. I would introduce define to specify the different value.

Quoted 5 lines
Quoted 5 lines

Regards,

--
Julien Grall

--
Julien Grall

Signature · 1 line
Julien Grall
#9 lore raw
In reply to Stefano Stabellini

Hi,

Quoted 3 lines · Stefano Stabellini

FYI we talked f2f about this and we reached the conclusion that we should rework this patch to be non-intrusive and acceptable for 4.5. After all without it we cannot boot guests on GICv3 systems.

I'm gonna rework this patch (as long as my patch for the DOMCTL) and send a new version by the end of the week.

Vijay: I will, of course, keep your signed-off-by and author.

Cheers,

Quoted 154 lines · Julien Grall
Quoted 153 lines

Hi Stefano,

Quoted 1 line · Stefano Stabellini

I have just realized that this patch didn't make RC1 last Friday.

I asked for few changes: documentation, way to implement the check... but Vijay never came back with a new version.

Quoted 8 lines

What should we do about it?

Without it, I am not sure we should really claim that Xen 4.5 has GICv3 support, given that we wouldn't be able to start any guests on a GICv3 platform.

I don't think is so risky it couldn't make RC2, but that's not entirely up to me.

This patch series requires to defer the VGIC initialization later.

The patch [1] to implement this feature has been deferred to Xen 4.6 because it was only necessary to my non-pci passthrough series (which has not reached Xen 4.5 for various reasons).

I don't think this patch should go in Xen 4.5 at this stage of the release (RC1 went out last week), because it modify too much the way to initialize the domain (VGIC has been deferred). Furthermore it has been reworked in a private branch [2] to address the comments.

By side effect, the toolstack part for the GICv3 would have to be defer.

Regards,

[1] https://patches.linaro.org/34664/
[2]
http://xenbits.xen.org/gitweb/?p=people/julieng/xen-unstable.git;a=commitdiff;h=002b216707ae90b669ffebf009042d5e42b26dc0;hp=30e15fa1f52aa790bf13b5f40dc62d832443846c

Quoted 113 lines · Julien Grall
Quoted 112 lines

Hello Vijay,

Quoted 10 lines · On 10/06/2014 01:46 PM, [email protected] wrote:
tools/libxl/libxl_types.idl +0 -0
index 7d9eec2..8f3f074 100644
@@ -349,6 +349,7 @@ libxl_domain_build_info =

Struct("domain_build_info",[
("disable_migrate", libxl_defbool),
("cpuid", libxl_cpuid_policy_list),
("blkdev_start", string),
+ ("gic_version", uint32),

How would you differentiate GICv2 from GICv2m with an integer? I think an enum would be better to describe the GIC version.

tools/libxl/xl_cmdimpl.c skip_vfb: · line 1528

Quoted 11 lines
tools/libxl/xl_cmdimpl.c +3 -0
index 2ec17ca..5fcb396 100644
@@ -1523,6 +1523,9 @@ skip_vfb:
      if (!xlu_cfg_get_long (config, "pci_seize", &l, 0))
          pci_seize = l;
 
+    if (!xlu_cfg_get_long (config, "gic_version", &l, 0))
+        b_info->gic_version = l;
+

You have to document this new option in docs/man/xl.cfg.pod.5

[..]

Quoted 15 lines
xen/arch/arm/domctl.c +2 -0
index 370dd99..1bea026 100644
@@ -10,6 +10,8 @@
  #include <xen/errno.h>
  #include <xen/sched.h>
  #include <xen/hypercall.h>
+#include <asm/gic.h>
+#include <xen/guest_access.h>
  #include <public/domctl.h>
 
  long arch_do_domctl(struct xen_domctl *domctl, struct domain *d,
@@ -39,9 +41,36 @@ long arch_do_domctl(struct xen_domctl *domctl, struct
 domain *d,

xen/arch/arm/domctl.c long arch_do_domctl(struct xen_domctl *domctl, struct · line 49

Quoted 10 lines
xen/arch/arm/domctl.c +2 -2
          if ( domctl->u.configuredomain.nr_spis > (gic_number_lines() -
 32) )
              return -EINVAL;
 
-        return domain_configure_vgic(d,
 domctl->u.configuredomain.nr_spis);
-    }
+        if ( domain_configure_vgic(d,
 domctl->u.configuredomain.nr_spis) )
+            return -EINVAL;

domain_configure_vgic should be called after we check that current version of GIC match. The user may want to chose to emulate a GICv2 on GICv3 hardware.

Quoted 7 lines
xen/include/public/arch-arm.h +0 -0
index cebb349..6f80c99 100644
@@ -363,6 +363,14 @@ typedef uint64_t xen_callback_t;
   * should instead use the FDT.

xen/include/public/arch-arm.h typedef uint64_t xen_callback_t; · line 373

Quoted 10 lines
xen/include/public/arch-arm.h +8 -0
   */
 
+/* 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
+

This should go after "/* Physical Address Space */

xen/include/public/arch-arm.h typedef uint64_t xen_callback_t; · line 376

Quoted 3 lines
xen/include/public/arch-arm.h +0 -0
  /* Physical Address Space */
  #define GUEST_GICD_BASE   0x03001000ULL
  #define GUEST_GICD_SIZE   0x00001000ULL

Please modify those defines, along *GICC* to add GICV2 in the name.

xen/include/public/domctl.h DEFINE_XEN_GUEST_HANDLE(xen_domctl_createdomain_t); · line 77

Quoted 10 lines
xen/include/public/domctl.h +2 -0
index 8adb8e2..502cfb6 100644
@@ -73,6 +73,8 @@ DEFINE_XEN_GUEST_HANDLE(xen_domctl_createdomain_t);
  struct xen_domctl_configuredomain {
      /* IN parameters */
      uint32_t nr_spis;
+    /* IN/OUT parameter */
+    uint32_t gic_version;

uint32_t sounds a bit too much for the gic_version. Maybe a uint8_t? Also a better name would be vgic_version.

Futhermore, people reading the structure don't know what value should be expected in this field. I would introduce define to specify the different value.

Regards,

--
Julien Grall

Signature · 1 line
Julien Grall
Signature · 1 line
Julien Grall
#10 lore raw
In reply to Julien Grall

Hi Julien,

Quoted 22 lines · Julien Grall

Hi Stefano,

Quoted 2 lines · Stefano Stabellini

I have just realized that this patch didn't make RC1 last Friday.

I asked for few changes: documentation, way to implement the check... but Vijay never came back with a new version.

Quoted 8 lines

What should we do about it?

Without it, I am not sure we should really claim that Xen 4.5 has GICv3 support, given that we wouldn't be able to start any guests on a GICv3 platform.

I don't think is so risky it couldn't make RC2, but that's not entirely up to me.

This patch series requires to defer the VGIC initialization later.

Quoted 8 lines

The patch [1] to implement this feature has been deferred to Xen 4.6 because it was only necessary to my non-pci passthrough series (which has not reached Xen 4.5 for various reasons).

I don't think this patch should go in Xen 4.5 at this stage of the release (RC1 went out last week), because it modify too much the way to initialize the domain (VGIC has been deferred). Furthermore it has been reworked in a private branch [2] to address the comments.

Could you please get your non-pci passthrough series merged. We have dependency for GICv3 and pci passthrough changes.

Quoted 134 lines

By side effect, the toolstack part for the GICv3 would have to be defer.

Regards,

[1] https://patches.linaro.org/34664/
[2]
http://xenbits.xen.org/gitweb/?p=people/julieng/xen-unstable.git;a=commitdiff;h=002b216707ae90b669ffebf009042d5e42b26dc0;hp=30e15fa1f52aa790bf13b5f40dc62d832443846c

Quoted 116 lines · Julien Grall
Quoted 115 lines

Hello Vijay,

Quoted 11 lines · On 10/06/2014 01:46 PM, [email protected] wrote:
tools/libxl/libxl_types.idl +0 -0
index 7d9eec2..8f3f074 100644
@@ -349,6 +349,7 @@ libxl_domain_build_info =

Struct("domain_build_info",[
("disable_migrate", libxl_defbool),
("cpuid", libxl_cpuid_policy_list),
("blkdev_start", string),
+ ("gic_version", uint32),

How would you differentiate GICv2 from GICv2m with an integer? I think an enum would be better to describe the GIC version.

tools/libxl/xl_cmdimpl.c skip_vfb: · line 1528

Quoted 11 lines
tools/libxl/xl_cmdimpl.c +3 -0
index 2ec17ca..5fcb396 100644
@@ -1523,6 +1523,9 @@ skip_vfb:
      if (!xlu_cfg_get_long (config, "pci_seize", &l, 0))
          pci_seize = l;
 
+    if (!xlu_cfg_get_long (config, "gic_version", &l, 0))
+        b_info->gic_version = l;
+

You have to document this new option in docs/man/xl.cfg.pod.5

[..]

Quoted 15 lines
xen/arch/arm/domctl.c +2 -0
index 370dd99..1bea026 100644
@@ -10,6 +10,8 @@
  #include <xen/errno.h>
  #include <xen/sched.h>
  #include <xen/hypercall.h>
+#include <asm/gic.h>
+#include <xen/guest_access.h>
  #include <public/domctl.h>
 
  long arch_do_domctl(struct xen_domctl *domctl, struct domain *d,
@@ -39,9 +41,36 @@ long arch_do_domctl(struct xen_domctl *domctl, struct
 domain *d,

xen/arch/arm/domctl.c long arch_do_domctl(struct xen_domctl *domctl, struct · line 49

Quoted 10 lines
xen/arch/arm/domctl.c +2 -2
          if ( domctl->u.configuredomain.nr_spis > (gic_number_lines() -
 32) )
              return -EINVAL;
 
-        return domain_configure_vgic(d,
 domctl->u.configuredomain.nr_spis);
-    }
+        if ( domain_configure_vgic(d,
 domctl->u.configuredomain.nr_spis) )
+            return -EINVAL;

domain_configure_vgic should be called after we check that current version of GIC match. The user may want to chose to emulate a GICv2 on GICv3 hardware.

Quoted 7 lines
xen/include/public/arch-arm.h +0 -0
index cebb349..6f80c99 100644
@@ -363,6 +363,14 @@ typedef uint64_t xen_callback_t;
   * should instead use the FDT.

xen/include/public/arch-arm.h typedef uint64_t xen_callback_t; · line 373

Quoted 10 lines
xen/include/public/arch-arm.h +8 -0
   */
 
+/* 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
+

This should go after "/* Physical Address Space */

xen/include/public/arch-arm.h typedef uint64_t xen_callback_t; · line 376

Quoted 3 lines
xen/include/public/arch-arm.h +0 -0
  /* Physical Address Space */
  #define GUEST_GICD_BASE   0x03001000ULL
  #define GUEST_GICD_SIZE   0x00001000ULL

Please modify those defines, along *GICC* to add GICV2 in the name.

xen/include/public/domctl.h DEFINE_XEN_GUEST_HANDLE(xen_domctl_createdomain_t); · line 77

Quoted 10 lines
xen/include/public/domctl.h +2 -0
index 8adb8e2..502cfb6 100644
@@ -73,6 +73,8 @@ DEFINE_XEN_GUEST_HANDLE(xen_domctl_createdomain_t);
  struct xen_domctl_configuredomain {
      /* IN parameters */
      uint32_t nr_spis;
+    /* IN/OUT parameter */
+    uint32_t gic_version;

uint32_t sounds a bit too much for the gic_version. Maybe a uint8_t? Also a better name would be vgic_version.

Futhermore, people reading the structure don't know what value should be expected in this field. I would introduce define to specify the different value.

Quoted 5 lines
Quoted 5 lines

Regards,

--
Julien Grall

--
Julien Grall

#11 lore raw
Quoted 29 lines · Vijay Kilari

Hi Julien,

Quoted 26 lines · Julien Grall

Hi Stefano,

Quoted 2 lines · Stefano Stabellini

I have just realized that this patch didn't make RC1 last Friday.

I asked for few changes: documentation, way to implement the check... but Vijay never came back with a new version.

Quoted 8 lines

What should we do about it?

Without it, I am not sure we should really claim that Xen 4.5 has GICv3 support, given that we wouldn't be able to start any guests on a GICv3 platform.

I don't think is so risky it couldn't make RC2, but that's not entirely up to me.

This patch series requires to defer the VGIC initialization later.

The patch [1] to implement this feature has been deferred to Xen 4.6 because it was only necessary to my non-pci passthrough series (which has not reached Xen 4.5 for various reasons).

Quoted 7 lines
Quoted 4 lines

I don't think this patch should go in Xen 4.5 at this stage of the release (RC1 went out last week), because it modify too much the way to initialize the domain (VGIC has been deferred). Furthermore it has been reworked in a private branch [2] to address the comments.

Could you please get your non-pci passthrough series merged. We have dependency for GICv3 and pci passthrough changes.

It is too late for Xen 4.5 now, we'll have to wait until the Xen 4.6 development window opens to merge them.

However we don't need to stop development for that, we can just work on private branches. For now you can rely on Julien's branch below.

Quoted 134 lines
Quoted 133 lines

By side effect, the toolstack part for the GICv3 would have to be defer.

Regards,

[1] https://patches.linaro.org/34664/
[2]
http://xenbits.xen.org/gitweb/?p=people/julieng/xen-unstable.git;a=commitdiff;h=002b216707ae90b669ffebf009042d5e42b26dc0;hp=30e15fa1f52aa790bf13b5f40dc62d832443846c

Quoted 116 lines · Julien Grall
Quoted 115 lines

Hello Vijay,

Quoted 11 lines · On 10/06/2014 01:46 PM, [email protected] wrote:
tools/libxl/libxl_types.idl +0 -0
index 7d9eec2..8f3f074 100644
@@ -349,6 +349,7 @@ libxl_domain_build_info =

Struct("domain_build_info",[
("disable_migrate", libxl_defbool),
("cpuid", libxl_cpuid_policy_list),
("blkdev_start", string),
+ ("gic_version", uint32),

How would you differentiate GICv2 from GICv2m with an integer? I think an enum would be better to describe the GIC version.

tools/libxl/xl_cmdimpl.c skip_vfb: · line 1528

Quoted 11 lines
tools/libxl/xl_cmdimpl.c +3 -0
index 2ec17ca..5fcb396 100644
@@ -1523,6 +1523,9 @@ skip_vfb:
      if (!xlu_cfg_get_long (config, "pci_seize", &l, 0))
          pci_seize = l;
 
+    if (!xlu_cfg_get_long (config, "gic_version", &l, 0))
+        b_info->gic_version = l;
+

You have to document this new option in docs/man/xl.cfg.pod.5

[..]

Quoted 15 lines
xen/arch/arm/domctl.c +2 -0
index 370dd99..1bea026 100644
@@ -10,6 +10,8 @@
  #include <xen/errno.h>
  #include <xen/sched.h>
  #include <xen/hypercall.h>
+#include <asm/gic.h>
+#include <xen/guest_access.h>
  #include <public/domctl.h>
 
  long arch_do_domctl(struct xen_domctl *domctl, struct domain *d,
@@ -39,9 +41,36 @@ long arch_do_domctl(struct xen_domctl *domctl, struct
 domain *d,

xen/arch/arm/domctl.c long arch_do_domctl(struct xen_domctl *domctl, struct · line 49

Quoted 10 lines
xen/arch/arm/domctl.c +2 -2
          if ( domctl->u.configuredomain.nr_spis > (gic_number_lines() -
 32) )
              return -EINVAL;
 
-        return domain_configure_vgic(d,
 domctl->u.configuredomain.nr_spis);
-    }
+        if ( domain_configure_vgic(d,
 domctl->u.configuredomain.nr_spis) )
+            return -EINVAL;

domain_configure_vgic should be called after we check that current version of GIC match. The user may want to chose to emulate a GICv2 on GICv3 hardware.

Quoted 7 lines
xen/include/public/arch-arm.h +0 -0
index cebb349..6f80c99 100644
@@ -363,6 +363,14 @@ typedef uint64_t xen_callback_t;
   * should instead use the FDT.

xen/include/public/arch-arm.h typedef uint64_t xen_callback_t; · line 373

Quoted 10 lines
xen/include/public/arch-arm.h +8 -0
   */
 
+/* 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
+

This should go after "/* Physical Address Space */

xen/include/public/arch-arm.h typedef uint64_t xen_callback_t; · line 376

Quoted 3 lines
xen/include/public/arch-arm.h +0 -0
  /* Physical Address Space */
  #define GUEST_GICD_BASE   0x03001000ULL
  #define GUEST_GICD_SIZE   0x00001000ULL

Please modify those defines, along *GICC* to add GICV2 in the name.

xen/include/public/domctl.h DEFINE_XEN_GUEST_HANDLE(xen_domctl_createdomain_t); · line 77

Quoted 10 lines
xen/include/public/domctl.h +2 -0
index 8adb8e2..502cfb6 100644
@@ -73,6 +73,8 @@ DEFINE_XEN_GUEST_HANDLE(xen_domctl_createdomain_t);
  struct xen_domctl_configuredomain {
      /* IN parameters */
      uint32_t nr_spis;
+    /* IN/OUT parameter */
+    uint32_t gic_version;

uint32_t sounds a bit too much for the gic_version. Maybe a uint8_t? Also a better name would be vgic_version.

Futhermore, people reading the structure don't know what value should be expected in this field. I would introduce define to specify the different value.

Quoted 5 lines
Quoted 5 lines

Regards,

--
Julien Grall

--
Julien Grall