Skip to contentSkip to conversation

xen: arm: Refactor/improve early DT parsing and multiboot module support

PATCH In review Ian Campbell 3 participants 28 messages Jul 18, 2014 – Jul 24, 2014

lore
Share & tools
lore
#0 lore raw

v3 cover xen: arm: Refactor/improve early DT parsing and multiboot module support

The following refactors the Xen early device tree stuff (i.e. which walks the flattened tree directly) away from the regular device tree stuff (i.e. the stuff which for the most part deals with the unflattened tree). It also makes some changes to the Xen side multiboot support which I think will make it easier to work with, both internally and for e.g. bootloader integration.

Impact on UEFI/ACPI: Mostly I think the refactoring may be useful when integrating the UEFI memory map and ACPI stuff (which wants early FDT, but not unflattening etc) in to Xen.

Impact on multiboot: This could potentially simplify things on the grub side by removing the need to guess default types for the modules in the common case.

In the future I think it would be good to implement more probing on the Xen side, e.g. to discover the XSM policy (similar to how it works on x86 -- which walks all the modules looking for the policy magic nr).

Apart from rebasing the main change here is to patch 7 to correct the lack of change to consider_modules which Julien pointed out last time.

Ian.

The following changes since commit f1870804e58565399cd770e93f62e7ce57cd5231:

xen: arm: flush TLB after overwriting 1:1 mapping in boot page tables (2014-07-18 13:38:09 +0100)

are available in the git repository at:

git://xenbits.xen.org/people/ianc/xen.git multiboot-improvements-v3

for you to fetch changes up to 212062ac8baaab4b1cdbd5c3c654e82bcc76e06e:

xen: arm: Only lookup kernel bootmodule once while building dom0 dtb. (2014-07-18 14:06:40 +0100)

----------------------------------------------------------------
Ian Campbell (10):
xen: arm: implement generic multiboot compatibility strings
xen: arm: /chosen/module@N/bootargs bootprotcol node is not deprecated
xen: arm: prefer typesafe max()/min() over MAX()/MIN()
xen: arm: rename early_info structs
xen: arm: move boot time fdt parsing into separate file.
xen: arm: move device_tree_bootargs to bootfdt.c, renaming to boot_fdt_cmdline
xen: arm: store per-boot module type instead of relying on index
xen: arm: support bootmodule type detection by ordering
xen: arm: update multiboot device tree bindings.
xen: arm: Only lookup kernel bootmodule once while building dom0 dtb.

 docs/misc/arm/device-tree/booting.txt |   59 ++++-
 xen/arch/arm/Makefile                 |    1 +
 xen/arch/arm/bootfdt.c                |  370 +++++++++++++++++++++++++++++++
 xen/arch/arm/domain_build.c           |   23 +-
 xen/arch/arm/kernel.c                 |   15 +-
 xen/arch/arm/kernel.h                 |    4 +-
 xen/arch/arm/p2m.c                    |    4 +-
 xen/arch/arm/setup.c                  |  133 ++++++++---
 xen/common/device_tree.c              |  388 +--------------------------------
 xen/include/asm-arm/setup.h           |   53 +++++
 xen/include/xen/device_tree.h         |   44 ----
 xen/xsm/xsm_policy.c                  |   19 +-
 12 files changed, 623 insertions(+), 490 deletions(-)
 create mode 100644 xen/arch/arm/bootfdt.c
#1 lore raw

PATCH v3 1/10 xen: arm: implement generic multiboot compatibility strings

This causes Xen to accept the more generic names specified in
http://wiki.xen.org/wiki/Xen_ARM_with_Virtualization_Extensions/Multiboot as of 2014-06-06.

These names are more generic than those proposed by Andre in
http://thread.gmane.org/gmane.linux.linaro.announce.boot/326 and those used in earlier drafts of the /Multiboot wiki page.

This will allow bootloaders to not special case Xen (or at least to reduce the amount which is required).

---
 xen/common/device_tree.c |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
xen/common/device_tree.c +6 -3
index 53f779a..3d18d7f 100644
@@ -340,9 +340,11 @@ static void __init process_multiboot_node(const void *fdt, int node,
     struct dt_mb_module *mod;
     int len;
 
-    if ( fdt_node_check_compatible(fdt, node, "xen,linux-zimage") == 0 )
+    if ( fdt_node_check_compatible(fdt, node, "xen,linux-zimage") == 0 ||
+         fdt_node_check_compatible(fdt, node, "multiboot,kernel") == 0 )
         nr = MOD_KERNEL;
-    else if ( fdt_node_check_compatible(fdt, node, "xen,linux-initrd") == 0)
+    else if ( fdt_node_check_compatible(fdt, node, "xen,linux-initrd") == 0 ||
+              fdt_node_check_compatible(fdt, node, "multiboot,ramdisk") == 0 )
         nr = MOD_INITRD;
     else if ( fdt_node_check_compatible(fdt, node, "xen,xsm-policy") == 0 )
         nr = MOD_XSM;
@@ -435,7 +437,8 @@ static int __init early_scan_node(const void *fdt,
 {
     if ( device_tree_node_matches(fdt, node, "memory") )
         process_memory_node(fdt, node, name, address_cells, size_cells);
-    else if ( device_tree_node_compatible(fdt, node, "xen,multiboot-module" ) )
+    else if ( device_tree_node_compatible(fdt, node, "xen,multiboot-module" ) ||
+              device_tree_node_compatible(fdt, node, "multiboot,module" ))
         process_multiboot_node(fdt, node, name, address_cells, size_cells);
     else if ( depth == 1 && device_tree_node_matches(fdt, node, "chosen") )
         process_chosen_node(fdt, node, name, address_cells, size_cells);
Signature · 1 line
1.7.10.4
#2 lore raw

PATCH v3 2/10 xen: arm: /chosen/module@N/bootargs bootprotcol node is not deprecated

In reply to Ian Campbell

When using a multiboot capable bootloader this is exactly the field which should be used.

Replace the deprecation wording with a reference to the information on the priority of the bootargs fields.

---
 docs/misc/arm/device-tree/booting.txt |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
docs/misc/arm/device-tree/booting.txt +3 -2
index a7fb52b..bfb8d01 100644
@@ -25,8 +25,9 @@ Each node contains the following properties:
 
 - bootargs (optional)
 
-	Command line associated with this module. This is deprecated and should
-	be replaced by the bootargs variations described below.
+	Command line associated with this module. See below for the
+	priority of this field vs. other mechanisms of specifying the
+	bootargs for the kernel.
 
 
 Command lines
Signature · 1 line
1.7.10.4
#3 lore raw

PATCH v3 3/10 xen: arm: prefer typesafe max()/min() over MAX()/MIN()

In reply to Ian Campbell
---
 xen/arch/arm/p2m.c       |    4 ++--
 xen/common/device_tree.c |    2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
xen/arch/arm/p2m.c +2 -2
index 2f855b5..18a3c9f 100644
@@ -812,8 +812,8 @@ static int apply_p2m_changes(struct domain *d,
         unsigned long sgfn = paddr_to_pfn(start_gpaddr);
         unsigned long egfn = paddr_to_pfn(end_gpaddr);
 
-        p2m->max_mapped_gfn = MAX(p2m->max_mapped_gfn, egfn);
-        p2m->lowest_mapped_gfn = MIN(p2m->lowest_mapped_gfn, sgfn);
+        p2m->max_mapped_gfn = max(p2m->max_mapped_gfn, egfn);
+        p2m->lowest_mapped_gfn = min(p2m->lowest_mapped_gfn, sgfn);
     }
 
     rc = 0;
xen/common/device_tree.c +1 -1
index 3d18d7f..dba2fba 100644
@@ -427,7 +427,7 @@ static void __init process_chosen_node(const void *fdt, int node,
     mod->start = start;
     mod->size = end - start;
 
-    early_info.modules.nr_mods = MAX(MOD_INITRD, early_info.modules.nr_mods);
+    early_info.modules.nr_mods = max(MOD_INITRD, early_info.modules.nr_mods);
 }
 
 static int __init early_scan_node(const void *fdt,
Signature · 1 line
1.7.10.4
#4 lore raw

PATCH v3 4/10 xen: arm: rename early_info structs

In reply to Ian Campbell

There isn't really anything Device Tree specific about the early_info, we just happen to get it from device tree (but in the future it might come e.g. from UEFI or ACPI or something else).

Move the relevant structs out of device_tree.h and into asm/setup.h and rename to be more neutral.

For now the code to parse the DT into the now arch specific structs remains in common code.

---
 xen/arch/arm/domain_build.c   |   13 ++++++-----
 xen/arch/arm/kernel.c         |    6 ++---
 xen/arch/arm/kernel.h         |    3 ++-
 xen/arch/arm/setup.c          |   51 ++++++++++++++++++++++-------------------
 xen/common/device_tree.c      |   38 +++++++++++++++---------------
 xen/include/asm-arm/setup.h   |   40 ++++++++++++++++++++++++++++++++
 xen/include/xen/device_tree.h |   39 -------------------------------
 7 files changed, 98 insertions(+), 92 deletions(-)
xen/arch/arm/domain_build.c +7 -6
index c58ad75..a065442 100644
@@ -16,6 +16,7 @@
 #include <asm/setup.h>
 #include <asm/platform.h>
 #include <asm/psci.h>
+#include <asm/setup.h>
 
 #include <asm/gic.h>
 #include <xen/irq.h>
@@ -404,9 +405,9 @@ static int write_properties(struct domain *d, struct kernel_info *kinfo,
     int res = 0;
     int had_dom0_bootargs = 0;
 
-    if ( early_info.modules.nr_mods >= MOD_KERNEL &&
-         early_info.modules.module[MOD_KERNEL].cmdline[0] )
-        bootargs = &early_info.modules.module[MOD_KERNEL].cmdline[0];
+    if ( bootinfo.modules.nr_mods >= MOD_KERNEL &&
+         bootinfo.modules.module[MOD_KERNEL].cmdline[0] )
+        bootargs = &bootinfo.modules.module[MOD_KERNEL].cmdline[0];
 
     dt_for_each_property_node (node, prop)
     {
@@ -465,7 +466,7 @@ static int write_properties(struct domain *d, struct kernel_info *kinfo,
          * If the bootloader provides an initrd, we must create a placeholder
          * for the initrd properties. The values will be replaced later.
          */
-        if ( early_info.modules.module[MOD_INITRD].size )
+        if ( bootinfo.modules.module[MOD_INITRD].size )
         {
             u64 a = 0;
             res = fdt_property(kinfo->fdt, "linux,initrd-start", &a, sizeof(a));
@@ -1221,8 +1222,8 @@ static void dtb_load(struct kernel_info *kinfo)
 static void initrd_load(struct kernel_info *kinfo)
 {
     paddr_t load_addr = kinfo->initrd_paddr;
-    paddr_t paddr = early_info.modules.module[MOD_INITRD].start;
-    paddr_t len = early_info.modules.module[MOD_INITRD].size;
+    paddr_t paddr = bootinfo.modules.module[MOD_INITRD].start;
+    paddr_t len = bootinfo.modules.module[MOD_INITRD].size;
     unsigned long offs;
     int node;
     int res;
xen/arch/arm/kernel.c +3 -3
index 69182ec..ce5b95a 100644
@@ -69,7 +69,7 @@ static void place_modules(struct kernel_info *info,
 {
     /* Align DTB and initrd size to 2Mb. Linux only requires 4 byte alignment */
     const paddr_t initrd_len =
-        ROUNDUP(early_info.modules.module[MOD_INITRD].size, MB(2));
+        ROUNDUP(bootinfo.modules.module[MOD_INITRD].size, MB(2));
     const paddr_t dtb_len = ROUNDUP(fdt_totalsize(info->fdt), MB(2));
     const paddr_t modsize = initrd_len + dtb_len;
 
@@ -376,8 +376,8 @@ int kernel_probe(struct kernel_info *info)
 
     paddr_t start, size;
 
-    start = early_info.modules.module[MOD_KERNEL].start;
-    size = early_info.modules.module[MOD_KERNEL].size;
+    start = bootinfo.modules.module[MOD_KERNEL].start;
+    size = bootinfo.modules.module[MOD_KERNEL].size;
 
     if ( !size )
     {
xen/arch/arm/kernel.h +2 -1
index fd2f61d..7c7f624 100644
@@ -8,6 +8,7 @@
 
 #include <xen/libelf.h>
 #include <xen/device_tree.h>
+#include <asm/setup.h>
 
 struct kernel_info {
 #ifdef CONFIG_ARM_64
@@ -16,7 +17,7 @@ struct kernel_info {
 
     void *fdt; /* flat device tree */
     paddr_t unassigned_mem; /* RAM not (yet) assigned to a bank */
-    struct dt_mem_info mem;
+    struct meminfo mem;
 
     /* kernel entry point */
     paddr_t entry;
xen/arch/arm/setup.c +27 -24

135 lines not on this page · raw message

xen/common/device_tree.c +19 -19
index dba2fba..c0b2b95 100644
@@ -23,8 +23,8 @@
 #include <xen/cpumask.h>
 #include <xen/ctype.h>
 #include <xen/lib.h>
+#include <asm/setup.h>
 
-struct dt_early_info __initdata early_info;
 const void *device_tree_flattened;
 dt_irq_xlate_func dt_irq_xlate;
 /* Host device tree */
@@ -238,10 +238,10 @@ const char *device_tree_bootargs(const void *fdt)
     prop = fdt_get_property(fdt, node, "xen,xen-bootargs", NULL);
     if ( prop == NULL )
     {
-        struct dt_mb_module *dom0_mod = NULL;
+        struct bootmodule *dom0_mod = NULL;
 
-        if ( early_info.modules.nr_mods >= MOD_KERNEL )
-            dom0_mod = &early_info.modules.module[MOD_KERNEL];
+        if ( bootinfo.modules.nr_mods >= MOD_KERNEL )
+            dom0_mod = &bootinfo.modules.module[MOD_KERNEL];
 
         if (fdt_get_property(fdt, node, "xen,dom0-bootargs", NULL) ||
             ( dom0_mod && dom0_mod->cmdline[0] ) )
@@ -319,14 +319,14 @@ static void __init process_memory_node(const void *fdt, int node,
     cell = (const __be32 *)prop->data;
     banks = fdt32_to_cpu(prop->len) / (reg_cells * sizeof (u32));
 
-    for ( i = 0; i < banks && early_info.mem.nr_banks < NR_MEM_BANKS; i++ )
+    for ( i = 0; i < banks && bootinfo.mem.nr_banks < NR_MEM_BANKS; i++ )
     {
         device_tree_get_reg(&cell, address_cells, size_cells, &start, &size);
         if ( !size )
             continue;
-        early_info.mem.bank[early_info.mem.nr_banks].start = start;
-        early_info.mem.bank[early_info.mem.nr_banks].size = size;
-        early_info.mem.nr_banks++;
+        bootinfo.mem.bank[bootinfo.mem.nr_banks].start = start;
+        bootinfo.mem.bank[bootinfo.mem.nr_banks].size = size;
+        bootinfo.mem.nr_banks++;
     }
 }
 
@@ -337,7 +337,7 @@ static void __init process_multiboot_node(const void *fdt, int node,
     const struct fdt_property *prop;
     const __be32 *cell;
     int nr;
-    struct dt_mb_module *mod;
+    struct bootmodule *mod;
     int len;
 
     if ( fdt_node_check_compatible(fdt, node, "xen,linux-zimage") == 0 ||
@@ -351,7 +351,7 @@ static void __init process_multiboot_node(const void *fdt, int node,
     else
         panic("%s not a known xen multiboot type\n", name);
 
-    mod = &early_info.modules.module[nr];
+    mod = &bootinfo.modules.module[nr];
 
     prop = fdt_get_property(fdt, node, "reg", &len);
     if ( !prop )
@@ -376,8 +376,8 @@ static void __init process_multiboot_node(const void *fdt, int node,
     else
         mod->cmdline[0] = 0;
 
-    if ( nr > early_info.modules.nr_mods )
-        early_info.modules.nr_mods = nr;
+    if ( nr > bootinfo.modules.nr_mods )
+        bootinfo.modules.nr_mods = nr;
 }
 
 static void __init process_chosen_node(const void *fdt, int node,
@@ -385,7 +385,7 @@ static void __init process_chosen_node(const void *fdt, int node,
                                        u32 address_cells, u32 size_cells)
 {
     const struct fdt_property *prop;
-    struct dt_mb_module *mod = &early_info.modules.module[MOD_INITRD];
+    struct bootmodule *mod = &bootinfo.modules.module[MOD_INITRD];
     paddr_t start, end;
     int len;
 
@@ -427,7 +427,7 @@ static void __init process_chosen_node(const void *fdt, int node,
     mod->start = start;
     mod->size = end - start;
 
-    early_info.modules.nr_mods = max(MOD_INITRD, early_info.modules.nr_mods);
+    bootinfo.modules.nr_mods = max(MOD_INITRD, bootinfo.modules.nr_mods);
 }
 
 static int __init early_scan_node(const void *fdt,
@@ -448,8 +448,8 @@ static int __init early_scan_node(const void *fdt,
 
 static void __init early_print_info(void)
 {
-    struct dt_mem_info *mi = &early_info.mem;
-    struct dt_module_info *mods = &early_info.modules;
+    struct meminfo *mi = &bootinfo.mem;
+    struct bootmodules *mods = &bootinfo.modules;
     int i, nr_rsvd;
 
     for ( i = 0; i < mi->nr_banks; i++ )
@@ -485,18 +485,18 @@ static void __init early_print_info(void)
  */
 size_t __init device_tree_early_init(const void *fdt, paddr_t paddr)
 {
-    struct dt_mb_module *mod;
+    struct bootmodule *mod;
     int ret;
 
     ret = fdt_check_header(fdt);
     if ( ret < 0 )
         panic("No valid device tree\n");
 
-    mod = &early_info.modules.module[MOD_FDT];
+    mod = &bootinfo.modules.module[MOD_FDT];
     mod->start = paddr;
     mod->size = fdt_totalsize(fdt);
 
-    early_info.modules.nr_mods = max(MOD_FDT, early_info.modules.nr_mods);
+    bootinfo.modules.nr_mods = max(MOD_FDT, bootinfo.modules.nr_mods);
 
     device_tree_for_each_node((void *)fdt, early_scan_node, NULL);
     early_print_info();
xen/include/asm-arm/setup.h +40 -0
index b09f688..ea0dc46 100644
@@ -3,6 +3,46 @@
 
 #include <public/version.h>
 
+#define NR_MEM_BANKS 8
+
+#define MOD_XEN    0
+#define MOD_FDT    1
+#define MOD_KERNEL 2
+#define MOD_INITRD 3
+#define MOD_XSM    4
+#define NR_MODULES 5
+
+#define MOD_DISCARD_FIRST MOD_FDT
+
+struct membank {
+    paddr_t start;
+    paddr_t size;
+};
+
+struct meminfo {
+    int nr_banks;
+    struct membank bank[NR_MEM_BANKS];
+};
+
+struct bootmodule {
+    paddr_t start;
+    paddr_t size;
+    char cmdline[1024];
+};
+
+struct bootmodules {
+    int nr_mods;
+    /* Module 0 is Xen itself, followed by the provided modules-proper */
+    struct bootmodule module[NR_MODULES];
+};
+
+struct bootinfo {
+    struct meminfo mem;
+    struct bootmodules modules;
+};
+
+extern struct bootinfo bootinfo;
+
 void arch_init_memory(void);
 
 void copy_from_paddr(void *dst, paddr_t paddr, unsigned long len);
xen/include/xen/device_tree.h +0 -39
index 865e1ef..717ef55 100644
@@ -20,44 +20,6 @@
 
 #define DEVICE_TREE_MAX_DEPTH 16
 
-#define NR_MEM_BANKS 8
-
-#define MOD_XEN    0
-#define MOD_FDT    1
-#define MOD_KERNEL 2
-#define MOD_INITRD 3
-#define MOD_XSM    4
-#define NR_MODULES 5
-
-#define MOD_DISCARD_FIRST MOD_FDT
-
-struct membank {
-    paddr_t start;
-    paddr_t size;
-};
-
-struct dt_mem_info {
-    int nr_banks;
-    struct membank bank[NR_MEM_BANKS];
-};
-
-struct dt_mb_module {
-    paddr_t start;
-    paddr_t size;
-    char cmdline[1024];
-};
-
-struct dt_module_info {
-    int nr_mods;
-    /* Module 0 is Xen itself, followed by the provided modules-proper */
-    struct dt_mb_module module[NR_MODULES];
-};
-
-struct dt_early_info {
-    struct dt_mem_info mem;
-    struct dt_module_info modules;
-};
-
 /*
  * Struct used for matching a device
  */
@@ -195,7 +157,6 @@ typedef int (*device_tree_node_func)(const void *fdt,
                                      u32 address_cells, u32 size_cells,
                                      void *data);
 
-extern struct dt_early_info early_info;
 extern const void *device_tree_flattened;
 
 size_t __init device_tree_early_init(const void *fdt, paddr_t paddr);
Signature · 1 line
1.7.10.4
#5 lore raw

PATCH v3 5/10 xen: arm: move boot time fdt parsing into separate file.

In reply to Ian Campbell

Move the early code for walking the flattened device tree out of device_tree.c. The intention is that eventually only the proper (i.e. unflattened) device tree support will live in device_tree.c.

The new home is bootfdt.c to try and better reflect the purpose of the code. Although in theory this early code could be generic in reality it is pretty ARM specific, so place it under xen/arch/arm until a second user wants it.

As part of the move rename device_tree_early_init to boot_fdt_info. Drop device_tree_dump, it is unused.

---
 xen/arch/arm/Makefile         |    1 +
 xen/arch/arm/bootfdt.c        |  345 +++++++++++++++++++++++++++++++++++++++
 xen/arch/arm/setup.c          |    2 +-
 xen/common/device_tree.c      |  358 -----------------------------------------
 xen/include/asm-arm/setup.h   |    2 +
 xen/include/xen/device_tree.h |    3 -
 6 files changed, 349 insertions(+), 362 deletions(-)
 create mode 100644 xen/arch/arm/bootfdt.c
xen/arch/arm/Makefile +1 -0
index 20f59f4..c13206f 100644
@@ -21,6 +21,7 @@ obj-y += guestcopy.o
 obj-y += physdev.o
 obj-y += platform.o
 obj-y += setup.o
+obj-y += bootfdt.o
 obj-y += time.o
 obj-y += smpboot.o
 obj-y += smp.o
xen/arch/arm/bootfdt.c new file +345 -0

345 lines not on this page · raw message

xen/arch/arm/setup.c +1 -1
index b1aa9c3..05336d6 100644
@@ -684,7 +684,7 @@ void __init start_xen(unsigned long boot_phys_offset,
     /* This is mapped by head.S */
     device_tree_flattened = (void *)BOOT_FDT_VIRT_START
         + (fdt_paddr & ((1 << SECOND_SHIFT) - 1));
-    fdt_size = device_tree_early_init(device_tree_flattened, fdt_paddr);
+    fdt_size = boot_fdt_info(device_tree_flattened, fdt_paddr);
 
     cmdline = device_tree_bootargs(device_tree_flattened);
     printk("Command line: %s\n", cmdline);
xen/common/device_tree.c +0 -358

382 lines not on this page · raw message

xen/include/asm-arm/setup.h +2 -0
index ea0dc46..21dbcd4 100644
@@ -53,6 +53,8 @@ int construct_dom0(struct domain *d);
 
 void discard_initial_modules(void);
 
+size_t __init boot_fdt_info(const void *fdt, paddr_t paddr);
+
 #endif
 /*
  * Local variables:
xen/include/xen/device_tree.h +0 -3
index 717ef55..7e6ab6b 100644
@@ -159,10 +159,7 @@ typedef int (*device_tree_node_func)(const void *fdt,
 
 extern const void *device_tree_flattened;
 
-size_t __init device_tree_early_init(const void *fdt, paddr_t paddr);
-
 const char __init *device_tree_bootargs(const void *fdt);
-void __init device_tree_dump(const void *fdt);
 
 /**
  * dt_unflatten_host_device_tree - Unflatten the host device tree
Signature · 1 line
1.7.10.4
#6 lore raw

PATCH v3 6/10 xen: arm: move device_tree_bootargs to bootfdt.c, renaming to boot_fdt_cmdline

In reply to Ian Campbell
---
 xen/arch/arm/bootfdt.c        |   27 +++++++++++++++++++++++++++
 xen/arch/arm/setup.c          |    2 +-
 xen/common/device_tree.c      |   31 -------------------------------
 xen/include/asm-arm/setup.h   |    1 +
 xen/include/xen/device_tree.h |    2 --
 5 files changed, 29 insertions(+), 34 deletions(-)
xen/arch/arm/bootfdt.c +27 -0
index bcf4882..23aff5a 100644
@@ -335,6 +335,33 @@ size_t __init boot_fdt_info(const void *fdt, paddr_t paddr)
     return fdt_totalsize(fdt);
 }
 
+const char *boot_fdt_cmdline(const void *fdt)
+{
+    int node;
+    const struct fdt_property *prop;
+
+    node = fdt_path_offset(fdt, "/chosen");
+    if ( node < 0 )
+        return NULL;
+
+    prop = fdt_get_property(fdt, node, "xen,xen-bootargs", NULL);
+    if ( prop == NULL )
+    {
+        struct bootmodule *dom0_mod = NULL;
+
+        if ( bootinfo.modules.nr_mods >= MOD_KERNEL )
+            dom0_mod = &bootinfo.modules.module[MOD_KERNEL];
+
+        if (fdt_get_property(fdt, node, "xen,dom0-bootargs", NULL) ||
+            ( dom0_mod && dom0_mod->cmdline[0] ) )
+            prop = fdt_get_property(fdt, node, "bootargs", NULL);
+    }
+    if ( prop == NULL )
+        return NULL;
+
+    return prop->data;
+}
+
 /*
  * Local variables:
  * mode: C
xen/arch/arm/setup.c +1 -1
index 05336d6..eefb610 100644
@@ -686,7 +686,7 @@ void __init start_xen(unsigned long boot_phys_offset,
         + (fdt_paddr & ((1 << SECOND_SHIFT) - 1));
     fdt_size = boot_fdt_info(device_tree_flattened, fdt_paddr);
 
-    cmdline = device_tree_bootargs(device_tree_flattened);
+    cmdline = boot_fdt_cmdline(device_tree_flattened);
     printk("Command line: %s\n", cmdline);
     cmdline_parse(cmdline);
 
xen/common/device_tree.c +0 -31
index 689970d..f72b2e9 100644
@@ -115,37 +115,6 @@ void dt_set_range(__be32 **cellp, const struct dt_device_node *np,
     dt_set_cell(cellp, dt_n_size_cells(np), size);
 }
 
-/**
- * device_tree_bootargs - return the bootargs (the Xen command line)
- * @fdt flat device tree.
- */
-const char *device_tree_bootargs(const void *fdt)
-{
-    int node;
-    const struct fdt_property *prop;
-
-    node = fdt_path_offset(fdt, "/chosen");
-    if ( node < 0 )
-        return NULL;
-
-    prop = fdt_get_property(fdt, node, "xen,xen-bootargs", NULL);
-    if ( prop == NULL )
-    {
-        struct bootmodule *dom0_mod = NULL;
-
-        if ( bootinfo.modules.nr_mods >= MOD_KERNEL )
-            dom0_mod = &bootinfo.modules.module[MOD_KERNEL];
-
-        if (fdt_get_property(fdt, node, "xen,dom0-bootargs", NULL) ||
-            ( dom0_mod && dom0_mod->cmdline[0] ) )
-            prop = fdt_get_property(fdt, node, "bootargs", NULL);
-    }
-    if ( prop == NULL )
-        return NULL;
-
-    return prop->data;
-}
-
 static void __init *unflatten_dt_alloc(unsigned long *mem, unsigned long size,
                                        unsigned long align)
 {
xen/include/asm-arm/setup.h +1 -0
index 21dbcd4..85aa866 100644
@@ -54,6 +54,7 @@ int construct_dom0(struct domain *d);
 void discard_initial_modules(void);
 
 size_t __init boot_fdt_info(const void *fdt, paddr_t paddr);
+const char __init *boot_fdt_cmdline(const void *fdt);
 
 #endif
 /*
xen/include/xen/device_tree.h +0 -2
index 7e6ab6b..08db8bc 100644
@@ -159,8 +159,6 @@ typedef int (*device_tree_node_func)(const void *fdt,
 
 extern const void *device_tree_flattened;
 
-const char __init *device_tree_bootargs(const void *fdt);
-
 /**
  * dt_unflatten_host_device_tree - Unflatten the host device tree
  *
Signature · 1 line
1.7.10.4
#7 lore raw

PATCH v3 7/10 xen: arm: store per-boot module type instead of relying on index

In reply to Ian Campbell

This is more natural and better matches how multiboot is actually supposed to work.

As part of this we need to modify consider_modules to handle Xen not necessarily being module zero any more. To do this we first register a module for Xen at the original load address and then update after we have relocated. This is also fixing a latent issue which is that get_xen_paddr() would not consider Xen's current physical address when picking the target address which was buggy because the relocation code cannot handle the possiblity of the old and new locations overlapping.

All callers of consider_modules now consider the full range instead of some skipping slot 0.

---
v3: Handle consider_modules, remove obsolete comment
v2: Fix XSM
s/bootmodulekind/bootmodule_kind/
Print which module we aren't adding
Only (and explictly) preserve Xen in discard_initial_modules

---
 xen/arch/arm/bootfdt.c      |   49 +++++++++++--------------------
 xen/arch/arm/domain_build.c |   20 ++++++++-----
 xen/arch/arm/kernel.c       |   15 +++++-----
 xen/arch/arm/setup.c        |   68 ++++++++++++++++++++++++++++++++++++++-----
 xen/include/asm-arm/setup.h |   29 +++++++++++-------
 xen/xsm/xsm_policy.c        |   19 ++++++++++--
 6 files changed, 134 insertions(+), 66 deletions(-)
xen/arch/arm/bootfdt.c +17 -32
index 23aff5a..ce7fdf2 100644
@@ -167,23 +167,22 @@ static void __init process_multiboot_node(const void *fdt, int node,
 {
     const struct fdt_property *prop;
     const __be32 *cell;
-    int nr;
-    struct bootmodule *mod;
+    bootmodule_kind kind;
+    paddr_t start, size;
+    const char *cmdline;
     int len;
 
     if ( fdt_node_check_compatible(fdt, node, "xen,linux-zimage") == 0 ||
          fdt_node_check_compatible(fdt, node, "multiboot,kernel") == 0 )
-        nr = MOD_KERNEL;
+        kind = BOOTMOD_KERNEL;
     else if ( fdt_node_check_compatible(fdt, node, "xen,linux-initrd") == 0 ||
               fdt_node_check_compatible(fdt, node, "multiboot,ramdisk") == 0 )
-        nr = MOD_INITRD;
+        kind = BOOTMOD_RAMDISK;
     else if ( fdt_node_check_compatible(fdt, node, "xen,xsm-policy") == 0 )
-        nr = MOD_XSM;
+        kind = BOOTMOD_XSM;
     else
         panic("%s not a known xen multiboot type\n", name);
 
-    mod = &bootinfo.modules.module[nr];
-
     prop = fdt_get_property(fdt, node, "reg", &len);
     if ( !prop )
         panic("node %s missing `reg' property\n", name);
@@ -193,22 +192,19 @@ static void __init process_multiboot_node(const void *fdt, int node,
                     name);
 
     cell = (const __be32 *)prop->data;
-    device_tree_get_reg(&cell, address_cells, size_cells,
-                        &mod->start, &mod->size);
+    device_tree_get_reg(&cell, address_cells, size_cells, &start, &size);
 
     prop = fdt_get_property(fdt, node, "bootargs", &len);
     if ( prop )
     {
-        if ( len > sizeof(mod->cmdline) )
-            panic("module %d command line too long\n", nr);
-
-        safe_strcpy(mod->cmdline, prop->data);
+        if ( len > BOOTMOD_MAX_CMDLINE )
+            panic("module %s command line too long\n", name);
+        cmdline = prop->data;
     }
     else
-        mod->cmdline[0] = 0;
+        cmdline = NULL;
 
-    if ( nr > bootinfo.modules.nr_mods )
-        bootinfo.modules.nr_mods = nr;
+    add_boot_module(kind, start, size, cmdline);
 }
 
 static void __init process_chosen_node(const void *fdt, int node,
@@ -216,7 +212,6 @@ static void __init process_chosen_node(const void *fdt, int node,
                                        u32 address_cells, u32 size_cells)
 {
     const struct fdt_property *prop;
-    struct bootmodule *mod = &bootinfo.modules.module[MOD_INITRD];
     paddr_t start, end;
     int len;
 
@@ -255,10 +250,7 @@ static void __init process_chosen_node(const void *fdt, int node,
 
     printk("Initrd %"PRIpaddr"-%"PRIpaddr"\n", start, end);
 
-    mod->start = start;
-    mod->size = end - start;
-
-    bootinfo.modules.nr_mods = max(MOD_INITRD, bootinfo.modules.nr_mods);
+    add_boot_module(BOOTMOD_RAMDISK, start, end-start, NULL);
 }
 
 static int __init early_scan_node(const void *fdt,
@@ -288,7 +280,7 @@ static void __init early_print_info(void)
                      mi->bank[i].start,
                      mi->bank[i].start + mi->bank[i].size - 1);
     printk("\n");
-    for ( i = 1 ; i < mods->nr_mods + 1; i++ )
+    for ( i = 0 ; i < mods->nr_mods; i++ )
         printk("MODULE[%d]: %"PRIpaddr" - %"PRIpaddr" %s\n",
                      i,
                      mods->module[i].start,
@@ -316,18 +308,13 @@ static void __init early_print_info(void)
  */
 size_t __init boot_fdt_info(const void *fdt, paddr_t paddr)
 {
-    struct bootmodule *mod;
     int ret;
 
     ret = fdt_check_header(fdt);
     if ( ret < 0 )
         panic("No valid device tree\n");
 
-    mod = &bootinfo.modules.module[MOD_FDT];
-    mod->start = paddr;
-    mod->size = fdt_totalsize(fdt);
-
-    bootinfo.modules.nr_mods = max(MOD_FDT, bootinfo.modules.nr_mods);
+    add_boot_module(BOOTMOD_FDT, paddr, fdt_totalsize(fdt), NULL);
 
     device_tree_for_each_node((void *)fdt, early_scan_node, NULL);
     early_print_info();
@@ -347,10 +334,8 @@ const char *boot_fdt_cmdline(const void *fdt)
     prop = fdt_get_property(fdt, node, "xen,xen-bootargs", NULL);
     if ( prop == NULL )
     {
-        struct bootmodule *dom0_mod = NULL;
-
-        if ( bootinfo.modules.nr_mods >= MOD_KERNEL )
-            dom0_mod = &bootinfo.modules.module[MOD_KERNEL];
+        struct bootmodule *dom0_mod =
+            boot_module_find_by_kind(BOOTMOD_KERNEL);
 
         if (fdt_get_property(fdt, node, "xen,dom0-bootargs", NULL) ||
             ( dom0_mod && dom0_mod->cmdline[0] ) )
xen/arch/arm/domain_build.c +13 -7
index a065442..154367e 100644
@@ -405,9 +405,10 @@ static int write_properties(struct domain *d, struct kernel_info *kinfo,
     int res = 0;
     int had_dom0_bootargs = 0;
 
-    if ( bootinfo.modules.nr_mods >= MOD_KERNEL &&
-         bootinfo.modules.module[MOD_KERNEL].cmdline[0] )
-        bootargs = &bootinfo.modules.module[MOD_KERNEL].cmdline[0];
+    struct bootmodule *mod = boot_module_find_by_kind(BOOTMOD_KERNEL);
+
+    if ( mod && mod->cmdline[0] )
+        bootargs = &mod->cmdline[0];
 
     dt_for_each_property_node (node, prop)
     {
@@ -454,6 +455,8 @@ static int write_properties(struct domain *d, struct kernel_info *kinfo,
 
     if ( dt_node_path_is_equal(node, "/chosen") )
     {
+        struct bootmodule *mod = boot_module_find_by_kind(BOOTMOD_RAMDISK);
+
         if ( bootargs )
         {
             res = fdt_property(kinfo->fdt, "bootargs", bootargs,
@@ -466,7 +469,7 @@ static int write_properties(struct domain *d, struct kernel_info *kinfo,
          * If the bootloader provides an initrd, we must create a placeholder
          * for the initrd properties. The values will be replaced later.
          */
-        if ( bootinfo.modules.module[MOD_INITRD].size )
+        if ( mod && mod->size )
         {
             u64 a = 0;
             res = fdt_property(kinfo->fdt, "linux,initrd-start", &a, sizeof(a));
@@ -1221,18 +1224,21 @@ static void dtb_load(struct kernel_info *kinfo)
 
 static void initrd_load(struct kernel_info *kinfo)
 {
+    struct bootmodule *mod = boot_module_find_by_kind(BOOTMOD_RAMDISK);
     paddr_t load_addr = kinfo->initrd_paddr;
-    paddr_t paddr = bootinfo.modules.module[MOD_INITRD].start;
-    paddr_t len = bootinfo.modules.module[MOD_INITRD].size;
+    paddr_t paddr, len;
     unsigned long offs;
     int node;
     int res;
     __be32 val[2];
     __be32 *cellp;
 
-    if ( !len )
+    if ( !mod || !mod->size )
         return;
 
+    paddr = mod->start;
+    len = mod->size;
+
     printk("Loading dom0 initrd from %"PRIpaddr" to 0x%"PRIpaddr"-0x%"PRIpaddr"\n",
            paddr, load_addr, load_addr + len);
 
xen/arch/arm/kernel.c +8 -7
index ce5b95a..230ff8f 100644
@@ -68,8 +68,8 @@ static void place_modules(struct kernel_info *info,
                           paddr_t kernbase, paddr_t kernend)
 {
     /* Align DTB and initrd size to 2Mb. Linux only requires 4 byte alignment */
-    const paddr_t initrd_len =
-        ROUNDUP(bootinfo.modules.module[MOD_INITRD].size, MB(2));
+    const struct bootmodule *mod = boot_module_find_by_kind(BOOTMOD_RAMDISK);
+    const paddr_t initrd_len = ROUNDUP(mod ? mod->size : 0, MB(2));
     const paddr_t dtb_len = ROUNDUP(fdt_totalsize(info->fdt), MB(2));
     const paddr_t modsize = initrd_len + dtb_len;
 
@@ -372,20 +372,21 @@ err:
 
 int kernel_probe(struct kernel_info *info)
 {
+    struct bootmodule *mod = boot_module_find_by_kind(BOOTMOD_KERNEL);
     int rc;
 
     paddr_t start, size;
 
-    start = bootinfo.modules.module[MOD_KERNEL].start;
-    size = bootinfo.modules.module[MOD_KERNEL].size;
-
-    if ( !size )
+    if ( !mod || !mod->size )
     {
         printk(XENLOG_ERR "Missing kernel boot module?\n");
         return -ENOENT;
     }
 
-    printk("Loading kernel from boot module %d\n", MOD_KERNEL);
+    start = mod->start;
+    size = mod->size;
+
+    printk("Loading kernel from boot module @ %"PRIpaddr"\n", start);
 
 #ifdef CONFIG_ARM_64
     rc = kernel_zimage64_probe(info, start, size);
xen/arch/arm/setup.c +61 -7

108 lines not on this page · raw message

xen/include/asm-arm/setup.h +19 -10
index 85aa866..e2e18c3 100644
@@ -5,14 +5,17 @@
 
 #define NR_MEM_BANKS 8
 
-#define MOD_XEN    0
-#define MOD_FDT    1
-#define MOD_KERNEL 2
-#define MOD_INITRD 3
-#define MOD_XSM    4
-#define NR_MODULES 5
+#define MAX_MODULES 5 /* Current maximum useful modules */
+
+typedef enum {
+    BOOTMOD_XEN,
+    BOOTMOD_FDT,
+    BOOTMOD_KERNEL,
+    BOOTMOD_RAMDISK,
+    BOOTMOD_XSM,
+    BOOTMOD_UNKNOWN
+}  bootmodule_kind;
 
-#define MOD_DISCARD_FIRST MOD_FDT
 
 struct membank {
     paddr_t start;
@@ -24,16 +27,17 @@ struct meminfo {
     struct membank bank[NR_MEM_BANKS];
 };
 
+#define BOOTMOD_MAX_CMDLINE 1024
 struct bootmodule {
+    bootmodule_kind kind;
     paddr_t start;
     paddr_t size;
-    char cmdline[1024];
+    char cmdline[BOOTMOD_MAX_CMDLINE];
 };
 
 struct bootmodules {
     int nr_mods;
-    /* Module 0 is Xen itself, followed by the provided modules-proper */
-    struct bootmodule module[NR_MODULES];
+    struct bootmodule module[MAX_MODULES];
 };
 
 struct bootinfo {
@@ -56,6 +60,11 @@ void discard_initial_modules(void);
 size_t __init boot_fdt_info(const void *fdt, paddr_t paddr);
 const char __init *boot_fdt_cmdline(const void *fdt);
 
+struct bootmodule *add_boot_module(bootmodule_kind kind,
+                                   paddr_t start, paddr_t size,
+                                   const char *cmdline);
+struct bootmodule *boot_module_find_by_kind(bootmodule_kind kind);
+
 #endif
 /*
  * Local variables:
xen/xsm/xsm_policy.c +16 -3
index a0dee09..6e0bb78 100644
@@ -77,13 +77,16 @@ int __init xsm_multiboot_policy_init(unsigned long *module_map,
 #ifdef HAS_DEVICE_TREE
 int __init xsm_dt_policy_init(void)
 {
-    paddr_t paddr = early_info.modules.module[MOD_XSM].start;
-    paddr_t len = early_info.modules.module[MOD_XSM].size;
+    struct bootmodule *mod = boot_module_find_by_kind(BOOTMOD_XSM);
+    paddr_t paddr, len;
     xsm_magic_t magic;
 
-    if ( !len )
+    if ( !mod || !mod->size )
         return 0;
 
+    paddr = mod->start;
+    len = mod->size;
+
     copy_from_paddr(&magic, paddr, sizeof(magic));
 
     if ( magic != XSM_MAGIC )
@@ -106,3 +109,13 @@ int __init xsm_dt_policy_init(void)
     return 0;
 }
 #endif
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
Signature · 1 line
1.7.10.4
Acked-by on v3 7/10
#8 lore raw

Re: [PATCH v3 07/10] xen: arm: store per-boot module type instead of relying on index

Hi Ian,

Quoted 9 lines · Ian Campbell

This is more natural and better matches how multiboot is actually supposed to work.

As part of this we need to modify consider_modules to handle Xen not necessarily being module zero any more. To do this we first register a module for Xen at the original load address and then update after we have relocated. This is also fixing a latent issue which is that get_xen_paddr() would not consider Xen's current physical address when picking the target address which was buggy because the relocation code cannot handle the possiblity of the old

possibility

Quoted 6 lines

and new locations overlapping.

All callers of consider_modules now consider the full range instead of some skipping slot 0.

Signature · 1 line
Julien Grall
#9 lore raw

PATCH v3 8/10 xen: arm: support bootmodule type detection by ordering

In reply to Ian Campbell

Assign modules types based on the order in which they are defined in the FDT. This is supported only for the dom0 kernel and ramdisk when given as the first and second modules respectively, similar to how
http://wiki.xen.org/wiki?title=Xen_ARM_with_Virtualization_Extensions/Multiboot&oldid=11824
defined the default types from the bootloader side.

This is compatible with how Xen interprets the modules with x86 multiboot and I think simplifies things for bootloaders which now need not contain similar guessing code if they only care about the most basic case.

---
v2: Don't rely on enum ordering for guessing

---
 xen/arch/arm/bootfdt.c      |   17 +++++++++++++++--
 xen/arch/arm/setup.c        |   14 ++++++++++++++
 xen/include/asm-arm/setup.h |    1 +
 3 files changed, 30 insertions(+), 2 deletions(-)
xen/arch/arm/bootfdt.c +15 -2
index ce7fdf2..e100233 100644
@@ -165,6 +165,7 @@ static void __init process_multiboot_node(const void *fdt, int node,
                                           const char *name,
                                           u32 address_cells, u32 size_cells)
 {
+    static int kind_guess = 0;
     const struct fdt_property *prop;
     const __be32 *cell;
     bootmodule_kind kind;
@@ -181,7 +182,18 @@ static void __init process_multiboot_node(const void *fdt, int node,
     else if ( fdt_node_check_compatible(fdt, node, "xen,xsm-policy") == 0 )
         kind = BOOTMOD_XSM;
     else
-        panic("%s not a known xen multiboot type\n", name);
+        kind = BOOTMOD_UNKNOWN;
+
+    /* Guess that first two unknown are kernel and ramdisk respectively. */
+    if ( kind == BOOTMOD_UNKNOWN )
+    {
+        switch ( kind_guess++ )
+        {
+        case 0: kind = BOOTMOD_KERNEL; break;
+        case 1: kind = BOOTMOD_RAMDISK; break;
+        default: break;
+        }
+    }
 
     prop = fdt_get_property(fdt, node, "reg", &len);
     if ( !prop )
@@ -281,10 +293,11 @@ static void __init early_print_info(void)
                      mi->bank[i].start + mi->bank[i].size - 1);
     printk("\n");
     for ( i = 0 ; i < mods->nr_mods; i++ )
-        printk("MODULE[%d]: %"PRIpaddr" - %"PRIpaddr" %s\n",
+        printk("MODULE[%d]: %"PRIpaddr" - %"PRIpaddr" %-12s %s\n",
                      i,
                      mods->module[i].start,
                      mods->module[i].start + mods->module[i].size,
+                     boot_module_kind_as_string(mods->module[i].kind),
                      mods->module[i].cmdline);
     nr_rsvd = fdt_num_mem_rsv(device_tree_flattened);
     for ( i = 0; i < nr_rsvd; i++ )
xen/arch/arm/setup.c +14 -0
index 0cbe552..e53e491 100644
@@ -223,6 +223,20 @@ struct bootmodule * __init boot_module_find_by_kind(bootmodule_kind kind)
     return NULL;
 }
 
+const char * __init boot_module_kind_as_string(bootmodule_kind kind)
+{
+    switch ( kind )
+    {
+    case BOOTMOD_XEN:     return "Xen";
+    case BOOTMOD_FDT:     return "Device Tree";
+    case BOOTMOD_KERNEL:  return "Kernel";
+    case BOOTMOD_RAMDISK: return "Ramdisk";
+    case BOOTMOD_XSM:     return "XSM";
+    case BOOTMOD_UNKNOWN: return "Unknown";
+    default: BUG();
+    }
+}
+
 void __init discard_initial_modules(void)
 {
     struct bootmodules *mi = &bootinfo.modules;
xen/include/asm-arm/setup.h +1 -0
index e2e18c3..36e5704 100644
@@ -64,6 +64,7 @@ struct bootmodule *add_boot_module(bootmodule_kind kind,
                                    paddr_t start, paddr_t size,
                                    const char *cmdline);
 struct bootmodule *boot_module_find_by_kind(bootmodule_kind kind);
+const char * __init boot_module_kind_as_string(bootmodule_kind kind);
 
 #endif
 /*
Signature · 1 line
1.7.10.4
Acked-by on v3 8/10
#10 lore raw

Re: [PATCH v3 08/10] xen: arm: support bootmodule type detection by ordering

Hi Ian,

Quoted 25 lines · Ian Campbell
xen/arch/arm/bootfdt.c +2 -1
@@ -281,10 +293,11 @@ static void __init early_print_info(void)
                       mi->bank[i].start + mi->bank[i].size - 1);
      printk("\n");
      for ( i = 0 ; i < mods->nr_mods; i++ )
-        printk("MODULE[%d]: %"PRIpaddr" - %"PRIpaddr" %s\n",
+        printk("MODULE[%d]: %"PRIpaddr" - %"PRIpaddr" %-12s %s\n",
                       i,
                       mods->module[i].start,
                       mods->module[i].start + mods->module[i].size,
+                     boot_module_kind_as_string(mods->module[i].kind),
                       mods->module[i].cmdline);
      nr_rsvd = fdt_num_mem_rsv(device_tree_flattened);
      for ( i = 0; i < nr_rsvd; i++ )
xen/arch/arm/setup.c +4 -0
index 0cbe552..e53e491 100644
@@ -223,6 +223,20 @@ struct bootmodule * __init boot_module_find_by_kind(bootmodule_kind kind)
      return NULL;
  }
 
+const char * __init boot_module_kind_as_string(bootmodule_kind kind)
+{
+    switch ( kind )
+    {

xen/arch/arm/setup.c struct bootmodule * __init boot_module_find_by_kind(bootmodule_kind kind) · line 239

Quoted 10 lines
xen/arch/arm/setup.c +10 -0
+    case BOOTMOD_XEN:     return "Xen";
+    case BOOTMOD_FDT:     return "Device Tree";
+    case BOOTMOD_KERNEL:  return "Kernel";
+    case BOOTMOD_RAMDISK: return "Ramdisk";
+    case BOOTMOD_XSM:     return "XSM";
+    case BOOTMOD_UNKNOWN: return "Unknown";
+    default: BUG();
+    }
+}
+

A bit strange to introduce boot_module_kind_as_string here rather than in the earlier patch. Likewise for changing the string format a bit above.

Anyway:

Regards,

Signature · 1 line
Julien Grall
#11 lore raw

Re: [PATCH v3 08/10] xen: arm: support bootmodule type detection by ordering

Quoted 33 lines · Julien Grall

Hi Ian,

Quoted 30 lines · Ian Campbell
xen/arch/arm/bootfdt.c +2 -1
@@ -281,10 +293,11 @@ static void __init early_print_info(void)
                       mi->bank[i].start + mi->bank[i].size - 1);
      printk("\n");
      for ( i = 0 ; i < mods->nr_mods; i++ )
-        printk("MODULE[%d]: %"PRIpaddr" - %"PRIpaddr" %s\n",
+        printk("MODULE[%d]: %"PRIpaddr" - %"PRIpaddr" %-12s %s\n",
                       i,
                       mods->module[i].start,
                       mods->module[i].start + mods->module[i].size,
+                     boot_module_kind_as_string(mods->module[i].kind),
                       mods->module[i].cmdline);
      nr_rsvd = fdt_num_mem_rsv(device_tree_flattened);
      for ( i = 0; i < nr_rsvd; i++ )
xen/arch/arm/setup.c +9 -0
index 0cbe552..e53e491 100644
@@ -223,6 +223,20 @@ struct bootmodule * __init boot_module_find_by_kind(bootmodule_kind kind)
      return NULL;
  }
 
+const char * __init boot_module_kind_as_string(bootmodule_kind kind)
+{
+    switch ( kind )
+    {
+    case BOOTMOD_XEN:     return "Xen";
+    case BOOTMOD_FDT:     return "Device Tree";
+    case BOOTMOD_KERNEL:  return "Kernel";
+    case BOOTMOD_RAMDISK: return "Ramdisk";
+    case BOOTMOD_XSM:     return "XSM";
Quoted 8 lines

xen/arch/arm/setup.c struct bootmodule * __init boot_module_find_by_kind(bootmodule_kind kind) · line 239

Quoted 5 lines
xen/arch/arm/setup.c +5 -0
+    case BOOTMOD_UNKNOWN: return "Unknown";
+    default: BUG();
+    }
+}
+

A bit strange to introduce boot_module_kind_as_string here rather than in the earlier patch.

This is the first time it seemed necessary, since you can no longer infer it from the module number.

Quoted 1 line

Likewise for changing the string format a bit above.

That's just adding "%-12s" to print the type.

Quoted 4 lines

Anyway:

Thanks

Quoted 5 lines

Regards,

#12 lore raw

PATCH v3 9/10 xen: arm: update multiboot device tree bindings.

In reply to Ian Campbell

---
v2: (Try to) Clarify some wording, add examples to help.

---
 docs/misc/arm/device-tree/booting.txt |   54 +++++++++++++++++++++++++++++----
 1 file changed, 48 insertions(+), 6 deletions(-)
docs/misc/arm/device-tree/booting.txt +48 -6
index bfb8d01..d967061 100644
@@ -8,15 +8,31 @@ Each node contains the following properties:
 
 - compatible
 
-	Must be:
+	Must always include at least the generic compatiblity string:
 
-		"xen,<type>", "xen,multiboot-module"
+		"multiboot,module"
 
-	where <type> must be one of:
+	Optionally a more specific compatible string may be used in
+	addition to the above. One of:
 
-	- "linux-zimage" -- the dom0 kernel
-	- "linux-initrd" -- the dom0 ramdisk
-	- "xsm-policy"	 -- XSM policy blob
+	- "multiboot,kernel"	-- the dom0 kernel
+	- "multiboot,ramdisk"	-- the dom0 ramdisk
+	- "xen,xsm-policy"	-- XSM policy blob
+
+	It is normally recommended to include a more specific
+	compatible string (if one applies) in addition to the generic
+	string (which must always be present).
+
+        Xen 4.4 supported a different set of legacy compatible strings
+	which remain supported such that systems supporting both 4.4
+	and later can use a single DTB.
+
+	- "xen,multiboot-module" equivalent to "multiboot,module"
+	- "xen,linux-zimage"     equivalent to "multiboot,kernel"
+	- "xen,linux-initrd"     equivalent to "multiboot,ramdisk"
+
+	For compatibility with Xen 4.4 the more specific "xen,linux-*"
+	names are non-optional and must be included.
 
 - reg
 
@@ -29,6 +45,32 @@ Each node contains the following properties:
 	priority of this field vs. other mechanisms of specifying the
 	bootargs for the kernel.
 
+Examples
+========
+
+A boot module of unspecified type:
+
+	module@0xc0000000 {
+		compatible = "multiboot,module";
+		reg = <0xc0000000 0x1234>;
+		bootargs = "...";
+	};
+
+A boot module containing a ramdisk:
+
+	module@0xd0000000 {
+		compatible = "multiboot,ramdisk", "multiboot,module";
+		reg = <0xd0000000 0x5678>;
+	};
+
+The previous examples are compatible with Xen 4.5+ only.
+
+To be compatible with Xen 4.4 as well use the legacy names:
+
+	module@0xd0000000 {
+		compatible = "xen,linux-initrd", "xen,multiboot-module";
+		reg = <0xd0000000 0x5678>;
+	};
 
 Command lines
 =============
Signature · 1 line
1.7.10.4
Acked-by on v3 9/10
#13 lore raw

Re: [PATCH v3 09/10] xen: arm: update multiboot device tree bindings.

Hi Ian,

Quoted 1 line · Ian Campbell

Regards,

Quoted 82 lines

---
v2: (Try to) Clarify some wording, add examples to help.

---
  docs/misc/arm/device-tree/booting.txt |   54 +++++++++++++++++++++++++++++----
  1 file changed, 48 insertions(+), 6 deletions(-)
docs/misc/arm/device-tree/booting.txt +48 -6
index bfb8d01..d967061 100644
@@ -8,15 +8,31 @@ Each node contains the following properties:
 
  - compatible
 
-	Must be:
+	Must always include at least the generic compatiblity string:
 
-		"xen,<type>", "xen,multiboot-module"
+		"multiboot,module"
 
-	where <type> must be one of:
+	Optionally a more specific compatible string may be used in
+	addition to the above. One of:
 
-	- "linux-zimage" -- the dom0 kernel
-	- "linux-initrd" -- the dom0 ramdisk
-	- "xsm-policy"	 -- XSM policy blob
+	- "multiboot,kernel"	-- the dom0 kernel
+	- "multiboot,ramdisk"	-- the dom0 ramdisk
+	- "xen,xsm-policy"	-- XSM policy blob
+
+	It is normally recommended to include a more specific
+	compatible string (if one applies) in addition to the generic
+	string (which must always be present).
+
+        Xen 4.4 supported a different set of legacy compatible strings
+	which remain supported such that systems supporting both 4.4
+	and later can use a single DTB.
+
+	- "xen,multiboot-module" equivalent to "multiboot,module"
+	- "xen,linux-zimage"     equivalent to "multiboot,kernel"
+	- "xen,linux-initrd"     equivalent to "multiboot,ramdisk"
+
+	For compatibility with Xen 4.4 the more specific "xen,linux-*"
+	names are non-optional and must be included.
 
  - reg
 
@@ -29,6 +45,32 @@ Each node contains the following properties:
  	priority of this field vs. other mechanisms of specifying the
  	bootargs for the kernel.
 
+Examples
+========
+
+A boot module of unspecified type:
+
+	module@0xc0000000 {
+		compatible = "multiboot,module";
+		reg = <0xc0000000 0x1234>;
+		bootargs = "...";
+	};
+
+A boot module containing a ramdisk:
+
+	module@0xd0000000 {
+		compatible = "multiboot,ramdisk", "multiboot,module";
+		reg = <0xd0000000 0x5678>;
+	};
+
+The previous examples are compatible with Xen 4.5+ only.
+
+To be compatible with Xen 4.4 as well use the legacy names:
+
+	module@0xd0000000 {
+		compatible = "xen,linux-initrd", "xen,multiboot-module";
+		reg = <0xd0000000 0x5678>;
+	};
 
  Command lines
  =============
Signature · 1 line
Julien Grall
#14 lore raw

Re: [PATCH v3 09/10] xen: arm: update multiboot device tree bindings.

Quoted 6 lines · Julien Grall

Hi Ian,

Quoted 1 line · Ian Campbell

Thanks. I've applied patches 1..9 of this series. I'll resend 10 ASAP with the change you've suggested.

On my potential backports list I've got:
xen: arm: implement generic multiboot compatibility strings
xen: arm: /chosen/module@N/bootargs bootprotcol node is not deprecated

I don't think anything else here is suitable for backport. Let me know if you think something is (or isn't)

Thanks,
Ian.

#15 lore raw

Re: [PATCH v3 09/10] xen: arm: update multiboot device tree bindings.

Quoted 11 lines · Ian Campbell
Quoted 6 lines · Julien Grall

Hi Ian,

Quoted 1 line · Ian Campbell

Thanks. I've applied patches 1..9 of this series. I'll resend 10 ASAP with the change you've suggested.

Quoted 6 lines

On my potential backports list I've got:
xen: arm: implement generic multiboot compatibility strings
xen: arm: /chosen/module@N/bootargs bootprotcol node is not deprecated

I don't think anything else here is suitable for backport. Let me know if you think something is (or isn't)

I would also update the document bindings in
docs/misc/arm/device-tree/booting.txt.

The patch #9 looks the good one for this purpose. Minus the unspecified type example.

BTW, I don't find anything in the documentation talking about bootmodule type detection by ordering. Is this intended?

Regards,

Signature · 1 line
Julien Grall
#16 lore raw

Re: [PATCH v3 09/10] xen: arm: update multiboot device tree bindings.

Quoted 16 lines · Julien Grall
Quoted 15 lines · Ian Campbell
Quoted 6 lines · Julien Grall

Hi Ian,

Quoted 1 line · Ian Campbell

Thanks. I've applied patches 1..9 of this series. I'll resend 10 ASAP with the change you've suggested.

On my potential backports list I've got:
xen: arm: implement generic multiboot compatibility strings
xen: arm: /chosen/module@N/bootargs bootprotcol node is not deprecated

Quoted 8 lines
Quoted 2 lines

I don't think anything else here is suitable for backport. Let me know if you think something is (or isn't)

I would also update the document bindings in
docs/misc/arm/device-tree/booting.txt.

The patch #9 looks the good one for this purpose. Minus the unspecified type example.

I think it is acceptable to point people to the latest version of the doc in the dev branch as the canonical copy.

The latest version already needs to properly describe the mechanisms for backwards compatibility anyway and trying to backport only the docs updates which match backported bits of code is liable to get fiddly quite fast and/or require new patches etc, I'd rather not do this.

Quoted 2 lines

BTW, I don't find anything in the documentation talking about bootmodule type detection by ordering. Is this intended?

No, I should have done this and forgot, thanks for the reminder. See below.

Ian.

8<--------------------------

Quoted 1 line

From f9e80ead57b9f739c3041fe5abc4b23c8f0eb18f Mon Sep 17 00:00:00 2001

From: Ian Campbell <[email protected]>
Date: Mon, 21 Jul 2014 13:16:31 +0100
Subject: [PATCH] xen: arm: document boot module compatibility based on
ordering

---
 docs/misc/arm/device-tree/booting.txt |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
docs/misc/arm/device-tree/booting.txt +7 -1
index d967061..ad98bf3 100644
@@ -23,7 +23,13 @@ Each node contains the following properties:
 	compatible string (if one applies) in addition to the generic
 	string (which must always be present).
 
-        Xen 4.4 supported a different set of legacy compatible strings
+	Xen will assume that the first module which lacks a more
+	specific compatible string is a "multiboot,kernel" and that
+	the second such is a "multiboot,ramdisk". Any subsequent
+	modules which lack a specific compatiblity string will not
+	receive any special treatment.
+
+	Xen 4.4 supported a different set of legacy compatible strings
 	which remain supported such that systems supporting both 4.4
 	and later can use a single DTB.
 
Signature · 1 line
1.7.10.4
Acked-by
#17 lore raw

Re: [PATCH v3 09/10] xen: arm: update multiboot device tree bindings.

Quoted 60 lines · Ian Campbell
Quoted 16 lines · Julien Grall
Quoted 15 lines · Ian Campbell
Quoted 6 lines · Julien Grall

Hi Ian,

Quoted 1 line · Ian Campbell

Thanks. I've applied patches 1..9 of this series. I'll resend 10 ASAP with the change you've suggested.

On my potential backports list I've got:
xen: arm: implement generic multiboot compatibility strings
xen: arm: /chosen/module@N/bootargs bootprotcol node is not deprecated

Quoted 8 lines
Quoted 2 lines

I don't think anything else here is suitable for backport. Let me know if you think something is (or isn't)

I would also update the document bindings in
docs/misc/arm/device-tree/booting.txt.

The patch #9 looks the good one for this purpose. Minus the unspecified type example.

I think it is acceptable to point people to the latest version of the doc in the dev branch as the canonical copy.

The latest version already needs to properly describe the mechanisms for backwards compatibility anyway and trying to backport only the docs updates which match backported bits of code is liable to get fiddly quite fast and/or require new patches etc, I'd rather not do this.

Quoted 2 lines

BTW, I don't find anything in the documentation talking about bootmodule type detection by ordering. Is this intended?

No, I should have done this and forgot, thanks for the reminder. See below.

Ian.

8<--------------------------

From f9e80ead57b9f739c3041fe5abc4b23c8f0eb18f Mon Sep 17 00:00:00 2001
From: Ian Campbell <[email protected]>
Date: Mon, 21 Jul 2014 13:16:31 +0100
Subject: [PATCH] xen: arm: document boot module compatibility based on
ordering

---
 docs/misc/arm/device-tree/booting.txt |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
docs/misc/arm/device-tree/booting.txt +0 -0
index d967061..ad98bf3 100644

docs/misc/arm/device-tree/booting.txt Each node contains the following properties: · line 26

Quoted 5 lines
docs/misc/arm/device-tree/booting.txt +1 -1
@@ -23,7 +23,13 @@ Each node contains the following properties:
 	compatible string (if one applies) in addition to the generic
 	string (which must always be present).
 
-        Xen 4.4 supported a different set of legacy compatible strings
+	Xen will assume that the first module which lacks a more

With this change, it's not clear that Xen 4.4 doesn't support boot module ordering. I would precise Xen 4.5 and onwards.

With that:

docs/misc/arm/device-tree/booting.txt Each node contains the following properties: · line 35

Quoted 10 lines
docs/misc/arm/device-tree/booting.txt +6 -0
+	specific compatible string is a "multiboot,kernel" and that
+	the second such is a "multiboot,ramdisk". Any subsequent
+	modules which lack a specific compatiblity string will not
+	receive any special treatment.
+
+	Xen 4.4 supported a different set of legacy compatible strings
 	which remain supported such that systems supporting both 4.4
 	and later can use a single DTB.
 

Regards,

Signature · 1 line
Julien Grall
#18 lore raw

Re: [PATCH v3 09/10] xen: arm: update multiboot device tree bindings.

Quoted 64 lines · Julien Grall
Quoted 63 lines · Ian Campbell
Quoted 16 lines · Julien Grall
Quoted 15 lines · Ian Campbell
Quoted 6 lines · Julien Grall

Hi Ian,

Quoted 1 line · Ian Campbell

Thanks. I've applied patches 1..9 of this series. I'll resend 10 ASAP with the change you've suggested.

On my potential backports list I've got:
xen: arm: implement generic multiboot compatibility strings
xen: arm: /chosen/module@N/bootargs bootprotcol node is not deprecated

Quoted 8 lines
Quoted 2 lines

I don't think anything else here is suitable for backport. Let me know if you think something is (or isn't)

I would also update the document bindings in
docs/misc/arm/device-tree/booting.txt.

The patch #9 looks the good one for this purpose. Minus the unspecified type example.

I think it is acceptable to point people to the latest version of the doc in the dev branch as the canonical copy.

The latest version already needs to properly describe the mechanisms for backwards compatibility anyway and trying to backport only the docs updates which match backported bits of code is liable to get fiddly quite fast and/or require new patches etc, I'd rather not do this.

Quoted 2 lines

BTW, I don't find anything in the documentation talking about bootmodule type detection by ordering. Is this intended?

No, I should have done this and forgot, thanks for the reminder. See below.

Ian.

8<--------------------------

From f9e80ead57b9f739c3041fe5abc4b23c8f0eb18f Mon Sep 17 00:00:00 2001
From: Ian Campbell <[email protected]>
Date: Mon, 21 Jul 2014 13:16:31 +0100
Subject: [PATCH] xen: arm: document boot module compatibility based on
ordering

---
 docs/misc/arm/device-tree/booting.txt |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
docs/misc/arm/device-tree/booting.txt +0 -0
index d967061..ad98bf3 100644
@@ -23,7 +23,13 @@ Each node contains the following properties:
 	compatible string (if one applies) in addition to the generic
 	string (which must always be present).
 
Quoted 5 lines

docs/misc/arm/device-tree/booting.txt Each node contains the following properties: · line 26

Quoted 2 lines
docs/misc/arm/device-tree/booting.txt +1 -1
-        Xen 4.4 supported a different set of legacy compatible strings
+	Xen will assume that the first module which lacks a more

With this change, it's not clear that Xen 4.4 doesn't support boot module ordering. I would precise Xen 4.5 and onwards.

Note that a paragraph further down still reads:
For compatibility with Xen 4.4 the more specific "xen,linux-*" names are non-optional and must be included.

So I don't think it's necessary to clutter up this new paragraph with that caveat.

Also note that the apparently remove "Xen 4.4" above is actually just re-indented, it was the only line not using a hard tab for some reason.

Actually I'd prefer that file to use soft tabs like everything else, but I wasn't about to do that at the same time...

Ian.

Quoted 19 lines

With that:

docs/misc/arm/device-tree/booting.txt Each node contains the following properties: · line 35

Quoted 10 lines
docs/misc/arm/device-tree/booting.txt +6 -0
+	specific compatible string is a "multiboot,kernel" and that
+	the second such is a "multiboot,ramdisk". Any subsequent
+	modules which lack a specific compatiblity string will not
+	receive any special treatment.
+
+	Xen 4.4 supported a different set of legacy compatible strings
 	which remain supported such that systems supporting both 4.4
 	and later can use a single DTB.
 

Regards,

#19 lore raw

Re: [PATCH v3 09/10] xen: arm: update multiboot device tree bindings.

Quoted 71 lines · Ian Campbell
Quoted 64 lines · Julien Grall
Quoted 63 lines · Ian Campbell
Quoted 16 lines · Julien Grall
Quoted 15 lines · Ian Campbell
Quoted 6 lines · Julien Grall

Hi Ian,

Quoted 1 line · Ian Campbell

Thanks. I've applied patches 1..9 of this series. I'll resend 10 ASAP with the change you've suggested.

On my potential backports list I've got:
xen: arm: implement generic multiboot compatibility strings
xen: arm: /chosen/module@N/bootargs bootprotcol node is not deprecated

Quoted 8 lines
Quoted 2 lines

I don't think anything else here is suitable for backport. Let me know if you think something is (or isn't)

I would also update the document bindings in
docs/misc/arm/device-tree/booting.txt.

The patch #9 looks the good one for this purpose. Minus the unspecified type example.

I think it is acceptable to point people to the latest version of the doc in the dev branch as the canonical copy.

The latest version already needs to properly describe the mechanisms for backwards compatibility anyway and trying to backport only the docs updates which match backported bits of code is liable to get fiddly quite fast and/or require new patches etc, I'd rather not do this.

Quoted 2 lines

BTW, I don't find anything in the documentation talking about bootmodule type detection by ordering. Is this intended?

No, I should have done this and forgot, thanks for the reminder. See below.

Ian.

8<--------------------------

From f9e80ead57b9f739c3041fe5abc4b23c8f0eb18f Mon Sep 17 00:00:00 2001
From: Ian Campbell <[email protected]>
Date: Mon, 21 Jul 2014 13:16:31 +0100
Subject: [PATCH] xen: arm: document boot module compatibility based on
ordering

---
 docs/misc/arm/device-tree/booting.txt |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
docs/misc/arm/device-tree/booting.txt +0 -0
index d967061..ad98bf3 100644
@@ -23,7 +23,13 @@ Each node contains the following properties:
 	compatible string (if one applies) in addition to the generic
 	string (which must always be present).
 
Quoted 5 lines

docs/misc/arm/device-tree/booting.txt Each node contains the following properties: · line 26

Quoted 2 lines
docs/misc/arm/device-tree/booting.txt +1 -1
-        Xen 4.4 supported a different set of legacy compatible strings
+	Xen will assume that the first module which lacks a more

With this change, it's not clear that Xen 4.4 doesn't support boot module ordering. I would precise Xen 4.5 and onwards.

Quoted 3 lines

Note that a paragraph further down still reads:
For compatibility with Xen 4.4 the more specific "xen,linux-*" names are non-optional and must be included.

Oh right, I forgot there was a paragraph about it.

So this change looks good to me.

Regards,

Signature · 1 line
Julien Grall
#20 lore raw

Re: [PATCH v3 09/10] xen: arm: update multiboot device tree bindings.

Quoted 25 lines · Julien Grall
Quoted 25 lines
Quoted 24 lines
Quoted 16 lines

From f9e80ead57b9f739c3041fe5abc4b23c8f0eb18f Mon Sep 17 00:00:00 2001
From: Ian Campbell <[email protected]>
Date: Mon, 21 Jul 2014 13:16:31 +0100
Subject: [PATCH] xen: arm: document boot module compatibility based on
ordering

---
 docs/misc/arm/device-tree/booting.txt |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
docs/misc/arm/device-tree/booting.txt +0 -0
index d967061..ad98bf3 100644

docs/misc/arm/device-tree/booting.txt Each node contains the following properties: · line 26

Quoted 5 lines
docs/misc/arm/device-tree/booting.txt +1 -1
@@ -23,7 +23,13 @@ Each node contains the following properties:
 	compatible string (if one applies) in addition to the generic
 	string (which must always be present).
 
-        Xen 4.4 supported a different set of legacy compatible strings
+	Xen will assume that the first module which lacks a more

With this change, it's not clear that Xen 4.4 doesn't support boot module ordering. I would precise Xen 4.5 and onwards.

Quoted 7 lines
Quoted 3 lines

Note that a paragraph further down still reads:
For compatibility with Xen 4.4 the more specific "xen,linux-*" names are non-optional and must be included.

Oh right, I forgot there was a paragraph about it.

So this change looks good to me.

May I take that as an Ack?

Acked-by
#21 lore raw

Re: [PATCH v3 09/10] xen: arm: update multiboot device tree bindings.

Quoted 30 lines · Ian Campbell
Quoted 29 lines · Julien Grall
Quoted 28 lines
Quoted 19 lines
Quoted 19 lines

From f9e80ead57b9f739c3041fe5abc4b23c8f0eb18f Mon Sep 17 00:00:00 2001
From: Ian Campbell <[email protected]>
Date: Mon, 21 Jul 2014 13:16:31 +0100
Subject: [PATCH] xen: arm: document boot module compatibility based on
ordering

---
 docs/misc/arm/device-tree/booting.txt |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
docs/misc/arm/device-tree/booting.txt +0 -0
index d967061..ad98bf3 100644
@@ -23,7 +23,13 @@ Each node contains the following properties:
 	compatible string (if one applies) in addition to the generic
 	string (which must always be present).
 
Quoted 5 lines

docs/misc/arm/device-tree/booting.txt Each node contains the following properties: · line 26

Quoted 2 lines
docs/misc/arm/device-tree/booting.txt +1 -1
-        Xen 4.4 supported a different set of legacy compatible strings
+	Xen will assume that the first module which lacks a more

With this change, it's not clear that Xen 4.4 doesn't support boot module ordering. I would precise Xen 4.5 and onwards.

Note that a paragraph further down still reads:
For compatibility with Xen 4.4 the more specific "xen,linux-*" names are non-optional and must be included.

Quoted 5 lines
Quoted 3 lines

Oh right, I forgot there was a paragraph about it.

So this change looks good to me.

May I take that as an Ack?

I though have acked it on a previous mail...

Anyway:

Regards,

Signature · 1 line
Julien Grall
#22 lore raw

Re: [PATCH v3 09/10] xen: arm: update multiboot device tree bindings.

Quoted 31 lines · Julien Grall
Quoted 30 lines · Ian Campbell
Quoted 29 lines · Julien Grall
Quoted 28 lines
Quoted 19 lines
Quoted 19 lines

From f9e80ead57b9f739c3041fe5abc4b23c8f0eb18f Mon Sep 17 00:00:00 2001
From: Ian Campbell <[email protected]>
Date: Mon, 21 Jul 2014 13:16:31 +0100
Subject: [PATCH] xen: arm: document boot module compatibility based on
ordering

---
 docs/misc/arm/device-tree/booting.txt |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
docs/misc/arm/device-tree/booting.txt +0 -0
index d967061..ad98bf3 100644
@@ -23,7 +23,13 @@ Each node contains the following properties:
 	compatible string (if one applies) in addition to the generic
 	string (which must always be present).
 
Quoted 5 lines

docs/misc/arm/device-tree/booting.txt Each node contains the following properties: · line 26

Quoted 2 lines
docs/misc/arm/device-tree/booting.txt +1 -1
-        Xen 4.4 supported a different set of legacy compatible strings
+	Xen will assume that the first module which lacks a more

With this change, it's not clear that Xen 4.4 doesn't support boot module ordering. I would precise Xen 4.5 and onwards.

Note that a paragraph further down still reads:
For compatibility with Xen 4.4 the more specific "xen,linux-*" names are non-optional and must be included.

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

Oh right, I forgot there was a paragraph about it.

So this change looks good to me.

May I take that as an Ack?

I though have acked it on a previous mail...

It was conditional on something which we decided wasn't necessary so I just wanted to make sure.

Quoted 8 lines

Anyway:

Regards,

#23 lore raw

PATCH v3 10/10 xen: arm: Only lookup kernel bootmodule once while building dom0 dtb.

In reply to Ian Campbell

---
v3: New patch

---
 xen/arch/arm/domain_build.c |    4 +++-
 xen/arch/arm/kernel.h       |    1 +
 2 files changed, 4 insertions(+), 1 deletion(-)
xen/arch/arm/domain_build.c +3 -1
index 154367e..3db2e94 100644
@@ -405,7 +405,7 @@ static int write_properties(struct domain *d, struct kernel_info *kinfo,
     int res = 0;
     int had_dom0_bootargs = 0;
 
-    struct bootmodule *mod = boot_module_find_by_kind(BOOTMOD_KERNEL);
+    struct bootmodule *mod = kinfo->bootmodule;
 
     if ( mod && mod->cmdline[0] )
         bootargs = &mod->cmdline[0];
@@ -1307,6 +1307,8 @@ int construct_dom0(struct domain *d)
     d->max_pages = ~0U;
 
     kinfo.unassigned_mem = dom0_mem;
+    kinfo.bootmodule = boot_module_find_by_kind(BOOTMOD_KERNEL);
+    BUG_ON(!kinfo.bootmodule);
 
     rc = kernel_probe(&kinfo);
     if ( rc < 0 )
xen/arch/arm/kernel.h +1 -0
index 7c7f624..2745bb5 100644
@@ -23,6 +23,7 @@ struct kernel_info {
     paddr_t entry;
 
     /* boot blob load addresses */
+    struct bootmodule *bootmodule;
     paddr_t dtb_paddr;
     paddr_t initrd_paddr;
 
Signature · 1 line
1.7.10.4
#24 lore raw

Re: [PATCH v3 10/10] xen: arm: Only lookup kernel bootmodule once while building dom0 dtb.

Hi Ian,

xen/arch/arm/kernel.h struct kernel_info { · line 26

Quoted 9 lines · Ian Campbell
xen/arch/arm/kernel.h +1 -0
index 7c7f624..2745bb5 100644
@@ -23,6 +23,7 @@ struct kernel_info {
      paddr_t entry;
 
      /* boot blob load addresses */
+    struct bootmodule *bootmodule;

If you don't read the assignment in the code you don't know to which module the variable pointed to. I would rename to smth like kernelmodule.

Regards,

Signature · 1 line
Julien Grall
#25 lore raw

Re: [PATCH v3 10/10] xen: arm: Only lookup kernel bootmodule once while building dom0 dtb.

Quoted 10 lines · Julien Grall

Hi Ian,

Quoted 7 lines · Ian Campbell
xen/arch/arm/kernel.h +0 -0
index 7c7f624..2745bb5 100644
@@ -23,6 +23,7 @@ struct kernel_info {
      paddr_t entry;
 
Quoted 5 lines

xen/arch/arm/kernel.h struct kernel_info { · line 26

Quoted 2 lines
xen/arch/arm/kernel.h +1 -0
      /* boot blob load addresses */
+    struct bootmodule *bootmodule;

If you don't read the assignment in the code you don't know to which module the variable pointed to. I would rename to smth like kernelmodule.

Good idea.

Ian.

#26 lore raw
In reply to Ian Campbell

On Fri, 2014-07-18 at 14:07 +0100, Ian Campbell wrote:

@linaro folks, the first 9 patches here are now in the staging tree. I think at least Roy and Fu Wei were waiting to make use of these.

Ian.

#27 lore raw

Cool, Great thanks, will try that branch right away :-)

Quoted 7 lines · Ian Campbell

On Fri, 2014-07-18 at 14:07 +0100, Ian Campbell wrote:

@linaro folks, the first 9 patches here are now in the staging tree. I think at least Roy and Fu Wei were waiting to make use of these.

Ian.

Signature · 12 lines
Best regards,

Fu Wei
Enterprise Server Engineer From Red Hat
LEG Team
Linaro.org | Open source software for ARM SoCs
Ph: +86 186 2020 4684 (mobile)
IRC: fuwei
Skype: tekkamanninja
Room 1512, Regus One Corporate Avenue,Level 15,
One Corporate Avenue,222 Hubin Road,Huangpu District,
Shanghai,China 200021