[U-Boot] [PATCH v3 0/3] Add a config for AM335x High Security EVM

Hello all,
This series is [0] and [1] together due to a dependency. Both are modified as suggested in the comments.
Thanks, Andrew
[0]: https://patchwork.ozlabs.org/patch/713945/ [1]: https://patchwork.ozlabs.org/patch/715820/
Andrew F. Davis (3): malloc_simple: Add debug statements to memalign_simple spl: Remove overwrite of relocated malloc limit defconfig: Add a config for AM335x High Security EVM
MAINTAINERS | 1 + common/malloc_simple.c | 6 +++- common/spl/spl.c | 2 ++ configs/am335x_hs_evm_defconfig | 62 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 configs/am335x_hs_evm_defconfig

Add debug statements to memalign_simple to match malloc_simple.
Signed-off-by: Andrew F. Davis afd@ti.com --- common/malloc_simple.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/common/malloc_simple.c b/common/malloc_simple.c index 0f6bcbcc71..611400265b 100644 --- a/common/malloc_simple.c +++ b/common/malloc_simple.c @@ -39,10 +39,14 @@ void *memalign_simple(size_t align, size_t bytes)
addr = ALIGN(gd->malloc_base + gd->malloc_ptr, align); new_ptr = addr + bytes - gd->malloc_base; - if (new_ptr > gd->malloc_limit) + if (new_ptr > gd->malloc_limit) { + debug("space exhausted\n"); return NULL; + } + ptr = map_sysmem(addr, bytes); gd->malloc_ptr = ALIGN(new_ptr, sizeof(new_ptr)); + debug("%lx\n", (ulong)ptr);
return ptr; }

On Sun, Jan 22, 2017 at 04:19:35PM -0600, Andrew F. Davis wrote:
Add debug statements to memalign_simple to match malloc_simple.
Signed-off-by: Andrew F. Davis afd@ti.com
Reviewed-by: Tom Rini trini@konsulko.com

On Monday 23 January 2017 03:49 AM, Andrew F. Davis wrote:
Add debug statements to memalign_simple to match malloc_simple.
Signed-off-by: Andrew F. Davis afd@ti.com
Reviewed-by: Lokesh Vutla lokeshvutla@ti.com
Thanks and regards, Lokesh

spl_init on some boards is called after stack and heap relocation, on some platforms spl_relocate_stack_gd is called to handle setting the limit to its value CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN when simple SPL malloc is enabled during relocation. spl_init should then not re-assign the old pre-relocation limit when this is defined.
Signed-off-by: Andrew F. Davis afd@ti.com --- common/spl/spl.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/common/spl/spl.c b/common/spl/spl.c index 462c3a2b97..abff85a725 100644 --- a/common/spl/spl.c +++ b/common/spl/spl.c @@ -187,7 +187,9 @@ int spl_init(void) #ifdef CONFIG_MALLOC_F_ADDR gd->malloc_base = CONFIG_MALLOC_F_ADDR; #endif +#ifndef CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN gd->malloc_limit = CONFIG_SYS_MALLOC_F_LEN; +#endif gd->malloc_ptr = 0; #endif if (CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)) {

On Sun, Jan 22, 2017 at 04:19:36PM -0600, Andrew F. Davis wrote:
spl_init on some boards is called after stack and heap relocation, on some platforms spl_relocate_stack_gd is called to handle setting the limit to its value CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN when simple SPL malloc is enabled during relocation. spl_init should then not re-assign the old pre-relocation limit when this is defined.
Signed-off-by: Andrew F. Davis afd@ti.com
common/spl/spl.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/common/spl/spl.c b/common/spl/spl.c index 462c3a2b97..abff85a725 100644 --- a/common/spl/spl.c +++ b/common/spl/spl.c @@ -187,7 +187,9 @@ int spl_init(void) #ifdef CONFIG_MALLOC_F_ADDR gd->malloc_base = CONFIG_MALLOC_F_ADDR; #endif +#ifndef CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN gd->malloc_limit = CONFIG_SYS_MALLOC_F_LEN; +#endif gd->malloc_ptr = 0; #endif
With fuller context of the function, I don't like this solution. When we do have CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN we are setting both malloc_limit and malloc_base down in spl_relocate_stack_gd() and would not want to overwrite either of them, yes? So what's happening (I think) is that CONFIG_SYS_MALLOC_F_LEN set for U-Boot proper but are in the case where it's also not the valid size for SPL. Yes?
So I think, in sum, we should change the just-above-context line: #if defined(CONFIG_SYS_MALLOC_F_LEN) into: #if defined(CONFIG_SYS_MALLOC_F_LEN) && \ !defined(CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN)
And comment above it what is going on.

Add a new defconfig file for the AM335x High Security EVM. This config is specific for the case of memory device booting. Memory device booting is handled separatly from peripheral booting on HS devices as the load address changes.
This defconfig is the same as for the non-secure part, except for: CONFIG_TI_SECURE_DEVICE option set to 'y' CONFIG_ISW_ENTRY_ADDR updated for secure images. CONFIG_FIT_IMAGE_POST_PROCESS option set to 'y' CONFIG_SPL_FIT_IMAGE_POST_PROCESS option set to 'y' CONFIG_USE_TINY_PRINTF option set to 'y' to reduce SPL size CONFIG_SPL_SYS_MALLOC_SIMPLE set to 'y' to reduce SPL size
Signed-off-by: Andrew F. Davis afd@ti.com Reviewed-by: Tom Rini trini@konsulko.com --- MAINTAINERS | 1 + configs/am335x_hs_evm_defconfig | 62 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+) create mode 100644 configs/am335x_hs_evm_defconfig
diff --git a/MAINTAINERS b/MAINTAINERS index 0e05c0ecff..eaa2c3bbb8 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -441,6 +441,7 @@ F: arch/arm/mach-omap2/omap5/sec_entry_cpu1.S F: arch/arm/mach-omap2/omap5/sec-fxns.c F: arch/arm/mach-omap2/sec-common.c F: arch/arm/mach-omap2/config_secure.mk +F: configs/am335x_hs_evm_defconfig F: configs/am43xx_hs_evm_defconfig F: configs/am57xx_hs_evm_defconfig F: configs/dra7xx_hs_evm_defconfig diff --git a/configs/am335x_hs_evm_defconfig b/configs/am335x_hs_evm_defconfig new file mode 100644 index 0000000000..d6224bcdfb --- /dev/null +++ b/configs/am335x_hs_evm_defconfig @@ -0,0 +1,62 @@ +CONFIG_ARM=y +CONFIG_AM33XX=y +CONFIG_TI_SECURE_DEVICE=y +# CONFIG_SPL_EXT_SUPPORT is not set +# CONFIG_SPL_NAND_SUPPORT is not set +CONFIG_TARGET_AM335X_EVM=y +CONFIG_ISW_ENTRY_ADDR=0x40300350 +CONFIG_SPL_STACK_R_ADDR=0x82000000 +# CONFIG_SPL_YMODEM_SUPPORT is not set +CONFIG_DEFAULT_DEVICE_TREE="am335x-evm" +CONFIG_DISTRO_DEFAULTS=y +CONFIG_FIT=y +CONFIG_SYS_EXTRA_OPTIONS="NAND" +CONFIG_SPL_LOAD_FIT=y +CONFIG_SPL_FIT_IMAGE_POST_PROCESS=y +CONFIG_FIT_IMAGE_POST_PROCESS=y +CONFIG_SYS_CONSOLE_INFO_QUIET=y +CONFIG_VERSION_VARIABLE=y +CONFIG_SPL=y +CONFIG_SPL_SYS_MALLOC_SIMPLE=y +CONFIG_SPL_STACK_R=y +CONFIG_SPL_MTD_SUPPORT=y +# CONFIG_CMD_IMLS is not set +CONFIG_CMD_ASKENV=y +# CONFIG_CMD_FLASH is not set +CONFIG_CMD_MMC=y +CONFIG_CMD_SF=y +CONFIG_CMD_SPI=y +CONFIG_CMD_I2C=y +CONFIG_CMD_USB=y +CONFIG_CMD_DFU=y +CONFIG_CMD_GPIO=y +# CONFIG_CMD_SETEXPR is not set +CONFIG_CMD_EXT4_WRITE=y +CONFIG_OF_CONTROL=y +CONFIG_OF_LIST="am335x-evm" +# CONFIG_BLK is not set +CONFIG_DFU_MMC=y +CONFIG_DFU_NAND=y +CONFIG_DFU_RAM=y +CONFIG_DM_I2C=y +CONFIG_DM_MMC=y +# CONFIG_DM_MMC_OPS is not set +CONFIG_MMC_OMAP_HS=y +CONFIG_SPI_FLASH=y +CONFIG_SPI_FLASH_WINBOND=y +CONFIG_DM_ETH=y +CONFIG_SYS_NS16550=y +CONFIG_TIMER=y +CONFIG_OMAP_TIMER=y +CONFIG_USB=y +CONFIG_USB_MUSB_HOST=y +CONFIG_USB_MUSB_GADGET=y +CONFIG_USB_STORAGE=y +CONFIG_USB_GADGET=y +CONFIG_USB_GADGET_DOWNLOAD=y +CONFIG_G_DNL_MANUFACTURER="Texas Instruments" +CONFIG_G_DNL_VENDOR_NUM=0x0451 +CONFIG_G_DNL_PRODUCT_NUM=0xd022 +CONFIG_USE_TINY_PRINTF=y +CONFIG_RSA=y +CONFIG_SPL_OF_LIBFDT=y

On Monday 23 January 2017 03:49 AM, Andrew F. Davis wrote:
Add a new defconfig file for the AM335x High Security EVM. This config is specific for the case of memory device booting. Memory device booting is handled separatly from peripheral booting on HS devices as the load address changes.
This defconfig is the same as for the non-secure part, except for: CONFIG_TI_SECURE_DEVICE option set to 'y' CONFIG_ISW_ENTRY_ADDR updated for secure images. CONFIG_FIT_IMAGE_POST_PROCESS option set to 'y' CONFIG_SPL_FIT_IMAGE_POST_PROCESS option set to 'y' CONFIG_USE_TINY_PRINTF option set to 'y' to reduce SPL size CONFIG_SPL_SYS_MALLOC_SIMPLE set to 'y' to reduce SPL size
Signed-off-by: Andrew F. Davis afd@ti.com Reviewed-by: Tom Rini trini@konsulko.com
Reviewed-by: Lokesh Vutla lokeshvutla@ti.com
Thanks and regards, Lokesh
MAINTAINERS | 1 + configs/am335x_hs_evm_defconfig | 62 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+) create mode 100644 configs/am335x_hs_evm_defconfig
diff --git a/MAINTAINERS b/MAINTAINERS index 0e05c0ecff..eaa2c3bbb8 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -441,6 +441,7 @@ F: arch/arm/mach-omap2/omap5/sec_entry_cpu1.S F: arch/arm/mach-omap2/omap5/sec-fxns.c F: arch/arm/mach-omap2/sec-common.c F: arch/arm/mach-omap2/config_secure.mk +F: configs/am335x_hs_evm_defconfig F: configs/am43xx_hs_evm_defconfig F: configs/am57xx_hs_evm_defconfig F: configs/dra7xx_hs_evm_defconfig diff --git a/configs/am335x_hs_evm_defconfig b/configs/am335x_hs_evm_defconfig new file mode 100644 index 0000000000..d6224bcdfb --- /dev/null +++ b/configs/am335x_hs_evm_defconfig @@ -0,0 +1,62 @@ +CONFIG_ARM=y +CONFIG_AM33XX=y +CONFIG_TI_SECURE_DEVICE=y +# CONFIG_SPL_EXT_SUPPORT is not set +# CONFIG_SPL_NAND_SUPPORT is not set +CONFIG_TARGET_AM335X_EVM=y +CONFIG_ISW_ENTRY_ADDR=0x40300350 +CONFIG_SPL_STACK_R_ADDR=0x82000000 +# CONFIG_SPL_YMODEM_SUPPORT is not set +CONFIG_DEFAULT_DEVICE_TREE="am335x-evm" +CONFIG_DISTRO_DEFAULTS=y +CONFIG_FIT=y +CONFIG_SYS_EXTRA_OPTIONS="NAND" +CONFIG_SPL_LOAD_FIT=y +CONFIG_SPL_FIT_IMAGE_POST_PROCESS=y +CONFIG_FIT_IMAGE_POST_PROCESS=y +CONFIG_SYS_CONSOLE_INFO_QUIET=y +CONFIG_VERSION_VARIABLE=y +CONFIG_SPL=y +CONFIG_SPL_SYS_MALLOC_SIMPLE=y +CONFIG_SPL_STACK_R=y +CONFIG_SPL_MTD_SUPPORT=y +# CONFIG_CMD_IMLS is not set +CONFIG_CMD_ASKENV=y +# CONFIG_CMD_FLASH is not set +CONFIG_CMD_MMC=y +CONFIG_CMD_SF=y +CONFIG_CMD_SPI=y +CONFIG_CMD_I2C=y +CONFIG_CMD_USB=y +CONFIG_CMD_DFU=y +CONFIG_CMD_GPIO=y +# CONFIG_CMD_SETEXPR is not set +CONFIG_CMD_EXT4_WRITE=y +CONFIG_OF_CONTROL=y +CONFIG_OF_LIST="am335x-evm" +# CONFIG_BLK is not set +CONFIG_DFU_MMC=y +CONFIG_DFU_NAND=y +CONFIG_DFU_RAM=y +CONFIG_DM_I2C=y +CONFIG_DM_MMC=y +# CONFIG_DM_MMC_OPS is not set +CONFIG_MMC_OMAP_HS=y +CONFIG_SPI_FLASH=y +CONFIG_SPI_FLASH_WINBOND=y +CONFIG_DM_ETH=y +CONFIG_SYS_NS16550=y +CONFIG_TIMER=y +CONFIG_OMAP_TIMER=y +CONFIG_USB=y +CONFIG_USB_MUSB_HOST=y +CONFIG_USB_MUSB_GADGET=y +CONFIG_USB_STORAGE=y +CONFIG_USB_GADGET=y +CONFIG_USB_GADGET_DOWNLOAD=y +CONFIG_G_DNL_MANUFACTURER="Texas Instruments" +CONFIG_G_DNL_VENDOR_NUM=0x0451 +CONFIG_G_DNL_PRODUCT_NUM=0xd022 +CONFIG_USE_TINY_PRINTF=y +CONFIG_RSA=y +CONFIG_SPL_OF_LIBFDT=y
participants (3)
-
Andrew F. Davis
-
Lokesh Vutla
-
Tom Rini