cmd: pxe_utils: Limit fdtcontroladdr usage to non-fitImage
PATCH v2 1/1 cmd: pxe_utils: Limit fdtcontroladdr usage to non-fitImage
Commit d5ba6188dfb ("cmd: pxe_utils: Check fdtcontroladdr in label_boot") forces '$fdtcontroladdr' DT address as a third parameter of bootm command even if the PXE transfer pulls in a fitImage which contains configuration node with its own DT that is preferrable to be passed to Linux. Limit the $fdtcontroladdr fallback utilization to non-fitImages, since it is highly likely a fitImage would come with its own DT, while single-file images do need a separate DT.
---
Cc: Peter Hoyes <[email protected]>
Cc: Ramon Fried <[email protected]>
Cc: Simon Glass <[email protected]>
---
V1: Map the kernel buffer before testing image type
V2: Update code comment to reflect the change
--- boot/pxe_utils.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
boot/pxe_utils.c +5 -4
@@ -617,7 +617,7 @@ static int label_boot(struct pxe_context *ctx, struct pxe_label *label)* bootm, and adjust argc appropriately. * * Scenario 3: If there is an fdtcontroladdr specified, pass it along to -* bootm, and adjust argc appropriately. +* bootm, and adjust argc appropriately, unless the image type is fitImage. * * Scenario 4: fdt blob is not available. */
@@ -724,7 +724,10 @@ static int label_boot(struct pxe_context *ctx, struct pxe_label *label)if (!bootm_argv[3 ]) bootm_argv[3 ] =env_get ("fdt_addr" ); -if (!bootm_argv[3 ]) + kernel_addr_r =genimg_get_kernel_addr (kernel_addr); + buf =map_sysmem (kernel_addr_r,0 ); + +if (!bootm_argv[3 ] &&genimg_get_format (buf) !=IMAGE_FORMAT_FIT ) bootm_argv[3 ] =env_get ("fdtcontroladdr" );if (bootm_argv[3 ]) {
@@ -733,8 +736,6 @@ static int label_boot(struct pxe_context *ctx, struct pxe_label *label) bootm_argc =4 ; } - kernel_addr_r =genimg_get_kernel_addr (kernel_addr); - buf =map_sysmem (kernel_addr_r,0 );/* Try bootm for legacy and FIT format image */ if (genimg_get_format (buf) !=IMAGE_FORMAT_INVALID &&IS_ENABLED (CONFIG_CMD_BOOTM ))
Signature · 1 line
2.35.1
Hi Marek,
Quoted 8 lines · Marek Vasut
Commit
d5ba6188dfb("cmd:pxe_utils: Check fdtcontroladdr inlabel_boot") forces '$fdtcontroladdr' DT address as a third parameter of bootm command even if the PXE transfer pulls in a fitImage which contains configuration node with its own DT that is preferrable to be passed to Linux. Limit the $fdtcontroladdr fallback utilization to non-fitImages, since it is highly likely a fitImage would come with its own DT, while single-file images do need a separate DT.
Tested on top of an almost vanilla v2022.10 on Ringneck PX30, the FDT from the selected fitimage configuration (via #conf in kernel field in extlinux.conf) is taken into account.
Not sure overriding the DT gotten from the fit image wasn't a use-case Peter wanted to support though.
Cheers,
Quentin
Quoted 47 lines
Fixes d5ba6188dfb ("cmd: pxe_utils: Check fdtcontroladdr in label_boot")Signed-off-by Marek Vasut <[email protected]>---
Cc: Peter Hoyes <[email protected]>
Cc: Ramon Fried <[email protected]>
Cc: Simon Glass <[email protected]>
---
V1: Map the kernel buffer before testing image type
V2: Update code comment to reflect the change--- boot/pxe_utils.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)boot/pxe_utils.c +5
-4@@ -617,7 +617,7 @@ static int label_boot(struct pxe_context *ctx, struct pxe_label *label)* bootm, and adjust argc appropriately. * * Scenario 3: If there is an fdtcontroladdr specified, pass it along to -* bootm, and adjust argc appropriately. +* bootm, and adjust argc appropriately, unless the image type is fitImage. * * Scenario 4: fdt blob is not available. */ @@ -724,7 +724,10 @@ static int label_boot(struct pxe_context *ctx, struct pxe_label *label)if (!bootm_argv[3 ]) bootm_argv[3 ] =env_get ("fdt_addr" ); -if (!bootm_argv[3 ]) + kernel_addr_r =genimg_get_kernel_addr (kernel_addr); + buf =map_sysmem (kernel_addr_r,0 ); + +if (!bootm_argv[3 ] &&genimg_get_format (buf) !=IMAGE_FORMAT_FIT ) bootm_argv[3 ] =env_get ("fdtcontroladdr" );if (bootm_argv[3 ]) {@@ -733,8 +736,6 @@ static int label_boot(struct pxe_context *ctx, struct pxe_label *label) bootm_argc =4 ; } - kernel_addr_r =genimg_get_kernel_addr (kernel_addr); - buf =map_sysmem (kernel_addr_r,0 );/* Try bootm for legacy and FIT format image */ if (genimg_get_format (buf) !=IMAGE_FORMAT_INVALID &&IS_ENABLED (CONFIG_CMD_BOOTM ))
Quoted 1 line · Quentin Schulz
Hi Marek,
Hi,
Quoted 10 lines · Marek Vasut
Quoted 8 lines
Commit
d5ba6188dfb("cmd:pxe_utils: Check fdtcontroladdr inlabel_boot") forces '$fdtcontroladdr' DT address as a third parameter of bootm command even if the PXE transfer pulls in a fitImage which contains configuration node with its own DT that is preferrable to be passed to Linux. Limit the $fdtcontroladdr fallback utilization to non-fitImages, since it is highly likely a fitImage would come with its own DT, while single-file images do need a separate DT.
Quoted 6 lines
Reviewed-by Quentin Schulz <[email protected]>Tested-by Quentin Schulz <[email protected]>Tested on top of an almost vanilla v2022.10 on Ringneck PX30, the FDT from the selected fitimage configuration (via #conf in kernel field in extlinux.conf) is taken into account.
Not sure overriding the DT gotten from the fit image wasn't a use-case Peter wanted to support though.
I am hoping to get feedback from Peter, but that kind of behavior would be rather odd. If user wants to use fdtcontroladdr DT, then just don't add DT fdt property into the configuration node entry in the fitImage.
Quoted 15 lines · Marek Vasut
Quoted 1 line · Quentin Schulz
Hi Marek,
Hi,
Quoted 10 lines · Marek Vasut
Quoted 8 lines
Commit
d5ba6188dfb("cmd:pxe_utils: Check fdtcontroladdr inlabel_boot") forces '$fdtcontroladdr' DT address as a third parameter of bootm command even if the PXE transfer pulls in a fitImage which contains configuration node with its own DT that is preferrable to be passed to Linux. Limit the $fdtcontroladdr fallback utilization to non-fitImages, since it is highly likely a fitImage would come with its own DT, while single-file images do need a separate DT.
Quoted 8 lines
Quoted 6 lines
Reviewed-by Quentin Schulz <[email protected]>Tested-by Quentin Schulz <[email protected]>Tested on top of an almost vanilla v2022.10 on Ringneck PX30, the FDT from the selected fitimage configuration (via #conf in kernel field in extlinux.conf) is taken into account.
Not sure overriding the DT gotten from the fit image wasn't a use-case Peter wanted to support though.
I am hoping to get feedback from Peter, but that kind of behavior would be rather odd. If user wants to use fdtcontroladdr DT, then just don't add DT fdt property into the configuration node entry in the fitImage.
Tested with an fdtcontroladdr provided by a prior boot stage (TF-A) on an Arm FVP.
The implemented behavior works for me. We do not have any need to override the DT from a FIT image.
Thanks,
Peter
Quoted 57 lines · Marek Vasut
Commit
d5ba6188dfb("cmd:pxe_utils: Check fdtcontroladdr inlabel_boot") forces '$fdtcontroladdr' DT address as a third parameter of bootm command even if the PXE transfer pulls in a fitImage which contains configuration node with its own DT that is preferrable to be passed to Linux. Limit the $fdtcontroladdr fallback utilization to non-fitImages, since it is highly likely a fitImage would come with its own DT, while single-file images do need a separate DT.Fixes d5ba6188dfb ("cmd: pxe_utils: Check fdtcontroladdr in label_boot")Signed-off-by Marek Vasut <[email protected]>---
Cc: Peter Hoyes <[email protected]>
Cc: Ramon Fried <[email protected]>
Cc: Simon Glass <[email protected]>
---
V1: Map the kernel buffer before testing image type
V2: Update code comment to reflect the change--- boot/pxe_utils.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)boot/pxe_utils.c +5
-5@@ -617,7 +617,7 @@ static int label_boot(struct pxe_context *ctx, struct pxe_label *label)* bootm, and adjust argc appropriately. * * Scenario 3: If there is an fdtcontroladdr specified, pass it along to -* bootm, and adjust argc appropriately. +* bootm, and adjust argc appropriately, unless the image type is fitImage. * * Scenario 4: fdt blob is not available. */ @@ -724,7 +724,10 @@ static int label_boot(struct pxe_context *ctx, struct pxe_label *label)if (!bootm_argv[3 ]) bootm_argv[3 ] =env_get ("fdt_addr" ); -if (!bootm_argv[3 ]) + kernel_addr_r =genimg_get_kernel_addr (kernel_addr); + buf =map_sysmem (kernel_addr_r,0 ); + +if (!bootm_argv[3 ] &&genimg_get_format (buf) !=IMAGE_FORMAT_FIT ) bootm_argv[3 ] =env_get ("fdtcontroladdr" );if (bootm_argv[3 ]) {@@ -733,8 +736,6 @@ static int label_boot(struct pxe_context *ctx, struct pxe_label *label) bootm_argc =4 ; } - kernel_addr_r =genimg_get_kernel_addr (kernel_addr); - buf =map_sysmem (kernel_addr_r,0 );/* Try bootm for legacy and FIT format image */ if (genimg_get_format (buf) !=IMAGE_FORMAT_INVALID &&IS_ENABLED (CONFIG_CMD_BOOTM )) --
Quoted 2 lines
2.35.1
Quoted 47 lines · Marek Vasut
Commit
d5ba6188dfb("cmd:pxe_utils: Check fdtcontroladdr inlabel_boot") forces '$fdtcontroladdr' DT address as a third parameter of bootm command even if the PXE transfer pulls in a fitImage which contains configuration node with its own DT that is preferrable to be passed to Linux. Limit the $fdtcontroladdr fallback utilization to non-fitImages, since it is highly likely a fitImage would come with its own DT, while single-file images do need a separate DT.Fixes d5ba6188dfb ("cmd: pxe_utils: Check fdtcontroladdr in label_boot")Signed-off-by Marek Vasut <[email protected]>---
Cc: Peter Hoyes <[email protected]>
Cc: Ramon Fried <[email protected]>
Cc: Simon Glass <[email protected]>
---
V1: Map the kernel buffer before testing image type
V2: Update code comment to reflect the change--- boot/pxe_utils.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)boot/pxe_utils.c +5
-2@@ -617,7 +617,7 @@ static int label_boot(struct pxe_context *ctx, struct pxe_label *label)* bootm, and adjust argc appropriately. * * Scenario 3: If there is an fdtcontroladdr specified, pass it along to -* bootm, and adjust argc appropriately. +* bootm, and adjust argc appropriately, unless the image type is fitImage. * * Scenario 4: fdt blob is not available. */ @@ -724,7 +724,10 @@ static int label_boot(struct pxe_context *ctx, struct pxe_label *label)if (!bootm_argv[3 ]) bootm_argv[3 ] =env_get ("fdt_addr" ); -if (!bootm_argv[3 ]) + kernel_addr_r =genimg_get_kernel_addr (kernel_addr); + buf =map_sysmem (kernel_addr_r,0 ); + +if (!bootm_argv[3 ] &&genimg_get_format (buf) !=IMAGE_FORMAT_FIT ) bootm_argv[3 ] =env_get ("fdtcontroladdr" );if (bootm_argv[3 ]) {
boot/pxe_utils.c static int label_boot(struct pxe_context *ctx, struct pxe_label *label) · line 741
Quoted 8 lines
boot/pxe_utils.c +0
-2@@ -733,8 +736,6 @@ static int label_boot(struct pxe_context *ctx, struct pxe_label *label) bootm_argc =4 ; } - kernel_addr_r =genimg_get_kernel_addr (kernel_addr); - buf =map_sysmem (kernel_addr_r,0 );/* Try bootm for legacy and FIT format image */ if (genimg_get_format (buf) !=IMAGE_FORMAT_INVALID &&IS_ENABLED (CONFIG_CMD_BOOTM ))
Quoted 8 lines · Marek Vasut
Commit
d5ba6188dfb("cmd:pxe_utils: Check fdtcontroladdr inlabel_boot") forces '$fdtcontroladdr' DT address as a third parameter of bootm command even if the PXE transfer pulls in a fitImage which contains configuration node with its own DT that is preferrable to be passed to Linux. Limit the $fdtcontroladdr fallback utilization to non-fitImages, since it is highly likely a fitImage would come with its own DT, while single-file images do need a separate DT.
Quoted 8 lines
Fixes d5ba6188dfb ("cmd: pxe_utils: Check fdtcontroladdr in label_boot")Signed-off-by Marek Vasut <[email protected]>Reviewed-by Quentin Schulz <[email protected]>Tested-by Quentin Schulz <[email protected]>Reviewed-by Simon Glass <[email protected]>Reviewed-by Peter Hoyes <[email protected]>Tested-by Peter Hoyes <[email protected]>Reviewed-by Neil Armstrong <[email protected]>
Applied to u-boot/master, thanks!
Signature · 1 line
Tom