]> xenbits.xensource.com Git - people/sstabellini/xen-unstable.git/.git/commitdiff
xen/arm: add coloring support to dom0less
authorLuca Miccio <206497@studenti.unimore.it>
Thu, 22 Aug 2019 10:13:40 +0000 (12:13 +0200)
committerLuca Miccio <206497@studenti.unimore.it>
Mon, 6 Jan 2020 14:07:34 +0000 (15:07 +0100)
Dom0less color assignment is performed via Device Tree with a new
attribyte "colors". In this case the color assignment is represented by
a bitmask where it suffices to set all and only the bits having a
position equal to the chosen colors, leaving unset all the others.

Signed-off-by: Luca Miccio <206497@studenti.unimore.it>
Signed-off-by: Marco Solieri <marco.solieri@unimore.it>
xen/arch/arm/domain_build.c

index f41de26d8c8b8ffb30c3fd01662561285c946727..4980bd5b1ed33d7a8f3c2554dcc5a0034992ff8b 100644 (file)
@@ -2431,8 +2431,9 @@ static int __init construct_domU(struct domain *d,
                                  const struct dt_device_node *node)
 {
     struct kernel_info kinfo = {};
-    int rc;
+    int rc, i, k;
     u64 mem;
+    u64 col_val;
 
     rc = dt_property_read_u64(node, "memory", &mem);
     if ( !rc )
@@ -2450,6 +2451,31 @@ static int __init construct_domU(struct domain *d,
         return -ENOMEM;
     d->max_pages = ~0U;
 
+    rc = dt_property_read_u64(node, "colors", &col_val);
+
+    if ( get_max_colors() && col_val )
+    {
+        printk("Colored configuration: 0x%"PRIx64"\n", col_val);
+        d->max_colors = 0;
+        if ( d->colors )
+            xfree(d->colors);
+
+        /* Calculate number of bit set */
+        for ( i = 0; i < get_max_colors(); i++)
+            if ( col_val & (1 << i) )
+                d->max_colors++;
+
+        d->colors = xzalloc_array(uint32_t, d->max_colors);
+        for ( i = 0, k = 0; k < d->max_colors; i++ )
+            if ( col_val & (1 << i) )
+                d->colors[k++] = i;
+
+        printk("DomU config: [ ");
+        for ( k = 0; k < d->max_colors; k++ )
+            printk("%u ", d->colors[k]);
+        printk("]\n");
+    }
+
     kinfo.d = d;
 
     rc = kernel_probe(&kinfo, node);