xen/arm: fixes around device tree generation
cover xen/arm: fixes around device tree generation
Michal Orzel (2):
xen/arm: Fix initrd placeholders generation in make_chosen_node() xen/arm: Skip inclusion of domU nodes into hwdom dt /chosen node
xen/arch/arm/domain_build.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
Signature · 1 line
2.25.1
PATCH 1/2 xen/arm: Fix initrd placeholders generation in make_chosen_node()
When booting a dom0less domU without initial ramdisk, it was observed that Xen still creates empty linux,initrd-{start,end} properties under /chosen node. This is because in make_chosen_node(), generation of initrd placeholders (later on filled with the real values) is protected with a check for presence of kernel bootmodule (always present) instead of initrd bootmodule. Fix it along with renaming the variable from "mod" to "initrd" to prevent similar mistakes in the future.
--- xen/arch/arm/domain_build.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
xen/arch/arm/domain_build.c +2 -2
@@ -2256,7 +2256,7 @@ int __init make_chosen_node(const struct kernel_info *kinfo) {int res;const char *bootargs =NULL ; -const struct bootmodule *mod = kinfo->kernel_bootmodule; +const struct bootmodule *initrd = kinfo->initrd_bootmodule;void *fdt = kinfo->fdt;dt_dprintk ("Create chosen node\n" );
@@ -2276,7 +2276,7 @@ int __init make_chosen_node(const 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 ( mod && mod->size ) +if ( initrd && initrd->size ) {u64 a =0 ; res =fdt_property (kinfo->fdt,"linux,initrd-start" , &a,sizeof (a));
Signature · 1 line
2.25.1
Re: [PATCH 1/2] xen/arm: Fix initrd placeholders generation in make_chosen_node()
Quoted 12 lines · Michal Orzel
When booting a dom0less domU without initial ramdisk, it was observed that Xen still creates empty linux,initrd-{start,end} properties under /chosen node. This is because in
make_chosen_node(), generation of initrd placeholders (later on filled with the real values) is protected with a check for presence of kernel bootmodule (always present) instead of initrd bootmodule. Fix it along with renaming the variable from "mod" to "initrd" to prevent similar mistakes in the future.
Quoted 2 lines
Fixes 48f4bf6bdeb4 ("arm/acpi: Create min DT stub for Dom0")Signed-off-by Michal Orzel <[email protected]>
Hi Michal, good catch!
Cheers,
Luca
Stefano Stabellini
Acked-byRe: [PATCH 1/2] xen/arm: Fix initrd placeholders generation in make_chosen_node()
Quoted 10 lines · Luca Fancellu
Quoted 10 lines · Michal Orzel
When booting a dom0less domU without initial ramdisk, it was observed that Xen still creates empty linux,initrd-{start,end} properties under /chosen node. This is because in
make_chosen_node(), generation of initrd placeholders (later on filled with the real values) is protected with a check for presence of kernel bootmodule (always present) instead of initrd bootmodule. Fix it along with renaming the variable from "mod" to "initrd" to prevent similar mistakes in the future.
Quoted 6 lines
Quoted 2 lines
Fixes 48f4bf6bdeb4 ("arm/acpi: Create min DT stub for Dom0")Signed-off-by Michal Orzel <[email protected]>Hi Michal, good catch!
Reviewed-by Luca Fancellu <[email protected]>
Re: [PATCH 1/2] xen/arm: Fix initrd placeholders generation in make_chosen_node()
In reply to Michal OrzelHi Michal,
Quoted 9 lines · Michal Orzel
When booting a dom0less domU without initial ramdisk, it was observed that Xen still creates empty linux,initrd-{start,end} properties under /chosen node. This is because in
make_chosen_node(), generation of initrd placeholders (later on filled with the real values) is protected with a check for presence of kernel bootmodule (always present) instead of initrd bootmodule. Fix it along with renaming the variable from "mod" to "initrd" to prevent similar mistakes in the future.Fixes 48f4bf6bdeb4 ("arm/acpi: Create min DT stub for Dom0")
(No change required, just a remark about the tag)
Someone wanting to backport this would need to be cautious. The fix would not apply as-is for Xen older than ~4.11 because 'mod' is used to fetch the command line as well.
This also means that it would not be correct to simply replace 'mod' with 'initrd'. Anyway, for upstream, this would only be backported up to 4.17 as the other release are either only security supported or not supported at all. So this is not a concern for us.
Cheers,
Signature · 1 line
Julien Grall
PATCH 2/2 xen/arm: Skip inclusion of domU nodes into hwdom dt /chosen node
In reply to Michal OrzelConfiguration for dom0less domUs is stored under /chosen/<domu> nodes present in the host device tree provided to Xen. All the properties and sub nodes there are meant only for Xen. However, at the moment we still copy them (except for modules that we skip) into hardware domain /chosen node. Fix it by adding "xen,domain" compatible into the list of nodes to skip in handle_node().
--- xen/arch/arm/domain_build.c | 1 + 1 file changed, 1 insertion(+)
xen/arch/arm/domain_build.c +1 -0
@@ -2592,6 +2592,7 @@ static int __init handle_node(struct domain *d, struct kernel_info *kinfo, {static const struct dt_device_match skip_matches[]__initconst = { +DT_MATCH_COMPATIBLE ("xen,domain" ),DT_MATCH_COMPATIBLE ("xen,xen" ),DT_MATCH_COMPATIBLE ("xen,multiboot-module" ),DT_MATCH_COMPATIBLE ("multiboot,module" ),
Signature · 1 line
2.25.1
Re: [PATCH 2/2] xen/arm: Skip inclusion of domU nodes into hwdom dt /chosen node
Quoted 12 lines · Michal Orzel
Configuration for dom0less domUs is stored under /chosen/<domu> nodes present in the host device tree provided to Xen. All the properties and sub nodes there are meant only for Xen. However, at the moment we still copy them (except for modules that we skip) into hardware domain /chosen node. Fix it by adding "xen,domain" compatible into the list of nodes to skip in
handle_node().Signed-off-by Michal Orzel <[email protected]>
Stefano Stabellini
Acked-byRe: [PATCH 2/2] xen/arm: Skip inclusion of domU nodes into hwdom dt /chosen node
Quoted 9 lines · Luca Fancellu
Quoted 9 lines · Michal Orzel
Configuration for dom0less domUs is stored under /chosen/<domu> nodes present in the host device tree provided to Xen. All the properties and sub nodes there are meant only for Xen. However, at the moment we still copy them (except for modules that we skip) into hardware domain /chosen node. Fix it by adding "xen,domain" compatible into the list of nodes to skip in
handle_node().
Quoted 3 lines
Quoted 1 line
Signed-off-by Michal Orzel <[email protected]>Reviewed-by Luca Fancellu <[email protected]>