xen: arm: fix usage of bootargs for Xen.
PATCH v2 1/1 xen: arm: fix usage of bootargs for Xen.
The chosen node's bootargs property should be used for Xen if there is a dom0 kernel multiboot module with a command line, not just if xen,dom0-bootargs is present.
---
v2: Tweak the docs to reflect this change.
--- docs/misc/arm/device-tree/booting.txt | 2 ++ xen/common/device_tree.c | 10 ++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-)
docs/misc/arm/device-tree/booting.txt +2 -0
@@ -39,6 +39,8 @@ lines for Xen and Dom0. The logic is the following: - If xen,dom0-bootargs is present, it will be used for Dom0. - If xen,xen-bootargs is _not_ present, but xen,dom0-bootargs is, bootargs will be used for Xen. + - If a kernel boot module is present and has a bootargs property then + the top-level bootargs will used for Xen. - If no Xen specific properties are present, bootargs is for Dom0. - If xen,xen-bootargs is present, but xen,dom0-bootargs is missing, bootargs will be used for Dom0.
xen/common/device_tree.c +8 -2
@@ -240,7 +240,7 @@ static int __init device_tree_for_each_node(const void *fdt,*/ const char *device_tree_bootargs (const void *fdt) { -int node; +int node;const struct fdt_property *prop; node =fdt_path_offset (fdt,"/chosen" );
@@ -250,7 +250,13 @@ const char *device_tree_bootargs(const void *fdt) prop =fdt_get_property (fdt, node,"xen,xen-bootargs" ,NULL );if ( prop ==NULL ) { -if (fdt_get_property (fdt, node,"xen,dom0-bootargs" ,NULL )) +struct dt_mb_module *dom0_mod =NULL ; + +if ( early_info.modules.nr_mods >=MOD_KERNEL ) + dom0_mod = &early_info.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 )
Signature · 1 line
1.8.4.rc3
Quoted 5 lines · Ian Campbell
The chosen node's bootargs property should be used for Xen if there is a dom0 kernel multiboot module with a command line, not just if xen,dom0-bootargs is present.
Signed-off-by Ian Campbell <[email protected]>
Quoted 34 lines
---
v2: Tweak the docs to reflect this change.--- docs/misc/arm/device-tree/booting.txt | 2 ++ xen/common/device_tree.c | 10 ++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-)docs/misc/arm/device-tree/booting.txt +2
-0@@ -39,6 +39,8 @@ lines for Xen and Dom0. The logic is the following: - If xen,dom0-bootargs is present, it will be used for Dom0. - If xen,xen-bootargs is _not_ present, but xen,dom0-bootargs is, bootargs will be used for Xen. + - If a kernel boot module is present and has a bootargs property then + the top-level bootargs will used for Xen. - If no Xen specific properties are present, bootargs is for Dom0. - If xen,xen-bootargs is present, but xen,dom0-bootargs is missing, bootargs will be used for Dom0.xen/common/device_tree.c +1
-1@@ -240,7 +240,7 @@ static int __init device_tree_for_each_node(const void *fdt,*/ const char *device_tree_bootargs (const void *fdt) { -int node; +int node;const struct fdt_property *prop; node =fdt_path_offset (fdt,"/chosen" );
xen/common/device_tree.c const char *device_tree_bootargs(const void *fdt) · line 256
Quoted 8 lines
xen/common/device_tree.c +4
-1@@ -250,7 +250,13 @@ const char *device_tree_bootargs(const void *fdt) prop =fdt_get_property (fdt, node,"xen,xen-bootargs" ,NULL );if ( prop ==NULL ) { -if (fdt_get_property (fdt, node,"xen,dom0-bootargs" ,NULL )) +struct dt_mb_module *dom0_mod =NULL ; + +if ( early_info.modules.nr_mods >=MOD_KERNEL ) + dom0_mod = &early_info.modules.module[MOD_KERNEL ];
I'm wondering if it's really usefull to test nr_mods? We can have nr_mods >= MOD_KERNEL (for instance MOD_INITRD), but the kernel command is not set. As the structure will be zeroed during boot Xen, it's not harmful to remove the check.
Signature · 1 line
Julien Grall