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

[PATCH 10/36] xen/arch: check color selection function



From: Luca Miccio <lucmiccio@xxxxxxxxx>

Dom0 color configuration is parsed in the Xen command line. Add an
helper function to check the user selection. If no configuration is
provided by the user, all the available colors supported by the
hardware will be assigned to dom0.

Signed-off-by: Luca Miccio <lucmiccio@xxxxxxxxx>
Signed-off-by: Marco Solieri <marco.solieri@xxxxxxxxxxxxxxx>
---
 xen/arch/arm/coloring.c             | 17 +++++++++++++++++
 xen/arch/arm/include/asm/coloring.h |  8 ++++++++
 2 files changed, 25 insertions(+)

diff --git a/xen/arch/arm/coloring.c b/xen/arch/arm/coloring.c
index f6e6d09477..382d558021 100644
--- a/xen/arch/arm/coloring.c
+++ b/xen/arch/arm/coloring.c
@@ -179,6 +179,23 @@ uint32_t *setup_default_colors(uint32_t *col_num)
     return NULL;
 }
 
+bool check_domain_colors(struct domain *d)
+{
+    int i;
+    bool ret = false;
+
+    if ( !d )
+        return ret;
+
+    if ( d->max_colors > max_col_num )
+        return ret;
+
+    for ( i = 0; i < d->max_colors; i++ )
+        ret |= (d->colors[i] > (max_col_num - 1));
+
+    return !ret;
+}
+
 bool __init coloring_init(void)
 {
     int i;
diff --git a/xen/arch/arm/include/asm/coloring.h 
b/xen/arch/arm/include/asm/coloring.h
index 8f24acf082..fdd46448d7 100644
--- a/xen/arch/arm/include/asm/coloring.h
+++ b/xen/arch/arm/include/asm/coloring.h
@@ -26,8 +26,16 @@
 #define MAX_COLORS_CELLS 4
 
 #ifdef CONFIG_COLORING
+#include <xen/sched.h>
+
 bool __init coloring_init(void);
 
+/*
+ * Check colors of a given domain.
+ * Return true if check passed, false otherwise.
+ */
+bool check_domain_colors(struct domain *d);
+
 /*
  * Return an array with default colors selection and store the number of
  * colors in @param col_num. The array selection will be equal to the dom0
-- 
2.30.2




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.