@@ -27,6 +27,7 @@
#include <asm/setup.h>
#include <asm/cpufeature.h>
#include <asm/domain_build.h>
+#include <asm/coloring.h>
#include <xen/irq.h>
#include <xen/grant_table.h>
@@ -3173,6 +3174,10 @@ void __init create_domUs(void)
{
struct dt_device_node *node;
const struct dt_device_node *chosen = dt_find_node_by_path("/chosen");
+ u32 col_val;
+ const u32 *cells;
+ u32 len;
+ int cell, i, k;
BUG_ON(chosen == NULL);
dt_for_each_child_node(chosen, node)
@@ -3241,6 +3246,31 @@ void __init create_domUs(void)
vpl011_virq - 32 + 1);
}
+ d_cfg.arch.colors.max_colors = 0;
+ memset(&d_cfg.arch.colors.colors, 0x0, sizeof(d_cfg.arch.colors.colors));
+
+ cells = dt_get_property(node, "colors", &len);
+ if ( cells != NULL && len > 0 )
+ {
+ if ( !get_max_colors() )
+ panic("Coloring requested but no colors configuration found!\n");
+
+ if ( len > sizeof(d_cfg.arch.colors.colors) )
+ panic("Dom0less DomU color information is invalid\n");
+
+ for ( k = 0, cell = len/4 - 1; cell >= 0; cell--, k++ )
+ {
+ col_val = be32_to_cpup(&cells[cell]);
+ if ( col_val )
+ {
+ /* Calculate number of bit set */
+ for ( i = 0; i < 32; i++)
+ if ( col_val & (1 << i) )
+ d_cfg.arch.colors.max_colors++;
+ d_cfg.arch.colors.colors[k] = col_val;
+ }
+ }
+ }
/*
* The variable max_init_domid is initialized with zero, so here it's
* very important to use the pre-increment operator to call