Add support for loading main_r5fss0_core0
Subsystems (3)
v3 cover Add support for loading main_r5fss0_core0
This patch series enables mcu_r5fss0_core0 & main_r5fss0_core0. Tested for firmware loading and execution on J721e.
Changes in v3:
* Removed saving env in MMC and fixed env saving in SPL when nowhere option is set.
Changes in v2:
* Factored out all the generic elf handling functions under lib/elf.c
Keerthy (10):
lib: elf: Move the generic elf loading/validating functions to lib
arm: k3: Add support for loading non linux remote cores
armv7R: K3: r5_mpu: Enable execute permission for MCU0 BTCM
armv7R: K3: Add support for jumping to firmware
arm: dts: k3-j721e-r5: Add fs_loader node
arm: dts: k3-j721e-r5: Enable r5fss0 cluster in SPL
include: configs: j721e_evm: Add env variables for mcu_r5fss0_core0 &
main_r5fss0_core0
configs: j721e_evm_r5: Enable R5F remoteproc support
configs: j721e_evm_r5_defconfig: Remove saving ENV in eMMC
env: nowhere: set default enviroment
.../arm/dts/k3-j721e-r5-common-proc-board.dts | 20 ++ arch/arm/mach-k3/common.c | 106 +++++++- arch/arm/mach-k3/common.h | 2 + arch/arm/mach-k3/j721e_init.c | 34 +++ arch/arm/mach-k3/r5_mpu.c | 4 +- cmd/Kconfig | 1 + cmd/elf.c | 229 ---------------- configs/j721e_evm_r5_defconfig | 6 +- env/nowhere.c | 1 + include/configs/j721e_evm.h | 4 + include/elf.h | 4 + lib/Kconfig | 3 + lib/Makefile | 1 + lib/elf.c | 256 ++++++++++++++++++ 14 files changed, 426 insertions(+), 245 deletions(-) create mode 100644 lib/elf.c
Signature · 1 line
2.17.1
PATCH v3 1/10 lib: elf: Move the generic elf loading/validating functions to lib
Move the generic elf loading/validating functions to lib/ so that they can be re-used and accessed by code existing outside cmd.
--- cmd/Kconfig | 1 + cmd/elf.c | 229 -------------------------------------------- include/elf.h | 4 + lib/Kconfig | 3 + lib/Makefile | 1 + lib/elf.c | 256 ++++++++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 265 insertions(+), 229 deletions(-) create mode 100644 lib/elf.c
cmd/Kconfig +1 -0
@@ -375,6 +375,7 @@ config CMD_ADTIMG config CMD_ELF bool "bootelf, bootvx" default y + select ELF help Boot an ELF/vxWorks image from the memory.
cmd/elf.c +0 -229
241 lines not on this page · raw message
include/elf.h +4 -0
@@ -692,6 +692,10 @@ unsigned long elf_hash(const unsigned char *name);#ifndef __ASSEMBLER__int valid_elf_image (unsigned long addr); +unsigned long load_elf64_image_phdr (unsigned long addr); +unsigned long load_elf64_image_shdr (unsigned long addr); +unsigned long load_elf_image_phdr (unsigned long addr); +unsigned long load_elf_image_shdr (unsigned long addr);#endif #endif /* _ELF_H */
lib/Kconfig +3 -0
@@ -601,4 +601,7 @@ config TEST_FDTDEC config LIB_DATE bool +config ELF + bool "enable basic elf loading/validating functions" + endmenu
lib/Makefile +1 -0
@@ -122,6 +122,7 @@ obj-y += vsprintf.o strto.o endif obj-y += date.o +obj-$(CONFIG_ELF) += elf.o # # Build a fast OID lookup registry from include/linux/oid_registry.h
lib/elf.c new file +256 -0
256 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v3 1/10 lib: elf: Move the generic elf loading/validating functions to lib
Quoted 28 lines · Keerthy
Move the generic elf loading/validating functions to
lib/so that they can be re-used and accessed by code existing outside cmd.Signed-off-by Keerthy <[email protected]>Suggested-by Simon Goldschmidt <[email protected]>Reviewed-by Simon Goldschmidt <[email protected]>---
include/elf.h +4
-0@@ -692,6 +692,10 @@ unsigned long elf_hash(const unsigned char *name);#ifndef __ASSEMBLER__int valid_elf_image (unsigned long addr); +unsigned long load_elf64_image_phdr (unsigned long addr); +unsigned long load_elf64_image_shdr (unsigned long addr); +unsigned long load_elf_image_phdr (unsigned long addr); +unsigned long load_elf_image_shdr (unsigned long addr);#endif #endif /* _ELF_H */ lib/Kconfig +0
-0
lib/Kconfig config TEST_FDTDEC · line 604
Quoted 4 lines
lib/Kconfig +1
-0@@ -601,4 +601,7 @@ config TEST_FDTDEC config LIB_DATE bool +config ELF
LIB_ELF?
Andrew
PATCH v3 2/10 arm: k3: Add support for loading non linux remote cores
In reply to KeerthyAdd MAIN domain R5FSS0 remoteproc support from spl. This enables loading the elf firmware in SPL and starting the remotecore.
In order to start the core, there should be a file with path "/lib/firmware/j7-main-r5f0_0-fw" under filesystem of respective boot mode.
--- arch/arm/mach-k3/common.c | 84 ++++++++++++++++++++++++++++++++--- arch/arm/mach-k3/common.h | 2 + arch/arm/mach-k3/j721e_init.c | 34 ++++++++++++++ 3 files changed, 115 insertions(+), 5 deletions(-)
arch/arm/mach-k3/common.c +79 -5
@@ -16,6 +16,10 @@#include <asm/arch/sys_proto.h> #include <asm/hardware.h> #include <asm/io.h> +#include <fs_loader.h> +#include <fs.h> +#include <env.h> +#include <elf.h> struct ti_sci_handle *get_ti_sci_handle (void ) {
@@ -57,6 +61,74 @@ int early_console_init(void)#endif #ifdef CONFIG_SYS_K3_SPL_ATF + +void init_env (void ) +{ +#ifdef CONFIG_SPL_ENV_SUPPORT +char *part; + +env_init (); +env_load (); +switch (spl_boot_device ()) { +case BOOT_DEVICE_MMC2 : + part =env_get ("bootpart" ); +env_set ("storage_interface" ,"mmc" ); +env_set ("fw_dev_part" , part); +break ; +case BOOT_DEVICE_SPI : +env_set ("storage_interface" ,"ubi" ); +env_set ("fw_ubi_mtdpart" ,"UBI" ); +env_set ("fw_ubi_volume" ,"UBI0" ); +break ; +default : +printf ("%s from device %u not supported!\n" , + __func__,spl_boot_device ()); +return ; + } +#endif +} + +#ifdef CONFIG_FS_LOADER +int load_firmware (char *name_fw,char *name_loadaddr,u32 *loadaddr) +{ +struct udevice *fsdev; +char *name =NULL ; +int size =0 ; + + *loadaddr =0 ; +#ifdef CONFIG_SPL_ENV_SUPPORT +switch (spl_boot_device ()) { +case BOOT_DEVICE_MMC2 : + name =env_get (name_fw); + *loadaddr =env_get_hex (name_loadaddr, *loadaddr); +break ; +default : +printf ("Loading rproc fw image from device %u not supported!\n" , +spl_boot_device ()); +return 0 ; + } +#endif +if (!*loadaddr) +return 0 ; + +if (!uclass_get_device (UCLASS_FS_FIRMWARE_LOADER ,0 , &fsdev)) { + size =request_firmware_into_buf (fsdev, name, (void *)*loadaddr, +0 ,0 ); + } + +return size; +} +#else +int load_firmware (char *name_fw,char *name_loadaddr,u32 *loadaddr) +{ +return 0 ; +} +#endif + +__weak void start_non_linux_remote_cores (void ) +{ +} +void __noreturn jump_to_image_no_args (struct spl_image_info *spl_image) {struct ti_sci_handle *ti_sci =get_ti_sci_handle ();
@@ -65,15 +137,17 @@ void __noreturn jump_to_image_no_args(struct spl_image_info *spl_image)/* Release all the exclusive devices held by SPL before starting ATF */ ti_sci->ops.dev_ops.release_exclusive_devices (ti_sci); + ret =rproc_init (); +if (ret) +panic ("rproc failed to be initialized (%d)\n" , ret); + +init_env (); +start_non_linux_remote_cores (); +/* * It is assumed that remoteproc device 1 is the corresponding * Cortex-A core which runs ATF. Make sure DT reflects the same. */ - ret =rproc_dev_init (1 ); -if (ret) -panic ("%s: ATF failed to initialize on rproc (%d)\n" , __func__, - ret); - ret =rproc_load (1 , spl_image->entry_point,0x200 );if (ret)panic ("%s: ATF failed to load on rproc (%d)\n" , __func__, ret);
arch/arm/mach-k3/common.h +2 -0
@@ -24,3 +24,5 @@ void setup_k3_mpu_regions(void);int early_console_init (void );void disable_linefill_optimization (void );void remove_fwl_configs (struct fwl_data *fwl_data,size_t fwl_data_size); +void start_non_linux_remote_cores (void ); +int load_firmware (char *name_fw,char *name_loadaddr,u32 *loadaddr);
arch/arm/mach-k3/j721e_init.c +34 -0
@@ -18,6 +18,7 @@#include <dm.h> #include <dm/uclass-internal.h> #include <dm/pinctrl.h> +#include <remoteproc.h> #ifdef CONFIG_SPL_BUILD #ifdef CONFIG_K3_LOAD_SYSFW
@@ -295,3 +296,36 @@ void release_resources_for_core_shutdown(void) } }#endif + +#ifdef CONFIG_SYS_K3_SPL_ATF +void start_non_linux_remote_cores (void ) +{ +int size =0 , ret; +u32 loadaddr =0 ; + + size =load_firmware ("mainr5f0_0fwname" ,"mainr5f0_0loadaddr" , + &loadaddr); +if (size <=0 ) + goto err_load; + +/* assuming remoteproc 2 is aliased for the needed remotecore */ + ret =rproc_load (2 , loadaddr, size); +if (ret) { +printf ("Firmware failed to start on rproc (%d)\n" , ret); + goto err_load; + } + + ret =rproc_start (2 ); +if (ret) { +printf ("Firmware init failed on rproc (%d)\n" , ret); + goto err_load; + } + +printf ("Remoteproc 2 started successfully\n" ); + +return ; + +err_load: +rproc_reset (2 ); +} +#endif
Signature · 1 line
2.17.1
PATCH v3 2/10 arm: k3: Add support for loading non linux remote cores
Quoted 48 lines · Keerthy
Add MAIN domain R5FSS0 remoteproc support from spl. This enables loading the elf firmware in SPL and starting the remotecore.
In order to start the core, there should be a file with path "
/lib/firmware/j7-main-r5f0_0-fw" under filesystem of respective boot mode.Signed-off-by Keerthy <[email protected]>Signed-off-by Lokesh Vutla <[email protected]>[Guard start_non_linux_remote_cores under CONFIG_FS_LOADER]Signed-off-by Andreas Dannenberg <[email protected]>--- arch/arm/mach-k3/common.c | 84 ++++++++++++++++++++++++++++++++--- arch/arm/mach-k3/common.h | 2 + arch/arm/mach-k3/j721e_init.c | 34 ++++++++++++++ 3 files changed, 115 insertions(+), 5 deletions(-)arch/arm/mach-k3/common.c +16
-0@@ -16,6 +16,10 @@#include <asm/arch/sys_proto.h> #include <asm/hardware.h> #include <asm/io.h> +#include <fs_loader.h> +#include <fs.h> +#include <env.h> +#include <elf.h> struct ti_sci_handle *get_ti_sci_handle (void ) {@@ -57,6 +61,74 @@ int early_console_init(void)#endif #ifdef CONFIG_SYS_K3_SPL_ATF + +void init_env (void ) +{ +#ifdef CONFIG_SPL_ENV_SUPPORT +char *part; + +env_init (); +env_load (); +switch (spl_boot_device ()) { +case BOOT_DEVICE_MMC2 : + part =env_get ("bootpart" ); +env_set ("storage_interface" ,"mmc" );
arch/arm/mach-k3/common.c int early_console_init(void) · line 85
Quoted 10 lines
arch/arm/mach-k3/common.c +10
-0+env_set ("fw_dev_part" , part); +break ; +case BOOT_DEVICE_SPI : +env_set ("storage_interface" ,"ubi" ); +env_set ("fw_ubi_mtdpart" ,"UBI" ); +env_set ("fw_ubi_volume" ,"UBI0" ); +break ; +default : +printf ("%s from device %u not supported!\n" , + __func__,spl_boot_device ());
This will print for almost every boot mode..
Quoted 12 lines
arch/arm/mach-k3/common.c +12
-0+return ; + } +#endif +} + +#ifdef CONFIG_FS_LOADER +int load_firmware (char *name_fw,char *name_loadaddr,u32 *loadaddr) +{ +struct udevice *fsdev; +char *name =NULL ; +int size =0 ; +
arch/arm/mach-k3/common.c int early_console_init(void) · line 107
Quoted 10 lines
arch/arm/mach-k3/common.c +10
-0+ *loadaddr =0 ; +#ifdef CONFIG_SPL_ENV_SUPPORT +switch (spl_boot_device ()) { +case BOOT_DEVICE_MMC2 : + name =env_get (name_fw); + *loadaddr =env_get_hex (name_loadaddr, *loadaddr); +break ; +default : +printf ("Loading rproc fw image from device %u not supported!\n" , +spl_boot_device ());
This whole thing seems very MMC specific, if early firmware loading is important it should work for all boot modes. Find a way to include it in the next boot stage FIT image (tispl.bin) so it works for all modes.
Quoted 37 lines
arch/arm/mach-k3/common.c +30
-0+return 0 ; + } +#endif +if (!*loadaddr) +return 0 ; + +if (!uclass_get_device (UCLASS_FS_FIRMWARE_LOADER ,0 , &fsdev)) { + size =request_firmware_into_buf (fsdev, name, (void *)*loadaddr, +0 ,0 ); + } + +return size; +} +#else +int load_firmware (char *name_fw,char *name_loadaddr,u32 *loadaddr) +{ +return 0 ; +} +#endif + +__weak void start_non_linux_remote_cores (void ) +{ +} +void __noreturn jump_to_image_no_args (struct spl_image_info *spl_image) {struct ti_sci_handle *ti_sci =get_ti_sci_handle ();@@ -65,15 +137,17 @@ void __noreturn jump_to_image_no_args(struct spl_image_info *spl_image)/* Release all the exclusive devices held by SPL before starting ATF */ ti_sci->ops.dev_ops.release_exclusive_devices (ti_sci); + ret =rproc_init (); +if (ret) +panic ("rproc failed to be initialized (%d)\n" , ret); + +init_env (); +start_non_linux_remote_cores ();
arch/arm/mach-k3/common.c void __noreturn jump_to_image_no_args(struct spl_image_info *spl_image) · line 76
Quoted 10 lines
arch/arm/mach-k3/common.c +1
-5+/* * It is assumed that remoteproc device 1 is the corresponding * Cortex-A core which runs ATF. Make sure DT reflects the same. */ - ret =rproc_dev_init (1 ); -if (ret) -panic ("%s: ATF failed to initialize on rproc (%d)\n" , __func__, - ret); -
Where did this code go?
Quoted 32 lines
arch/arm/mach-k3/common.c +0
-0ret =rproc_load (1 , spl_image->entry_point,0x200 );if (ret)panic ("%s: ATF failed to load on rproc (%d)\n" , __func__, ret);arch/arm/mach-k3/common.h +2
-0@@ -24,3 +24,5 @@ void setup_k3_mpu_regions(void);int early_console_init (void );void disable_linefill_optimization (void );void remove_fwl_configs (struct fwl_data *fwl_data,size_t fwl_data_size); +void start_non_linux_remote_cores (void ); +int load_firmware (char *name_fw,char *name_loadaddr,u32 *loadaddr);arch/arm/mach-k3/j721e_init.c +4
-0@@ -18,6 +18,7 @@#include <dm.h> #include <dm/uclass-internal.h> #include <dm/pinctrl.h> +#include <remoteproc.h> #ifdef CONFIG_SPL_BUILD #ifdef CONFIG_K3_LOAD_SYSFW @@ -295,3 +296,36 @@ void release_resources_for_core_shutdown(void) } }#endif + +#ifdef CONFIG_SYS_K3_SPL_ATF +void start_non_linux_remote_cores (void )
arch/arm/mach-k3/j721e_init.c void release_resources_for_core_shutdown(void) · line 311
Quoted 10 lines
arch/arm/mach-k3/j721e_init.c +10
-0+{ +int size =0 , ret; +u32 loadaddr =0 ; + + size =load_firmware ("mainr5f0_0fwname" ,"mainr5f0_0loadaddr" , + &loadaddr); +if (size <=0 ) + goto err_load; + +/* remoteproc 2 is aliased for the needed remotecore */
Assuming the big-arm core to boot is remoteproc 1 was reasonable, but there needs to be a better what than assuming the number for every other remote core.
arch/arm/mach-k3/j721e_init.c void release_resources_for_core_shutdown(void) · line 324
Quoted 13 lines
arch/arm/mach-k3/j721e_init.c +13
-0+ ret =rproc_load (2 , loadaddr, size); +if (ret) { +printf ("Firmware failed to start on rproc (%d)\n" , ret); + goto err_load; + } + + ret =rproc_start (2 ); +if (ret) { +printf ("Firmware init failed on rproc (%d)\n" , ret); + goto err_load; + } + +printf ("Remoteproc 2 started successfully\n" );
That's useful..
Andrew
Quoted 8 lines
arch/arm/mach-k3/j721e_init.c +7
-0+ +return ; + +err_load: + rproc_reset(2); +} +#endif
PATCH v3 2/10 arm: k3: Add support for loading non linux remote cores
Quoted 54 lines · Andrew F. Davis
Quoted 53 lines · Keerthy
Add MAIN domain R5FSS0 remoteproc support from spl. This enables loading the elf firmware in SPL and starting the remotecore.
In order to start the core, there should be a file with path "
/lib/firmware/j7-main-r5f0_0-fw" under filesystem of respective boot mode.Signed-off-by Keerthy <[email protected]>Signed-off-by Lokesh Vutla <[email protected]>[Guard start_non_linux_remote_cores under CONFIG_FS_LOADER]Signed-off-by Andreas Dannenberg <[email protected]>--- arch/arm/mach-k3/common.c | 84 ++++++++++++++++++++++++++++++++--- arch/arm/mach-k3/common.h | 2 + arch/arm/mach-k3/j721e_init.c | 34 ++++++++++++++ 3 files changed, 115 insertions(+), 5 deletions(-)arch/arm/mach-k3/common.c +21
-0@@ -16,6 +16,10 @@#include <asm/arch/sys_proto.h> #include <asm/hardware.h> #include <asm/io.h> +#include <fs_loader.h> +#include <fs.h> +#include <env.h> +#include <elf.h> struct ti_sci_handle *get_ti_sci_handle (void ) {@@ -57,6 +61,74 @@ int early_console_init(void)#endif #ifdef CONFIG_SYS_K3_SPL_ATF + +void init_env (void ) +{ +#ifdef CONFIG_SPL_ENV_SUPPORT +char *part; + +env_init (); +env_load (); +switch (spl_boot_device ()) { +case BOOT_DEVICE_MMC2 : + part =env_get ("bootpart" ); +env_set ("storage_interface" ,"mmc" ); +env_set ("fw_dev_part" , part); +break ; +case BOOT_DEVICE_SPI : +env_set ("storage_interface" ,"ubi" ); +env_set ("fw_ubi_mtdpart" ,"UBI" );
Quoted 8 lines
arch/arm/mach-k3/common.c int early_console_init(void) · line 85
Quoted 5 lines
arch/arm/mach-k3/common.c +5
-0+env_set ("fw_ubi_volume" ,"UBI0" ); +break ; +default : +printf ("%s from device %u not supported!\n" , + __func__,spl_boot_device ());This will print for almost every boot mode..
I can keep this under debug.
Quoted 21 lines
Quoted 21 lines
arch/arm/mach-k3/common.c +19
-0+return ; + } +#endif +} + +#ifdef CONFIG_FS_LOADER +int load_firmware (char *name_fw,char *name_loadaddr,u32 *loadaddr) +{ +struct udevice *fsdev; +char *name =NULL ; +int size =0 ; + + *loadaddr =0 ; +#ifdef CONFIG_SPL_ENV_SUPPORT +switch (spl_boot_device ()) { +case BOOT_DEVICE_MMC2 : + name =env_get (name_fw); + *loadaddr =env_get_hex (name_loadaddr, *loadaddr); +break ;
Quoted 8 lines
arch/arm/mach-k3/common.c int early_console_init(void) · line 107
Quoted 3 lines
arch/arm/mach-k3/common.c +3
-0+default : +printf ("Loading rproc fw image from device %u not supported!\n" , +spl_boot_device ());This whole thing seems very MMC specific, if early firmware loading is important it should work for all boot modes. Find a way to include it in the next boot stage FIT image (tispl.bin) so it works for all modes.
That was not NAKd. We are going with fs_loader approach.
Quoted 44 lines
Quoted 44 lines
arch/arm/mach-k3/common.c +31
-0+return 0 ; + } +#endif +if (!*loadaddr) +return 0 ; + +if (!uclass_get_device (UCLASS_FS_FIRMWARE_LOADER ,0 , &fsdev)) { + size =request_firmware_into_buf (fsdev, name, (void *)*loadaddr, +0 ,0 ); + } + +return size; +} +#else +int load_firmware (char *name_fw,char *name_loadaddr,u32 *loadaddr) +{ +return 0 ; +} +#endif + +__weak void start_non_linux_remote_cores (void ) +{ +} +void __noreturn jump_to_image_no_args (struct spl_image_info *spl_image) {struct ti_sci_handle *ti_sci =get_ti_sci_handle ();@@ -65,15 +137,17 @@ void __noreturn jump_to_image_no_args(struct spl_image_info *spl_image)/* Release all the exclusive devices held by SPL before starting ATF */ ti_sci->ops.dev_ops.release_exclusive_devices (ti_sci); + ret =rproc_init (); +if (ret) +panic ("rproc failed to be initialized (%d)\n" , ret); + +init_env (); +start_non_linux_remote_cores (); +/* * It is assumed that remoteproc device 1 is the corresponding * Cortex-A core which runs ATF. Make sure DT reflects the same. */
Quoted 8 lines
arch/arm/mach-k3/common.c void __noreturn jump_to_image_no_args(struct spl_image_info *spl_image) · line 76
Quoted 5 lines
arch/arm/mach-k3/common.c +0
-5- ret =rproc_dev_init (1 ); -if (ret) -panic ("%s: ATF failed to initialize on rproc (%d)\n" , __func__, - ret); -Where did this code go?
rproc_init takes care of that.
Quoted 51 lines
Quoted 34 lines
arch/arm/mach-k3/common.c +0
-0ret =rproc_load (1 , spl_image->entry_point,0x200 );if (ret)panic ("%s: ATF failed to load on rproc (%d)\n" , __func__, ret);arch/arm/mach-k3/common.h +2
-0@@ -24,3 +24,5 @@ void setup_k3_mpu_regions(void);int early_console_init (void );void disable_linefill_optimization (void );void remove_fwl_configs (struct fwl_data *fwl_data,size_t fwl_data_size); +void start_non_linux_remote_cores (void ); +int load_firmware (char *name_fw,char *name_loadaddr,u32 *loadaddr);arch/arm/mach-k3/j721e_init.c +4
-0@@ -18,6 +18,7 @@#include <dm.h> #include <dm/uclass-internal.h> #include <dm/pinctrl.h> +#include <remoteproc.h> #ifdef CONFIG_SPL_BUILD #ifdef CONFIG_K3_LOAD_SYSFW @@ -295,3 +296,36 @@ void release_resources_for_core_shutdown(void) } }#endif + +#ifdef CONFIG_SYS_K3_SPL_ATF +void start_non_linux_remote_cores (void )arch/arm/mach-k3/j721e_init.c void release_resources_for_core_shutdown(void) · line 311
Quoted 10 lines
arch/arm/mach-k3/j721e_init.c +10
-0+{ +int size =0 , ret; +u32 loadaddr =0 ; + + size =load_firmware ("mainr5f0_0fwname" ,"mainr5f0_0loadaddr" , + &loadaddr); +if (size <=0 ) + goto err_load; + +/* remoteproc 2 is aliased for the needed remotecore */ Assuming the big-arm core to boot is remoteproc 1 was reasonable, but there needs to be a better what than assuming the number for every other remote core.
Quoted 16 lines
arch/arm/mach-k3/j721e_init.c void release_resources_for_core_shutdown(void) · line 324
Quoted 13 lines
arch/arm/mach-k3/j721e_init.c +13
-0+ ret =rproc_load (2 , loadaddr, size); +if (ret) { +printf ("Firmware failed to start on rproc (%d)\n" , ret); + goto err_load; + } + + ret =rproc_start (2 ); +if (ret) { +printf ("Firmware init failed on rproc (%d)\n" , ret); + goto err_load; + } + +printf ("Remoteproc 2 started successfully\n" );That's useful..
That is a print that tells everything went well with rproc 2. Otherwise one has to really find other ways to see if it succeeded or not.
Quoted 12 lines
Andrew
Quoted 8 lines
arch/arm/mach-k3/j721e_init.c +7
-0+ +return ; + +err_load: + rproc_reset(2); +} +#endif
PATCH v3 2/10 arm: k3: Add support for loading non linux remote cores
Quoted 97 lines · keerthy
Quoted 52 lines · Andrew F. Davis
Quoted 51 lines · Keerthy
Add MAIN domain R5FSS0 remoteproc support from spl. This enables loading the elf firmware in SPL and starting the remotecore.
In order to start the core, there should be a file with path "
/lib/firmware/j7-main-r5f0_0-fw" under filesystem of respective boot mode.Signed-off-by Keerthy <[email protected]>Signed-off-by Lokesh Vutla <[email protected]>[Guard start_non_linux_remote_cores under CONFIG_FS_LOADER]Signed-off-by Andreas Dannenberg <[email protected]>---
arch/arm/mach-k3/common.c | 84 ++++++++++++++++++++++++++++++++--- arch/arm/mach-k3/common.h | 2 +arch/arm/mach-k3/j721e_init.c| 34 ++++++++++++++3 files changed, 115 insertions(+), 5 deletions(-)arch/arm/mach-k3/common.c +21
-0@@ -16,6 +16,10 @@ #include <asm/arch/sys_proto.h> #include <asm/hardware.h> #include <asm/io.h> +#include <fs_loader.h> +#include <fs.h> +#include <env.h> +#include <elf.h> struct ti_sci_handle *get_ti_sci_handle(void) {@@ -57,6 +61,74 @@ int early_console_init(void) #endif #ifdef CONFIG_SYS_K3_SPL_ATF + +void init_env (void ) +{ +#ifdef CONFIG_SPL_ENV_SUPPORT + char *part; + + env_init(); + env_load(); + switch (spl_boot_device()) { + case BOOT_DEVICE_MMC2: + part = env_get("bootpart"); + env_set("storage_interface", "mmc"); + env_set("fw_dev_part", part); + break; + case BOOT_DEVICE_SPI: + env_set("storage_interface", "ubi"); + env_set("fw_ubi_mtdpart", "UBI");Quoted 8 lines
arch/arm/mach-k3/common.c int early_console_init(void) · line 85
Quoted 5 lines
arch/arm/mach-k3/common.c +5
-0+ env_set("fw_ubi_volume", "UBI0"); + break; + default: + printf("%s from device %u not supported!\n", + __func__, spl_boot_device());This will print for almost every boot mode..
I can keep this under debug.
Quoted 22 lines
Quoted 22 lines
arch/arm/mach-k3/common.c +20
-0+ return; + } +#endif +} + +#ifdef CONFIG_FS_LOADER +int load_firmware (char *name_fw,char *name_loadaddr,u32 *loadaddr) +{ + struct udevice *fsdev; + char *name = NULL; + int size = 0; + + *loadaddr = 0; +#ifdef CONFIG_SPL_ENV_SUPPORT + switch (spl_boot_device()) { + case BOOT_DEVICE_MMC2: + name = env_get(name_fw); + *loadaddr = env_get_hex(name_loadaddr, *loadaddr); + break; + default:Quoted 8 lines
arch/arm/mach-k3/common.c int early_console_init(void) · line 107
Quoted 3 lines
arch/arm/mach-k3/common.c +2
-0+ printf("Loading rproc fw image from device %u not supported!\n", + spl_boot_device());This whole thing seems very MMC specific, if early firmware loading is important it should work for all boot modes. Find a way to include it in the next boot stage FIT image (tispl.bin) so it works for all modes.
Quoted 2 lines
That was not NAKd. We are going with
fs_loaderapproach.
When, where, link?
Quoted 56 lines
Quoted 47 lines
Quoted 47 lines
arch/arm/mach-k3/common.c +24
-0+ return 0; + } +#endif + if (!*loadaddr) + return 0; + + if (!uclass_get_device(UCLASS_FS_FIRMWARE_LOADER, 0, &fsdev)) { + size = request_firmware_into_buf(fsdev, name, (void *)*loadaddr, + 0, 0); + } + + return size; +} +#else +int load_firmware (char *name_fw,char *name_loadaddr,u32 *loadaddr) +{ + return 0; +} +#endif + +__weak void start_non_linux_remote_cores (void ) +{ +} +void
__noreturnjump_to_image_no_args(struct spl_image_info *spl_image)
{
structti_sci_handle*ti_sci=get_ti_sci_handle();arch/arm/mach-k3/common.c +0
-0@@ -65,15 +137,17 @@ void __noreturn jump_to_image_no_args(struct spl_image_info *spl_image) /* Release all the exclusive devices held by SPL beforestarting ATF */
ti_sci->ops.dev_ops.release_exclusive_devices(ti_sci); + ret =rproc_init();
+ if (ret)
+panic("rproc failed to be initialized (%d)\n", ret);arch/arm/mach-k3/common.c +4
-0+ + init_env(); + start_non_linux_remote_cores(); +/*
* It is assumed that remoteproc device 1 is the corresponding
* Cortex-A core which runs ATF. Make sure DT reflects the same. */Quoted 8 lines
Quoted 5 lines
- ret =
rproc_dev_init(1);
- if (ret)
-panic("%s: ATF failed to initialize on rproc (%d)\n", __func__, - ret);
-Where did this code go?
Quoted 2 lines
rproc_inittakes care of that.
Is that new behavior then? It should be it's own patch with a commit message about that.
Quoted 70 lines
Quoted 53 lines
Quoted 36 lines
ret =
rproc_load(1, spl_image->entry_point, 0x200); if (ret)
panic("%s: ATF failed to load on rproc (%d)\n", __func__, ret);arch/arm/mach-k3/common.h +0
-0@@ -24,3 +24,5 @@ void setup_k3_mpu_regions(void); int early_console_init(void); void disable_linefill_optimization(void);void
remove_fwl_configs(struct fwl_data *fwl_data, size_t fwl_data_size);arch/arm/mach-k3/common.h +2
-0+void start_non_linux_remote_cores (void ); +int load_firmware (char *name_fw,char *name_loadaddr,u32 *loadaddr);arch/arm/mach-k3/j721e_init.c +4
-0@@ -18,6 +18,7 @@ #include <dm.h> #include <dm/uclass-internal.h> #include <dm/pinctrl.h> +#include <remoteproc.h> #ifdef CONFIG_SPL_BUILD #ifdef CONFIG_K3_LOAD_SYSFW@@ -295,3 +296,36 @@ void release_resources_for_core_shutdown(void) } } #endif + +#ifdef CONFIG_SYS_K3_SPL_ATF +void start_non_linux_remote_cores (void )arch/arm/mach-k3/j721e_init.c void release_resources_for_core_shutdown(void) · line 311
Quoted 10 lines
arch/arm/mach-k3/j721e_init.c +10
-0+{ + int size = 0, ret; + u32 loadaddr = 0; + + size = load_firmware("mainr5f0_0fwname", "mainr5f0_0loadaddr", + &loadaddr); + if (size <= 0) + goto err_load; + + /* remoteproc 2 is aliased for the needed remotecore */Assuming the big-arm core to boot is remoteproc 1 was reasonable, but there needs to be a better what than assuming the number for every other remote core.
Quoted 16 lines
arch/arm/mach-k3/j721e_init.c void release_resources_for_core_shutdown(void) · line 324
Quoted 13 lines
arch/arm/mach-k3/j721e_init.c +13
-0+ ret = rproc_load(2, loadaddr, size); + if (ret) { + printf("Firmware failed to start on rproc (%d)\n", ret); + goto err_load; + } + + ret = rproc_start(2); + if (ret) { + printf("Firmware init failed on rproc (%d)\n", ret); + goto err_load; + } + + printf("Remoteproc 2 started successfully\n");That's useful..
Quoted 3 lines
That is a print that tells everything went well with rproc 2. Otherwise one has to really find other ways to see if it succeeded or not.
I'm just a customer booting my board, I have no idea what a "Remoteproc 2" is. I'm saying make the message describe what has happened.
Andrew
Quoted 12 lines
Quoted 12 lines
Andrew
Quoted 8 lines
arch/arm/mach-k3/j721e_init.c +7
-0+ + return; + +err_load: + rproc_reset(2); +} +#endif
PATCH v3 2/10 arm: k3: Add support for loading non linux remote cores
Quoted 98 lines · Andrew F. Davis
Quoted 97 lines · keerthy
Quoted 52 lines · Andrew F. Davis
Quoted 51 lines · Keerthy
Add MAIN domain R5FSS0 remoteproc support from spl. This enables loading the elf firmware in SPL and starting the remotecore.
In order to start the core, there should be a file with path "
/lib/firmware/j7-main-r5f0_0-fw" under filesystem of respective boot mode.Signed-off-by Keerthy <[email protected]>Signed-off-by Lokesh Vutla <[email protected]>[Guard start_non_linux_remote_cores under CONFIG_FS_LOADER]Signed-off-by Andreas Dannenberg <[email protected]>--- arch/arm/mach-k3/common.c | 84 ++++++++++++++++++++++++++++++++--- arch/arm/mach-k3/common.h | 2 + arch/arm/mach-k3/j721e_init.c | 34 ++++++++++++++ 3 files changed, 115 insertions(+), 5 deletions(-)arch/arm/mach-k3/common.c +21
-0@@ -16,6 +16,10 @@ #include <asm/arch/sys_proto.h> #include <asm/hardware.h> #include <asm/io.h> +#include <fs_loader.h> +#include <fs.h> +#include <env.h> +#include <elf.h> struct ti_sci_handle *get_ti_sci_handle(void) {@@ -57,6 +61,74 @@ int early_console_init(void) #endif #ifdef CONFIG_SYS_K3_SPL_ATF + +void init_env (void ) +{ +#ifdef CONFIG_SPL_ENV_SUPPORT + char *part; + + env_init(); + env_load(); + switch (spl_boot_device()) { + case BOOT_DEVICE_MMC2: + part = env_get("bootpart"); + env_set("storage_interface", "mmc"); + env_set("fw_dev_part", part); + break; + case BOOT_DEVICE_SPI: + env_set("storage_interface", "ubi"); + env_set("fw_ubi_mtdpart", "UBI");Quoted 8 lines
arch/arm/mach-k3/common.c int early_console_init(void) · line 85
Quoted 5 lines
arch/arm/mach-k3/common.c +5
-0+ env_set("fw_ubi_volume", "UBI0"); + break; + default: + printf("%s from device %u not supported!\n", + __func__, spl_boot_device());This will print for almost every boot mode..
I can keep this under debug.
Quoted 30 lines
Quoted 15 lines
arch/arm/mach-k3/common.c +13
-0+ return; + } +#endif +} + +#ifdef CONFIG_FS_LOADER +int load_firmware (char *name_fw,char *name_loadaddr,u32 *loadaddr) +{ + struct udevice *fsdev; + char *name = NULL; + int size = 0; + + *loadaddr = 0;arch/arm/mach-k3/common.c int early_console_init(void) · line 107
Quoted 10 lines
arch/arm/mach-k3/common.c +9
-0+#ifdef CONFIG_SPL_ENV_SUPPORT + switch (spl_boot_device()) { + case BOOT_DEVICE_MMC2: + name = env_get(name_fw); + *loadaddr = env_get_hex(name_loadaddr, *loadaddr); + break; + default: + printf("Loading rproc fw image from device %u not supported!\n", + spl_boot_device());This whole thing seems very MMC specific, if early firmware loading is important it should work for all boot modes. Find a way to include it in the next boot stage FIT image (tispl.bin) so it works for all modes.
Quoted 5 lines
Quoted 2 lines
That was not NAKd. We are going with
fs_loaderapproach.When, where, link?
I had implemented that way internally. That was rejected for multiple right reasons:
1) SPL size would bloat based on the size of the firmware.
2) There are multiple cores that need to be loaded and hence adding all the firmwares under a fit can be really painful.
3) Changing firmware means building the tispl.bin again.
The FIT solution can not scale well.
- Keerthy
Quoted 159 lines
Quoted 58 lines
Quoted 49 lines
Quoted 49 lines
arch/arm/mach-k3/common.c +24
-0+ return 0; + } +#endif + if (!*loadaddr) + return 0; + + if (!uclass_get_device(UCLASS_FS_FIRMWARE_LOADER, 0, &fsdev)) { + size = request_firmware_into_buf(fsdev, name, (void *)*loadaddr, + 0, 0); + } + + return size; +} +#else +int load_firmware (char *name_fw,char *name_loadaddr,u32 *loadaddr) +{ + return 0; +} +#endif + +__weak void start_non_linux_remote_cores (void ) +{ +} + void __noreturn jump_to_image_no_args(struct spl_image_info *spl_image){
structti_sci_handle*ti_sci=get_ti_sci_handle();arch/arm/mach-k3/common.c +0
-0@@ -65,15 +137,17 @@ void __noreturn jump_to_image_no_args(struct spl_image_info *spl_image) /* Release all the exclusive devices held by SPL beforestarting ATF */
ti_sci->ops.dev_ops.release_exclusive_devices(ti_sci); + ret =rproc_init();
+ if (ret)
+panic("rproc failed to be initialized (%d)\n", ret);arch/arm/mach-k3/common.c +4
-0+ + init_env(); + start_non_linux_remote_cores(); + /** It is assumed that remoteproc device 1 is the corresponding * Cortex-A core which runs ATF. Make sure DT reflects the same. */ Quoted 8 lines
Quoted 5 lines
- ret =
rproc_dev_init(1);
- if (ret)
-panic("%s: ATF failed to initialize on rproc (%d)\n", __func__, - ret);
-Where did this code go?
Quoted 2 lines
rproc_inittakes care of that.Is that new behavior then? It should be it's own patch with a commit message about that.
Quoted 70 lines
Quoted 53 lines
Quoted 36 lines
ret =
rproc_load(1, spl_image->entry_point, 0x200); if (ret)
panic("%s: ATF failed to load on rproc (%d)\n",__func__,
ret);arch/arm/mach-k3/common.h +0
-0@@ -24,3 +24,5 @@ void setup_k3_mpu_regions(void); int early_console_init(void); void disable_linefill_optimization(void); void remove_fwl_configs(struct fwl_data *fwl_data, size_t
fwl_data_size);arch/arm/mach-k3/common.h +2
-0+void start_non_linux_remote_cores (void ); +int load_firmware (char *name_fw,char *name_loadaddr,u32 *loadaddr);arch/arm/mach-k3/j721e_init.c +4
-0@@ -18,6 +18,7 @@ #include <dm.h> #include <dm/uclass-internal.h> #include <dm/pinctrl.h> +#include <remoteproc.h> #ifdef CONFIG_SPL_BUILD #ifdef CONFIG_K3_LOAD_SYSFW@@ -295,3 +296,36 @@ void release_resources_for_core_shutdown(void) } } #endif + +#ifdef CONFIG_SYS_K3_SPL_ATF +void start_non_linux_remote_cores (void )arch/arm/mach-k3/j721e_init.c void release_resources_for_core_shutdown(void) · line 311
Quoted 10 lines
arch/arm/mach-k3/j721e_init.c +10
-0+{ + int size = 0, ret; + u32 loadaddr = 0; + + size = load_firmware("mainr5f0_0fwname", "mainr5f0_0loadaddr", + &loadaddr); + if (size <= 0) + goto err_load; + + /* remoteproc 2 is aliased for the needed remotecore */Assuming the big-arm core to boot is remoteproc 1 was reasonable, but there needs to be a better what than assuming the number for every other remote core.
Quoted 16 lines
arch/arm/mach-k3/j721e_init.c void release_resources_for_core_shutdown(void) · line 324
Quoted 13 lines
arch/arm/mach-k3/j721e_init.c +13
-0+ ret = rproc_load(2, loadaddr, size); + if (ret) { + printf("Firmware failed to start on rproc (%d)\n", ret); + goto err_load; + } + + ret = rproc_start(2); + if (ret) { + printf("Firmware init failed on rproc (%d)\n", ret); + goto err_load; + } + + printf("Remoteproc 2 started successfully\n");That's useful..
Quoted 3 lines
That is a print that tells everything went well with rproc 2. Otherwise one has to really find other ways to see if it succeeded or not.
I'm just a customer booting my board, I have no idea what a "Remoteproc 2" is. I'm saying make the message describe what has happened.
Andrew
Quoted 12 lines
Quoted 12 lines
Andrew
Quoted 8 lines
arch/arm/mach-k3/j721e_init.c +7
-0+ + return; + +err_load: + rproc_reset(2); +} +#endif
PATCH v3 2/10 arm: k3: Add support for loading non linux remote cores
Quoted 103 lines · Keerthy
Quoted 100 lines · Andrew F. Davis
Quoted 99 lines · keerthy
Quoted 53 lines · Andrew F. Davis
Quoted 52 lines · Keerthy
Add MAIN domain R5FSS0 remoteproc support from spl. This enables loading the elf firmware in SPL and starting the remotecore.
In order to start the core, there should be a file with path "
/lib/firmware/j7-main-r5f0_0-fw" under filesystem of respective boot mode.Signed-off-by Keerthy <[email protected]>Signed-off-by Lokesh Vutla <[email protected]>[Guard start_non_linux_remote_cores under CONFIG_FS_LOADER]Signed-off-by Andreas Dannenberg <[email protected]>---
arch/arm/mach-k3/common.c | 84
++++++++++++++++++++++++++++++++---
arch/arm/mach-k3/common.h | 2 +arch/arm/mach-k3/j721e_init.c| 34 ++++++++++++++3 files changed, 115 insertions(+), 5 deletions(-)arch/arm/mach-k3/common.c +21
-0@@ -16,6 +16,10 @@ #include <asm/arch/sys_proto.h> #include <asm/hardware.h> #include <asm/io.h> +#include <fs_loader.h> +#include <fs.h> +#include <env.h> +#include <elf.h> struct ti_sci_handle *get_ti_sci_handle(void) {@@ -57,6 +61,74 @@ int early_console_init(void) #endif #ifdef CONFIG_SYS_K3_SPL_ATF + +void init_env (void ) +{ +#ifdef CONFIG_SPL_ENV_SUPPORT + char *part; + + env_init(); + env_load(); + switch (spl_boot_device()) { + case BOOT_DEVICE_MMC2: + part = env_get("bootpart"); + env_set("storage_interface", "mmc"); + env_set("fw_dev_part", part); + break; + case BOOT_DEVICE_SPI: + env_set("storage_interface", "ubi"); + env_set("fw_ubi_mtdpart", "UBI");Quoted 8 lines
arch/arm/mach-k3/common.c int early_console_init(void) · line 85
Quoted 5 lines
arch/arm/mach-k3/common.c +5
-0+ env_set("fw_ubi_volume", "UBI0"); + break; + default: + printf("%s from device %u not supported!\n", + __func__, spl_boot_device());This will print for almost every boot mode..
I can keep this under debug.
Quoted 31 lines
Quoted 15 lines
arch/arm/mach-k3/common.c +13
-0+ return; + } +#endif +} + +#ifdef CONFIG_FS_LOADER +int load_firmware (char *name_fw,char *name_loadaddr,u32 *loadaddr) +{ + struct udevice *fsdev; + char *name = NULL; + int size = 0; + + *loadaddr = 0;arch/arm/mach-k3/common.c int early_console_init(void) · line 107
Quoted 10 lines
arch/arm/mach-k3/common.c +9
-0+#ifdef CONFIG_SPL_ENV_SUPPORT + switch (spl_boot_device()) { + case BOOT_DEVICE_MMC2: + name = env_get(name_fw); + *loadaddr = env_get_hex(name_loadaddr, *loadaddr); + break; + default: + printf("Loading rproc fw image from device %u not supported!\n", + spl_boot_device());This whole thing seems very MMC specific, if early firmware loading is important it should work for all boot modes. Find a way to include it in
the next boot stage FIT image (tispl.bin) so it works for all modes.
Quoted 9 lines
Quoted 5 lines
Quoted 2 lines
That was not NAKd. We are going with
fs_loaderapproach.When, where, link?
I had implemented that way internally. That was rejected for multiple right reasons:
I must have missed the internal reviews for this, anyway this is posted upstream so lets discus it here.
Quoted 1 line
1) SPL size would bloat based on the size of the firmware.
SPL size would remain constant, the combined FIT (tispl.bin) would grow, but that is okay as DRAM is enabled at this point so we have no hard memory constraints.
Quoted 2 lines
2) There are multiple cores that need to be loaded and hence adding all the firmwares under a fit can be really painful.
Bundling images is what FIT is for, are you saying the better solution is to hard-code each firmware starting like done here?
Quoted 2 lines
3) Changing firmware means building the tispl.bin again.
FIT images can be disassembled and reassembled with a script around tools/dumpimage.
SPL should be simple and load the one next stage.
Quoted 2 lines
The FIT solution can not scale well.
How does this current series scale at all? At least with FIT you can add more images without adding code for request_firmware(<hard-coded-firmware-name>) and rproc_load(<hard-coded-number>). That all could be encoded in the FIT data.
Andrew
Quoted 163 lines
- Keerthy
Quoted 162 lines
Quoted 60 lines
Quoted 51 lines
Quoted 51 lines
arch/arm/mach-k3/common.c +24
-0+ return 0; + } +#endif + if (!*loadaddr) + return 0; + + if (!uclass_get_device(UCLASS_FS_FIRMWARE_LOADER, 0, &fsdev)) { + size = request_firmware_into_buf(fsdev, name, (void *)*loadaddr, + 0, 0); + } + + return size; +} +#else +int load_firmware (char *name_fw,char *name_loadaddr,u32 *loadaddr) +{ + return 0; +} +#endif + +__weak void start_non_linux_remote_cores (void ) +{ +} +void
__noreturnjump_to_image_no_args(struct spl_image_info *spl_image)
{
structti_sci_handle*ti_sci=get_ti_sci_handle();arch/arm/mach-k3/common.c +0
-0@@ -65,15 +137,17 @@ void __noreturn jump_to_image_no_args(struct spl_image_info *spl_image) /* Release all the exclusive devices held by SPL beforestarting ATF */
ti_sci->ops.dev_ops.release_exclusive_devices(ti_sci); + ret =rproc_init();
+ if (ret)
+panic("rproc failed to be initialized (%d)\n", ret);arch/arm/mach-k3/common.c +4
-0+ + init_env(); + start_non_linux_remote_cores(); +/*
* It is assumed that remoteproc device 1 is the corresponding
* Cortex-A core which runs ATF. Make sure DT reflects the same.
*/
- ret =rproc_dev_init(1);Quoted 8 lines
Quoted 5 lines
- if (ret)
- panic("%s: ATF failed to initialize on rproc (%d)\n",__func__,
- ret);
-Where did this code go?
Quoted 2 lines
rproc_inittakes care of that.Is that new behavior then? It should be it's own patch with a commit message about that.
Quoted 71 lines
Quoted 54 lines
Quoted 36 lines
ret =
rproc_load(1, spl_image->entry_point, 0x200); if (ret)
panic("%s: ATF failed to load on rproc (%d)\n", __func__, ret);arch/arm/mach-k3/common.h +0
-0@@ -24,3 +24,5 @@ void setup_k3_mpu_regions(void); int early_console_init(void); void disable_linefill_optimization(void);void
remove_fwl_configs(struct fwl_data *fwl_data, size_t fwl_data_size);arch/arm/mach-k3/common.h +2
-0+void start_non_linux_remote_cores (void ); +int load_firmware (char *name_fw,char *name_loadaddr,u32 *loadaddr);arch/arm/mach-k3/j721e_init.c +4
-0@@ -18,6 +18,7 @@ #include <dm.h> #include <dm/uclass-internal.h> #include <dm/pinctrl.h> +#include <remoteproc.h> #ifdef CONFIG_SPL_BUILD #ifdef CONFIG_K3_LOAD_SYSFW@@ -295,3 +296,36 @@ void release_resources_for_core_shutdown(void) } } #endif + +#ifdef CONFIG_SYS_K3_SPL_ATF +void start_non_linux_remote_cores (void )arch/arm/mach-k3/j721e_init.c void release_resources_for_core_shutdown(void) · line 311
Quoted 10 lines
arch/arm/mach-k3/j721e_init.c +10
-0+{ + int size = 0, ret; + u32 loadaddr = 0; + + size = load_firmware("mainr5f0_0fwname", "mainr5f0_0loadaddr", + &loadaddr); + if (size <= 0) + goto err_load; + + /* remoteproc 2 is aliased for the needed remotecore */Assuming the big-arm core to boot is remoteproc 1 was reasonable, but there needs to be a better what than assuming the number for every other
remote core.Quoted 16 lines
arch/arm/mach-k3/j721e_init.c void release_resources_for_core_shutdown(void) · line 324
Quoted 13 lines
arch/arm/mach-k3/j721e_init.c +13
-0+ ret = rproc_load(2, loadaddr, size); + if (ret) { + printf("Firmware failed to start on rproc (%d)\n", ret); + goto err_load; + } + + ret = rproc_start(2); + if (ret) { + printf("Firmware init failed on rproc (%d)\n", ret); + goto err_load; + } + + printf("Remoteproc 2 started successfully\n");That's useful..
Quoted 3 lines
That is a print that tells everything went well with rproc 2. Otherwise one has to really find other ways to see if it succeeded or not.
I'm just a customer booting my board, I have no idea what a "Remoteproc 2" is. I'm saying make the message describe what has happened.
Andrew
Quoted 12 lines
Quoted 12 lines
Andrew
Quoted 8 lines
arch/arm/mach-k3/j721e_init.c +7
-0+ + return; + +err_load: + rproc_reset(2); +} +#endif
PATCH v3 2/10 arm: k3: Add support for loading non linux remote cores
Quoted 119 lines · Andrew F. Davis
Quoted 103 lines · Keerthy
Quoted 100 lines · Andrew F. Davis
Quoted 99 lines · keerthy
Quoted 53 lines · Andrew F. Davis
Quoted 52 lines · Keerthy
Add MAIN domain R5FSS0 remoteproc support from spl. This enables loading the elf firmware in SPL and starting the remotecore.
In order to start the core, there should be a file with path "
/lib/firmware/j7-main-r5f0_0-fw" under filesystem of respective boot mode.Signed-off-by Keerthy <[email protected]>Signed-off-by Lokesh Vutla <[email protected]>[Guard start_non_linux_remote_cores under CONFIG_FS_LOADER]Signed-off-by Andreas Dannenberg <[email protected]>--- arch/arm/mach-k3/common.c | 84 ++++++++++++++++++++++++++++++++--- arch/arm/mach-k3/common.h | 2 + arch/arm/mach-k3/j721e_init.c | 34 ++++++++++++++ 3 files changed, 115 insertions(+), 5 deletions(-)arch/arm/mach-k3/common.c +21
-0@@ -16,6 +16,10 @@ #include <asm/arch/sys_proto.h> #include <asm/hardware.h> #include <asm/io.h> +#include <fs_loader.h> +#include <fs.h> +#include <env.h> +#include <elf.h> struct ti_sci_handle *get_ti_sci_handle(void) {@@ -57,6 +61,74 @@ int early_console_init(void) #endif #ifdef CONFIG_SYS_K3_SPL_ATF + +void init_env (void ) +{ +#ifdef CONFIG_SPL_ENV_SUPPORT + char *part; + + env_init(); + env_load(); + switch (spl_boot_device()) { + case BOOT_DEVICE_MMC2: + part = env_get("bootpart"); + env_set("storage_interface", "mmc"); + env_set("fw_dev_part", part); + break; + case BOOT_DEVICE_SPI: + env_set("storage_interface", "ubi"); + env_set("fw_ubi_mtdpart", "UBI");Quoted 8 lines
arch/arm/mach-k3/common.c int early_console_init(void) · line 85
Quoted 5 lines
arch/arm/mach-k3/common.c +5
-0+ env_set("fw_ubi_volume", "UBI0"); + break; + default: + printf("%s from device %u not supported!\n", + __func__, spl_boot_device());This will print for almost every boot mode..
I can keep this under debug.
Quoted 31 lines
Quoted 15 lines
arch/arm/mach-k3/common.c +13
-0+ return; + } +#endif +} + +#ifdef CONFIG_FS_LOADER +int load_firmware (char *name_fw,char *name_loadaddr,u32 *loadaddr) +{ + struct udevice *fsdev; + char *name = NULL; + int size = 0; + + *loadaddr = 0;arch/arm/mach-k3/common.c int early_console_init(void) · line 107
Quoted 10 lines
arch/arm/mach-k3/common.c +9
-0+#ifdef CONFIG_SPL_ENV_SUPPORT + switch (spl_boot_device()) { + case BOOT_DEVICE_MMC2: + name = env_get(name_fw); + *loadaddr = env_get_hex(name_loadaddr, *loadaddr); + break; + default: + printf("Loading rproc fw image from device %u not supported!\n", + spl_boot_device());This whole thing seems very MMC specific, if early firmware loading is important it should work for all boot modes. Find a way to include it in
the next boot stage FIT image (tispl.bin) so it works for all modes.Quoted 9 lines
Quoted 5 lines
Quoted 2 lines
That was not NAKd. We are going with
fs_loaderapproach.When, where, link?
I had implemented that way internally. That was rejected for multiple right reasons:
I must have missed the internal reviews for this, anyway this is posted upstream so lets discus it here.
Quoted 6 lines
Quoted 1 line
1) SPL size would bloat based on the size of the firmware.
SPL size would remain constant, the combined FIT (tispl.bin) would grow, but that is okay as DRAM is enabled at this point so we have no hard memory constraints.
I meant the FIT image containing the SPL will bloat.
Quoted 8 lines
Quoted 4 lines
2) There are multiple cores that need to be loaded and hence adding all the firmwares under a fit can be really painful.
Bundling images is what FIT is for, are you saying the better solution is to hard-code each firmware starting like done here?
How many firmwares will you go on bundling. Firmwares are already kept in file system. It is a matter of reading them from there.
Quoted 8 lines
Quoted 4 lines
3) Changing firmware means building the tispl.bin again.
FIT images can be disassembled and reassembled with a script around
tools/dumpimage.
And you expect everyone to master that instead of looking at couple of aliases in DT to figure out which core corresponds to which ID?
Quoted 4 lines
SPL should be simple and load the one next stage.
Quoted 8 lines
Quoted 2 lines
The FIT solution can not scale well.
How does this current series scale at all? At least with FIT you can add more images without adding code for
request_firmware(<hard-coded-firmware-name>)andrproc_load(<hard-coded-number>). That all could be encoded in the FIT data.
I understand and as explained earlier i have even implemented that once before. fs_loader was meant to address the exact use case we are discussing about.
Even in u-boot remotecores are started/loaded by indices. Users need to know them. This is no different than that.
I am not convinced about FIT approach. I would let Lokesh take a call on this.
Thanks,
Keerthy
Quoted 167 lines
Andrew
Quoted 163 lines
- Keerthy
Quoted 162 lines
Quoted 60 lines
Quoted 51 lines
Quoted 51 lines
arch/arm/mach-k3/common.c +24
-0+ return 0; + } +#endif + if (!*loadaddr) + return 0; + + if (!uclass_get_device(UCLASS_FS_FIRMWARE_LOADER, 0, &fsdev)) { + size = request_firmware_into_buf(fsdev, name, (void *)*loadaddr, + 0, 0); + } + + return size; +} +#else +int load_firmware (char *name_fw,char *name_loadaddr,u32 *loadaddr) +{ + return 0; +} +#endif + +__weak void start_non_linux_remote_cores (void ) +{ +} + void __noreturn jump_to_image_no_args(struct spl_image_info *spl_image){
structti_sci_handle*ti_sci=get_ti_sci_handle();arch/arm/mach-k3/common.c +0
-0@@ -65,15 +137,17 @@ void __noreturn jump_to_image_no_args(struct spl_image_info *spl_image) /* Release all the exclusive devices held by SPL beforestarting ATF */
ti_sci->ops.dev_ops.release_exclusive_devices(ti_sci); + ret =rproc_init();
+ if (ret)
+panic("rproc failed to be initialized (%d)\n", ret);arch/arm/mach-k3/common.c +4
-0+ + init_env(); + start_non_linux_remote_cores(); + /** It is assumed that remoteproc device 1 is the corresponding * Cortex-A core which runs ATF. Make sure DT reflects the same.
*/
- ret =rproc_dev_init(1);Quoted 8 lines
Quoted 5 lines
- if (ret)
- panic("%s: ATF failed to initialize on rproc (%d)\n",__func__,
- ret);
-Where did this code go?
Quoted 2 lines
rproc_inittakes care of that.Is that new behavior then? It should be it's own patch with a commit message about that.
Quoted 71 lines
Quoted 54 lines
Quoted 36 lines
ret =
rproc_load(1, spl_image->entry_point, 0x200); if (ret)
panic("%s: ATF failed to load on rproc (%d)\n",__func__,
ret);arch/arm/mach-k3/common.h +0
-0@@ -24,3 +24,5 @@ void setup_k3_mpu_regions(void); int early_console_init(void); void disable_linefill_optimization(void); void remove_fwl_configs(struct fwl_data *fwl_data, size_t
fwl_data_size);arch/arm/mach-k3/common.h +2
-0+void start_non_linux_remote_cores (void ); +int load_firmware (char *name_fw,char *name_loadaddr,u32 *loadaddr);arch/arm/mach-k3/j721e_init.c +4
-0@@ -18,6 +18,7 @@ #include <dm.h> #include <dm/uclass-internal.h> #include <dm/pinctrl.h> +#include <remoteproc.h> #ifdef CONFIG_SPL_BUILD #ifdef CONFIG_K3_LOAD_SYSFW@@ -295,3 +296,36 @@ void release_resources_for_core_shutdown(void) } } #endif + +#ifdef CONFIG_SYS_K3_SPL_ATF +void start_non_linux_remote_cores (void )arch/arm/mach-k3/j721e_init.c void release_resources_for_core_shutdown(void) · line 311
Quoted 10 lines
arch/arm/mach-k3/j721e_init.c +10
-0+{ + int size = 0, ret; + u32 loadaddr = 0; + + size = load_firmware("mainr5f0_0fwname", "mainr5f0_0loadaddr", + &loadaddr); + if (size <= 0) + goto err_load; + + /* remoteproc 2 is aliased for the needed remotecore */Assuming the big-arm core to boot is remoteproc 1 was reasonable, but there needs to be a better what than assuming the number for every other
remote core.Quoted 16 lines
arch/arm/mach-k3/j721e_init.c void release_resources_for_core_shutdown(void) · line 324
Quoted 13 lines
arch/arm/mach-k3/j721e_init.c +13
-0+ ret = rproc_load(2, loadaddr, size); + if (ret) { + printf("Firmware failed to start on rproc (%d)\n", ret); + goto err_load; + } + + ret = rproc_start(2); + if (ret) { + printf("Firmware init failed on rproc (%d)\n", ret); + goto err_load; + } + + printf("Remoteproc 2 started successfully\n");That's useful..
Quoted 3 lines
That is a print that tells everything went well with rproc 2. Otherwise one has to really find other ways to see if it succeeded or not.
I'm just a customer booting my board, I have no idea what a "Remoteproc 2" is. I'm saying make the message describe what has happened.
Andrew
Quoted 12 lines
Quoted 12 lines
Andrew
Quoted 8 lines
arch/arm/mach-k3/j721e_init.c +7
-0+ + return; + +err_load: + rproc_reset(2); +} +#endif
PATCH v3 2/10 arm: k3: Add support for loading non linux remote cores
Quoted 124 lines · Keerthy
Quoted 121 lines · Andrew F. Davis
Quoted 105 lines · Keerthy
Quoted 102 lines · Andrew F. Davis
Quoted 101 lines · keerthy
Quoted 53 lines · Andrew F. Davis
Quoted 52 lines · Keerthy
Add MAIN domain R5FSS0 remoteproc support from spl. This enables loading the elf firmware in SPL and starting the remotecore.
In order to start the core, there should be a file with path "
/lib/firmware/j7-main-r5f0_0-fw" under filesystem of respective boot mode.Signed-off-by Keerthy <[email protected]>Signed-off-by Lokesh Vutla <[email protected]>[Guard start_non_linux_remote_cores under CONFIG_FS_LOADER]Signed-off-by Andreas Dannenberg <[email protected]>---
arch/arm/mach-k3/common.c | 84
++++++++++++++++++++++++++++++++---
arch/arm/mach-k3/common.h | 2 +arch/arm/mach-k3/j721e_init.c| 34 ++++++++++++++3 files changed, 115 insertions(+), 5 deletions(-)arch/arm/mach-k3/common.c +21
-0@@ -16,6 +16,10 @@ #include <asm/arch/sys_proto.h> #include <asm/hardware.h> #include <asm/io.h> +#include <fs_loader.h> +#include <fs.h> +#include <env.h> +#include <elf.h> struct ti_sci_handle *get_ti_sci_handle(void) {@@ -57,6 +61,74 @@ int early_console_init(void) #endif #ifdef CONFIG_SYS_K3_SPL_ATF + +void init_env (void ) +{ +#ifdef CONFIG_SPL_ENV_SUPPORT + char *part; + + env_init(); + env_load(); + switch (spl_boot_device()) { + case BOOT_DEVICE_MMC2: + part = env_get("bootpart"); + env_set("storage_interface", "mmc"); + env_set("fw_dev_part", part); + break; + case BOOT_DEVICE_SPI: + env_set("storage_interface", "ubi"); + env_set("fw_ubi_mtdpart", "UBI");Quoted 8 lines
arch/arm/mach-k3/common.c int early_console_init(void) · line 84
Quoted 5 lines
arch/arm/mach-k3/common.c +5
-0+ env_set("fw_ubi_volume", "UBI0"); + break; + default: + printf("%s from device %u not supported!\n", + __func__, spl_boot_device());This will print for almost every boot mode..
I can keep this under debug.
Quoted 33 lines
Quoted 16 lines
arch/arm/mach-k3/common.c +13
-0+ return; + } +#endif +} + +#ifdef CONFIG_FS_LOADER +int load_firmware (char *name_fw,char *name_loadaddr,u32 *loadaddr) +{ + struct udevice *fsdev; + char *name = NULL; + int size = 0; + + *loadaddr = 0;arch/arm/mach-k3/common.c int early_console_init(void) · line 108
Quoted 10 lines
arch/arm/mach-k3/common.c +9
-0+#ifdef CONFIG_SPL_ENV_SUPPORT + switch (spl_boot_device()) { + case BOOT_DEVICE_MMC2: + name = env_get(name_fw); + *loadaddr = env_get_hex(name_loadaddr, *loadaddr); + break; + default: + printf("Loading rproc fw image from device %u not supported!\n", + spl_boot_device());This whole thing seems very MMC specific, if early firmware loading is
important it should work for all boot modes. Find a way to include it in
the next boot stage FIT image (tispl.bin) so it works for all modes.Quoted 9 lines
Quoted 5 lines
Quoted 2 lines
That was not NAKd. We are going with
fs_loaderapproach.When, where, link?
I had implemented that way internally. That was rejected for multiple right reasons:
I must have missed the internal reviews for this, anyway this is posted upstream so lets discus it here.
Quoted 8 lines
Quoted 6 lines
Quoted 1 line
1) SPL size would bloat based on the size of the firmware.
SPL size would remain constant, the combined FIT (tispl.bin) would grow, but that is okay as DRAM is enabled at this point so we have no hard memory constraints.
I meant the FIT image containing the SPL will bloat.
Exactly what I said, and so size is not a huge deal.
Quoted 7 lines
Quoted 7 lines
Quoted 5 lines
2) There are multiple cores that need to be loaded and hence adding all the firmwares under a fit can be really painful.
Quoted 6 lines
Quoted 2 lines
Bundling images is what FIT is for, are you saying the better solution is to hard-code each firmware starting like done here?
How many firmwares will you go on bundling. Firmwares are already kept in file system. It is a matter of reading them from there.
If we are early booting them from SPL then they don't really need to be on the filesystem.
Quoted 6 lines
Quoted 6 lines
Quoted 4 lines
3) Changing firmware means building the tispl.bin again.
Quoted 6 lines
Quoted 2 lines
FIT images can be disassembled and reassembled with a script around
tools/dumpimage.And you expect everyone to master that instead of looking at couple of aliases in DT to figure out which core corresponds to which ID?
Your patches do more than add DT aliases to add a firmware image. I think you are responding to the wrong comment here, the ID part is below.
Quoted 18 lines
Quoted 8 lines
SPL should be simple and load the one next stage.
Quoted 2 lines
The FIT solution can not scale well.
Quoted 5 lines
How does this current series scale at all? At least with FIT you can add more images without adding code for
request_firmware(<hard-coded-firmware-name>)andrproc_load(<hard-coded-number>). That all could be encoded in the FIT data.I understand and as explained earlier i have even implemented that once before.
fs_loaderwas meant to address the exact use case we are discussing about.
Quoted 6 lines
Even in u-boot remotecores are started/loaded by indices. Users need to know them. This is no different than that.
I am not convinced about FIT approach. I would let Lokesh take a call on this.
Lokesh is not the whole U-Boot community, I get you two aligned internally on this, but I'd be much more interested in Tom or Simon's opinion here. I was doing the same thing when loading PMMC firmware for HS and was pushed to make a FIT friendly version, I'm glad that I did, it ended up much less hacky in the long run.
Andrew
Quoted 174 lines
Thanks,
KeerthyQuoted 172 lines
Andrew
Quoted 168 lines
- Keerthy
Quoted 167 lines
Quoted 62 lines
Quoted 53 lines
Quoted 53 lines
arch/arm/mach-k3/common.c +24
-0+ return 0; + } +#endif + if (!*loadaddr) + return 0; + + if (!uclass_get_device(UCLASS_FS_FIRMWARE_LOADER, 0, &fsdev)) { + size = request_firmware_into_buf(fsdev, name, (void *)*loadaddr, + 0, 0); + } + + return size; +} +#else +int load_firmware (char *name_fw,char *name_loadaddr,u32 *loadaddr) +{ + return 0; +} +#endif + +__weak void start_non_linux_remote_cores (void ) +{ +} +void
__noreturnjump_to_image_no_args(struct spl_image_info *spl_image)
{
structti_sci_handle*ti_sci=get_ti_sci_handle();arch/arm/mach-k3/common.c +0
-0@@ -65,15 +137,17 @@ void __noreturn jump_to_image_no_args(struct spl_image_info *spl_image) /* Release all the exclusive devices held by SPL beforestarting ATF */
ti_sci->ops.dev_ops.release_exclusive_devices(ti_sci); + ret =rproc_init();
+ if (ret)
+panic("rproc failed to be initialized (%d)\n", ret);arch/arm/mach-k3/common.c +4
-0+ + init_env(); + start_non_linux_remote_cores(); +/*
* It is assumed that remoteproc device 1 is the corresponding
* Cortex-A core which runs ATF. Make sure DT reflects the same.
*/
- ret =rproc_dev_init(1);Quoted 8 lines
Quoted 5 lines
- if (ret)
- panic("%s: ATF failed to initialize on rproc (%d)\n",__func__,
- ret);
-Where did this code go?
Quoted 2 lines
rproc_inittakes care of that.Is that new behavior then? It should be it's own patch with a commit message about that.
Quoted 73 lines
Quoted 56 lines
Quoted 38 lines
ret =
rproc_load(1, spl_image->entry_point, 0x200); if (ret)
panic("%s: ATF failed to load on rproc (%d)\n",__func__,
ret);arch/arm/mach-k3/common.h +0
-0@@ -24,3 +24,5 @@ void setup_k3_mpu_regions(void); int early_console_init(void); void disable_linefill_optimization(void);void
remove_fwl_configs(struct fwl_data *fwl_data, size_t fwl_data_size);arch/arm/mach-k3/common.h +2
-0+void start_non_linux_remote_cores (void ); +int load_firmware(char *name_fw, char *name_loadaddr, u32*loadaddr);
arch/arm/mach-k3/j721e_init.c +4
-0@@ -18,6 +18,7 @@ #include <dm.h> #include <dm/uclass-internal.h> #include <dm/pinctrl.h> +#include <remoteproc.h> #ifdef CONFIG_SPL_BUILD #ifdef CONFIG_K3_LOAD_SYSFW@@ -295,3 +296,36 @@ void release_resources_for_core_shutdown(void) } } #endif + +#ifdef CONFIG_SYS_K3_SPL_ATF +void start_non_linux_remote_cores (void )arch/arm/mach-k3/j721e_init.c void release_resources_for_core_shutdown(void) · line 311
Quoted 10 lines
arch/arm/mach-k3/j721e_init.c +10
-0+{ + int size = 0, ret; + u32 loadaddr = 0; + + size = load_firmware("mainr5f0_0fwname", "mainr5f0_0loadaddr", + &loadaddr); + if (size <= 0) + goto err_load; + + /* remoteproc 2 is aliased for the needed remotecore */Assuming the big-arm core to boot is remoteproc 1 was reasonable, but there needs to be a better what than assuming the number for every other
remote core.Quoted 16 lines
arch/arm/mach-k3/j721e_init.c void release_resources_for_core_shutdown(void) · line 324
Quoted 13 lines
arch/arm/mach-k3/j721e_init.c +13
-0+ ret = rproc_load(2, loadaddr, size); + if (ret) { + printf("Firmware failed to start on rproc (%d)\n", ret); + goto err_load; + } + + ret = rproc_start(2); + if (ret) { + printf("Firmware init failed on rproc (%d)\n", ret); + goto err_load; + } + + printf("Remoteproc 2 started successfully\n");That's useful..
Quoted 4 lines
That is a print that tells everything went well with rproc 2. Otherwise
one has to really find other ways to see if it succeeded or not.I'm just a customer booting my board, I have no idea what a "Remoteproc 2" is. I'm saying make the message describe what has happened.
Andrew
Quoted 12 lines
Quoted 12 lines
Andrew
Quoted 8 lines
arch/arm/mach-k3/j721e_init.c +7
-0+ + return; + +err_load: + rproc_reset(2); +} +#endif
PATCH v3 2/10 arm: k3: Add support for loading non linux remote cores
Quoted 201 lines · Andrew F. Davis
Quoted 124 lines · Keerthy
Quoted 121 lines · Andrew F. Davis
Quoted 105 lines · Keerthy
Quoted 102 lines · Andrew F. Davis
Quoted 101 lines · keerthy
Quoted 53 lines · Andrew F. Davis
Quoted 52 lines · Keerthy
Add MAIN domain R5FSS0 remoteproc support from spl. This enables loading the elf firmware in SPL and starting the remotecore.
In order to start the core, there should be a file with path "
/lib/firmware/j7-main-r5f0_0-fw" under filesystem of respective boot mode.Signed-off-by Keerthy <[email protected]>Signed-off-by Lokesh Vutla <[email protected]>[Guard start_non_linux_remote_cores under CONFIG_FS_LOADER]Signed-off-by Andreas Dannenberg <[email protected]>--- arch/arm/mach-k3/common.c | 84 ++++++++++++++++++++++++++++++++--- arch/arm/mach-k3/common.h | 2 + arch/arm/mach-k3/j721e_init.c | 34 ++++++++++++++ 3 files changed, 115 insertions(+), 5 deletions(-)arch/arm/mach-k3/common.c +21
-0@@ -16,6 +16,10 @@ #include <asm/arch/sys_proto.h> #include <asm/hardware.h> #include <asm/io.h> +#include <fs_loader.h> +#include <fs.h> +#include <env.h> +#include <elf.h> struct ti_sci_handle *get_ti_sci_handle(void) {@@ -57,6 +61,74 @@ int early_console_init(void) #endif #ifdef CONFIG_SYS_K3_SPL_ATF + +void init_env (void ) +{ +#ifdef CONFIG_SPL_ENV_SUPPORT + char *part; + + env_init(); + env_load(); + switch (spl_boot_device()) { + case BOOT_DEVICE_MMC2: + part = env_get("bootpart"); + env_set("storage_interface", "mmc"); + env_set("fw_dev_part", part); + break; + case BOOT_DEVICE_SPI: + env_set("storage_interface", "ubi"); + env_set("fw_ubi_mtdpart", "UBI");Quoted 8 lines
arch/arm/mach-k3/common.c int early_console_init(void) · line 84
Quoted 5 lines
arch/arm/mach-k3/common.c +5
-0+ env_set("fw_ubi_volume", "UBI0"); + break; + default: + printf("%s from device %u not supported!\n", + __func__, spl_boot_device());This will print for almost every boot mode..
I can keep this under debug.
Quoted 33 lines
Quoted 16 lines
arch/arm/mach-k3/common.c +13
-0+ return; + } +#endif +} + +#ifdef CONFIG_FS_LOADER +int load_firmware (char *name_fw,char *name_loadaddr,u32 *loadaddr) +{ + struct udevice *fsdev; + char *name = NULL; + int size = 0; + + *loadaddr = 0;arch/arm/mach-k3/common.c int early_console_init(void) · line 108
Quoted 10 lines
arch/arm/mach-k3/common.c +9
-0+#ifdef CONFIG_SPL_ENV_SUPPORT + switch (spl_boot_device()) { + case BOOT_DEVICE_MMC2: + name = env_get(name_fw); + *loadaddr = env_get_hex(name_loadaddr, *loadaddr); + break; + default: + printf("Loading rproc fw image from device %u not supported!\n", + spl_boot_device());This whole thing seems very MMC specific, if early firmware loading is
important it should work for all boot modes. Find a way to include it in
the next boot stage FIT image (tispl.bin) so it works for all modes.Quoted 9 lines
Quoted 5 lines
Quoted 2 lines
That was not NAKd. We are going with
fs_loaderapproach.When, where, link?
I had implemented that way internally. That was rejected for multiple right reasons:
I must have missed the internal reviews for this, anyway this is posted upstream so lets discus it here.
Quoted 8 lines
Quoted 6 lines
Quoted 1 line
1) SPL size would bloat based on the size of the firmware.
SPL size would remain constant, the combined FIT (tispl.bin) would grow, but that is okay as DRAM is enabled at this point so we have no hard memory constraints.
I meant the FIT image containing the SPL will bloat.
Exactly what I said, and so size is not a huge deal.
Quoted 7 lines
Quoted 7 lines
Quoted 5 lines
2) There are multiple cores that need to be loaded and hence adding all the firmwares under a fit can be really painful.
Quoted 6 lines
Quoted 2 lines
Bundling images is what FIT is for, are you saying the better solution is to hard-code each firmware starting like done here?
How many firmwares will you go on bundling. Firmwares are already kept in file system. It is a matter of reading them from there.
If we are early booting them from SPL then they don't really need to be on the filesystem.
Quoted 6 lines
Quoted 6 lines
Quoted 4 lines
3) Changing firmware means building the tispl.bin again.
Quoted 6 lines
Quoted 2 lines
FIT images can be disassembled and reassembled with a script around
tools/dumpimage.And you expect everyone to master that instead of looking at couple of aliases in DT to figure out which core corresponds to which ID?
Your patches do more than add DT aliases to add a firmware image. I think you are responding to the wrong comment here, the ID part is below.
Quoted 18 lines
Quoted 8 lines
SPL should be simple and load the one next stage.
Quoted 2 lines
The FIT solution can not scale well.
Quoted 5 lines
How does this current series scale at all? At least with FIT you can add more images without adding code for
request_firmware(<hard-coded-firmware-name>)andrproc_load(<hard-coded-number>). That all could be encoded in the FIT data.I understand and as explained earlier i have even implemented that once before.
fs_loaderwas meant to address the exact use case we are discussing about.Quoted 6 lines
Even in u-boot remotecores are started/loaded by indices. Users need to know them. This is no different than that.
I am not convinced about FIT approach. I would let Lokesh take a call on this.
Quoted 5 lines
Lokesh is not the whole U-Boot community, I get you two aligned internally on this, but I'd be much more interested in Tom or Simon's opinion here. I was doing the same thing when loading PMMC firmware for HS and was pushed to make a FIT friendly version, I'm glad that I did, it ended up much less hacky in the long run.
I would love to hear Tom & simon's opinions. Before we jump on to PMMC fimrware example. I believe there is one such firmware that gets appended to the FIT image. In case of remoteprocs there can be multiple such firmware. File system is the most generic and scaleble place to access firmware.
Lokesh/Sekhar/Tero,
You can share your viewpoints as well.
Thanks,
Keerthy
Quoted 178 lines
Andrew
Quoted 174 lines
Thanks,
KeerthyQuoted 172 lines
Andrew
Quoted 168 lines
- Keerthy
Quoted 167 lines
Quoted 62 lines
Quoted 53 lines
Quoted 53 lines
arch/arm/mach-k3/common.c +24
-0+ return 0; + } +#endif + if (!*loadaddr) + return 0; + + if (!uclass_get_device(UCLASS_FS_FIRMWARE_LOADER, 0, &fsdev)) { + size = request_firmware_into_buf(fsdev, name, (void *)*loadaddr, + 0, 0); + } + + return size; +} +#else +int load_firmware (char *name_fw,char *name_loadaddr,u32 *loadaddr) +{ + return 0; +} +#endif + +__weak void start_non_linux_remote_cores (void ) +{ +} +void
__noreturnjump_to_image_no_args(structspl_image_info*spl_image)
{
structti_sci_handle*ti_sci=get_ti_sci_handle();arch/arm/mach-k3/common.c +0
-0@@ -65,15 +137,17 @@ void __noreturn jump_to_image_no_args(struct spl_image_info *spl_image) /* Release all the exclusive devices held by SPL beforestarting ATF */
ti_sci->ops.dev_ops.release_exclusive_devices(ti_sci); + ret =rproc_init();
+ if (ret)
+panic("rproc failed to be initialized (%d)\n", ret);arch/arm/mach-k3/common.c +4
-0+ + init_env(); + start_non_linux_remote_cores(); + /** It is assumed that remoteproc device 1 is the corresponding
* Cortex-A core which runs ATF. Make sure DT reflects the
same.
*/
- ret =rproc_dev_init(1);Quoted 8 lines
Quoted 5 lines
- if (ret)
- panic("%s: ATF failed to initialize on rproc (%d)\n",__func__,
- ret);
-Where did this code go?
Quoted 2 lines
rproc_inittakes care of that.Is that new behavior then? It should be it's own patch with a commit message about that.
Quoted 73 lines
Quoted 56 lines
Quoted 38 lines
ret =
rproc_load(1, spl_image->entry_point, 0x200); if (ret)
panic("%s: ATF failed to load on rproc (%d)\n",__func__,
ret);arch/arm/mach-k3/common.h +0
-0@@ -24,3 +24,5 @@ void setup_k3_mpu_regions(void); int early_console_init(void); void disable_linefill_optimization(void); void remove_fwl_configs(struct fwl_data *fwl_data, size_t
fwl_data_size);arch/arm/mach-k3/common.h +2
-0+void start_non_linux_remote_cores (void ); +int load_firmware(char *name_fw, char *name_loadaddr, u32*loadaddr);
arch/arm/mach-k3/j721e_init.c +4
-0@@ -18,6 +18,7 @@ #include <dm.h> #include <dm/uclass-internal.h> #include <dm/pinctrl.h> +#include <remoteproc.h> #ifdef CONFIG_SPL_BUILD #ifdef CONFIG_K3_LOAD_SYSFW@@ -295,3 +296,36 @@ void release_resources_for_core_shutdown(void) } } #endif + +#ifdef CONFIG_SYS_K3_SPL_ATF +void start_non_linux_remote_cores (void )arch/arm/mach-k3/j721e_init.c void release_resources_for_core_shutdown(void) · line 311
Quoted 10 lines
arch/arm/mach-k3/j721e_init.c +10
-0+{ + int size = 0, ret; + u32 loadaddr = 0; + + size = load_firmware("mainr5f0_0fwname", "mainr5f0_0loadaddr", + &loadaddr); + if (size <= 0) + goto err_load; + + /* remoteproc 2 is aliased for the needed remotecore */Assuming the big-arm core to boot is remoteproc 1 was reasonable, but there needs to be a better what than assuming the number for every other
remote core.Quoted 16 lines
arch/arm/mach-k3/j721e_init.c void release_resources_for_core_shutdown(void) · line 324
Quoted 13 lines
arch/arm/mach-k3/j721e_init.c +13
-0+ ret = rproc_load(2, loadaddr, size); + if (ret) { + printf("Firmware failed to start on rproc (%d)\n", ret); + goto err_load; + } + + ret = rproc_start(2); + if (ret) { + printf("Firmware init failed on rproc (%d)\n", ret); + goto err_load; + } + + printf("Remoteproc 2 started successfully\n");That's useful..
Quoted 4 lines
That is a print that tells everything went well with rproc 2. Otherwise
one has to really find other ways to see if it succeeded or not.I'm just a customer booting my board, I have no idea what a "Remoteproc 2" is. I'm saying make the message describe what has happened.
Andrew
Quoted 12 lines
Quoted 12 lines
Andrew
Quoted 8 lines
arch/arm/mach-k3/j721e_init.c +7
-0+ + return; + +err_load: + rproc_reset(2); +} +#endif
PATCH v3 2/10 arm: k3: Add support for loading non linux remote cores
Quoted 220 lines · Keerthy
Quoted 205 lines · Andrew F. Davis
Quoted 128 lines · Keerthy
Quoted 125 lines · Andrew F. Davis
Quoted 106 lines · Keerthy
Quoted 103 lines · Andrew F. Davis
Quoted 102 lines · keerthy
Quoted 53 lines · Andrew F. Davis
Quoted 52 lines · Keerthy
Add MAIN domain R5FSS0 remoteproc support from spl. This enables loading the elf firmware in SPL and starting the remotecore.
In order to start the core, there should be a file with path "
/lib/firmware/j7-main-r5f0_0-fw" under filesystem of respective boot mode.Signed-off-by Keerthy <[email protected]>Signed-off-by Lokesh Vutla <[email protected]>[Guard start_non_linux_remote_cores under CONFIG_FS_LOADER]Signed-off-by Andreas Dannenberg <[email protected]>---
arch/arm/mach-k3/common.c | 84
++++++++++++++++++++++++++++++++---
arch/arm/mach-k3/common.h | 2 +arch/arm/mach-k3/j721e_init.c| 34 ++++++++++++++3 files changed, 115 insertions(+), 5 deletions(-)arch/arm/mach-k3/common.c +21
-0@@ -16,6 +16,10 @@ #include <asm/arch/sys_proto.h> #include <asm/hardware.h> #include <asm/io.h> +#include <fs_loader.h> +#include <fs.h> +#include <env.h> +#include <elf.h> struct ti_sci_handle *get_ti_sci_handle(void) {@@ -57,6 +61,74 @@ int early_console_init(void) #endif #ifdef CONFIG_SYS_K3_SPL_ATF + +void init_env (void ) +{ +#ifdef CONFIG_SPL_ENV_SUPPORT + char *part; + + env_init(); + env_load(); + switch (spl_boot_device()) { + case BOOT_DEVICE_MMC2: + part = env_get("bootpart"); + env_set("storage_interface", "mmc"); + env_set("fw_dev_part", part); + break; + case BOOT_DEVICE_SPI: + env_set("storage_interface", "ubi"); + env_set("fw_ubi_mtdpart", "UBI");Quoted 8 lines
arch/arm/mach-k3/common.c int early_console_init(void) · line 84
Quoted 5 lines
arch/arm/mach-k3/common.c +5
-0+ env_set("fw_ubi_volume", "UBI0"); + break; + default: + printf("%s from device %u not supported!\n", + __func__, spl_boot_device());This will print for almost every boot mode..
I can keep this under debug.
Quoted 34 lines
Quoted 16 lines
arch/arm/mach-k3/common.c +13
-0+ return; + } +#endif +} + +#ifdef CONFIG_FS_LOADER +int load_firmware (char *name_fw,char *name_loadaddr,u32 *loadaddr) +{ + struct udevice *fsdev; + char *name = NULL; + int size = 0; + + *loadaddr = 0;arch/arm/mach-k3/common.c int early_console_init(void) · line 108
Quoted 10 lines
arch/arm/mach-k3/common.c +9
-0+#ifdef CONFIG_SPL_ENV_SUPPORT + switch (spl_boot_device()) { + case BOOT_DEVICE_MMC2: + name = env_get(name_fw); + *loadaddr = env_get_hex(name_loadaddr, *loadaddr); + break; + default: + printf("Loading rproc fw image from device %u not supported!\n", + spl_boot_device());This whole thing seems very MMC specific, if early firmware loading is
important it should work for all boot modes. Find a way to include it in
the next boot stage FIT image (tispl.bin) so it works for all modes.Quoted 9 lines
Quoted 5 lines
Quoted 2 lines
That was not NAKd. We are going with
fs_loaderapproach.When, where, link?
I had implemented that way internally. That was rejected for multiple right reasons:
I must have missed the internal reviews for this, anyway this is posted upstream so lets discus it here.
Quoted 1 line
1) SPL size would bloat based on the size of the firmware.
Quoted 6 lines
Quoted 4 lines
SPL size would remain constant, the combined FIT (tispl.bin) would grow,
but that is okay as DRAM is enabled at this point so we have no hard memory constraints.I meant the FIT image containing the SPL will bloat.
Exactly what I said, and so size is not a huge deal.
Quoted 8 lines
Quoted 8 lines
Quoted 6 lines
2) There are multiple cores that need to be loaded and hence adding all
the firmwares under a fit can be really painful.Quoted 6 lines
Quoted 2 lines
Bundling images is what FIT is for, are you saying the better solution is to hard-code each firmware starting like done here?
How many firmwares will you go on bundling. Firmwares are already kept in file system. It is a matter of reading them from there.
If we are early booting them from SPL then they don't really need to be on the filesystem.
Quoted 6 lines
Quoted 6 lines
Quoted 4 lines
3) Changing firmware means building the tispl.bin again.
Quoted 6 lines
Quoted 2 lines
FIT images can be disassembled and reassembled with a script around
tools/dumpimage.And you expect everyone to master that instead of looking at couple of aliases in DT to figure out which core corresponds to which ID?
Your patches do more than add DT aliases to add a firmware image. I think you are responding to the wrong comment here, the ID part is below.
Quoted 19 lines
Quoted 8 lines
SPL should be simple and load the one next stage.
Quoted 2 lines
The FIT solution can not scale well.
Quoted 6 lines
How does this current series scale at all? At least with FIT you can add
more images without adding code forrequest_firmware(<hard-coded-firmware-name>)andrproc_load(<hard-coded-number>). That all could be encoded in the FIT data.I understand and as explained earlier i have even implemented that once before.
fs_loaderwas meant to address the exact use case we are discussing about.Quoted 6 lines
Even in u-boot remotecores are started/loaded by indices. Users need to know them. This is no different than that.
I am not convinced about FIT approach. I would let Lokesh take a call on this.
Quoted 5 lines
Lokesh is not the whole U-Boot community, I get you two aligned internally on this, but I'd be much more interested in Tom or Simon's opinion here. I was doing the same thing when loading PMMC firmware for HS and was pushed to make a FIT friendly version, I'm glad that I did, it ended up much less hacky in the long run.
I would love to hear Tom & simon's opinions. Before we jump on to PMMC fimrware example. I believe there is one such firmware that gets appended to the FIT image. In case of remoteprocs there can be multiple such firmware. File system is the most generic and scaleble place to access firmware.
Quoted 3 lines
Lokesh/Sekhar/Tero,
You can share your viewpoints as well.
I think the initial reason to split the firmwares away from the FIT was that we didn't want to have ROM load everything for us, and so that SPL would come up earlier. Couple of reasons behind that, the size of the FIT image directly transforms into time spent loading it, and also ROM might not be loading things at optimal speed... There are couple of critical firmwares that need to be booted up as soon as possible.
-Tero
Quoted 179 lines
Thanks,
KeerthyQuoted 176 lines
Andrew
Quoted 172 lines
Thanks,
KeerthyQuoted 170 lines
Andrew
Quoted 166 lines
- Keerthy
Quoted 165 lines
Quoted 64 lines
Quoted 55 lines
Quoted 55 lines
arch/arm/mach-k3/common.c +15
-0+ return 0; + } +#endif + if (!*loadaddr) + return 0; + + if (!uclass_get_device(UCLASS_FS_FIRMWARE_LOADER, 0, &fsdev)) { + size = request_firmware_into_buf(fsdev, name, (void *)*loadaddr, + 0, 0); + } + + return size; +} +#else +int load_firmware(char *name_fw, char *name_loadaddr, u32*loadaddr)
arch/arm/mach-k3/common.c +9
-0+{ + return 0; +} +#endif + +__weak void start_non_linux_remote_cores (void ) +{ +} +void
__noreturnjump_to_image_no_args(struct spl_image_info *spl_image)
{
structti_sci_handle*ti_sci=get_ti_sci_handle();arch/arm/mach-k3/common.c +0
-0@@ -65,15 +137,17 @@ void __noreturn jump_to_image_no_args(struct spl_image_info *spl_image) /* Release all the exclusive devices held by SPL beforestarting ATF */
ti_sci->ops.dev_ops.release_exclusive_devices(ti_sci); + ret =rproc_init();
+ if (ret)
+panic("rproc failed to be initialized (%d)\n", ret);arch/arm/mach-k3/common.c +4
-0+ + init_env(); + start_non_linux_remote_cores(); +/*
* It is assumed that remoteproc device 1 is the corresponding
* Cortex-A core which runs ATF. Make sure DT reflects the
same.
*/
- ret =rproc_dev_init(1);Quoted 8 lines
Quoted 5 lines
- if (ret)
- panic("%s: ATF failed to initialize on rproc (%d)\n",__func__,
- ret);
-Where did this code go?
Quoted 2 lines
rproc_inittakes care of that.Is that new behavior then? It should be it's own patch with a commit message about that.
Quoted 76 lines
Quoted 59 lines
Quoted 44 lines
ret =
rproc_load(1, spl_image->entry_point, 0x200); if (ret)
panic("%s: ATF failed to load on rproc (%d)\n",__func__,
ret);arch/arm/mach-k3/common.h +0
-0@@ -24,3 +24,5 @@ void setup_k3_mpu_regions(void); int early_console_init(void); void disable_linefill_optimization(void);void
remove_fwl_configs(struct fwl_data *fwl_data, size_t fwl_data_size);arch/arm/mach-k3/common.h +2
-0+void start_non_linux_remote_cores (void ); +int load_firmware(char *name_fw, char *name_loadaddr, u32*loadaddr);
arch/arm/mach-k3/j721e_init.c +1
-0@@ -18,6 +18,7 @@ #include <dm.h> #include <dm/uclass-internal.h> #include <dm/pinctrl.h> +#include <remoteproc.h> #ifdef CONFIG_SPL_BUILD #ifdef CONFIG_K3_LOAD_SYSFW@@ -295,3 +296,36 @@ voidrelease_resources_for_core_shutdown (void ) } }#endif
arch/arm/mach-k3/j721e_init.c +8
-0+ +#ifdef CONFIG_SYS_K3_SPL_ATF +void start_non_linux_remote_cores (void ) +{ + int size = 0, ret; + u32 loadaddr = 0; + + size = load_firmware("mainr5f0_0fwname",Quoted 6 lines
"
mainr5f0_0loadaddr",
+ &loadaddr);
+ if (size <= 0)
+ gotoerr_load;
+
+ /* remoteproc 2 is aliased for the needed remotecore */Assuming the big-arm core to boot is remoteproc 1 was reasonable, but
there needs to be a better what than assuming the number for every other
remote core.Quoted 16 lines
arch/arm/mach-k3/j721e_init.c
Quoted 13 lines
+ ret =
rproc_load(2, loadaddr, size);
+ if (ret) {
+printf("Firmware failed to start on rproc (%d)\n", ret); + gotoerr_load;
+ }arch/arm/mach-k3/j721e_init.c +8
-0+ + ret = rproc_start(2); + if (ret) { + printf("Firmware init failed on rproc (%d)\n", ret); + goto err_load; + } + + printf("Remoteproc 2 started successfully\n");That's useful..
Quoted 4 lines
That is a print that tells everything went well with rproc 2. Otherwise
one has to really find other ways to see if it succeeded or not.I'm just a customer booting my board, I have no idea what a "Remoteproc
2" is. I'm saying make the message describe what has happened.Andrew
Quoted 4 lines
Quoted 4 lines
Andrew
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
arch/arm/mach-k3/j721e_init.c
Quoted 8 lines
arch/arm/mach-k3/j721e_init.c +7
-0+ + return; + +err_load: + rproc_reset(2); +} +#endif
--
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
PATCH v3 2/10 arm: k3: Add support for loading non linux remote cores
Quoted 227 lines · Tero Kristo
Quoted 226 lines · Keerthy
Quoted 209 lines · Andrew F. Davis
Quoted 130 lines · Keerthy
Quoted 127 lines · Andrew F. Davis
Quoted 107 lines · Keerthy
Quoted 104 lines · Andrew F. Davis
Quoted 103 lines · keerthy
Quoted 54 lines · Andrew F. Davis
Quoted 53 lines · Keerthy
Add MAIN domain R5FSS0 remoteproc support from spl. This enables loading the elf firmware in SPL and starting the remotecore.
In order to start the core, there should be a file with path "
/lib/firmware/j7-main-r5f0_0-fw" under filesystem of respective boot mode.Signed-off-by Keerthy <[email protected]>Signed-off-by Lokesh Vutla <[email protected]>[Guard start_non_linux_remote_cores under CONFIG_FS_LOADER]Signed-off-by Andreas Dannenberg <[email protected]>---
arch/arm/mach-k3/common.c | 84
++++++++++++++++++++++++++++++++---
arch/arm/mach-k3/common.h | 2 +arch/arm/mach-k3/j721e_init.c| 34 ++++++++++++++3 files changed, 115 insertions(+), 5 deletions(-)arch/arm/mach-k3/common.c +21
-0@@ -16,6 +16,10 @@ #include <asm/arch/sys_proto.h> #include <asm/hardware.h> #include <asm/io.h> +#include <fs_loader.h> +#include <fs.h> +#include <env.h> +#include <elf.h> struct ti_sci_handle *get_ti_sci_handle(void) {@@ -57,6 +61,74 @@ int early_console_init(void) #endif #ifdef CONFIG_SYS_K3_SPL_ATF + +void init_env (void ) +{ +#ifdef CONFIG_SPL_ENV_SUPPORT + char *part; + + env_init(); + env_load(); + switch (spl_boot_device()) { + case BOOT_DEVICE_MMC2: + part = env_get("bootpart"); + env_set("storage_interface", "mmc"); + env_set("fw_dev_part", part); + break; + case BOOT_DEVICE_SPI: + env_set("storage_interface", "ubi"); + env_set("fw_ubi_mtdpart", "UBI");Quoted 8 lines
arch/arm/mach-k3/common.c int early_console_init(void) · line 84
Quoted 5 lines
arch/arm/mach-k3/common.c +5
-0+ env_set("fw_ubi_volume", "UBI0"); + break; + default: + printf("%s from device %u not supported!\n", + __func__, spl_boot_device());This will print for almost every boot mode..
I can keep this under debug.
Quoted 34 lines
Quoted 16 lines
arch/arm/mach-k3/common.c +13
-0+ return; + } +#endif +} + +#ifdef CONFIG_FS_LOADER +int load_firmware (char *name_fw,char *name_loadaddr,u32 *loadaddr) +{ + struct udevice *fsdev; + char *name = NULL; + int size = 0; + + *loadaddr = 0;arch/arm/mach-k3/common.c int early_console_init(void) · line 108
Quoted 10 lines
arch/arm/mach-k3/common.c +9
-0+#ifdef CONFIG_SPL_ENV_SUPPORT + switch (spl_boot_device()) { + case BOOT_DEVICE_MMC2: + name = env_get(name_fw); + *loadaddr = env_get_hex(name_loadaddr, *loadaddr); + break; + default: + printf("Loading rproc fw image from device %u not supported!\n", + spl_boot_device());This whole thing seems very MMC specific, if early firmware loading is
important it should work for all boot modes. Find a way to include it in
the next boot stage FIT image (tispl.bin) so it works for all modes.Quoted 9 lines
Quoted 5 lines
Quoted 2 lines
That was not NAKd. We are going with
fs_loaderapproach.When, where, link?
I had implemented that way internally. That was rejected for multiple right reasons:
I must have missed the internal reviews for this, anyway this is posted
upstream so lets discus it here.Quoted 1 line
1) SPL size would bloat based on the size of the firmware.
Quoted 6 lines
Quoted 4 lines
SPL size would remain constant, the combined FIT (tispl.bin) would grow,
but that is okay as DRAM is enabled at this point so we have no hard memory constraints.I meant the FIT image containing the SPL will bloat.
Exactly what I said, and so size is not a huge deal.
Quoted 8 lines
Quoted 8 lines
Quoted 6 lines
2) There are multiple cores that need to be loaded and hence adding all
the firmwares under a fit can be really painful.Quoted 6 lines
Quoted 2 lines
Bundling images is what FIT is for, are you saying the better solution is to hard-code each firmware starting like done here?
How many firmwares will you go on bundling. Firmwares are already kept in file system. It is a matter of reading them from there.
If we are early booting them from SPL then they don't really need to be on the filesystem.
Quoted 6 lines
Quoted 6 lines
Quoted 4 lines
3) Changing firmware means building the tispl.bin again.
Quoted 6 lines
Quoted 2 lines
FIT images can be disassembled and reassembled with a script around
tools/dumpimage.And you expect everyone to master that instead of looking at couple of aliases in DT to figure out which core corresponds to which ID?
Your patches do more than add DT aliases to add a firmware image. I think you are responding to the wrong comment here, the ID part is below.
Quoted 19 lines
Quoted 8 lines
SPL should be simple and load the one next stage.
Quoted 2 lines
The FIT solution can not scale well.
Quoted 6 lines
How does this current series scale at all? At least with FIT you can add
more images without adding code forrequest_firmware(<hard-coded-firmware-name>)andrproc_load(<hard-coded-number>). That all could be encoded in the FIT data.I understand and as explained earlier i have even implemented that once before.
fs_loaderwas meant to address the exact use case we are discussing about.Quoted 7 lines
Even in u-boot remotecores are started/loaded by indices. Users need to know them. This is no different than that.
I am not convinced about FIT approach. I would let Lokesh take a call on
this.Quoted 5 lines
Lokesh is not the whole U-Boot community, I get you two aligned internally on this, but I'd be much more interested in Tom or Simon's opinion here. I was doing the same thing when loading PMMC firmware for HS and was pushed to make a FIT friendly version, I'm glad that I did, it ended up much less hacky in the long run.
I would love to hear Tom & simon's opinions. Before we jump on to PMMC fimrware example. I believe there is one such firmware that gets appended to the FIT image. In case of remoteprocs there can be multiple such firmware. File system is the most generic and scaleble place to access firmware.
Lokesh/Sekhar/Tero,
Quoted 9 lines
Quoted 1 line
You can share your viewpoints as well.
I think the initial reason to split the firmwares away from the FIT was that we didn't want to have ROM load everything for us, and so that SPL would come up earlier. Couple of reasons behind that, the size of the FIT image directly transforms into time spent loading it, and also ROM might not be loading things at optimal speed... There are couple of critical firmwares that need to be booted up as soon as possible.
The firmware is not going into the ROM loaded SPL (tiboot3.bin) I'm saying the A53/A72 SPL (tispl.bin) image (load done by R5 SPL). The R5 SPL is loading the firmware in either case so no time penalty based on how the firmware is packaged.
Andrew
Quoted 194 lines
-Tero
Quoted 188 lines
Thanks,
KeerthyQuoted 185 lines
Andrew
Quoted 181 lines
Thanks,
KeerthyQuoted 179 lines
Andrew
Quoted 175 lines
- Keerthy
Quoted 174 lines
Quoted 64 lines
Quoted 55 lines
Quoted 55 lines
arch/arm/mach-k3/common.c +15
-0+ return 0; + } +#endif + if (!*loadaddr) + return 0; + + if (!uclass_get_device(UCLASS_FS_FIRMWARE_LOADER, 0, &fsdev)) { + size = request_firmware_into_buf(fsdev, name, (void *)*loadaddr, + 0, 0); + } + + return size; +} +#else +int load_firmware(char *name_fw, char *name_loadaddr, u32*loadaddr)
arch/arm/mach-k3/common.c +9
-0+{ + return 0; +} +#endif + +__weak void start_non_linux_remote_cores (void ) +{ +} +void
__noreturnjump_to_image_no_args(struct spl_image_info *spl_image)
{
structti_sci_handle*ti_sci=get_ti_sci_handle();arch/arm/mach-k3/common.c +0
-0@@ -65,15 +137,17 @@ void __noreturn jump_to_image_no_args(struct spl_image_info *spl_image) /* Release all the exclusive devices held by SPL beforestarting ATF */
ti_sci->ops.dev_ops.release_exclusive_devices(ti_sci); + ret =rproc_init();
+ if (ret)
+panic("rproc failed to be initialized (%d)\n", ret);arch/arm/mach-k3/common.c +4
-0+ + init_env(); + start_non_linux_remote_cores(); +/*
* It is assumed that remoteproc device 1 is the corresponding
* Cortex-A core which runs ATF. Make sure DT reflects the
same.
*/
- ret =rproc_dev_init(1);Quoted 8 lines
Quoted 5 lines
- if (ret)
- panic("%s: ATF failed to initialize on rproc (%d)\n",__func__,
- ret);
-Where did this code go?
Quoted 2 lines
rproc_inittakes care of that.Is that new behavior then? It should be it's own patch with a commit message about that.
Quoted 77 lines
Quoted 60 lines
Quoted 45 lines
ret =
rproc_load(1, spl_image->entry_point, 0x200); if (ret)
panic("%s: ATF failed to load on rproc (%d)\n",__func__,
ret);arch/arm/mach-k3/common.h +0
-0@@ -24,3 +24,5 @@ void setup_k3_mpu_regions(void); int early_console_init(void); void disable_linefill_optimization(void);void
remove_fwl_configs(struct fwl_data *fwl_data, size_t fwl_data_size);arch/arm/mach-k3/common.h +2
-0+void start_non_linux_remote_cores (void ); +int load_firmware(char *name_fw, char *name_loadaddr, u32*loadaddr);
arch/arm/mach-k3/j721e_init.c +1
-0@@ -18,6 +18,7 @@ #include <dm.h> #include <dm/uclass-internal.h> #include <dm/pinctrl.h> +#include <remoteproc.h> #ifdef CONFIG_SPL_BUILD #ifdef CONFIG_K3_LOAD_SYSFW@@ -295,3 +296,36 @@ voidrelease_resources_for_core_shutdown (void ) } }#endif
arch/arm/mach-k3/j721e_init.c +8
-0+ +#ifdef CONFIG_SYS_K3_SPL_ATF +void start_non_linux_remote_cores (void ) +{ + int size = 0, ret; + u32 loadaddr = 0; + + size = load_firmware("mainr5f0_0fwname",Quoted 6 lines
"
mainr5f0_0loadaddr",
+ &loadaddr);
+ if (size <= 0)
+ gotoerr_load;
+
+ /* remoteproc 2 is aliased for the needed remotecore */Assuming the big-arm core to boot is remoteproc 1 was reasonable, but
there needs to be a better what than assuming the number for every other
remote core.Quoted 16 lines
arch/arm/mach-k3/j721e_init.c
Quoted 13 lines
+ ret =
rproc_load(2, loadaddr, size);
+ if (ret) {
+printf("Firmware failed to start on rproc (%d)\n", ret); + gotoerr_load;
+ }arch/arm/mach-k3/j721e_init.c +8
-0+ + ret = rproc_start(2); + if (ret) { + printf("Firmware init failed on rproc (%d)\n", ret); + goto err_load; + } + + printf("Remoteproc 2 started successfully\n");That's useful..
Quoted 4 lines
That is a print that tells everything went well with rproc 2. Otherwise
one has to really find other ways to see if it succeeded or not.I'm just a customer booting my board, I have no idea what a "Remoteproc
2" is. I'm saying make the message describe what has happened.Andrew
Quoted 12 lines
Quoted 12 lines
Andrew
Quoted 8 lines
arch/arm/mach-k3/j721e_init.c +7
-0+ + return; + +err_load: + rproc_reset(2); +} +#endif Signature · 2 lines
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
PATCH v3 2/10 arm: k3: Add support for loading non linux remote cores
In reply to KeerthyQuoted 214 lines · Keerthy
Quoted 205 lines · Andrew F. Davis
Quoted 128 lines · Keerthy
Quoted 125 lines · Andrew F. Davis
Quoted 106 lines · Keerthy
Quoted 103 lines · Andrew F. Davis
Quoted 102 lines · keerthy
Quoted 53 lines · Andrew F. Davis
Quoted 52 lines · Keerthy
Add MAIN domain R5FSS0 remoteproc support from spl. This enables loading the elf firmware in SPL and starting the remotecore.
In order to start the core, there should be a file with path "
/lib/firmware/j7-main-r5f0_0-fw" under filesystem of respective boot mode.Signed-off-by Keerthy <[email protected]>Signed-off-by Lokesh Vutla <[email protected]>[Guard start_non_linux_remote_cores under CONFIG_FS_LOADER]Signed-off-by Andreas Dannenberg <[email protected]>---
arch/arm/mach-k3/common.c | 84
++++++++++++++++++++++++++++++++---
arch/arm/mach-k3/common.h | 2 +arch/arm/mach-k3/j721e_init.c| 34 ++++++++++++++3 files changed, 115 insertions(+), 5 deletions(-)arch/arm/mach-k3/common.c +21
-0@@ -16,6 +16,10 @@ #include <asm/arch/sys_proto.h> #include <asm/hardware.h> #include <asm/io.h> +#include <fs_loader.h> +#include <fs.h> +#include <env.h> +#include <elf.h> struct ti_sci_handle *get_ti_sci_handle(void) {@@ -57,6 +61,74 @@ int early_console_init(void) #endif #ifdef CONFIG_SYS_K3_SPL_ATF + +void init_env (void ) +{ +#ifdef CONFIG_SPL_ENV_SUPPORT + char *part; + + env_init(); + env_load(); + switch (spl_boot_device()) { + case BOOT_DEVICE_MMC2: + part = env_get("bootpart"); + env_set("storage_interface", "mmc"); + env_set("fw_dev_part", part); + break; + case BOOT_DEVICE_SPI: + env_set("storage_interface", "ubi"); + env_set("fw_ubi_mtdpart", "UBI");Quoted 8 lines
arch/arm/mach-k3/common.c int early_console_init(void) · line 84
Quoted 5 lines
arch/arm/mach-k3/common.c +5
-0+ env_set("fw_ubi_volume", "UBI0"); + break; + default: + printf("%s from device %u not supported!\n", + __func__, spl_boot_device());This will print for almost every boot mode..
I can keep this under debug.
Quoted 34 lines
Quoted 16 lines
arch/arm/mach-k3/common.c +13
-0+ return; + } +#endif +} + +#ifdef CONFIG_FS_LOADER +int load_firmware (char *name_fw,char *name_loadaddr,u32 *loadaddr) +{ + struct udevice *fsdev; + char *name = NULL; + int size = 0; + + *loadaddr = 0;arch/arm/mach-k3/common.c int early_console_init(void) · line 108
Quoted 10 lines
arch/arm/mach-k3/common.c +9
-0+#ifdef CONFIG_SPL_ENV_SUPPORT + switch (spl_boot_device()) { + case BOOT_DEVICE_MMC2: + name = env_get(name_fw); + *loadaddr = env_get_hex(name_loadaddr, *loadaddr); + break; + default: + printf("Loading rproc fw image from device %u not supported!\n", + spl_boot_device());This whole thing seems very MMC specific, if early firmware loading is
important it should work for all boot modes. Find a way to include it in
the next boot stage FIT image (tispl.bin) so it works for all modes.Quoted 9 lines
Quoted 5 lines
Quoted 2 lines
That was not NAKd. We are going with
fs_loaderapproach.When, where, link?
I had implemented that way internally. That was rejected for multiple right reasons:
I must have missed the internal reviews for this, anyway this is posted upstream so lets discus it here.
Quoted 1 line
1) SPL size would bloat based on the size of the firmware.
Quoted 6 lines
Quoted 4 lines
SPL size would remain constant, the combined FIT (tispl.bin) would grow,
but that is okay as DRAM is enabled at this point so we have no hard memory constraints.I meant the FIT image containing the SPL will bloat.
Exactly what I said, and so size is not a huge deal.
Quoted 8 lines
Quoted 8 lines
Quoted 6 lines
2) There are multiple cores that need to be loaded and hence adding all
the firmwares under a fit can be really painful.Quoted 6 lines
Quoted 2 lines
Bundling images is what FIT is for, are you saying the better solution is to hard-code each firmware starting like done here?
How many firmwares will you go on bundling. Firmwares are already kept in file system. It is a matter of reading them from there.
If we are early booting them from SPL then they don't really need to be on the filesystem.
Quoted 6 lines
Quoted 6 lines
Quoted 4 lines
3) Changing firmware means building the tispl.bin again.
Quoted 6 lines
Quoted 2 lines
FIT images can be disassembled and reassembled with a script around
tools/dumpimage.And you expect everyone to master that instead of looking at couple of aliases in DT to figure out which core corresponds to which ID?
Your patches do more than add DT aliases to add a firmware image. I think you are responding to the wrong comment here, the ID part is below.
Quoted 19 lines
Quoted 8 lines
SPL should be simple and load the one next stage.
Quoted 2 lines
The FIT solution can not scale well.
Quoted 6 lines
How does this current series scale at all? At least with FIT you can add
more images without adding code forrequest_firmware(<hard-coded-firmware-name>)andrproc_load(<hard-coded-number>). That all could be encoded in the FIT data.I understand and as explained earlier i have even implemented that once before.
fs_loaderwas meant to address the exact use case we are discussing about.Quoted 6 lines
Even in u-boot remotecores are started/loaded by indices. Users need to know them. This is no different than that.
I am not convinced about FIT approach. I would let Lokesh take a call on this.
Quoted 5 lines
Lokesh is not the whole U-Boot community, I get you two aligned internally on this, but I'd be much more interested in Tom or Simon's opinion here. I was doing the same thing when loading PMMC firmware for HS and was pushed to make a FIT friendly version, I'm glad that I did, it ended up much less hacky in the long run.
Quoted 6 lines
I would love to hear Tom & simon's opinions. Before we jump on to PMMC fimrware example. I believe there is one such firmware that gets appended to the FIT image. In case of remoteprocs there can be multiple such firmware. File system is the most generic and scaleble place to access firmware.
Andrew,
PMMC in K2G is a case where the firmware image is targeted for a specific core and in K2G U-Boot only takes care of loading that particular core. Where as this series targets multiple cores which can cater to multiple use cases resulting in different combinations. To give more details, below are the approaches evaluated(prototyped):
Approach 1: Pack all the firmwares into a fit Image along with A72 SPL
----------------------------------------------------------------------
Pros:
-----
a) Boot media independent: No need to load firmware via file system present in different boot media.
Cons:
-----
a) Flash image: In case of raw flash devices. We need to upfront predict the partition that needs to be allocated for tispl.bin. Complex SoCs like J721e has ~9 remote cores and each firmware can be ~2-3MB resulting in ~20-30MB of tispl.bin. In case one has to add a bigger firmware that would mean flash partition resizing. Also not all boards has flashes > 32MB.
In fact a prototype of this approach was tried. It failed as soon as a larger firmware was included in the FIT image as the memory allocated was not sufficient.
b) Dependency on U-Boot repo for changing firmwares: The firmwares need to be built as part of the FIT Image that contains the SPL. Firmware change means repacking the FIT image. Any customer/developer who intends to change the remote core firmware needs to be using the u-boot repository to pack the image into the FIT Image.
c) Mapping the firmware to remote cores: J7 has around 9 remote cores(Mostly R5Fs & DSPs). Each firmware is position dependent. There is no good way to map which firmware corresponds to which remote core other than hard coding.
d) Use case support: Different use cases result in different combination of remote cores. Every different combination will result in a new binary.
e) Example build command would be:
make ARCH=arm R50=<> R51=<> R52=<>.........C7x=<> C6x0=<>
You can see it :)
Approach 2: Loading the firmware using fs_loader from file system
Pros:
a) No restriction on the firmware image sizes.
b) Need not re build u-boot for changing firmware
c) U-Boot build is un-touched for enabling various combination of use cases.
Cons:
1) Boot media dependent: fs_loader as of today supports loading firmware from the most common boot media and can be extended to any boot media.
2) Hard coding of remote core numbers to the firmware. This cannot be avoided any case with the current remoteproc framework in u-boot.
Rationale on choosing fs_loader approach:
Considering these options, and to scale the development process as well, fs_loader approach has been preferred.
Regards,
Keerthy
Quoted 187 lines
Thanks,
KeerthyQuoted 184 lines
Andrew
Quoted 180 lines
Thanks,
KeerthyQuoted 178 lines
Andrew
Quoted 174 lines
- Keerthy
Quoted 173 lines
Quoted 64 lines
Quoted 55 lines
Quoted 55 lines
arch/arm/mach-k3/common.c +15
-0+ return 0; + } +#endif + if (!*loadaddr) + return 0; + + if (!uclass_get_device(UCLASS_FS_FIRMWARE_LOADER, 0, &fsdev)) { + size = request_firmware_into_buf(fsdev, name, (void *)*loadaddr, + 0, 0); + } + + return size; +} +#else +int load_firmware(char *name_fw, char *name_loadaddr, u32*loadaddr)
arch/arm/mach-k3/common.c +9
-0+{ + return 0; +} +#endif + +__weak void start_non_linux_remote_cores (void ) +{ +} +void
__noreturnjump_to_image_no_args(struct spl_image_info *spl_image)
{
structti_sci_handle*ti_sci=get_ti_sci_handle();arch/arm/mach-k3/common.c +0
-0@@ -65,15 +137,17 @@ void __noreturn jump_to_image_no_args(struct spl_image_info *spl_image) /* Release all the exclusive devices held by SPL beforestarting ATF */
ti_sci->ops.dev_ops.release_exclusive_devices(ti_sci); + ret =rproc_init();
+ if (ret)
+panic("rproc failed to be initialized (%d)\n", ret);arch/arm/mach-k3/common.c +4
-0+ + init_env(); + start_non_linux_remote_cores(); +/*
* It is assumed that remoteproc device 1 is the corresponding
* Cortex-A core which runs ATF. Make sure DT reflects the
same.
*/
- ret =rproc_dev_init(1);Quoted 8 lines
Quoted 5 lines
- if (ret)
- panic("%s: ATF failed to initialize on rproc (%d)\n",__func__,
- ret);
-Where did this code go?
Quoted 2 lines
rproc_inittakes care of that.Is that new behavior then? It should be it's own patch with a commit message about that.
Quoted 76 lines
Quoted 59 lines
Quoted 44 lines
ret =
rproc_load(1, spl_image->entry_point, 0x200); if (ret)
panic("%s: ATF failed to load on rproc (%d)\n",__func__,
ret);arch/arm/mach-k3/common.h +0
-0@@ -24,3 +24,5 @@ void setup_k3_mpu_regions(void); int early_console_init(void); void disable_linefill_optimization(void);void
remove_fwl_configs(struct fwl_data *fwl_data, size_t fwl_data_size);arch/arm/mach-k3/common.h +2
-0+void start_non_linux_remote_cores (void ); +int load_firmware(char *name_fw, char *name_loadaddr, u32*loadaddr);
arch/arm/mach-k3/j721e_init.c +1
-0@@ -18,6 +18,7 @@ #include <dm.h> #include <dm/uclass-internal.h> #include <dm/pinctrl.h> +#include <remoteproc.h> #ifdef CONFIG_SPL_BUILD #ifdef CONFIG_K3_LOAD_SYSFW@@ -295,3 +296,36 @@ voidrelease_resources_for_core_shutdown (void ) } }#endif
arch/arm/mach-k3/j721e_init.c +8
-0+ +#ifdef CONFIG_SYS_K3_SPL_ATF +void start_non_linux_remote_cores (void ) +{ + int size = 0, ret; + u32 loadaddr = 0; + + size = load_firmware("mainr5f0_0fwname",Quoted 6 lines
"
mainr5f0_0loadaddr",
+ &loadaddr);
+ if (size <= 0)
+ gotoerr_load;
+
+ /* remoteproc 2 is aliased for the needed remotecore */Assuming the big-arm core to boot is remoteproc 1 was reasonable, but
there needs to be a better what than assuming the number for every other
remote core.Quoted 16 lines
arch/arm/mach-k3/j721e_init.c
Quoted 13 lines
+ ret =
rproc_load(2, loadaddr, size);
+ if (ret) {
+printf("Firmware failed to start on rproc (%d)\n", ret); + gotoerr_load;
+ }arch/arm/mach-k3/j721e_init.c +8
-0+ + ret = rproc_start(2); + if (ret) { + printf("Firmware init failed on rproc (%d)\n", ret); + goto err_load; + } + + printf("Remoteproc 2 started successfully\n");That's useful..
Quoted 4 lines
That is a print that tells everything went well with rproc 2. Otherwise
one has to really find other ways to see if it succeeded or not.I'm just a customer booting my board, I have no idea what a "Remoteproc
2" is. I'm saying make the message describe what has happened.Andrew
Quoted 12 lines
Quoted 12 lines
Andrew
Quoted 8 lines
arch/arm/mach-k3/j721e_init.c +7
-0+ + return; + +err_load: + rproc_reset(2); +} +#endif
PATCH v3 2/10 arm: k3: Add support for loading non linux remote cores
Quoted 278 lines · Keerthy
Quoted 210 lines · Keerthy
Quoted 201 lines · Andrew F. Davis
Quoted 124 lines · Keerthy
Quoted 121 lines · Andrew F. Davis
Quoted 105 lines · Keerthy
Quoted 102 lines · Andrew F. Davis
Quoted 101 lines · keerthy
Quoted 53 lines · Andrew F. Davis
Quoted 52 lines · Keerthy
Add MAIN domain R5FSS0 remoteproc support from spl. This enables loading the elf firmware in SPL and starting the remotecore.
In order to start the core, there should be a file with path "
/lib/firmware/j7-main-r5f0_0-fw" under filesystem of respective boot mode.Signed-off-by Keerthy <[email protected]>Signed-off-by Lokesh Vutla <[email protected]>[Guard start_non_linux_remote_cores under CONFIG_FS_LOADER]Signed-off-by Andreas Dannenberg <[email protected]>---
arch/arm/mach-k3/common.c | 84
++++++++++++++++++++++++++++++++---
arch/arm/mach-k3/common.h | 2 +arch/arm/mach-k3/j721e_init.c| 34 ++++++++++++++3 files changed, 115 insertions(+), 5 deletions(-)arch/arm/mach-k3/common.c +21
-0@@ -16,6 +16,10 @@ #include <asm/arch/sys_proto.h> #include <asm/hardware.h> #include <asm/io.h> +#include <fs_loader.h> +#include <fs.h> +#include <env.h> +#include <elf.h> struct ti_sci_handle *get_ti_sci_handle(void) {@@ -57,6 +61,74 @@ int early_console_init(void) #endif #ifdef CONFIG_SYS_K3_SPL_ATF + +void init_env (void ) +{ +#ifdef CONFIG_SPL_ENV_SUPPORT + char *part; + + env_init(); + env_load(); + switch (spl_boot_device()) { + case BOOT_DEVICE_MMC2: + part = env_get("bootpart"); + env_set("storage_interface", "mmc"); + env_set("fw_dev_part", part); + break; + case BOOT_DEVICE_SPI: + env_set("storage_interface", "ubi"); + env_set("fw_ubi_mtdpart", "UBI");Quoted 8 lines
arch/arm/mach-k3/common.c int early_console_init(void) · line 84
Quoted 5 lines
arch/arm/mach-k3/common.c +5
-0+ env_set("fw_ubi_volume", "UBI0"); + break; + default: + printf("%s from device %u not supported!\n", + __func__, spl_boot_device());This will print for almost every boot mode..
I can keep this under debug.
Quoted 33 lines
Quoted 16 lines
arch/arm/mach-k3/common.c +13
-0+ return; + } +#endif +} + +#ifdef CONFIG_FS_LOADER +int load_firmware (char *name_fw,char *name_loadaddr,u32 *loadaddr) +{ + struct udevice *fsdev; + char *name = NULL; + int size = 0; + + *loadaddr = 0;arch/arm/mach-k3/common.c int early_console_init(void) · line 108
Quoted 10 lines
arch/arm/mach-k3/common.c +9
-0+#ifdef CONFIG_SPL_ENV_SUPPORT + switch (spl_boot_device()) { + case BOOT_DEVICE_MMC2: + name = env_get(name_fw); + *loadaddr = env_get_hex(name_loadaddr, *loadaddr); + break; + default: + printf("Loading rproc fw image from device %u not supported!\n", + spl_boot_device());This whole thing seems very MMC specific, if early firmware loading is
important it should work for all boot modes. Find a way to include it in
the next boot stage FIT image (tispl.bin) so it works for all modes.Quoted 9 lines
Quoted 5 lines
Quoted 2 lines
That was not NAKd. We are going with
fs_loaderapproach.When, where, link?
I had implemented that way internally. That was rejected for multiple right reasons:
I must have missed the internal reviews for this, anyway this is posted upstream so lets discus it here.
Quoted 8 lines
Quoted 6 lines
Quoted 1 line
1) SPL size would bloat based on the size of the firmware.
SPL size would remain constant, the combined FIT (tispl.bin) would grow, but that is okay as DRAM is enabled at this point so we have no hard memory constraints.
I meant the FIT image containing the SPL will bloat.
Exactly what I said, and so size is not a huge deal.
Quoted 7 lines
Quoted 7 lines
Quoted 5 lines
2) There are multiple cores that need to be loaded and hence adding all the firmwares under a fit can be really painful.
Quoted 6 lines
Quoted 2 lines
Bundling images is what FIT is for, are you saying the better solution is to hard-code each firmware starting like done here?
How many firmwares will you go on bundling. Firmwares are already kept in file system. It is a matter of reading them from there.
If we are early booting them from SPL then they don't really need to be on the filesystem.
Quoted 6 lines
Quoted 6 lines
Quoted 4 lines
3) Changing firmware means building the tispl.bin again.
Quoted 6 lines
Quoted 2 lines
FIT images can be disassembled and reassembled with a script around
tools/dumpimage.And you expect everyone to master that instead of looking at couple of aliases in DT to figure out which core corresponds to which ID?
Your patches do more than add DT aliases to add a firmware image. I think you are responding to the wrong comment here, the ID part is below.
Quoted 18 lines
Quoted 8 lines
SPL should be simple and load the one next stage.
Quoted 2 lines
The FIT solution can not scale well.
Quoted 5 lines
How does this current series scale at all? At least with FIT you can add more images without adding code for
request_firmware(<hard-coded-firmware-name>)andrproc_load(<hard-coded-number>). That all could be encoded in the FIT data.I understand and as explained earlier i have even implemented that once before.
fs_loaderwas meant to address the exact use case we are discussing about.Quoted 6 lines
Even in u-boot remotecores are started/loaded by indices. Users need to know them. This is no different than that.
I am not convinced about FIT approach. I would let Lokesh take a call on this.
Quoted 5 lines
Lokesh is not the whole U-Boot community, I get you two aligned internally on this, but I'd be much more interested in Tom or Simon's opinion here. I was doing the same thing when loading PMMC firmware for HS and was pushed to make a FIT friendly version, I'm glad that I did, it ended up much less hacky in the long run.
Quoted 5 lines
I would love to hear Tom & simon's opinions. Before we jump on to PMMC fimrware example. I believe there is one such firmware that gets appended to the FIT image. In case of remoteprocs there can be multiple such firmware. File system is the most generic and scaleble place to access firmware.
Andrew,
PMMC in K2G is a case where the firmware image is targeted for a specific core and in K2G U-Boot only takes care of loading that particular core. Where as this series targets multiple cores which can cater to multiple use cases resulting in different combinations. To give more details, below are the approaches evaluated(prototyped):
Approach 1: Pack all the firmwares into a fit Image along with A72 SPL
----------------------------------------------------------------------
Pros:
-----
a) Boot media independent: No need to load firmware via file system present in different boot media.Cons:
-----
a) Flash image: In case of raw flash devices. We need to upfront predict the partition that needs to be allocated for tispl.bin. Complex SoCs like J721e has ~9 remote cores and each firmware can be ~2-3MB resulting in ~20-30MB of tispl.bin. In case one has to add
a bigger firmware that would mean flash partition resizing. Also not all boards has flashes > 32MB.In fact a prototype of this approach was tried. It failed as soon as a larger firmware was included in the FIT image as the memory allocated was not sufficient.
b) Dependency on U-Boot repo for changing firmwares: The firmwares need to be built as part of the FIT Image that contains the SPL. Firmware change means repacking the FIT image. Any customer/developer who intends to change the remote core firmware needs to be using the u-boot repository to pack the image into the FIT Image.
c) Mapping the firmware to remote cores: J7 has around 9 remote
cores(Mostly R5Fs & DSPs). Each firmware is position dependent. There is no good way to map which firmware corresponds to which remote core other than hard coding.d) Use case support: Different use cases result in different combination of remote cores. Every different combination will result in a new binary.
e) Example build command would be:
make ARCH=arm R50=<> R51=<> R52=<>.........C7x=<> C6x0=<>You can see it :)
Approach 2: Loading the firmware using
fs_loaderfrom file systemPros:
a) No restriction on the firmware image sizes.
b) Need not re build u-boot for changing firmware
c) U-Boot build is un-touched for enabling various combination of use cases.Cons:
1) Boot media dependent:
fs_loaderas of today supports loading firmware from the most common boot media and can be extended to any boot media.
Quoted 8 lines
2) Hard coding of remote core numbers to the firmware. This cannot be avoided any case with the current remoteproc framework in u-boot.
Rationale on choosing
fs_loaderapproach:Considering these options, and to scale the development process as well,
fs_loaderapproach has been preferred.
Its been more than a week and there are no responses for the above justification. I assume there are no objections for the current approach.
Thanks and regards,
Lokesh
Quoted 183 lines
Regards,
KeerthyQuoted 181 lines
Thanks,
KeerthyQuoted 178 lines
Andrew
Quoted 174 lines
Thanks,
KeerthyQuoted 172 lines
Andrew
Quoted 168 lines
- Keerthy
Quoted 167 lines
Quoted 62 lines
Quoted 53 lines
Quoted 53 lines
arch/arm/mach-k3/common.c +24
-0+ return 0; + } +#endif + if (!*loadaddr) + return 0; + + if (!uclass_get_device(UCLASS_FS_FIRMWARE_LOADER, 0, &fsdev)) { + size = request_firmware_into_buf(fsdev, name, (void *)*loadaddr, + 0, 0); + } + + return size; +} +#else +int load_firmware (char *name_fw,char *name_loadaddr,u32 *loadaddr) +{ + return 0; +} +#endif + +__weak void start_non_linux_remote_cores (void ) +{ +} +void
__noreturnjump_to_image_no_args(struct spl_image_info *spl_image)
{
structti_sci_handle*ti_sci=get_ti_sci_handle();arch/arm/mach-k3/common.c +0
-0@@ -65,15 +137,17 @@ void __noreturn jump_to_image_no_args(struct spl_image_info *spl_image) /* Release all the exclusive devices held by SPL beforestarting ATF */
ti_sci->ops.dev_ops.release_exclusive_devices(ti_sci); + ret =rproc_init();
+ if (ret)
+panic("rproc failed to be initialized (%d)\n", ret);arch/arm/mach-k3/common.c +4
-0+ + init_env(); + start_non_linux_remote_cores(); +/*
* It is assumed that remoteproc device 1 is the corresponding
* Cortex-A core which runs ATF. Make sure DT reflects the same.
*/
- ret =rproc_dev_init(1);Quoted 8 lines
Quoted 5 lines
- if (ret)
- panic("%s: ATF failed to initialize on rproc (%d)\n",__func__,
- ret);
-Where did this code go?
Quoted 2 lines
rproc_inittakes care of that.Is that new behavior then? It should be it's own patch with a commit message about that.
Quoted 73 lines
Quoted 56 lines
Quoted 38 lines
ret =
rproc_load(1, spl_image->entry_point, 0x200); if (ret)
panic("%s: ATF failed to load on rproc (%d)\n",__func__,
ret);arch/arm/mach-k3/common.h +0
-0@@ -24,3 +24,5 @@ void setup_k3_mpu_regions(void); int early_console_init(void); void disable_linefill_optimization(void);void
remove_fwl_configs(struct fwl_data *fwl_data, size_t fwl_data_size);arch/arm/mach-k3/common.h +2
-0+void start_non_linux_remote_cores (void ); +int load_firmware(char *name_fw, char *name_loadaddr, u32*loadaddr);
arch/arm/mach-k3/j721e_init.c +4
-0@@ -18,6 +18,7 @@ #include <dm.h> #include <dm/uclass-internal.h> #include <dm/pinctrl.h> +#include <remoteproc.h> #ifdef CONFIG_SPL_BUILD #ifdef CONFIG_K3_LOAD_SYSFW@@ -295,3 +296,36 @@ void release_resources_for_core_shutdown(void) } } #endif + +#ifdef CONFIG_SYS_K3_SPL_ATF +void start_non_linux_remote_cores (void )arch/arm/mach-k3/j721e_init.c void release_resources_for_core_shutdown(void) · line 311
Quoted 10 lines
arch/arm/mach-k3/j721e_init.c +10
-0+{ + int size = 0, ret; + u32 loadaddr = 0; + + size = load_firmware("mainr5f0_0fwname", "mainr5f0_0loadaddr", + &loadaddr); + if (size <= 0) + goto err_load; + + /* remoteproc 2 is aliased for the needed remotecore */Assuming the big-arm core to boot is remoteproc 1 was reasonable, but there needs to be a better what than assuming the number for every other
remote core.Quoted 16 lines
arch/arm/mach-k3/j721e_init.c void release_resources_for_core_shutdown(void) · line 324
Quoted 13 lines
arch/arm/mach-k3/j721e_init.c +13
-0+ ret = rproc_load(2, loadaddr, size); + if (ret) { + printf("Firmware failed to start on rproc (%d)\n", ret); + goto err_load; + } + + ret = rproc_start(2); + if (ret) { + printf("Firmware init failed on rproc (%d)\n", ret); + goto err_load; + } + + printf("Remoteproc 2 started successfully\n");That's useful..
Quoted 4 lines
That is a print that tells everything went well with rproc 2. Otherwise
one has to really find other ways to see if it succeeded or not.I'm just a customer booting my board, I have no idea what a "Remoteproc 2" is. I'm saying make the message describe what has happened.
Andrew
Quoted 12 lines
Quoted 12 lines
Andrew
Quoted 8 lines
arch/arm/mach-k3/j721e_init.c +7
-0+ + return; + +err_load: + rproc_reset(2); +} +#endif
PATCH v3 3/10 armv7R: K3: r5_mpu: Enable execute permission for MCU0 BTCM
In reply to KeerthyEnable execute permission for mcu_r5fss0_core0 BTCM so that we can jump to a firmware directly from SPL.
--- arch/arm/mach-k3/r5_mpu.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
arch/arm/mach-k3/r5_mpu.c +3 -1
@@ -26,7 +26,9 @@ struct mpu_region_config k3_mpu_regions[16] = {/* U-Boot's code area marking it as WB and Write allocate */ {CONFIG_SYS_SDRAM_BASE ,REGION_2 ,XN_DIS ,PRIV_RW_USR_RW , O_I_WB_RD_WR_ALLOC, REGION_2GB}, - {0x0, 3, 0x0, 0x0, 0x0, 0x0}, +/* mcu_r5fss0_core0 BTCM area marking it as WB and Write allocate. */ + {0x41010000, 3, XN_DIS, PRIV_RW_USR_RW, O_I_WB_RD_WR_ALLOC, + REGION_8MB}, {0x0, 4, 0x0, 0x0, 0x0, 0x0}, {0x0, 5, 0x0, 0x0, 0x0, 0x0}, {0x0, 6, 0x0, 0x0, 0x0, 0x0},
Signature · 1 line
2.17.1
PATCH v3 4/10 armv7R: K3: Add support for jumping to firmware
In reply to KeerthyMCU Domain rf50 is currently shutting down after loading the ATF. Load elf firmware and jump to firmware post loading ATF.
ROM doesn't enable ATCM memory, so make sure that firmware that is being loaded doesn't use ATCM memory or override SPL.
--- arch/arm/mach-k3/common.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-)
arch/arm/mach-k3/common.c +16 -6
@@ -131,8 +131,10 @@ __weak void start_non_linux_remote_cores(void)void __noreturn jump_to_image_no_args (struct spl_image_info *spl_image) { +typedef void __noreturn (*image_entry_noargs_t )(void );struct ti_sci_handle *ti_sci =get_ti_sci_handle (); -int ret; +u32 loadaddr =0 ; +int ret, size;/* Release all the exclusive devices held by SPL before starting ATF */ ti_sci->ops.dev_ops.release_exclusive_devices (ti_sci);
@@ -143,6 +145,9 @@ void __noreturn jump_to_image_no_args(struct spl_image_info *spl_image)init_env ();start_non_linux_remote_cores (); + size =load_firmware ("mcur5f0_0fwname" ,"mcur5f0_0loadaddr" , + &loadaddr); +/* * It is assumed that remoteproc device 1 is the corresponding
@@ -158,13 +163,18 @@ void __noreturn jump_to_image_no_args(struct spl_image_info *spl_image) ret =rproc_start (1 );if (ret)panic ("%s: ATF failed to start on rproc (%d)\n" , __func__, ret); +if (!(size >0 &&valid_elf_image (loadaddr))) { +debug ("Shutting down...\n" ); +release_resources_for_core_shutdown (); + +while (1 ) + asmvolatile ("wfe" ); + } -debug ("Releasing resources...\n" ); -release_resources_for_core_shutdown (); +image_entry_noargs_t image_entry = + (image_entry_noargs_t )load_elf_image_phdr (loadaddr); -debug ("Finalizing core shutdown...\n" ); -while (1 ) - asm volatile("wfe"); + image_entry(); }#endif
Signature · 1 line
2.17.1
PATCH v3 5/10 arm: dts: k3-j721e-r5: Add fs_loader node
In reply to KeerthyAdd fs_loader node which will be needed for loading firmwares from the boot media/filesystem.
--- arch/arm/dts/k3-j721e-r5-common-proc-board.dts | 6 ++++++ 1 file changed, 6 insertions(+)
arch/arm/dts/k3-j721e-r5-common-proc-board.dts +6 -0
@@ -18,6 +18,12 @@ chosen { stdout-path = "serial2:115200n8"; tick-timer = &timer1; + firmware-loader = &fs_loader0; + }; + + fs_loader0: fs_loader at 0 { + u-boot,dm-pre-reloc; + compatible = "u-boot,fs-loader"; }; a72_0: a72 at 0 {
Signature · 1 line
2.17.1
PATCH v3 6/10 arm: dts: k3-j721e-r5: Enable r5fss0 cluster in SPL
In reply to KeerthyEnable MAIN domain r5fss0 cluster and its core0 in R5 spl.
--- arch/arm/dts/k3-j721e-r5-common-proc-board.dts | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
arch/arm/dts/k3-j721e-r5-common-proc-board.dts +14 -0
@@ -13,6 +13,8 @@ aliases { remoteproc0 = &sysctrler; remoteproc1 = &a72_0; + remoteproc2 = &main_r5fss0_core0; + remoteproc3 = &main_r5fss0_core1; }; chosen {
@@ -213,4 +215,16 @@ u-boot,dm-spl; }; +&main_r5fss0 { + u-boot,dm-spl; +}; + +&main_r5fss0_core0 { + u-boot,dm-spl; +}; + +&main_r5fss0_core1 { + u-boot,dm-spl; +}; + #include "k3-j721e-common-proc-board-u-boot.dtsi"
Signature · 1 line
2.17.1
PATCH v3 7/10 include: configs: j721e_evm: Add env variables for mcu_r5fss0_core0 & main_r5fss0_core0
In reply to KeerthyAdd env variables for mcu_r5fss0_core0 & main_r5fss0_core0 firmware loadaddr and name.
--- include/configs/j721e_evm.h | 4 ++++ 1 file changed, 4 insertions(+)
include/configs/j721e_evm.h +4 -0
@@ -84,6 +84,10 @@"mmcdev=1\0" \"bootpart=1:2\0" \"bootdir=/boot\0" \ +"mainr5f0_0loadaddr=88000000\0" \ +"mainr5f0_0fwname=/lib/firmware/j7-main-r5f0_0-fw\0" \ +"mcur5f0_0loadaddr=89000000\0" \ +"mcur5f0_0fwname=/lib/firmware/j7-mcu-r5f0_0-fw\0" \"rd_spec=-\0" \"init_mmc=run args_all args_mmc\0" \"get_fdt_mmc=load mmc ${bootpart} ${fdtaddr} ${bootdir}/${name_fdt}\0" \
Signature · 1 line
2.17.1
PATCH v3 7/10 include: configs: j721e_evm: Add env variables for mcu_r5fss0_core0 & main_r5fss0_core0
Quoted 13 lines · Keerthy
Add env variables for
mcu_r5fss0_core0&main_r5fss0_core0firmware loadaddr and name.Signed-off-by Keerthy <[email protected]>--- include/configs/j721e_evm.h | 4 ++++ 1 file changed, 4 insertions(+)include/configs/j721e_evm.h +0
-0
include/configs/j721e_evm.h line 90
Quoted 7 lines
include/configs/j721e_evm.h +4
-0@@ -84,6 +84,10 @@"mmcdev=1\0" \"bootpart=1:2\0" \"bootdir=/boot\0" \ +"mainr5f0_0loadaddr=88000000\0" \ +"mainr5f0_0fwname=/lib/firmware/j7-main-r5f0_0-fw\0" \ +"mcur5f0_0loadaddr=89000000\0" \ +"mcur5f0_0fwname=/lib/firmware/j7-mcu-r5f0_0-fw\0" \
New convention for env vars I'm pushing is: names start with "name_" and addresses start with "addr_". Makes for easier sorting and for figuring out what each of the large list of env vars does at a glance.
Andrew
Quoted 4 lines
include/configs/j721e_evm.h +0
-0"rd_spec=-\0" \"init_mmc=run args_all args_mmc\0" \"get_fdt_mmc=load mmc ${bootpart} ${fdtaddr} ${bootdir}/${name_fdt}\0" \
PATCH v3 8/10 configs: j721e_evm_r5: Enable R5F remoteproc support
In reply to KeerthyEnable r5f remoteproc support in r5 defconfig so that r5s can be started in spl.
--- configs/j721e_evm_r5_defconfig | 2 ++ 1 file changed, 2 insertions(+)
configs/j721e_evm_r5_defconfig +2 -0
@@ -25,6 +25,7 @@ CONFIG_SPL_STACK_R=y CONFIG_SPL_SEPARATE_BSS=y CONFIG_SPL_EARLY_BSS=y CONFIG_SPL_ENV_SUPPORT=y +CONFIG_SPL_FS_EXT4=y CONFIG_SPL_I2C_SUPPORT=y CONFIG_SPL_DM_MAILBOX=y CONFIG_SPL_DM_RESET=y
@@ -92,6 +93,7 @@ CONFIG_SPL_DM_REGULATOR=y CONFIG_DM_REGULATOR_TPS65941=y CONFIG_K3_SYSTEM_CONTROLLER=y CONFIG_REMOTEPROC_TI_K3_ARM64=y +CONFIG_REMOTEPROC_TI_K3_R5F=y CONFIG_DM_RESET=y CONFIG_RESET_TI_SCI=y CONFIG_DM_SERIAL=y
Signature · 1 line
2.17.1
PATCH v3 8/10 configs: j721e_evm_r5: Enable R5F remoteproc support
Quoted 3 lines · Keerthy
Enable r5f remoteproc support in r5 defconfig so that r5s can be started in spl.
s/r5f/R5F
s/r5/R5
s/spl/SPL
Quoted 11 lines
Signed-off-by Keerthy <[email protected]>Signed-off-by Lokesh Vutla <[email protected]>--- configs/j721e_evm_r5_defconfig | 2 ++ 1 file changed, 2 insertions(+)configs/j721e_evm_r5_defconfig +0
-0
configs/j721e_evm_r5_defconfig CONFIG_SPL_STACK_R=y · line 28
Quoted 4 lines
configs/j721e_evm_r5_defconfig +1
-0@@ -25,6 +25,7 @@ CONFIG_SPL_STACK_R=y CONFIG_SPL_SEPARATE_BSS=y CONFIG_SPL_EARLY_BSS=y CONFIG_SPL_ENV_SUPPORT=y +CONFIG_SPL_FS_EXT4=y
? Not in commit message.
Andrew
Quoted 12 lines
configs/j721e_evm_r5_defconfig +1
-0CONFIG_SPL_I2C_SUPPORT=y CONFIG_SPL_DM_MAILBOX=y CONFIG_SPL_DM_RESET=y@@ -92,6 +93,7 @@ CONFIG_SPL_DM_REGULATOR=y CONFIG_DM_REGULATOR_TPS65941=y CONFIG_K3_SYSTEM_CONTROLLER=y CONFIG_REMOTEPROC_TI_K3_ARM64=y +CONFIG_REMOTEPROC_TI_K3_R5F=y CONFIG_DM_RESET=y CONFIG_RESET_TI_SCI=y CONFIG_DM_SERIAL=y
PATCH v3 9/10 configs: j721e_evm_r5_defconfig: Remove saving ENV in eMMC
In reply to KeerthyRemove saving ENV in eMMC in r5 as the power domains are not setup. Environment in eMMC cannot be read if we do not boot from eMMC.
--- configs/j721e_evm_r5_defconfig | 4 ---- 1 file changed, 4 deletions(-)
configs/j721e_evm_r5_defconfig +0 -4
@@ -7,7 +7,6 @@ CONFIG_SYS_MALLOC_F_LEN=0x55000 CONFIG_SOC_K3_J721E=y CONFIG_TARGET_J721E_R5_EVM=y CONFIG_ENV_SIZE=0x20000 -CONFIG_ENV_OFFSET=0x680000 CONFIG_SPL_MMC_SUPPORT=y CONFIG_SPL_SERIAL_SUPPORT=y CONFIG_SPL_DRIVERS_MISC_SUPPORT=y
@@ -48,9 +47,6 @@ CONFIG_CMD_FAT=y CONFIG_OF_CONTROL=y CONFIG_SPL_OF_CONTROL=y CONFIG_DEFAULT_DEVICE_TREE="k3-j721e-r5-common-proc-board" -CONFIG_ENV_IS_IN_MMC=y -CONFIG_SYS_REDUNDAND_ENVIRONMENT=y -CONFIG_ENV_OFFSET_REDUND=0x700000 CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_DM=y CONFIG_SPL_DM=y
Signature · 1 line
2.17.1
PATCH v3 10/10 env: nowhere: set default enviroment
In reply to Keerthyset default enviroment so that set_env calls succeed when ENV_IS_NOWHERE is alone set.
--- env/nowhere.c | 1 + 1 file changed, 1 insertion(+)
env/nowhere.c +1 -0
@@ -23,6 +23,7 @@ static int env_nowhere_init(void) { gd->env_addr = (ulong)&default_environment[0 ]; gd->env_valid =ENV_INVALID ; +env_set_default (NULL ,0 );return 0 ; }
Signature · 1 line
2.17.1
PATCH v3 10/10 env: nowhere: set default enviroment
Quoted 3 lines · Keerthy
set default enviroment so that
set_envcalls succeed whenENV_IS_NOWHEREis alone set.
Capitalize first letter of a sentence.
Also no need to line wrap at 50 chars..
For last line:
"when only ENV_IS_NOWHERE is set."
reads better.
Andrew
Quoted 18 lines
Signed-off-by Keerthy <[email protected]>--- env/nowhere.c | 1 + 1 file changed, 1 insertion(+)env/nowhere.c +1
-0@@ -23,6 +23,7 @@ static int env_nowhere_init(void) { gd->env_addr = (ulong)&default_environment[0 ]; gd->env_valid =ENV_INVALID ; +env_set_default (NULL ,0 );return 0 ; }