]> xenbits.xensource.com Git - people/larsk/xen.git/commitdiff
xen/arm: handle "multiboot,device-tree" compatible nodes
authorStefano Stabellini <sstabellini@kernel.org>
Thu, 3 Oct 2019 17:34:15 +0000 (10:34 -0700)
committerStefano Stabellini <sstabellini@kernel.org>
Fri, 4 Oct 2019 17:16:11 +0000 (10:16 -0700)
Detect "multiboot,device-tree" compatible nodes. Add them to the bootmod
array as BOOTMOD_GUEST_DTB.  In kernel_probe, find the right
BOOTMOD_GUEST_DTB and store a pointer to it in dtb_bootmodule.

Signed-off-by: Stefano Stabellini <stefanos@xilinx.com>
Acked-by: Julien Grall <julien.grall@arm.com>
xen/arch/arm/bootfdt.c
xen/arch/arm/kernel.c
xen/arch/arm/setup.c
xen/include/asm-arm/setup.h

index a7810abb159381b191c23a33f31310b70b6e9c36..08fb59f4e7a9529d398cb6d1da54f4cdced04492 100644 (file)
@@ -242,6 +242,8 @@ static void __init process_multiboot_node(const void *fdt, int node,
         kind = BOOTMOD_RAMDISK;
     else if ( fdt_node_check_compatible(fdt, node, "xen,xsm-policy") == 0 )
         kind = BOOTMOD_XSM;
+    else if ( fdt_node_check_compatible(fdt, node, "multiboot,device-tree") == 0 )
+        kind = BOOTMOD_GUEST_DTB;
     else
         kind = BOOTMOD_UNKNOWN;
 
index 389bef2afae9bd218017fdba267954ba380223cc..8eff0748367deb458aaec220cd4eb49b2fdef397 100644 (file)
@@ -425,7 +425,7 @@ int __init kernel_probe(struct kernel_info *info,
     struct bootmodule *mod = NULL;
     struct bootcmdline *cmd = NULL;
     struct dt_device_node *node;
-    u64 kernel_addr, initrd_addr, size;
+    u64 kernel_addr, initrd_addr, dtb_addr, size;
     int rc;
 
     /* domain is NULL only for the hardware domain */
@@ -469,6 +469,18 @@ int __init kernel_probe(struct kernel_info *info,
                 info->initrd_bootmodule = boot_module_find_by_addr_and_kind(
                         BOOTMOD_RAMDISK, initrd_addr);
             }
+            else if ( dt_device_is_compatible(node, "multiboot,device-tree") )
+            {
+                uint32_t len;
+                const __be32 *val;
+
+                val = dt_get_property(node, "reg", &len);
+                if ( val == NULL )
+                    continue;
+                dt_get_range(&val, node, &dtb_addr, &size);
+                info->dtb_bootmodule = boot_module_find_by_addr_and_kind(
+                        BOOTMOD_GUEST_DTB, dtb_addr);
+            }
             else
                 continue;
         }
index 790eab94d685ed50958f2423ca986be54015ae5b..705a917abf763c7c363331be4c4fcab94ad16a1a 100644 (file)
@@ -369,6 +369,7 @@ const char * __init boot_module_kind_as_string(bootmodule_kind kind)
     case BOOTMOD_KERNEL:  return "Kernel";
     case BOOTMOD_RAMDISK: return "Ramdisk";
     case BOOTMOD_XSM:     return "XSM";
+    case BOOTMOD_GUEST_DTB:     return "DTB";
     case BOOTMOD_UNKNOWN: return "Unknown";
     default: BUG();
     }
index fa0a8721b2316cd517af727b78bf3ec0f5a96061..2f8f24e286ed1464b99f9f6659dd63eeaaba28b7 100644 (file)
@@ -16,6 +16,7 @@ typedef enum {
     BOOTMOD_KERNEL,
     BOOTMOD_RAMDISK,
     BOOTMOD_XSM,
+    BOOTMOD_GUEST_DTB,
     BOOTMOD_UNKNOWN
 }  bootmodule_kind;