[PATCH 0/5] K3 incremental fixes

The series addresses the previous review comments in an incremental manner [0]. Only the important and core ones are addressed currently and the furthur fixes will be sent accordingly after their development is done..
[0]: https://lore.kernel.org/u-boot/20230713-b4-upstream-fit-image-support-v1-0-b...
Signed-off-by: Manorit Chawdhry m-chawdhry@ti.com --- Manorit Chawdhry (3): configs: am62x: add SPL_MAX_SIZE back configs: am64x_evm_a53_defconfig: remove SYS_SPI_U_BOOT_OFFS mach-k3: security: improve the checks around authentication
Vignesh Raghavendra (2): env: ti: mmc.env: Move mmc related args to common place env: ti: mmc.env: Fix overlays directory path
arch/arm/mach-k3/security.c | 20 +++++++++----------- board/ti/am62x/am62x.env | 14 -------------- board/ti/am64x/am64x.env | 14 -------------- board/ti/am65x/am65x.env | 14 -------------- board/ti/j721e/j721e.env | 15 --------------- board/ti/j721s2/j721s2.env | 17 ----------------- configs/am62x_evm_a53_defconfig | 1 + configs/am64x_evm_a53_defconfig | 1 - include/environment/ti/mmc.env | 14 ++++++++++++++ 9 files changed, 24 insertions(+), 86 deletions(-) --- base-commit: 94e7cb181ad6bd25d36a11c58e0df64e9f815888 change-id: 20230725-b4-upstream-k3-fixes-383c756de738
Best regards,

This was regressed by the following commit and is required to build with additional configs enabled.
Fixes: 14439cd71c1a ("configs: k3: make consistent bootcmd across all k3 socs")
Signed-off-by: Manorit Chawdhry m-chawdhry@ti.com --- configs/am62x_evm_a53_defconfig | 1 + 1 file changed, 1 insertion(+)
diff --git a/configs/am62x_evm_a53_defconfig b/configs/am62x_evm_a53_defconfig index 424a032201e8..4c5edc01a44b 100644 --- a/configs/am62x_evm_a53_defconfig +++ b/configs/am62x_evm_a53_defconfig @@ -30,6 +30,7 @@ CONFIG_SPL_LOAD_FIT=y CONFIG_SPL_LOAD_FIT_ADDRESS=0x81000000 CONFIG_DISTRO_DEFAULTS=y CONFIG_BOOTCOMMAND="run envboot; run distro_bootcmd;" +CONFIG_SPL_MAX_SIZE=0x58000 CONFIG_SPL_HAS_BSS_LINKER_SECTION=y CONFIG_SPL_BSS_START_ADDR=0x80c80000 CONFIG_SPL_BSS_MAX_SIZE=0x80000

On 25/07/23 13:09, Manorit Chawdhry wrote:
This was regressed by the following commit and is required to build with additional configs enabled.
Fixes: 14439cd71c1a ("configs: k3: make consistent bootcmd across all k3 socs")
Signed-off-by: Manorit Chawdhrym-chawdhry@ti.com
configs/am62x_evm_a53_defconfig | 1 + 1 file changed, 1 insertion(+)
Tested-by: Nikhil M Jain n-jain1@ti.com

On Tue, Jul 25, 2023 at 01:09:18PM +0530, Manorit Chawdhry wrote:
This was regressed by the following commit and is required to build with additional configs enabled.
Fixes: 14439cd71c1a ("configs: k3: make consistent bootcmd across all k3 socs")
Signed-off-by: Manorit Chawdhry m-chawdhry@ti.com Tested-by: Nikhil M Jain n-jain1@ti.com
Applied to u-boot/master, thanks!

This got added mistakenly during patch posting, remove it.
Fixes: a5e8678e0a32 ("configs: k3: Remove saved environments") Signed-off-by: Manorit Chawdhry m-chawdhry@ti.com --- configs/am64x_evm_a53_defconfig | 1 - 1 file changed, 1 deletion(-)
diff --git a/configs/am64x_evm_a53_defconfig b/configs/am64x_evm_a53_defconfig index 5fdaafb983d4..9bdb767f9e6a 100644 --- a/configs/am64x_evm_a53_defconfig +++ b/configs/am64x_evm_a53_defconfig @@ -14,7 +14,6 @@ CONFIG_TARGET_AM642_A53_EVM=y CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x80480000 CONFIG_ENV_SIZE=0x20000 -CONFIG_SYS_SPI_U_BOOT_OFFS=0x300000 CONFIG_DM_GPIO=y CONFIG_SPL_DM_SPI=y CONFIG_DEFAULT_DEVICE_TREE="k3-am642-evm"

On Tue, Jul 25, 2023 at 01:09:19PM +0530, Manorit Chawdhry wrote:
This got added mistakenly during patch posting, remove it.
Fixes: a5e8678e0a32 ("configs: k3: Remove saved environments") Signed-off-by: Manorit Chawdhry m-chawdhry@ti.com
This isn't required as the resync cleared this from the defconfig.

From: Vignesh Raghavendra vigneshr@ti.com
All K3 SoCs use same set of args to load kernel for MMC. So move this to common place to avoid duplication.
Signed-off-by: Vignesh Raghavendra vigneshr@ti.com Signed-off-by: Manorit Chawdhry m-chawdhry@ti.com --- board/ti/am62x/am62x.env | 14 -------------- board/ti/am64x/am64x.env | 14 -------------- board/ti/am65x/am65x.env | 14 -------------- board/ti/j721e/j721e.env | 15 --------------- board/ti/j721s2/j721s2.env | 17 ----------------- include/environment/ti/mmc.env | 14 ++++++++++++++ 6 files changed, 14 insertions(+), 74 deletions(-)
diff --git a/board/ti/am62x/am62x.env b/board/ti/am62x/am62x.env index 0901a8536da5..bb37d21de61b 100644 --- a/board/ti/am62x/am62x.env +++ b/board/ti/am62x/am62x.env @@ -16,20 +16,6 @@ mmcdev=1 bootpart=1:2 bootdir=/boot rd_spec=- -init_mmc=run args_all args_mmc -get_overlay_mmc= - fdt address ${fdtaddr}; - fdt resize 0x100000; - for overlay in $name_overlays; - do; - load mmc ${bootpart} ${dtboaddr} ${bootdir}/${overlay} && - fdt apply ${dtboaddr}; - done; -get_kern_mmc=load mmc ${bootpart} ${loadaddr} - ${bootdir}/${name_kern} -get_fit_mmc=load mmc ${bootpart} ${addr_fit} - ${bootdir}/${name_fit} -partitions=name=rootfs,start=0,size=-,uuid=${uuid_gpt_rootfs}
splashfile=ti.gz splashimage=0x80200000 diff --git a/board/ti/am64x/am64x.env b/board/ti/am64x/am64x.env index 015f63a66c71..ecb07366fc8a 100644 --- a/board/ti/am64x/am64x.env +++ b/board/ti/am64x/am64x.env @@ -20,20 +20,6 @@ mmcdev=1 bootpart=1:2 bootdir=/boot rd_spec=- -init_mmc=run args_all args_mmc -get_overlay_mmc= - fdt address ${fdtaddr}; - fdt resize 0x100000; - for overlay in $name_overlays; - do; - load mmc ${bootpart} ${dtboaddr} ${bootdir}/${overlay} && - fdt apply ${dtboaddr}; - done; -get_kern_mmc=load mmc ${bootpart} ${loadaddr} - ${bootdir}/${name_kern} -get_fit_mmc=load mmc ${bootpart} ${addr_fit} - ${bootdir}/${name_fit} -partitions=name=rootfs,start=0,size=-,uuid=${uuid_gpt_rootfs}
args_usb=run finduuid;setenv bootargs console=${console} ${optargs} diff --git a/board/ti/am65x/am65x.env b/board/ti/am65x/am65x.env index d7130cc3f7df..036f4752835a 100644 --- a/board/ti/am65x/am65x.env +++ b/board/ti/am65x/am65x.env @@ -19,20 +19,6 @@ mmcdev=1 bootpart=1:2 bootdir=/boot rd_spec=- -init_mmc=run args_all args_mmc -get_overlay_mmc= - fdt address ${fdtaddr}; - fdt resize 0x100000; - for overlay in $name_overlays; - do; - load mmc ${bootpart} ${dtboaddr} ${bootdir}/${overlay} && - fdt apply ${dtboaddr}; - done; -get_kern_mmc=load mmc ${bootpart} ${loadaddr} - ${bootdir}/${name_kern} -get_fit_mmc=load mmc ${bootpart} ${addr_fit} - ${bootdir}/${name_fit} -partitions=name=root,start=0,size=-,uuid=${uuid_gpt_rootfs}
init_ubi= run args_all args_ubi; diff --git a/board/ti/j721e/j721e.env b/board/ti/j721e/j721e.env index 23ce7e1af746..f7a4880bf835 100644 --- a/board/ti/j721e/j721e.env +++ b/board/ti/j721e/j721e.env @@ -36,21 +36,6 @@ mmcdev=1 bootpart=1:2 bootdir=/boot rd_spec=- -init_mmc=run args_all args_mmc -get_overlay_mmc= - fdt address ${fdtaddr}; - fdt resize 0x100000; - for overlay in $name_overlays; - do; - load mmc ${bootpart} ${dtboaddr} ${bootdir}/${overlay} && - fdt apply ${dtboaddr}; - done; -partitions=uuid_disk=${uuid_gpt_disk}; - name=rootfs,start=0,size=-,uuid=${uuid_gpt_rootfs} -get_kern_mmc=load mmc ${bootpart} ${loadaddr} - ${bootdir}/${name_kern} -get_fit_mmc=load mmc ${bootpart} ${addr_fit} - ${bootdir}/${name_fit}
#if CONFIG_TARGET_J7200_A72_EVM do_main_cpsw0_qsgmii_phyinit=1 diff --git a/board/ti/j721s2/j721s2.env b/board/ti/j721s2/j721s2.env index 9464fe499037..2ec652dbdd3e 100644 --- a/board/ti/j721s2/j721s2.env +++ b/board/ti/j721s2/j721s2.env @@ -30,23 +30,6 @@ addr_mcur5f0_0load=0x89000000 name_mcur5f0_0fw=/lib/firmware/j7-mcu-r5f0_0-fw #endif rd_spec=- -init_mmc=run args_all args_mmc -get_overlay_mmc= - fdt address ${fdtaddr}; - fdt resize 0x100000; - for overlay in $name_overlays; - do; - load mmc ${bootpart} ${dtboaddr} ${bootdir}/${overlay} && - fdt apply ${dtboaddr}; - done; -partitions=uuid_disk=${uuid_gpt_disk}; - name=rootfs,start=0,size=-,uuid=${uuid_gpt_rootfs} -get_kern_mmc=load mmc ${bootpart} ${loadaddr} - ${bootdir}/${name_kern} -get_fit_mmc=load mmc ${bootpart} ${addr_fit} - ${bootdir}/${name_fit} -partitions=uuid_disk=${uuid_gpt_disk}; - name=rootfs,start=0,size=-,uuid=${uuid_gpt_rootfs}
rproc_fw_binaries= 2 /lib/firmware/j721s2-main-r5f0_0-fw 3 /lib/firmware/j721s2-main-r5f0_1-fw 4 /lib/firmware/j721s2-main-r5f1_0-fw 5 /lib/firmware/j721s2-main-r5f1_1-fw 6 /lib/firmware/j721s2-c71_0-fw 7 /lib/firmware/j721s2-c71_1-fw
diff --git a/include/environment/ti/mmc.env b/include/environment/ti/mmc.env index a052d288535e..c0c8854bbd00 100644 --- a/include/environment/ti/mmc.env +++ b/include/environment/ti/mmc.env @@ -60,3 +60,17 @@ mmcboot=mmc dev ${mmcdev}; fi; fi;
+init_mmc=run args_all args_mmc +get_overlay_mmc= + fdt address ${fdtaddr}; + fdt resize 0x100000; + for overlay in $name_overlays; + do; + load mmc ${bootpart} ${dtboaddr} ${bootdir}/${overlay} && + fdt apply ${dtboaddr}; + done; +get_kern_mmc=load mmc ${bootpart} ${loadaddr} + ${bootdir}/${name_kern} +get_fit_mmc=load mmc ${bootpart} ${addr_fit} + ${bootdir}/${name_fit} +partitions=name=rootfs,start=0,size=-,uuid=${uuid_gpt_rootfs}

On 25/07/23 13:09, Manorit Chawdhry wrote:
From: Vignesh Raghavendravigneshr@ti.com
All K3 SoCs use same set of args to load kernel for MMC. So move this to common place to avoid duplication.
Signed-off-by: Vignesh Raghavendravigneshr@ti.com Signed-off-by: Manorit Chawdhrym-chawdhry@ti.com
board/ti/am62x/am62x.env | 14 -------------- board/ti/am64x/am64x.env | 14 -------------- board/ti/am65x/am65x.env | 14 -------------- board/ti/j721e/j721e.env | 15 --------------- board/ti/j721s2/j721s2.env | 17 ----------------- include/environment/ti/mmc.env | 14 ++++++++++++++ 6 files changed, 14 insertions(+), 74 deletions(-)
Reviewed-by: Nikhil M Jain n-jain1@ti.com

On Tue, Jul 25, 2023 at 01:09:20PM +0530, Manorit Chawdhry wrote:
From: Vignesh Raghavendra vigneshr@ti.com
All K3 SoCs use same set of args to load kernel for MMC. So move this to common place to avoid duplication.
Signed-off-by: Vignesh Raghavendra vigneshr@ti.com Signed-off-by: Manorit Chawdhry m-chawdhry@ti.com Reviewed-by: Nikhil M Jain n-jain1@ti.com
Applied to u-boot/master, thanks!

From: Vignesh Raghavendra vigneshr@ti.com
Similar to get_fdt_mmc make get_overlays_mmc look at /boot/dtb/* path for overlay files.
Signed-off-by: Vignesh Raghavendra vigneshr@ti.com Signed-off-by: Manorit Chawdhry m-chawdhry@ti.com --- include/environment/ti/mmc.env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/environment/ti/mmc.env b/include/environment/ti/mmc.env index c0c8854bbd00..6fb47fb26673 100644 --- a/include/environment/ti/mmc.env +++ b/include/environment/ti/mmc.env @@ -66,7 +66,7 @@ get_overlay_mmc= fdt resize 0x100000; for overlay in $name_overlays; do; - load mmc ${bootpart} ${dtboaddr} ${bootdir}/${overlay} && + load mmc ${bootpart} ${dtboaddr} ${bootdir}/dtb/${overlay} && fdt apply ${dtboaddr}; done; get_kern_mmc=load mmc ${bootpart} ${loadaddr}

On 25/07/23 13:09, Manorit Chawdhry wrote:
From: Vignesh Raghavendravigneshr@ti.com
Similar to get_fdt_mmc make get_overlays_mmc look at/boot/dtb/* path for overlay files.
Signed-off-by: Vignesh Raghavendravigneshr@ti.com Signed-off-by: Manorit Chawdhrym-chawdhry@ti.com
include/environment/ti/mmc.env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Reviewed-by: Nikhil M Jain n-jain1@ti.com

On Tue, Jul 25, 2023 at 01:09:21PM +0530, Manorit Chawdhry wrote:
From: Vignesh Raghavendra vigneshr@ti.com
Similar to get_fdt_mmc make get_overlays_mmc look at /boot/dtb/* path for overlay files.
Signed-off-by: Vignesh Raghavendra vigneshr@ti.com Signed-off-by: Manorit Chawdhry m-chawdhry@ti.com Reviewed-by: Nikhil M Jain n-jain1@ti.com
Applied to u-boot/master, thanks!

The following checks are more reasonable as the previous logs were a bit misleading as we could still get the logs that the authetication is being skipped but still authenticate. Move the debug prints and checks to proper locations.
Signed-off-by: Manorit Chawdhry m-chawdhry@ti.com --- arch/arm/mach-k3/security.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-)
diff --git a/arch/arm/mach-k3/security.c b/arch/arm/mach-k3/security.c index 6038c9665ecb..89659f479eed 100644 --- a/arch/arm/mach-k3/security.c +++ b/arch/arm/mach-k3/security.c @@ -67,14 +67,6 @@ void ti_secure_image_check_binary(void **p_image, size_t *p_size)
return; } - - if (get_device_type() != K3_DEVICE_TYPE_HS_SE && - !ti_secure_cert_detected(*p_image)) { - printf("Warning: Did not detect image signing certificate. " - "Skipping authentication to prevent boot failure. " - "This will fail on Security Enforcing(HS-SE) devices\n"); - return; - } }
void ti_secure_image_post_process(void **p_image, size_t *p_size) @@ -91,11 +83,17 @@ void ti_secure_image_post_process(void **p_image, size_t *p_size) return; }
- if (get_device_type() == K3_DEVICE_TYPE_GP && - (get_device_type() != K3_DEVICE_TYPE_HS_SE && - !ti_secure_cert_detected(*p_image))) + if (get_device_type() == K3_DEVICE_TYPE_GP) return;
+ if (get_device_type() != K3_DEVICE_TYPE_HS_SE && + !ti_secure_cert_detected(*p_image)) { + printf("Warning: Did not detect image signing certificate. " + "Skipping authentication to prevent boot failure. " + "This will fail on Security Enforcing(HS-SE) devices\n"); + return; + } + /* Clean out image so it can be seen by system firmware */ image_addr = dma_map_single(*p_image, *p_size, DMA_BIDIRECTIONAL);

On Tue, Jul 25, 2023 at 01:09:22PM +0530, Manorit Chawdhry wrote:
The following checks are more reasonable as the previous logs were a bit misleading as we could still get the logs that the authetication is being skipped but still authenticate. Move the debug prints and checks to proper locations.
Signed-off-by: Manorit Chawdhry m-chawdhry@ti.com
Applied to u-boot/master, thanks!
participants (3)
-
Manorit Chawdhry
-
Nikhil M Jain
-
Tom Rini