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

[Xen-devel] [RFC PATCH v2 22/22] xen/arm: its: Generate ITS dt node for DomU



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

Generate ITS device tree node for DomU.
This patch generate ITS node outside the GICv3 node
for DomU.

Signed-off-by: Vijaya Kumar K <Vijaya.Kumar@xxxxxxxxxxxxxxxxxx>
---
 tools/libxl/libxl_arm.c       |   36 ++++++++++++++++++++++++++++++++++++
 xen/arch/arm/gic-v3-its.c     |    7 ++++++-
 xen/include/public/arch-arm.h |    3 +++
 3 files changed, 45 insertions(+), 1 deletion(-)

diff --git a/tools/libxl/libxl_arm.c b/tools/libxl/libxl_arm.c
index 65a762b..af6ab39 100644
--- a/tools/libxl/libxl_arm.c
+++ b/tools/libxl/libxl_arm.c
@@ -53,6 +53,7 @@ static struct arch_info {
 enum {
     PHANDLE_NONE = 0,
     PHANDLE_GIC,
+    PHANDLE_ITS,
 };
 
 typedef uint32_t be32;
@@ -362,6 +363,36 @@ static int make_gicv2_node(libxl__gc *gc, void *fdt,
     return 0;
 }
 
+static int make_its_node(libxl__gc *gc, void *fdt,
+                         uint64_t its_base, uint64_t its_size)
+{
+    int res;
+    const char *name = GCSPRINTF("gic-its@%"PRIx64, its_base);
+
+    res = fdt_begin_node(fdt, name);
+    if (res) return res;
+
+    res = fdt_property_compat(gc, fdt, 1,
+                              "arm,gic-v3-its");
+    if (res) return res;
+
+    res = fdt_property(fdt, "msi-controller", NULL, 0);
+    if (res) return res;
+
+    res = fdt_property_regs(gc, fdt, ROOT_ADDRESS_CELLS, ROOT_SIZE_CELLS,
+                            1,
+                            its_base, its_size);
+    if (res) return res;
+
+    res = fdt_property_cell(fdt, "phandle", PHANDLE_ITS);
+    if (res) return res;
+
+    res = fdt_end_node(fdt);
+    if (res) return res;
+
+    return 0;
+}
+
 static int make_gicv3_node(libxl__gc *gc, void *fdt)
 {
     int res;
@@ -600,6 +631,11 @@ next_resize:
             break;
         case XEN_DOMCTL_CONFIG_GIC_V3:
             FDT( make_gicv3_node(gc, fdt) );
+            /*
+             * TODO: Need to generate based on Config and its node should be
+             * generated inside gicv3 node
+             */
+            FDT( make_its_node(gc, fdt, GUEST_GICV3_ITS_BASE, 
GUEST_GICV3_ITS_SIZE) );
             break;
         default:
             LOG(ERROR, "Unknown GIC version %d", config.gic_version);
diff --git a/xen/arch/arm/gic-v3-its.c b/xen/arch/arm/gic-v3-its.c
index c2c59fa..dda4c20 100644
--- a/xen/arch/arm/gic-v3-its.c
+++ b/xen/arch/arm/gic-v3-its.c
@@ -1098,7 +1098,12 @@ void its_domain_init(uint32_t its_nr, struct domain *d)
                d->arch.vits[its_nr].phys_size = its->phys_size;
                d->arch.vits[its_nr].its  = its;
        }
-       /* TODO: Update for DomU */
+       else
+       {
+               /* Only one vITS is supported for DomU */
+               d->arch.vits[0].phys_base = GUEST_GICV3_ITS_BASE ;
+               d->arch.vits[0].phys_size = GUEST_GICV3_ITS_SIZE;
+       }
 }
 
 static int its_probe(struct dt_device_node *node)
diff --git a/xen/include/public/arch-arm.h b/xen/include/public/arch-arm.h
index c2dcb66..0f129a2 100644
--- a/xen/include/public/arch-arm.h
+++ b/xen/include/public/arch-arm.h
@@ -381,6 +381,9 @@ typedef uint64_t xen_callback_t;
 #define GUEST_GICV3_GICR0_BASE     0x03020000ULL    /* vCPU0 - vCPU7 */
 #define GUEST_GICV3_GICR0_SIZE     0x00100000ULL
 
+#define GUEST_GICV3_ITS_BASE       0x03200000ULL
+#define GUEST_GICV3_ITS_SIZE       0x00200000ULL
+
 /*
  * 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®.