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

[Xen-devel] [PATCH WIP v1 09/10] HACK: xen: arm: stop recursing with dom0 mappings once we've hit a ranges.



Probably better done with improvements to DT/PCI parsing code and doesn't seem
to dpo any harm not to have this patch anyway.

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
---
 xen/arch/arm/domain_build.c | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index e754d37..ee27930 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -1022,7 +1022,8 @@ static int map_device(struct domain *d, struct 
dt_device_node *dev)
 }
 
 static int handle_node(struct domain *d, struct kernel_info *kinfo,
-                       struct dt_device_node *node)
+                       struct dt_device_node *node,
+                       bool_t map)
 {
     static const struct dt_device_match skip_matches[] __initconst =
     {
@@ -1051,6 +1052,8 @@ static int handle_node(struct domain *d, struct 
kernel_info *kinfo,
     int res;
     const char *name;
     const char *path;
+    bool_t map_children = true;
+    u32 ranges_len;
 
     path = dt_node_full_name(node);
 
@@ -1099,7 +1102,8 @@ static int handle_node(struct domain *d, struct 
kernel_info *kinfo,
      *  property. Therefore these device doesn't need to be mapped. This
      *  solution can be use later for pass through.
      */
-    if ( !dt_device_type_is_equal(node, "memory") &&
+    if ( map &&
+         !dt_device_type_is_equal(node, "memory") &&
          dt_device_is_available(node) )
     {
         res = map_device(d, node);
@@ -1124,9 +1128,15 @@ static int handle_node(struct domain *d, struct 
kernel_info *kinfo,
     if ( res )
         return res;
 
+    /* Don't need to map anything below a node with a non-empty ranges property
+     * -- it's already covered and we may not know how to translate
+     * anyway. */
+    if ( dt_get_property(node, "ranges", &ranges_len) != NULL && ranges_len )
+        map_children = false;
+
     for ( child = node->child; child != NULL; child = child->sibling )
     {
-        res = handle_node(d, kinfo, child);
+        res = handle_node(d, kinfo, child, map_children);
         if ( res )
             return res;
     }
@@ -1177,7 +1187,7 @@ static int prepare_dtb(struct domain *d, struct 
kernel_info *kinfo)
 
     fdt_finish_reservemap(kinfo->fdt);
 
-    ret = handle_node(d, kinfo, dt_host);
+    ret = handle_node(d, kinfo, dt_host, true);
     if ( ret )
         goto err;
 
-- 
2.1.4


_______________________________________________
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®.