xen/arm: Add new platform specific callback device_is_blacklist
authorJulien Grall <julien.grall@linaro.org>
Fri, 13 Sep 2013 12:49:26 +0000 (13:49 +0100)
committerIan Campbell <ian.campbell@citrix.com>
Tue, 17 Sep 2013 14:28:55 +0000 (15:28 +0100)
Each platform code will list the device that must not pass-through to a guest.
Theses devices are used for: power management, timer,...

When theses devices are given to DOM0, it can controls the hardware and then
break the whole platform.

This callback is enough until we will start to care about power performance.
For this purpose, we may need to extend this interface to implement per-device
MMIO filtering to allow dom0 to continue to control devices which it owns which
happen to share e.g. a clock controller with Xen.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
xen/arch/arm/domain_build.c
xen/arch/arm/platform.c
xen/include/asm-arm/platform.h

index cda1e13d7a4bc49d3cc0a3e82a7566a70e961a9d..300a64da49c092fad863e0c03f8a2f3df7bf80ad 100644 (file)
@@ -676,7 +676,8 @@ static int handle_node(struct domain *d, struct kernel_info *kinfo,
     DPRINT("handle %s\n", path);
 
     /* Skip theses nodes and the sub-nodes */
-    if ( dt_match_node(skip_matches, np ) )
+    if ( dt_match_node(skip_matches, np ) ||
+         platform_device_is_blacklisted(np) )
     {
         DPRINT("  Skip it!\n");
         return 0;
index afda302159fd6bf42f7fb97fde098f08da6dd292..db79368ce2c19cbb7f0bb071d91c1eaea18bd940 100644 (file)
@@ -127,6 +127,16 @@ bool_t platform_has_quirk(uint32_t quirk)
     return !!(quirks & quirk);
 }
 
+bool_t platform_device_is_blacklisted(const struct dt_device_node *node)
+{
+    const struct dt_device_match *blacklist = NULL;
+
+    if ( platform && platform->blacklist_dev )
+        blacklist = platform->blacklist_dev;
+
+    return dt_match_node(blacklist, node);
+}
+
 /*
  * Local variables:
  * mode: C
index f460e9cb67f6de43e2fba2f5172cb6b79d9b262f..a19dbf732b24e6ffd66c9385033686a54daf9e2f 100644 (file)
@@ -4,6 +4,7 @@
 #include <xen/init.h>
 #include <xen/sched.h>
 #include <xen/mm.h>
+#include <xen/device_tree.h>
 
 /* Describe specific operation for a board */
 struct platform_desc {
@@ -26,6 +27,11 @@ struct platform_desc {
      * board with different quirk on each
      */
     uint32_t (*quirks)(void);
+    /*
+     * Platform blacklist devices
+     * List of devices which must not pass-through to a guest
+     */
+    const struct dt_device_match *blacklist_dev;
 };
 
 /*
@@ -40,6 +46,7 @@ int __init platform_specific_mapping(struct domain *d);
 void platform_reset(void);
 void platform_poweroff(void);
 bool_t platform_has_quirk(uint32_t quirk);
+bool_t platform_device_is_blacklisted(const struct dt_device_node *node);
 
 #define PLATFORM_START(_name, _namestr)                         \
 static const struct platform_desc  __plat_desc_##_name __used   \