arm: k3: replace tifsstub runtime filter with per-state FIT configurations
Subsystems (2)
cover arm: k3: replace tifsstub runtime filter with per-state FIT configurations
The AM62x family (TI EVMs, phytec phycore, toradex verdin) ships two or three mutually-exclusive tifsstub variants per tispl.bin FIT image (tifsstub-hs, tifsstub-fs, tifsstub-gp), all assigned the same load address 0x9dc00000. The current platform code loads every variant and discards the wrong ones at runtime by zeroing *p_size in board_fit_image_post_process() (arch/arm/mach-k3/r5/common.c).
This runtime-filter approach has become a friction point. An earlier attempt to add FIT-image load-address overlap detection to mkimage flagged the shared 0x9dc00000 as an apparent conflict, and the workaround in that series was to shift each tifsstub by 64KB increments. Bryan Brattlof reviewed that change at the time [1] and pointed out that the real semantics are "load one of three at runtime", and that moving the binaries was not necessarily safe given downstream IPC assumptions about the fixed load address. The series was ultimately reverted upstream, which leaves the underlying question open: any future static FIT validator needs a way to understand that these three images do not actually collide. The same point is being discussed at the spec level in flat-image-tree issue #32 [2], where a "mutually-exclusive-group" property has been floated to express runtime-resolved overlaps to static tooling.
This series fixes the problem structurally without moving any binaries and without a spec extension. Each board's binman dtsi is updated so the tispl.bin FIT carries one configuration per security state (conf-hs-se, conf-hs-fs, conf-gp), each containing only the matching tifsstub. board_fit_config_name_match() in each affected board reads the SoC security state via get_device_type() and selects the correct configuration up front, via a shared helper k3_fit_config_match_security_state() added in arch/arm/mach-k3/ common.c. Each FIT configuration ends up with exactly one tifsstub at 0x9dc00000, so the overlap goes away from any static validator's perspective and no platform-specific runtime knowledge is needed to pick the right firmware.
Series ordering is intentional and bisectable. Patch 1 introduces the helper, migrates the TI EVMs, and leaves the runtime filter in place. Phytec phycore and toradex verdin boards still use their old single-config dtsi at this point, and the runtime filter continues to do the right thing for them in the meantime. Patch 2 migrates the phytec phycore-am62 SoMs. Patch 3 migrates the toradex Verdin AM62 modules; their previous board_fit_config_name_match() returned 0 unconditionally, which after the dtsi split would have selected the first listed configuration regardless of silicon and broken HS-SE parts, so this patch is also a latent-bug fix on top of the migration. Patch 4 drops the now-dead runtime filter.
Boot tested on AM625 SK GP silicon end-to-end through TFA, OP-TEE, A53 SPL, U-Boot proper, and Linux 6.5. The two "Skipping authentication on GP device" messages in the SPL banner confirm only the GP tifsstub variant is present in the selected FIT configuration; loading any HS variant on GP silicon would fail TIFS authentication before reaching that point. Building (R5 SPL + A53 SPL + U-Boot proper) was verified clean against this restructured series on am62x_evm, phycore_am62x, and verdin-am62 defconfigs.
Testing on HS-FS and HS-SE silicon would be very welcome; I do not have either part.
[1] https://lore.kernel.org/u-boot/[email protected]/
[2] https://github.com/open-source-firmware/flat-image-tree/issues/32
Aristo Chen (4):
arm: k3: select tifsstub via board_fit_config_name_match
board: phytec: phycore-am62: select tifsstub via FIT config
board: toradex: verdin-am62: select tifsstub via FIT config
arm: k3: drop redundant tifsstub runtime filter
arch/arm/dts/k3-am625-phycore-som-binman.dtsi | 42 ++++++++++--- arch/arm/dts/k3-am625-sk-binman.dtsi | 61 ++++++++++++++----- .../dts/k3-am625-verdin-wifi-dev-binman.dtsi | 42 ++++++++++--- arch/arm/dts/k3-am62a-phycore-som-binman.dtsi | 15 +++-- arch/arm/dts/k3-am62a-sk-binman.dtsi | 28 ++++++--- arch/arm/dts/k3-am62p-sk-binman.dtsi | 28 ++++++--- .../dts/k3-am62p5-verdin-wifi-dev-binman.dtsi | 15 +++-- arch/arm/mach-k3/common.c | 27 ++++++++ arch/arm/mach-k3/common.h | 10 --- arch/arm/mach-k3/include/mach/hardware.h | 11 ++++ arch/arm/mach-k3/r5/common.c | 14 +---- board/phytec/phycore_am62ax/phycore-am62ax.c | 8 +++ board/phytec/phycore_am62x/phycore-am62x.c | 8 +++ board/ti/am62ax/evm.c | 8 +++ board/ti/am62px/evm.c | 8 +++ board/ti/am62x/evm.c | 8 +++ board/toradex/verdin-am62/verdin-am62.c | 3 +- board/toradex/verdin-am62p/verdin-am62p.c | 3 +- 18 files changed, 251 insertions(+), 88 deletions(-)
--
2.43.0
PATCH 1/4 arm: k3: select tifsstub via board_fit_config_name_match
TI K3 AM62x/AM62Ax/AM62Px boards carry two or three mutually-exclusive tifsstub variants in their tispl.bin FIT images, all at the same load address. The existing approach loads every variant and then discards the wrong ones at runtime via a *p_size = 0 hack in board_fit_image_post_process(). Switch to selecting the appropriate FIT configuration up front via board_fit_config_name_match() so only the correct tifsstub is loaded in the first place.
board_fit_config_name_match() is invoked by the R5 SPL during FIT config selection. get_device_type() is a simple register read that is available at that point, so the security state can be determined early. The matching logic is factored into k3_fit_config_match_security_state() in arch/arm/mach-k3/common.c so it can be shared by any K3 board that wants this scheme. It matches configurations by a suffix appended to the description string:
-hs-se -> HS-SE (K3_DEVICE_TYPE_HS_SE) -hs-fs -> HS-FS (K3_DEVICE_TYPE_HS_FS) -gp -> GP (K3_DEVICE_TYPE_GP)
Configurations without a security-state suffix (e.g. u-boot.img) do not match and fall through to the DTS-specified default config naturally.
Each TI EVM board defines its board_fit_config_name_match() as a thin wrapper around the shared helper:
- board/ti/am62x/evm.c (AM625 SK: hs-se, hs-fs, gp) - board/ti/am62ax/evm.c (AM62A SK: hs-se, hs-fs, gp) - board/ti/am62px/evm.c (AM62P SK: hs-se, hs-fs, gp)
FIT configurations are split per security state in:
- arch/arm/dts/k3-am625-sk-binman.dtsi
(ti-falcon, ti-spl, ti-spl_unsigned: conf-hs-se/conf-hs-fs/conf-gp)
- arch/arm/dts/k3-am62a-sk-binman.dtsi
(ti-falcon, ti-spl: conf-hs-se/conf-hs-fs; no GP variant on AM62A)
- arch/arm/dts/k3-am62p-sk-binman.dtsi
(ti-falcon, ti-spl: conf-hs-se/conf-hs-fs; no GP variant on AM62P)
The runtime filter in board_fit_image_post_process() is intentionally left in place. It becomes redundant once every board using the AM62x family dtsi files migrates to per-state configurations. The dtsi for phytec phycore and toradex verdin boards is updated by separate patches in this series, and the now-redundant runtime filter is removed by the final patch in the series.
--- arch/arm/dts/k3-am625-sk-binman.dtsi | 61 ++++++++++++++++++------ arch/arm/dts/k3-am62a-sk-binman.dtsi | 28 +++++++---- arch/arm/dts/k3-am62p-sk-binman.dtsi | 28 +++++++---- arch/arm/mach-k3/common.c | 27 +++++++++++ arch/arm/mach-k3/common.h | 10 ---- arch/arm/mach-k3/include/mach/hardware.h | 11 +++++ board/ti/am62ax/evm.c | 8 ++++ board/ti/am62px/evm.c | 8 ++++ board/ti/am62x/evm.c | 8 ++++ 9 files changed, 146 insertions(+), 43 deletions(-)
arch/arm/dts/k3-am625-sk-binman.dtsi +46 -15
@@ -263,12 +263,21 @@ }; configurations { - default = "conf-0"; - conf-0 { - description = "k3-am625-sk-falcon"; + default = "conf-hs-fs"; + conf-hs-fs { + description = "k3-am625-sk-falcon-hs-fs"; + firmware = "atf"; + loadables = "tee", "tifsstub-fs", "dm"; + }; + conf-hs-se { + description = "k3-am625-sk-falcon-hs-se"; + firmware = "atf"; + loadables = "tee", "tifsstub-hs", "dm"; + }; + conf-gp { + description = "k3-am625-sk-falcon-gp"; firmware = "atf"; - loadables = "tee", "tifsstub-hs", "tifsstub-fs", - "tifsstub-gp", "dm"; + loadables = "tee", "tifsstub-gp", "dm"; }; }; };
@@ -376,13 +385,24 @@ }; configurations { - default = "conf-0"; + default = "conf-hs-fs"; - conf-0 { - description = "k3-am625-sk"; + conf-hs-fs { + description = "k3-am625-sk-hs-fs"; + firmware = "atf"; + loadables = "tee", "tifsstub-fs", "dm", "spl"; + fdt = "fdt-0"; + }; + conf-hs-se { + description = "k3-am625-sk-hs-se"; firmware = "atf"; - loadables = "tee", "tifsstub-hs", "tifsstub-fs", - "tifsstub-gp", "dm", "spl"; + loadables = "tee", "tifsstub-hs", "dm", "spl"; + fdt = "fdt-0"; + }; + conf-gp { + description = "k3-am625-sk-gp"; + firmware = "atf"; + loadables = "tee", "tifsstub-gp", "dm", "spl"; fdt = "fdt-0"; }; };
@@ -497,13 +517,24 @@ }; configurations { - default = "conf-0"; + default = "conf-hs-fs"; - conf-0 { - description = "k3-am625-sk"; + conf-hs-fs { + description = "k3-am625-sk-hs-fs"; + firmware = "atf"; + loadables = "tee", "tifsstub-fs", "dm", "spl"; + fdt = "fdt-0"; + }; + conf-hs-se { + description = "k3-am625-sk-hs-se"; + firmware = "atf"; + loadables = "tee", "tifsstub-hs", "dm", "spl"; + fdt = "fdt-0"; + }; + conf-gp { + description = "k3-am625-sk-gp"; firmware = "atf"; - loadables = "tee", "tifsstub-hs", "tifsstub-fs", - "tifsstub-gp", "dm", "spl"; + loadables = "tee", "tifsstub-gp", "dm", "spl"; fdt = "fdt-0"; }; };
arch/arm/dts/k3-am62a-sk-binman.dtsi +19 -9
@@ -185,11 +185,16 @@ }; configurations { - default = "conf-0"; - conf-0 { - description = "k3-am62a7-sk-falcon"; + default = "conf-hs-fs"; + conf-hs-fs { + description = "k3-am62a7-sk-falcon-hs-fs"; + firmware = "atf"; + loadables = "tee", "dm", "tifsstub-fs"; + }; + conf-hs-se { + description = "k3-am62a7-sk-falcon-hs-se"; firmware = "atf"; - loadables = "tee", "dm", "tifsstub-hs", "tifsstub-fs"; + loadables = "tee", "dm", "tifsstub-hs"; }; }; };
@@ -284,13 +289,18 @@ }; configurations { - default = "conf-0"; + default = "conf-hs-fs"; - ti_spl_conf_0: conf-0 { - description = "k3-am62a7-sk"; + ti_spl_conf_0: conf-hs-fs { + description = "k3-am62a7-sk-hs-fs"; + firmware = "atf"; + loadables = "tee", "dm", "spl", "tifsstub-fs"; + fdt = "fdt-0"; + }; + conf-hs-se { + description = "k3-am62a7-sk-hs-se"; firmware = "atf"; - loadables = "tee", "dm", "spl", - "tifsstub-hs", "tifsstub-fs"; + loadables = "tee", "dm", "spl", "tifsstub-hs"; fdt = "fdt-0"; }; };
arch/arm/dts/k3-am62p-sk-binman.dtsi +19 -9
@@ -206,11 +206,16 @@ }; configurations { - default = "conf-0"; - conf-0 { - description = "k3-am62p5-sk-falcon"; + default = "conf-hs-fs"; + conf-hs-fs { + description = "k3-am62p5-sk-falcon-hs-fs"; firmware = "atf"; - loadables = "tee", "dm", "tifsstub-hs", "tifsstub-fs"; + loadables = "tee", "dm", "tifsstub-fs"; + }; + conf-hs-se { + description = "k3-am62p5-sk-falcon-hs-se"; + firmware = "atf"; + loadables = "tee", "dm", "tifsstub-hs"; }; }; };
@@ -309,13 +314,18 @@ }; configurations { - default = "conf-0"; + default = "conf-hs-fs"; - conf-0 { - description = "k3-am62px-sk"; + conf-hs-fs { + description = "k3-am62px-sk-hs-fs"; + firmware = "atf"; + loadables = "tee", "dm", "spl", "tifsstub-fs"; + fdt = "fdt-0"; + }; + conf-hs-se { + description = "k3-am62px-sk-hs-se"; firmware = "atf"; - loadables = "tee", "dm", "spl", - "tifsstub-hs", "tifsstub-fs"; + loadables = "tee", "dm", "spl", "tifsstub-hs"; fdt = "fdt-0"; }; };
arch/arm/mach-k3/common.c +27 -0
@@ -191,6 +191,33 @@ enum k3_device_type get_device_type(void) } } +int k3_fit_config_match_security_state (const char *name) +{ +const char *suffix; +size_t name_len, suffix_len; + +switch (get_device_type ()) { +case K3_DEVICE_TYPE_HS_SE : + suffix ="-hs-se" ; +break ; +case K3_DEVICE_TYPE_HS_FS : + suffix ="-hs-fs" ; +break ; +case K3_DEVICE_TYPE_GP : + suffix ="-gp" ; +break ; +default : +return -EINVAL ; + } + + name_len =strlen (name); + suffix_len =strlen (suffix); +if (name_len < suffix_len) +return -EINVAL ; + +return strcmp (name + name_len - suffix_len, suffix) ? -EINVAL :0 ; +} +#if defined(CONFIG_DISPLAY_CPUINFO )static const char *get_device_type_name (void ) {
arch/arm/mach-k3/common.h +0 -10
@@ -32,15 +32,6 @@ enum k3_firewall_region_type { K3_FIREWALL_REGION_BACKGROUND }; -enum k3_device_type { -K3_DEVICE_TYPE_BAD , -K3_DEVICE_TYPE_GP , -K3_DEVICE_TYPE_TEST , -K3_DEVICE_TYPE_EMU , -K3_DEVICE_TYPE_HS_FS , -K3_DEVICE_TYPE_HS_SE , -}; -void setup_k3_mpu_regions (void );int early_console_init (void );void disable_linefill_optimization (void );
@@ -55,7 +46,6 @@ const struct k3_speed_grade_map *k3_get_speed_grade_map(void);void k3_fix_rproc_clock (const char *path);void mmr_unlock (uintptr_t base,u32 partition);bool is_rom_loaded_sysfw (struct rom_extended_boot_data *data); -enum k3_device_type get_device_type (void );struct ti_sci_handle *get_ti_sci_handle (void );void do_board_detect (void );void ti_secure_image_check_binary (void **p_image,size_t *p_size);
arch/arm/mach-k3/include/mach/hardware.h +11 -0
@@ -124,8 +124,19 @@ struct rom_extended_boot_data {u32 num_components; }; +enum k3_device_type { +K3_DEVICE_TYPE_BAD , +K3_DEVICE_TYPE_GP , +K3_DEVICE_TYPE_TEST , +K3_DEVICE_TYPE_EMU , +K3_DEVICE_TYPE_HS_FS , +K3_DEVICE_TYPE_HS_SE , +}; +u32 get_boot_device (void );const char *get_reset_reason (void ); +enum k3_device_type get_device_type (void ); +int k3_fit_config_match_security_state (const char *name);#define writel_verify (val, addr) \ do { \
board/ti/am62ax/evm.c +8 -0
@@ -6,6 +6,7 @@* */ +#include <image.h> #include <asm/arch/hardware.h> #include <asm/io.h> #include <dm/uclass.h>
@@ -17,6 +18,13 @@#include "../common/fdt_ops.h" #include "../common/k3_32k_lfosc.h" +#if defined(CONFIG_SPL_LOAD_FIT ) +int board_fit_config_name_match (const char *name) +{ +return k3_fit_config_match_security_state (name); +} +#endif +#if defined(CONFIG_XPL_BUILD )void spl_perform_board_fixups (struct spl_image_info *spl_image) {
board/ti/am62px/evm.c +8 -0
@@ -7,6 +7,7 @@*/ #include <efi_loader.h> +#include <image.h> #include <asm/arch/hardware.h> #include <asm/io.h> #include <cpu_func.h>
@@ -43,6 +44,13 @@ struct efi_capsule_update_info update_info = { .images = fw_images, }; +#if defined(CONFIG_SPL_LOAD_FIT ) +int board_fit_config_name_match (const char *name) +{ +return k3_fit_config_match_security_state (name); +} +#endif +#if IS_ENABLED (CONFIG_SPL_BUILD )void spl_board_init (void ) {
board/ti/am62x/evm.c +8 -0
@@ -18,6 +18,7 @@#include <fdt_support.h> #include <fdt_simplefb.h> #include <asm/io.h> +#include <image.h> #include <asm/arch/hardware.h> #include <dm/uclass.h> #include <asm/arch/k3-ddr.h>
@@ -135,6 +136,13 @@ int board_late_init(void) }#endif +#if defined(CONFIG_SPL_LOAD_FIT ) +int board_fit_config_name_match (const char *name) +{ +return k3_fit_config_match_security_state (name); +} +#endif +#if defined(CONFIG_XPL_BUILD )void spl_board_init (void ) {
Signature · 1 line
2.43.0
Re: [PATCH v1 1/4] arm: k3: select tifsstub via board_fit_config_name_match
Hi Aristo,
Quoted 38 lines · Aristo Chen
TI K3 AM62x/AM62Ax/AM62Px boards carry two or three mutually-exclusive tifsstub variants in their tispl.bin FIT images, all at the same load address. The existing approach loads every variant and then discards the wrong ones at runtime via a
*p_size= 0 hack inboard_fit_image_post_process(). Switch to selecting the appropriate FIT configuration up front viaboard_fit_config_name_match()so only the correct tifsstub is loaded in the first place.
board_fit_config_name_match()is invoked by the R5 SPL during FIT config selection.get_device_type()is a simple register read that is available at that point, so the security state can be determined early. The matching logic is factored intok3_fit_config_match_security_state()inarch/arm/mach-k3/common.cso it can be shared by any K3 board that wants this scheme. It matches configurations by a suffix appended to the description string:-hs-se -> HS-SE (K3_DEVICE_TYPE_HS_SE) -hs-fs -> HS-FS (K3_DEVICE_TYPE_HS_FS) -gp -> GP (K3_DEVICE_TYPE_GP)Configurations without a security-state suffix (e.g. u-boot.img) do not match and fall through to the DTS-specified default config naturally.
Each TI EVM board defines its
board_fit_config_name_match()as a thin wrapper around the shared helper:- board/ti/am62x/evm.c (AM625 SK: hs-se, hs-fs, gp) - board/ti/am62ax/evm.c (AM62A SK: hs-se, hs-fs, gp) - board/ti/am62px/evm.c (AM62P SK: hs-se, hs-fs, gp)FIT configurations are split per security state in:
-arch/arm/dts/k3-am625-sk-binman.dtsi
(ti-falcon, ti-spl, ti-spl_unsigned: conf-hs-se/conf-hs-fs/conf-gp)
-arch/arm/dts/k3-am62a-sk-binman.dtsi
(ti-falcon, ti-spl: conf-hs-se/conf-hs-fs; no GP variant on AM62A)
-arch/arm/dts/k3-am62p-sk-binman.dtsi
(ti-falcon, ti-spl: conf-hs-se/conf-hs-fs; no GP variant on AM62P)
Quoted 8 lines
The runtime filter in
board_fit_image_post_process()is intentionally left in place. It becomes redundant once every board using the AM62x family dtsi files migrates to per-state configurations. The dtsi for phytec phycore and toradex verdin boards is updated by separate patches in this series, and the now-redundant runtime filter is removed by the final patch in the series.Signed-off-by Aristo Chen <[email protected]>
the patch looks good to me and makes sense to me, but I don't have a setup with TIFS stubs to test, therefore only
Quoted 12 lines
--- arch/arm/dts/k3-am625-sk-binman.dtsi | 61 ++++++++++++++++++------ arch/arm/dts/k3-am62a-sk-binman.dtsi | 28 +++++++---- arch/arm/dts/k3-am62p-sk-binman.dtsi | 28 +++++++---- arch/arm/mach-k3/common.c | 27 +++++++++++ arch/arm/mach-k3/common.h | 10 ---- arch/arm/mach-k3/include/mach/hardware.h | 11 +++++ board/ti/am62ax/evm.c | 8 ++++ board/ti/am62px/evm.c | 8 ++++ board/ti/am62x/evm.c | 8 ++++ 9 files changed, 146 insertions(+), 43 deletions(-)
Signature · 3 lines
Alexander Sverdlin Siemens AG www.siemens.com
Akashdeep Kaur
Tested-byRe: [PATCH v1 1/4] arm: k3: select tifsstub via board_fit_config_name_match
Hi Aristo,
Quoted 48 lines · Alexander
Hi Aristo,
Quoted 45 lines · Aristo Chen
TI K3 AM62x/AM62Ax/AM62Px boards carry two or three mutually-exclusive tifsstub variants in their tispl.bin FIT images, all at the same load address. The existing approach loads every variant and then discards the wrong ones at runtime via a
*p_size= 0 hack inboard_fit_image_post_process(). Switch to selecting the appropriate FIT configuration up front viaboard_fit_config_name_match()so only the correct tifsstub is loaded in the first place.
board_fit_config_name_match()is invoked by the R5 SPL during FIT config selection.get_device_type()is a simple register read that is available at that point, so the security state can be determined early. The matching logic is factored intok3_fit_config_match_security_state()inarch/arm/mach-k3/common.cso it can be shared by any K3 board that wants this scheme. It matches configurations by a suffix appended to the description string:-hs-se -> HS-SE (K3_DEVICE_TYPE_HS_SE) -hs-fs -> HS-FS (K3_DEVICE_TYPE_HS_FS) -gp -> GP (K3_DEVICE_TYPE_GP)Configurations without a security-state suffix (e.g. u-boot.img) do not match and fall through to the DTS-specified default config naturally.
Each TI EVM board defines its
board_fit_config_name_match()as a thin wrapper around the shared helper:- board/ti/am62x/evm.c (AM625 SK: hs-se, hs-fs, gp) - board/ti/am62ax/evm.c (AM62A SK: hs-se, hs-fs, gp) - board/ti/am62px/evm.c (AM62P SK: hs-se, hs-fs, gp)FIT configurations are split per security state in:
-arch/arm/dts/k3-am625-sk-binman.dtsi
(ti-falcon, ti-spl, ti-spl_unsigned: conf-hs-se/conf-hs-fs/conf-gp)
-arch/arm/dts/k3-am62a-sk-binman.dtsi
(ti-falcon, ti-spl: conf-hs-se/conf-hs-fs; no GP variant on AM62A)
-arch/arm/dts/k3-am62p-sk-binman.dtsi
(ti-falcon, ti-spl: conf-hs-se/conf-hs-fs; no GP variant on AM62P)The runtime filter in
board_fit_image_post_process()is intentionally left in place. It becomes redundant once every board using the AM62x family dtsi files migrates to per-state configurations. The dtsi for phytec phycore and toradex verdin boards is updated by separate patches in this series, and the now-redundant runtime filter is removed by the final patch in the series.
Quoted 20 lines
Quoted 1 line
Signed-off-by Aristo Chen <[email protected]>the patch looks good to me and makes sense to me, but I don't have a setup with TIFS stubs to test, therefore only
Reviewed-by Alexander Sverdlin <[email protected]>Quoted 12 lines
--- arch/arm/dts/k3-am625-sk-binman.dtsi | 61 ++++++++++++++++++------ arch/arm/dts/k3-am62a-sk-binman.dtsi | 28 +++++++---- arch/arm/dts/k3-am62p-sk-binman.dtsi | 28 +++++++---- arch/arm/mach-k3/common.c | 27 +++++++++++ arch/arm/mach-k3/common.h | 10 ---- arch/arm/mach-k3/include/mach/hardware.h | 11 +++++ board/ti/am62ax/evm.c | 8 ++++ board/ti/am62px/evm.c | 8 ++++ board/ti/am62x/evm.c | 8 ++++ 9 files changed, 146 insertions(+), 43 deletions(-)
Tested these changes and patch 4 changes to be working on AM62PX HS-FS device and AM62X HS-SE device. Tested deep sleep suspend resume as if stub is not loaded properly, the resume will fail.
Re: [PATCH v1 1/4] arm: k3: select tifsstub via board_fit_config_name_match
In reply to Aristo ChenQuoted 9 lines · Aristo Chen
TI K3 AM62x/AM62Ax/AM62Px boards carry two or three mutually-exclusive tifsstub variants in their tispl.bin FIT images, all at the same load address. The existing approach loads every variant and then discards the wrong ones at runtime via a
*p_size= 0 hack inboard_fit_image_post_process(). Switch to selecting the appropriate FIT configuration up front viaboard_fit_config_name_match()so only the correct tifsstub is loaded in the first place.[...]
Signature · 1 line
Neha Malcom Francis <[email protected]>
Re: [PATCH v1 1/4] arm: k3: select tifsstub via board_fit_config_name_match
In reply to Aristo Chenarch/arm/mach-k3/common.c enum k3_device_type get_device_type(void) · line 218
Quoted 12 lines · Aristo Chen
arch/arm/mach-k3/common.c +0
-0@@ -191,6 +191,33 @@ enum k3_device_type get_device_type(void)[ ... skip 22 lines ... ]
arch/arm/mach-k3/common.c +6
-0+ name_len =strlen (name); + suffix_len =strlen (suffix); +if (name_len < suffix_len) +return -EINVAL ; + +return strcmp (name + name_len - suffix_len, suffix) ? -EINVAL :0 ;
Since we already know suffix_len, a strncmp might be better here. Also the ternary is redundant since -EINVAL would still mean the 'invalid' configuration is selected.
arch/arm/mach-k3/common.h const struct k3_speed_grade_map *k3_get_speed_grade_map(void); · line 58
Quoted 10 lines
arch/arm/mach-k3/common.h +0
-1@@ -55,7 +46,6 @@ const struct k3_speed_grade_map *k3_get_speed_grade_map(void);void k3_fix_rproc_clock (const char *path);void mmr_unlock (uintptr_t base,u32 partition);bool is_rom_loaded_sysfw (struct rom_extended_boot_data *data); -enum k3_device_type get_device_type (void );
Why the move of this function from common.h to hardware.h? This header should be accessible to all of K3 anyways.
board/ti/am62x/evm.c int board_late_init(void) · line 139
Quoted 10 lines
board/ti/am62x/evm.c +1
-0@@ -135,6 +136,13 @@ int board_late_init(void) }#endif +#if defined(CONFIG_SPL_LOAD_FIT )
There's no need for the #if guard here, SPL_LOAD_FIT is enabled for all ARCH_K3 and if disabled LTO will optimize out the function anyways at build time.
Signature · 1 line
Anshul Dalal <[email protected]>
Re: [PATCH v1 1/4] arm: k3: select tifsstub via board_fit_config_name_match
Hi Anshul,
Quoted 18 lines · Anshul Dalal
arch/arm/mach-k3/common.c enum k3_device_type get_device_type(void) · line 218
Quoted 12 lines · Aristo Chen
arch/arm/mach-k3/common.c +0
-0@@ -191,6 +191,33 @@ enum k3_device_type get_device_type(void)[ ... skip 22 lines ... ]
arch/arm/mach-k3/common.c +6
-0+ name_len =strlen (name); + suffix_len =strlen (suffix); +if (name_len < suffix_len) +return -EINVAL ; + +return strcmp (name + name_len - suffix_len, suffix) ? -EINVAL :0 ;Since we already know
suffix_len, a strncmp might be better here. Also the ternary is redundant since-EINVALwould still mean the 'invalid' configuration is selected.
Will fix it in V2.
Quoted 14 lines
arch/arm/mach-k3/common.h const struct k3_speed_grade_map *k3_get_speed_grade_map(void); · line 58
Quoted 11 lines
arch/arm/mach-k3/common.h +0
-1@@ -55,7 +46,6 @@ const struct k3_speed_grade_map *k3_get_speed_grade_map(void);void k3_fix_rproc_clock (const char *path);void mmr_unlock (uintptr_t base,u32 partition);bool is_rom_loaded_sysfw (struct rom_extended_boot_data *data); -enum k3_device_type get_device_type (void );Why the move of this function from
common.htohardware.h? This header should be accessible to all of K3 anyways.
If I understand correctly, arch/arm/mach-k3/common.h is currently mach-k3-internal. It is not in the include search path for board files; it is pulled in by .c files inside mach-k3/ via relative includes (#include "common.h" or #include "../common.h").
Board files like board/ti/am62x/evm.c include the K3 SoC header via <asm/arch/hardware.h>, which maps to arch/arm/mach-k3/include/mach/hardware.h. They have no direct path to arch/arm/mach-k3/common.h today.
For the board_fit_config_name_match() wrappers in this patch to call get_device_type(), the declaration needs to live somewhere boards can reach. The two options I considered were:
1. Move enum k3_device_type and get_device_type() to hardware.h
(what this patch does). Touches two files.
2. Relocate common.h into arch/arm/mach-k3/include/mach/ to make it
public, then update every relative include inside mach-k3/. Touches every mach-k3/ source file.
I went with (1) as the smaller change. Happy to revisit if you would prefer (2), but it felt out of scope for this series.
Quoted 10 lines
Quoted 10 lines
board/ti/am62x/evm.c +0
-0@@ -135,6 +136,13 @@ int board_late_init(void) }#endif
Quoted 4 lines
board/ti/am62x/evm.c int board_late_init(void) · line 139
Quoted 1 line
board/ti/am62x/evm.c +1
-0+#if defined(CONFIG_SPL_LOAD_FIT )There's no need for the #if guard here,
SPL_LOAD_FITis enabled for allARCH_K3and if disabled LTO will optimize out the function anyways at build time.
Will remove it in V2
Quoted 3 lines
--
Anshul Dalal <[email protected]>
Best regards,
Aristo
Re: [PATCH v1 1/4] arm: k3: select tifsstub via board_fit_config_name_match
Quoted 1 line · Aristo Chen
On Tue, Jun 23, 2026 at 2:18 PM Anshul Dalal <[email protected]> wrote:
[snip]
Quoted 30 lines
Quoted 4 lines
Quoted 4 lines
arch/arm/mach-k3/common.h +0
-0Quoted 8 lines
arch/arm/mach-k3/common.h const struct k3_speed_grade_map *k3_get_speed_grade_map(void); · line 58
Quoted 5 lines
arch/arm/mach-k3/common.h +0
-1@@ -55,7 +46,6 @@ const struct k3_speed_grade_map *k3_get_speed_grade_map(void);void k3_fix_rproc_clock (const char *path);void mmr_unlock (uintptr_t base,u32 partition);bool is_rom_loaded_sysfw (struct rom_extended_boot_data *data); -enum k3_device_type get_device_type (void );Why the move of this function from
common.htohardware.h? This header should be accessible to all of K3 anyways.If I understand correctly,
arch/arm/mach-k3/common.his currently mach-k3-internal. It is not in the include search path for board files; it is pulled in by .c files inside mach-k3/ via relative includes (#include "common.h" or #include "../common.h").Board files like
board/ti/am62x/evm.cinclude the K3 SoC header via <asm/arch/hardware.h>, which maps toarch/arm/mach-k3/include/mach/hardware.h. They have no direct path toarch/arm/mach-k3/common.htoday.For the
board_fit_config_name_match()wrappers in this patch to callget_device_type(), the declaration needs to live somewhere boards can reach. The two options I considered were:1. Move enum
k3_device_typeandget_device_type()tohardware.h
(what this patch does). Touches two files.
Quoted 7 lines
2. Relocate
common.hintoarch/arm/mach-k3/include/mach/to make it
public, then update every relative include inside mach-k3/. Touches every mach-k3/ source file.I went with (1) as the smaller change. Happy to revisit if you would prefer (2), but it felt out of scope for this series.
I can take a jab at refactoring things at a later point. But for the time being, what you have done with option #1 is alright.
PATCH 2/4 board: phytec: phycore-am62: select tifsstub via FIT config
In reply to Aristo ChenUse the k3_fit_config_match_security_state() helper introduced in the earlier "arm: k3: select tifsstub via board_fit_config_name_match" patch to pick the right tifsstub variant on phycore AM62x and AM62Ax SoMs at FIT config selection time.
The k3-am625-phycore-som-binman.dtsi and k3-am62a-phycore-som-binman.dtsi FIT images are split into per-security-state configurations (conf-hs-se, conf-hs-fs), and board_fit_config_name_match() in each phycore board file forwards to the shared K3 helper.
--- arch/arm/dts/k3-am625-phycore-som-binman.dtsi | 42 ++++++++++++++----- arch/arm/dts/k3-am62a-phycore-som-binman.dtsi | 15 ++++--- board/phytec/phycore_am62ax/phycore-am62ax.c | 8 ++++ board/phytec/phycore_am62x/phycore-am62x.c | 8 ++++ 4 files changed, 58 insertions(+), 15 deletions(-)
arch/arm/dts/k3-am625-phycore-som-binman.dtsi +32 -10
@@ -309,13 +309,24 @@ }; configurations { - default = "conf-0"; + default = "conf-hs-fs"; - conf-0 { - description = "k3-am625-phyboard-lyra-rdk"; + conf-hs-fs { + description = "k3-am625-phyboard-lyra-rdk-hs-fs"; + firmware = "atf"; + loadables = "tee", "tifsstub-fs", "dm", "spl"; + fdt = "fdt-0"; + }; + conf-hs-se { + description = "k3-am625-phyboard-lyra-rdk-hs-se"; + firmware = "atf"; + loadables = "tee", "tifsstub-hs", "dm", "spl"; + fdt = "fdt-0"; + }; + conf-gp { + description = "k3-am625-phyboard-lyra-rdk-gp"; firmware = "atf"; - loadables = "tee", "tifsstub-hs", "tifsstub-fs", - "tifsstub-gp", "dm", "spl"; + loadables = "tee", "tifsstub-gp", "dm", "spl"; fdt = "fdt-0"; }; };
@@ -547,13 +558,24 @@ }; configurations { - default = "conf-0"; + default = "conf-hs-fs"; - conf-0 { - description = "k3-am625-phyboard-lyra-rdk"; + conf-hs-fs { + description = "k3-am625-phyboard-lyra-rdk-hs-fs"; + firmware = "atf"; + loadables = "tee", "tifsstub-fs", "dm", "spl"; + fdt = "fdt-0"; + }; + conf-hs-se { + description = "k3-am625-phyboard-lyra-rdk-hs-se"; + firmware = "atf"; + loadables = "tee", "tifsstub-hs", "dm", "spl"; + fdt = "fdt-0"; + }; + conf-gp { + description = "k3-am625-phyboard-lyra-rdk-gp"; firmware = "atf"; - loadables = "tee", "tifsstub-hs", "tifsstub-fs", - "tifsstub-gp", "dm", "spl"; + loadables = "tee", "tifsstub-gp", "dm", "spl"; fdt = "fdt-0"; }; };
arch/arm/dts/k3-am62a-phycore-som-binman.dtsi +10 -5
@@ -247,13 +247,18 @@ }; configurations { - default = "conf-0"; + default = "conf-hs-fs"; - conf-0 { - description = "k3-am62a7-phyboard-lyra-rdk"; + conf-hs-fs { + description = "k3-am62a7-phyboard-lyra-rdk-hs-fs"; + firmware = "atf"; + loadables = "tee", "dm", "spl", "tifsstub-fs"; + fdt = "fdt-0"; + }; + conf-hs-se { + description = "k3-am62a7-phyboard-lyra-rdk-hs-se"; firmware = "atf"; - loadables = "tee", "dm", "spl", - "tifsstub-hs", "tifsstub-fs"; + loadables = "tee", "dm", "spl", "tifsstub-hs"; fdt = "fdt-0"; }; };
board/phytec/phycore_am62ax/phycore-am62ax.c +8 -0
@@ -8,6 +8,7 @@#include <asm/io.h> #include <spl.h> #include <fdt_support.h> +#include <image.h> #include "../common/am6_som_detection.h"
@@ -57,3 +58,10 @@ void spl_board_init(void) dram_init_banksize(); }#endif + +#if defined(CONFIG_SPL_LOAD_FIT ) +int board_fit_config_name_match (const char *name) +{ +return k3_fit_config_match_security_state (name); +} +#endif
board/phytec/phycore_am62x/phycore-am62x.c +8 -0
@@ -9,6 +9,7 @@#include <spl.h> #include <asm/arch/k3-ddr.h> #include <fdt_support.h> +#include <image.h> #include "phycore-ddr-data.h" #include "../common/k3/k3_ddrss_patch.h"
@@ -237,3 +238,10 @@ void spl_board_init(void) MCU_CTRL_DEVICE_CLKOUT_32K_CTRL); }#endif + +#if defined(CONFIG_SPL_LOAD_FIT ) +int board_fit_config_name_match (const char *name) +{ +return k3_fit_config_match_security_state (name); +} +#endif
Signature · 1 line
2.43.0
PATCH 3/4 board: toradex: verdin-am62: select tifsstub via FIT config
In reply to Aristo ChenUse the k3_fit_config_match_security_state() helper introduced in the earlier "arm: k3: select tifsstub via board_fit_config_name_match" patch to pick the right tifsstub variant on Verdin AM62 and AM62P SoMs at FIT config selection time.
The k3-am625-verdin-wifi-dev-binman.dtsi and k3-am62p5-verdin-wifi-dev-binman.dtsi FIT images are split into per-security-state configurations (conf-hs-se, conf-hs-fs), and board_fit_config_name_match() in each verdin board file forwards to the shared K3 helper. The previous implementation returned 0 unconditionally which matched the first listed configuration regardless of the actual silicon, which after the dtsi split would load the wrong tifsstub variant on HS-SE parts.
--- .../dts/k3-am625-verdin-wifi-dev-binman.dtsi | 42 ++++++++++++++----- .../dts/k3-am62p5-verdin-wifi-dev-binman.dtsi | 15 ++++--- board/toradex/verdin-am62/verdin-am62.c | 3 +- board/toradex/verdin-am62p/verdin-am62p.c | 3 +- 4 files changed, 46 insertions(+), 17 deletions(-)
arch/arm/dts/k3-am625-verdin-wifi-dev-binman.dtsi +32 -10
@@ -295,13 +295,24 @@ }; configurations { - default = "conf-0"; + default = "conf-hs-fs"; - conf-0 { - description = "k3-am625-verdin-wifi-dev"; + conf-hs-fs { + description = "k3-am625-verdin-wifi-dev-hs-fs"; + firmware = "atf"; + loadables = "tee", "tifsstub-fs", "dm", "spl"; + fdt = "fdt-0"; + }; + conf-hs-se { + description = "k3-am625-verdin-wifi-dev-hs-se"; + firmware = "atf"; + loadables = "tee", "tifsstub-hs", "dm", "spl"; + fdt = "fdt-0"; + }; + conf-gp { + description = "k3-am625-verdin-wifi-dev-gp"; firmware = "atf"; - loadables = "tee", "tifsstub-hs", "tifsstub-fs", - "tifsstub-gp", "dm", "spl"; + loadables = "tee", "tifsstub-gp", "dm", "spl"; fdt = "fdt-0"; }; };
@@ -414,13 +425,24 @@ }; configurations { - default = "conf-0"; + default = "conf-hs-fs"; - conf-0 { - description = "k3-am625-verdin-wifi-dev"; + conf-hs-fs { + description = "k3-am625-verdin-wifi-dev-hs-fs"; + firmware = "atf"; + loadables = "tee", "tifsstub-fs", "dm", "spl"; + fdt = "fdt-0"; + }; + conf-hs-se { + description = "k3-am625-verdin-wifi-dev-hs-se"; + firmware = "atf"; + loadables = "tee", "tifsstub-hs", "dm", "spl"; + fdt = "fdt-0"; + }; + conf-gp { + description = "k3-am625-verdin-wifi-dev-gp"; firmware = "atf"; - loadables = "tee", "tifsstub-hs", "tifsstub-fs", - "tifsstub-gp", "dm", "spl"; + loadables = "tee", "tifsstub-gp", "dm", "spl"; fdt = "fdt-0"; }; };
arch/arm/dts/k3-am62p5-verdin-wifi-dev-binman.dtsi +10 -5
@@ -248,13 +248,18 @@ }; configurations { - default = "conf-0"; + default = "conf-hs-fs"; - conf-0 { - description = "k3-am62p5-verdin-wifi-dev"; + conf-hs-fs { + description = "k3-am62p5-verdin-wifi-dev-hs-fs"; + firmware = "atf"; + loadables = "tee", "tifsstub-fs", "dm", "spl"; + fdt = "fdt-0"; + }; + conf-hs-se { + description = "k3-am62p5-verdin-wifi-dev-hs-se"; firmware = "atf"; - loadables = "tee", "tifsstub-hs", "tifsstub-fs", - "dm", "spl"; + loadables = "tee", "tifsstub-hs", "dm", "spl"; fdt = "fdt-0"; }; };
board/toradex/verdin-am62/verdin-am62.c +2 -1
@@ -12,6 +12,7 @@#include <dm/uclass.h> #include <env.h> #include <fdt_support.h> +#include <image.h> #include <init.h> #include <k3-ddrss.h> #include <spl.h>
@@ -60,7 +61,7 @@ phys_addr_t board_get_usable_ram_top(phys_size_t total_size)#if defined(CONFIG_SPL_LOAD_FIT )int board_fit_config_name_match (const char *name) { -return 0 ; +return k3_fit_config_match_security_state (name); }#endif
board/toradex/verdin-am62p/verdin-am62p.c +2 -1
@@ -14,6 +14,7 @@#include <dm/uclass.h> #include <env.h> #include <fdt_support.h> +#include <image.h> #include <init.h> #include <k3-ddrss.h> #include <spl.h>
@@ -86,7 +87,7 @@ int dram_init_banksize(void)#if IS_ENABLED (CONFIG_SPL_LOAD_FIT )int board_fit_config_name_match (const char *name) { -return 0 ; +return k3_fit_config_match_security_state (name); }#endif
Signature · 1 line
2.43.0
PATCH 4/4 arm: k3: drop redundant tifsstub runtime filter
In reply to Aristo ChenWith all AM62x family boards (TI EVMs, phytec phycore, toradex verdin) now using per-security-state FIT configurations and selecting the right one via board_fit_config_name_match(), the runtime filter in board_fit_image_post_process() that zero'd out *p_size for the wrong tifsstub variant is no longer reached. Only one tifsstub variant is present in the selected FIT configuration, and it is always the correct one for the current silicon.
Drop the filter so board_fit_image_post_process() simply debug-logs the variant name and returns.
--- arch/arm/mach-k3/r5/common.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-)
arch/arm/mach-k3/r5/common.c +1 -13
@@ -348,19 +348,7 @@ void board_fit_image_post_process(const void *fit, int node, void **p_image, }if (i <IMAGE_AMT && i >IMAGE_ID_DM_FW ) { -int device_type =get_device_type (); - -if ((device_type ==K3_DEVICE_TYPE_HS_SE && -strcmp (os,"tifsstub-hs" )) || - (device_type ==K3_DEVICE_TYPE_HS_FS && -strcmp (os,"tifsstub-fs" )) || - (device_type ==K3_DEVICE_TYPE_GP && -strcmp (os,"tifsstub-gp" ))) { - *p_size =0 ; - }else { -debug ("tifsstub-type: %s\n" , os); - } - +debug ("tifsstub-type: %s\n" , os);return ; }
Signature · 1 line
2.43.0
Re: [PATCH v1 4/4] arm: k3: drop redundant tifsstub runtime filter
Quoted 9 lines · Aristo Chen
With all AM62x family boards (TI EVMs, phytec phycore, toradex verdin) now using per-security-state FIT configurations and selecting the right one via
board_fit_config_name_match(), the runtime filter inboard_fit_image_post_process()that zero'd out*p_sizefor the wrong tifsstub variant is no longer reached. Only one tifsstub variant is present in the selected FIT configuration, and it is always the correct one for the current silicon.[...]
Signature · 1 line
Neha Malcom Francis <[email protected]>
Re: [PATCH v1 4/4] arm: k3: drop redundant tifsstub runtime filter
In reply to Aristo ChenQuoted 9 lines · Aristo Chen
With all AM62x family boards (TI EVMs, phytec phycore, toradex verdin) now using per-security-state FIT configurations and selecting the right one via
board_fit_config_name_match(), the runtime filter inboard_fit_image_post_process()that zero'd out*p_sizefor the wrong tifsstub variant is no longer reached. Only one tifsstub variant is present in the selected FIT configuration, and it is always the correct one for the current silicon.[...]
Signature · 1 line
Anshul Dalal <[email protected]>
Quoted 7 lines · Aristo Chen
[...]
Testing on HS-FS and HS-SE silicon would be very welcome; I do not have either part.
[1] https://lore.kernel.org/u-boot/[email protected]/
[2] https://github.com/open-source-firmware/flat-image-tree/issues/32
Hi Aristo,
Sorry for the belated review, overall the patch series looks good to me but I have added a few minor comments in the following e-mails.
Signature · 1 line
Anshul Dalal <[email protected]>
v2 cover arm: k3: replace tifsstub runtime filter with per-state FIT configurations
In reply to Aristo ChenThe AM62x family (TI EVMs, phytec phycore, toradex verdin) ships two or three mutually-exclusive tifsstub variants per tispl.bin FIT image (tifsstub-hs, tifsstub-fs, tifsstub-gp), all assigned the same load address 0x9dc00000. The current platform code loads every variant and discards the wrong ones at runtime by zeroing *p_size in board_fit_image_post_process() (arch/arm/mach-k3/r5/common.c).
This runtime-filter approach has become a friction point. An earlier attempt to add FIT-image load-address overlap detection to mkimage flagged the shared 0x9dc00000 as an apparent conflict, and the workaround in that series was to shift each tifsstub by 64KB increments. Bryan Brattlof reviewed that change at the time [1] and pointed out that the real semantics are "load one of three at runtime", and that moving the binaries was not necessarily safe given downstream IPC assumptions about the fixed load address. The series was ultimately reverted upstream, which leaves the underlying question open: any future static FIT validator needs a way to understand that these three images do not actually collide. The same point is being discussed at the spec level in flat-image-tree issue #32 [2], where a "mutually-exclusive-group" property has been floated to express runtime-resolved overlaps to static tooling.
This series fixes the problem structurally without moving any binaries and without a spec extension. Each board's binman dtsi is updated so the tispl.bin FIT carries one configuration per security state (conf-hs-se, conf-hs-fs, conf-gp), each containing only the matching tifsstub. board_fit_config_name_match() in each affected board reads the SoC security state via get_device_type() and selects the correct configuration up front, via a shared helper k3_fit_config_match_security_state() added in arch/arm/mach-k3/ common.c. Each FIT configuration ends up with exactly one tifsstub at 0x9dc00000, so the overlap goes away from any static validator's perspective and no platform-specific runtime knowledge is needed to pick the right firmware.
Series ordering is intentional and bisectable. Patch 1 introduces the helper, migrates the TI EVMs, and leaves the runtime filter in place. Phytec phycore and toradex verdin boards still use their old single-config dtsi at this point, and the runtime filter continues to do the right thing for them in the meantime. Patch 2 migrates the phytec phycore-am62 SoMs. Patch 3 migrates the toradex Verdin AM62 modules; their previous board_fit_config_name_match() returned 0 unconditionally, which after the dtsi split would have selected the first listed configuration regardless of silicon and broken HS-SE parts, so this patch is also a latent-bug fix on top of the migration. Patch 4 drops the now-dead runtime filter.
Changes since v1, all addressing review feedback from Anshul Dalal:
1. Patch 1: use strncmp() in k3_fit_config_match_security_state() instead of strcmp() with a redundant ternary, since the suffix length is already known.
2. Patches 1, 2 and 3: drop the CONFIG_SPL_LOAD_FIT #if guard around board_fit_config_name_match() on the TI EVM, phycore and verdin boards. SPL_LOAD_FIT is always selected on ARCH_K3 and LTO drops the function in any build that does not use it.
3. The move of enum k3_device_type and get_device_type() from arch/arm/mach-k3/common.h to arch/arm/mach-k3/include/mach/ hardware.h in patch 1 is kept as-is. common.h is currently mach-k3-internal and is not in the include search path for board files; making it public would be a larger refactor that Anshul has offered to take on separately [3].
Patch 4 is unchanged from v1; Acked-by from Neha Malcom Francis and Reviewed-by from Anshul Dalal collected on v1 are carried forward.
Patch 1 has small non-behavioral changes vs v1, so v1 tags from Alexander Sverdlin (Reviewed-by), Neha Malcom Francis (Acked-by), and Akashdeep Kaur (Tested-by) are not carried forward and are pending re-confirmation against v2.
Boot tested on AM625 SK GP silicon end-to-end through TFA, OP-TEE, A53 SPL, U-Boot proper, and Linux 6.5. The two "Skipping authentication on GP device" messages in the SPL banner confirm only the GP tifsstub variant is present in the selected FIT configuration; loading any HS variant on GP silicon would fail TIFS authentication before reaching that point. Building (R5 SPL + A53 SPL + U-Boot proper) was verified clean against v2 on am62x_evm, phycore_am62x, and verdin-am62 defconfigs.
Akashdeep Kaur tested v1 on AM62PX HS-FS and AM62X HS-SE devices, including deep-sleep suspend/resume. v2 changes are non-behavioral so the same code paths exercise as v1, but explicit re-test on v2 would be welcome.
[1] https://lore.kernel.org/u-boot/[email protected]/
[2] https://github.com/open-source-firmware/flat-image-tree/issues/32
[3] https://lore.kernel.org/u-boot/[email protected]/
Aristo Chen (4):
arm: k3: select tifsstub via board_fit_config_name_match
board: phytec: phycore-am62: select tifsstub via FIT config
board: toradex: verdin-am62: select tifsstub via FIT config
arm: k3: drop redundant tifsstub runtime filter
arch/arm/dts/k3-am625-phycore-som-binman.dtsi | 42 ++++++++++--- arch/arm/dts/k3-am625-sk-binman.dtsi | 61 ++++++++++++++----- .../dts/k3-am625-verdin-wifi-dev-binman.dtsi | 42 ++++++++++--- arch/arm/dts/k3-am62a-phycore-som-binman.dtsi | 15 +++-- arch/arm/dts/k3-am62a-sk-binman.dtsi | 28 ++++++--- arch/arm/dts/k3-am62p-sk-binman.dtsi | 28 ++++++--- .../dts/k3-am62p5-verdin-wifi-dev-binman.dtsi | 15 +++-- arch/arm/mach-k3/common.c | 27 ++++++++ arch/arm/mach-k3/common.h | 10 --- arch/arm/mach-k3/include/mach/hardware.h | 11 ++++ arch/arm/mach-k3/r5/common.c | 14 +---- board/phytec/phycore_am62ax/phycore-am62ax.c | 6 ++ board/phytec/phycore_am62x/phycore-am62x.c | 6 ++ board/ti/am62ax/evm.c | 6 ++ board/ti/am62px/evm.c | 6 ++ board/ti/am62x/evm.c | 6 ++ board/toradex/verdin-am62/verdin-am62.c | 5 +- board/toradex/verdin-am62p/verdin-am62p.c | 5 +- 18 files changed, 241 insertions(+), 92 deletions(-)
--
2.43.0
PATCH v2 1/4 arm: k3: select tifsstub via board_fit_config_name_match
TI K3 AM62x/AM62Ax/AM62Px boards carry two or three mutually-exclusive tifsstub variants in their tispl.bin FIT images, all at the same load address. The existing approach loads every variant and then discards the wrong ones at runtime via a *p_size = 0 hack in board_fit_image_post_process(). Switch to selecting the appropriate FIT configuration up front via board_fit_config_name_match() so only the correct tifsstub is loaded in the first place.
board_fit_config_name_match() is invoked by the R5 SPL during FIT config selection. get_device_type() is a simple register read that is available at that point, so the security state can be determined early. The matching logic is factored into k3_fit_config_match_security_state() in arch/arm/mach-k3/common.c so it can be shared by any K3 board that wants this scheme. It matches configurations by a suffix appended to the description string:
-hs-se -> HS-SE (K3_DEVICE_TYPE_HS_SE) -hs-fs -> HS-FS (K3_DEVICE_TYPE_HS_FS) -gp -> GP (K3_DEVICE_TYPE_GP)
Configurations without a security-state suffix (e.g. u-boot.img) do not match and fall through to the DTS-specified default config naturally.
Each TI EVM board defines its board_fit_config_name_match() as a thin wrapper around the shared helper:
- board/ti/am62x/evm.c (AM625 SK: hs-se, hs-fs, gp) - board/ti/am62ax/evm.c (AM62A SK: hs-se, hs-fs, gp) - board/ti/am62px/evm.c (AM62P SK: hs-se, hs-fs, gp)
FIT configurations are split per security state in:
- arch/arm/dts/k3-am625-sk-binman.dtsi
(ti-falcon, ti-spl, ti-spl_unsigned: conf-hs-se/conf-hs-fs/conf-gp)
- arch/arm/dts/k3-am62a-sk-binman.dtsi
(ti-falcon, ti-spl: conf-hs-se/conf-hs-fs; no GP variant on AM62A)
- arch/arm/dts/k3-am62p-sk-binman.dtsi
(ti-falcon, ti-spl: conf-hs-se/conf-hs-fs; no GP variant on AM62P)
The runtime filter in board_fit_image_post_process() is intentionally left in place. It becomes redundant once every board using the AM62x family dtsi files migrates to per-state configurations. The dtsi for phytec phycore and toradex verdin boards is updated by separate patches in this series, and the now-redundant runtime filter is removed by the final patch in the series.
--- arch/arm/dts/k3-am625-sk-binman.dtsi | 61 ++++++++++++++++++------ arch/arm/dts/k3-am62a-sk-binman.dtsi | 28 +++++++---- arch/arm/dts/k3-am62p-sk-binman.dtsi | 28 +++++++---- arch/arm/mach-k3/common.c | 27 +++++++++++ arch/arm/mach-k3/common.h | 10 ---- arch/arm/mach-k3/include/mach/hardware.h | 11 +++++ board/ti/am62ax/evm.c | 6 +++ board/ti/am62px/evm.c | 6 +++ board/ti/am62x/evm.c | 6 +++ 9 files changed, 140 insertions(+), 43 deletions(-)
arch/arm/dts/k3-am625-sk-binman.dtsi +46 -15
@@ -263,12 +263,21 @@ }; configurations { - default = "conf-0"; - conf-0 { - description = "k3-am625-sk-falcon"; + default = "conf-hs-fs"; + conf-hs-fs { + description = "k3-am625-sk-falcon-hs-fs"; + firmware = "atf"; + loadables = "tee", "tifsstub-fs", "dm"; + }; + conf-hs-se { + description = "k3-am625-sk-falcon-hs-se"; + firmware = "atf"; + loadables = "tee", "tifsstub-hs", "dm"; + }; + conf-gp { + description = "k3-am625-sk-falcon-gp"; firmware = "atf"; - loadables = "tee", "tifsstub-hs", "tifsstub-fs", - "tifsstub-gp", "dm"; + loadables = "tee", "tifsstub-gp", "dm"; }; }; };
@@ -376,13 +385,24 @@ }; configurations { - default = "conf-0"; + default = "conf-hs-fs"; - conf-0 { - description = "k3-am625-sk"; + conf-hs-fs { + description = "k3-am625-sk-hs-fs"; + firmware = "atf"; + loadables = "tee", "tifsstub-fs", "dm", "spl"; + fdt = "fdt-0"; + }; + conf-hs-se { + description = "k3-am625-sk-hs-se"; firmware = "atf"; - loadables = "tee", "tifsstub-hs", "tifsstub-fs", - "tifsstub-gp", "dm", "spl"; + loadables = "tee", "tifsstub-hs", "dm", "spl"; + fdt = "fdt-0"; + }; + conf-gp { + description = "k3-am625-sk-gp"; + firmware = "atf"; + loadables = "tee", "tifsstub-gp", "dm", "spl"; fdt = "fdt-0"; }; };
@@ -497,13 +517,24 @@ }; configurations { - default = "conf-0"; + default = "conf-hs-fs"; - conf-0 { - description = "k3-am625-sk"; + conf-hs-fs { + description = "k3-am625-sk-hs-fs"; + firmware = "atf"; + loadables = "tee", "tifsstub-fs", "dm", "spl"; + fdt = "fdt-0"; + }; + conf-hs-se { + description = "k3-am625-sk-hs-se"; + firmware = "atf"; + loadables = "tee", "tifsstub-hs", "dm", "spl"; + fdt = "fdt-0"; + }; + conf-gp { + description = "k3-am625-sk-gp"; firmware = "atf"; - loadables = "tee", "tifsstub-hs", "tifsstub-fs", - "tifsstub-gp", "dm", "spl"; + loadables = "tee", "tifsstub-gp", "dm", "spl"; fdt = "fdt-0"; }; };
arch/arm/dts/k3-am62a-sk-binman.dtsi +19 -9
@@ -185,11 +185,16 @@ }; configurations { - default = "conf-0"; - conf-0 { - description = "k3-am62a7-sk-falcon"; + default = "conf-hs-fs"; + conf-hs-fs { + description = "k3-am62a7-sk-falcon-hs-fs"; + firmware = "atf"; + loadables = "tee", "dm", "tifsstub-fs"; + }; + conf-hs-se { + description = "k3-am62a7-sk-falcon-hs-se"; firmware = "atf"; - loadables = "tee", "dm", "tifsstub-hs", "tifsstub-fs"; + loadables = "tee", "dm", "tifsstub-hs"; }; }; };
@@ -284,13 +289,18 @@ }; configurations { - default = "conf-0"; + default = "conf-hs-fs"; - ti_spl_conf_0: conf-0 { - description = "k3-am62a7-sk"; + ti_spl_conf_0: conf-hs-fs { + description = "k3-am62a7-sk-hs-fs"; + firmware = "atf"; + loadables = "tee", "dm", "spl", "tifsstub-fs"; + fdt = "fdt-0"; + }; + conf-hs-se { + description = "k3-am62a7-sk-hs-se"; firmware = "atf"; - loadables = "tee", "dm", "spl", - "tifsstub-hs", "tifsstub-fs"; + loadables = "tee", "dm", "spl", "tifsstub-hs"; fdt = "fdt-0"; }; };
arch/arm/dts/k3-am62p-sk-binman.dtsi +19 -9
@@ -206,11 +206,16 @@ }; configurations { - default = "conf-0"; - conf-0 { - description = "k3-am62p5-sk-falcon"; + default = "conf-hs-fs"; + conf-hs-fs { + description = "k3-am62p5-sk-falcon-hs-fs"; firmware = "atf"; - loadables = "tee", "dm", "tifsstub-hs", "tifsstub-fs"; + loadables = "tee", "dm", "tifsstub-fs"; + }; + conf-hs-se { + description = "k3-am62p5-sk-falcon-hs-se"; + firmware = "atf"; + loadables = "tee", "dm", "tifsstub-hs"; }; }; };
@@ -309,13 +314,18 @@ }; configurations { - default = "conf-0"; + default = "conf-hs-fs"; - conf-0 { - description = "k3-am62px-sk"; + conf-hs-fs { + description = "k3-am62px-sk-hs-fs"; + firmware = "atf"; + loadables = "tee", "dm", "spl", "tifsstub-fs"; + fdt = "fdt-0"; + }; + conf-hs-se { + description = "k3-am62px-sk-hs-se"; firmware = "atf"; - loadables = "tee", "dm", "spl", - "tifsstub-hs", "tifsstub-fs"; + loadables = "tee", "dm", "spl", "tifsstub-hs"; fdt = "fdt-0"; }; };
arch/arm/mach-k3/common.c +27 -0
@@ -191,6 +191,33 @@ enum k3_device_type get_device_type(void) } } +int k3_fit_config_match_security_state (const char *name) +{ +const char *suffix; +size_t name_len, suffix_len; + +switch (get_device_type ()) { +case K3_DEVICE_TYPE_HS_SE : + suffix ="-hs-se" ; +break ; +case K3_DEVICE_TYPE_HS_FS : + suffix ="-hs-fs" ; +break ; +case K3_DEVICE_TYPE_GP : + suffix ="-gp" ; +break ; +default : +return -EINVAL ; + } + + name_len =strlen (name); + suffix_len =strlen (suffix); +if (name_len < suffix_len) +return -EINVAL ; + +return strncmp (name + name_len - suffix_len, suffix, suffix_len); +} +#if defined(CONFIG_DISPLAY_CPUINFO )static const char *get_device_type_name (void ) {
arch/arm/mach-k3/common.h +0 -10
@@ -32,15 +32,6 @@ enum k3_firewall_region_type { K3_FIREWALL_REGION_BACKGROUND }; -enum k3_device_type { -K3_DEVICE_TYPE_BAD , -K3_DEVICE_TYPE_GP , -K3_DEVICE_TYPE_TEST , -K3_DEVICE_TYPE_EMU , -K3_DEVICE_TYPE_HS_FS , -K3_DEVICE_TYPE_HS_SE , -}; -void setup_k3_mpu_regions (void );int early_console_init (void );void disable_linefill_optimization (void );
@@ -55,7 +46,6 @@ const struct k3_speed_grade_map *k3_get_speed_grade_map(void);void k3_fix_rproc_clock (const char *path);void mmr_unlock (uintptr_t base,u32 partition);bool is_rom_loaded_sysfw (struct rom_extended_boot_data *data); -enum k3_device_type get_device_type (void );struct ti_sci_handle *get_ti_sci_handle (void );void do_board_detect (void );void ti_secure_image_check_binary (void **p_image,size_t *p_size);
arch/arm/mach-k3/include/mach/hardware.h +11 -0
@@ -124,8 +124,19 @@ struct rom_extended_boot_data {u32 num_components; }; +enum k3_device_type { +K3_DEVICE_TYPE_BAD , +K3_DEVICE_TYPE_GP , +K3_DEVICE_TYPE_TEST , +K3_DEVICE_TYPE_EMU , +K3_DEVICE_TYPE_HS_FS , +K3_DEVICE_TYPE_HS_SE , +}; +u32 get_boot_device (void );const char *get_reset_reason (void ); +enum k3_device_type get_device_type (void ); +int k3_fit_config_match_security_state (const char *name);#define writel_verify (val, addr) \ do { \
board/ti/am62ax/evm.c +6 -0
@@ -6,6 +6,7 @@* */ +#include <image.h> #include <asm/arch/hardware.h> #include <asm/io.h> #include <dm/uclass.h>
@@ -17,6 +18,11 @@#include "../common/fdt_ops.h" #include "../common/k3_32k_lfosc.h" +int board_fit_config_name_match (const char *name) +{ +return k3_fit_config_match_security_state (name); +} +#if defined(CONFIG_XPL_BUILD )void spl_perform_board_fixups (struct spl_image_info *spl_image) {
board/ti/am62px/evm.c +6 -0
@@ -7,6 +7,7 @@*/ #include <efi_loader.h> +#include <image.h> #include <asm/arch/hardware.h> #include <asm/io.h> #include <cpu_func.h>
@@ -43,6 +44,11 @@ struct efi_capsule_update_info update_info = { .images = fw_images, }; +int board_fit_config_name_match (const char *name) +{ +return k3_fit_config_match_security_state (name); +} +#if IS_ENABLED (CONFIG_SPL_BUILD )void spl_board_init (void ) {
board/ti/am62x/evm.c +6 -0
@@ -18,6 +18,7 @@#include <fdt_support.h> #include <fdt_simplefb.h> #include <asm/io.h> +#include <image.h> #include <asm/arch/hardware.h> #include <dm/uclass.h> #include <asm/arch/k3-ddr.h>
@@ -135,6 +136,11 @@ int board_late_init(void) }#endif +int board_fit_config_name_match (const char *name) +{ +return k3_fit_config_match_security_state (name); +} +#if defined(CONFIG_XPL_BUILD )void spl_board_init (void ) {
Signature · 1 line
2.43.0
Re: [PATCH v2 1/4] arm: k3: select tifsstub via board_fit_config_name_match
Quoted 9 lines · Aristo Chen
TI K3 AM62x/AM62Ax/AM62Px boards carry two or three mutually-exclusive tifsstub variants in their tispl.bin FIT images, all at the same load address. The existing approach loads every variant and then discards the wrong ones at runtime via a
*p_size= 0 hack inboard_fit_image_post_process(). Switch to selecting the appropriate FIT configuration up front viaboard_fit_config_name_match()so only the correct tifsstub is loaded in the first place.[...]
Signature · 1 line
Anshul Dalal <[email protected]>
PATCH v2 2/4 board: phytec: phycore-am62: select tifsstub via FIT config
In reply to Aristo ChenUse the k3_fit_config_match_security_state() helper introduced in the earlier "arm: k3: select tifsstub via board_fit_config_name_match" patch to pick the right tifsstub variant on phycore AM62x and AM62Ax SoMs at FIT config selection time.
The k3-am625-phycore-som-binman.dtsi and k3-am62a-phycore-som-binman.dtsi FIT images are split into per-security-state configurations (conf-hs-se, conf-hs-fs), and board_fit_config_name_match() in each phycore board file forwards to the shared K3 helper.
--- arch/arm/dts/k3-am625-phycore-som-binman.dtsi | 42 ++++++++++++++----- arch/arm/dts/k3-am62a-phycore-som-binman.dtsi | 15 ++++--- board/phytec/phycore_am62ax/phycore-am62ax.c | 6 +++ board/phytec/phycore_am62x/phycore-am62x.c | 6 +++ 4 files changed, 54 insertions(+), 15 deletions(-)
arch/arm/dts/k3-am625-phycore-som-binman.dtsi +32 -10
@@ -309,13 +309,24 @@ }; configurations { - default = "conf-0"; + default = "conf-hs-fs"; - conf-0 { - description = "k3-am625-phyboard-lyra-rdk"; + conf-hs-fs { + description = "k3-am625-phyboard-lyra-rdk-hs-fs"; + firmware = "atf"; + loadables = "tee", "tifsstub-fs", "dm", "spl"; + fdt = "fdt-0"; + }; + conf-hs-se { + description = "k3-am625-phyboard-lyra-rdk-hs-se"; + firmware = "atf"; + loadables = "tee", "tifsstub-hs", "dm", "spl"; + fdt = "fdt-0"; + }; + conf-gp { + description = "k3-am625-phyboard-lyra-rdk-gp"; firmware = "atf"; - loadables = "tee", "tifsstub-hs", "tifsstub-fs", - "tifsstub-gp", "dm", "spl"; + loadables = "tee", "tifsstub-gp", "dm", "spl"; fdt = "fdt-0"; }; };
@@ -547,13 +558,24 @@ }; configurations { - default = "conf-0"; + default = "conf-hs-fs"; - conf-0 { - description = "k3-am625-phyboard-lyra-rdk"; + conf-hs-fs { + description = "k3-am625-phyboard-lyra-rdk-hs-fs"; + firmware = "atf"; + loadables = "tee", "tifsstub-fs", "dm", "spl"; + fdt = "fdt-0"; + }; + conf-hs-se { + description = "k3-am625-phyboard-lyra-rdk-hs-se"; + firmware = "atf"; + loadables = "tee", "tifsstub-hs", "dm", "spl"; + fdt = "fdt-0"; + }; + conf-gp { + description = "k3-am625-phyboard-lyra-rdk-gp"; firmware = "atf"; - loadables = "tee", "tifsstub-hs", "tifsstub-fs", - "tifsstub-gp", "dm", "spl"; + loadables = "tee", "tifsstub-gp", "dm", "spl"; fdt = "fdt-0"; }; };
arch/arm/dts/k3-am62a-phycore-som-binman.dtsi +10 -5
@@ -247,13 +247,18 @@ }; configurations { - default = "conf-0"; + default = "conf-hs-fs"; - conf-0 { - description = "k3-am62a7-phyboard-lyra-rdk"; + conf-hs-fs { + description = "k3-am62a7-phyboard-lyra-rdk-hs-fs"; + firmware = "atf"; + loadables = "tee", "dm", "spl", "tifsstub-fs"; + fdt = "fdt-0"; + }; + conf-hs-se { + description = "k3-am62a7-phyboard-lyra-rdk-hs-se"; firmware = "atf"; - loadables = "tee", "dm", "spl", - "tifsstub-hs", "tifsstub-fs"; + loadables = "tee", "dm", "spl", "tifsstub-hs"; fdt = "fdt-0"; }; };
board/phytec/phycore_am62ax/phycore-am62ax.c +6 -0
@@ -8,6 +8,7 @@#include <asm/io.h> #include <spl.h> #include <fdt_support.h> +#include <image.h> #include "../common/am6_som_detection.h"
@@ -57,3 +58,8 @@ void spl_board_init(void) dram_init_banksize(); }#endif + +int board_fit_config_name_match (const char *name) +{ +return k3_fit_config_match_security_state (name); +}
board/phytec/phycore_am62x/phycore-am62x.c +6 -0
@@ -9,6 +9,7 @@#include <spl.h> #include <asm/arch/k3-ddr.h> #include <fdt_support.h> +#include <image.h> #include "phycore-ddr-data.h" #include "../common/k3/k3_ddrss_patch.h"
@@ -237,3 +238,8 @@ void spl_board_init(void) MCU_CTRL_DEVICE_CLKOUT_32K_CTRL); }#endif + +int board_fit_config_name_match (const char *name) +{ +return k3_fit_config_match_security_state (name); +}
Signature · 1 line
2.43.0
PATCH v2 3/4 board: toradex: verdin-am62: select tifsstub via FIT config
In reply to Aristo ChenUse the k3_fit_config_match_security_state() helper introduced in the earlier "arm: k3: select tifsstub via board_fit_config_name_match" patch to pick the right tifsstub variant on Verdin AM62 and AM62P SoMs at FIT config selection time.
The k3-am625-verdin-wifi-dev-binman.dtsi and k3-am62p5-verdin-wifi-dev-binman.dtsi FIT images are split into per-security-state configurations (conf-hs-se, conf-hs-fs), and board_fit_config_name_match() in each verdin board file forwards to the shared K3 helper. The previous implementation returned 0 unconditionally which matched the first listed configuration regardless of the actual silicon, which after the dtsi split would load the wrong tifsstub variant on HS-SE parts.
--- .../dts/k3-am625-verdin-wifi-dev-binman.dtsi | 42 ++++++++++++++----- .../dts/k3-am62p5-verdin-wifi-dev-binman.dtsi | 15 ++++--- board/toradex/verdin-am62/verdin-am62.c | 5 +-- board/toradex/verdin-am62p/verdin-am62p.c | 5 +-- 4 files changed, 46 insertions(+), 21 deletions(-)
arch/arm/dts/k3-am625-verdin-wifi-dev-binman.dtsi +32 -10
@@ -295,13 +295,24 @@ }; configurations { - default = "conf-0"; + default = "conf-hs-fs"; - conf-0 { - description = "k3-am625-verdin-wifi-dev"; + conf-hs-fs { + description = "k3-am625-verdin-wifi-dev-hs-fs"; + firmware = "atf"; + loadables = "tee", "tifsstub-fs", "dm", "spl"; + fdt = "fdt-0"; + }; + conf-hs-se { + description = "k3-am625-verdin-wifi-dev-hs-se"; + firmware = "atf"; + loadables = "tee", "tifsstub-hs", "dm", "spl"; + fdt = "fdt-0"; + }; + conf-gp { + description = "k3-am625-verdin-wifi-dev-gp"; firmware = "atf"; - loadables = "tee", "tifsstub-hs", "tifsstub-fs", - "tifsstub-gp", "dm", "spl"; + loadables = "tee", "tifsstub-gp", "dm", "spl"; fdt = "fdt-0"; }; };
@@ -414,13 +425,24 @@ }; configurations { - default = "conf-0"; + default = "conf-hs-fs"; - conf-0 { - description = "k3-am625-verdin-wifi-dev"; + conf-hs-fs { + description = "k3-am625-verdin-wifi-dev-hs-fs"; + firmware = "atf"; + loadables = "tee", "tifsstub-fs", "dm", "spl"; + fdt = "fdt-0"; + }; + conf-hs-se { + description = "k3-am625-verdin-wifi-dev-hs-se"; + firmware = "atf"; + loadables = "tee", "tifsstub-hs", "dm", "spl"; + fdt = "fdt-0"; + }; + conf-gp { + description = "k3-am625-verdin-wifi-dev-gp"; firmware = "atf"; - loadables = "tee", "tifsstub-hs", "tifsstub-fs", - "tifsstub-gp", "dm", "spl"; + loadables = "tee", "tifsstub-gp", "dm", "spl"; fdt = "fdt-0"; }; };
arch/arm/dts/k3-am62p5-verdin-wifi-dev-binman.dtsi +10 -5
@@ -248,13 +248,18 @@ }; configurations { - default = "conf-0"; + default = "conf-hs-fs"; - conf-0 { - description = "k3-am62p5-verdin-wifi-dev"; + conf-hs-fs { + description = "k3-am62p5-verdin-wifi-dev-hs-fs"; + firmware = "atf"; + loadables = "tee", "tifsstub-fs", "dm", "spl"; + fdt = "fdt-0"; + }; + conf-hs-se { + description = "k3-am62p5-verdin-wifi-dev-hs-se"; firmware = "atf"; - loadables = "tee", "tifsstub-hs", "tifsstub-fs", - "dm", "spl"; + loadables = "tee", "tifsstub-hs", "dm", "spl"; fdt = "fdt-0"; }; };
board/toradex/verdin-am62/verdin-am62.c +2 -3
@@ -12,6 +12,7 @@#include <dm/uclass.h> #include <env.h> #include <fdt_support.h> +#include <image.h> #include <init.h> #include <k3-ddrss.h> #include <spl.h>
@@ -57,12 +58,10 @@ phys_addr_t board_get_usable_ram_top(phys_size_t total_size)return 0x9C000000 ; } -#if defined(CONFIG_SPL_LOAD_FIT )int board_fit_config_name_match (const char *name) { -return 0 ; +return k3_fit_config_match_security_state (name); } -#endif #if IS_ENABLED (CONFIG_OF_LIBFDT ) &&IS_ENABLED (CONFIG_OF_BOARD_SETUP )int ft_board_setup (void *blob,struct bd_info *bd)
board/toradex/verdin-am62p/verdin-am62p.c +2 -3
@@ -14,6 +14,7 @@#include <dm/uclass.h> #include <env.h> #include <fdt_support.h> +#include <image.h> #include <init.h> #include <k3-ddrss.h> #include <spl.h>
@@ -83,12 +84,10 @@ int dram_init_banksize(void)return ret; } -#if IS_ENABLED (CONFIG_SPL_LOAD_FIT )int board_fit_config_name_match (const char *name) { -return 0 ; +return k3_fit_config_match_security_state (name); } -#endif #if IS_ENABLED (CONFIG_OF_LIBFDT ) &&IS_ENABLED (CONFIG_OF_BOARD_SETUP )int ft_board_setup (void *blob,struct bd_info *bd)
Signature · 1 line
2.43.0
PATCH v2 4/4 arm: k3: drop redundant tifsstub runtime filter
In reply to Aristo ChenWith all AM62x family boards (TI EVMs, phytec phycore, toradex verdin) now using per-security-state FIT configurations and selecting the right one via board_fit_config_name_match(), the runtime filter in board_fit_image_post_process() that zero'd out *p_size for the wrong tifsstub variant is no longer reached. Only one tifsstub variant is present in the selected FIT configuration, and it is always the correct one for the current silicon.
Drop the filter so board_fit_image_post_process() simply debug-logs the variant name and returns.
--- arch/arm/mach-k3/r5/common.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-)
arch/arm/mach-k3/r5/common.c +1 -13
@@ -348,19 +348,7 @@ void board_fit_image_post_process(const void *fit, int node, void **p_image, }if (i <IMAGE_AMT && i >IMAGE_ID_DM_FW ) { -int device_type =get_device_type (); - -if ((device_type ==K3_DEVICE_TYPE_HS_SE && -strcmp (os,"tifsstub-hs" )) || - (device_type ==K3_DEVICE_TYPE_HS_FS && -strcmp (os,"tifsstub-fs" )) || - (device_type ==K3_DEVICE_TYPE_GP && -strcmp (os,"tifsstub-gp" ))) { - *p_size =0 ; - }else { -debug ("tifsstub-type: %s\n" , os); - } - +debug ("tifsstub-type: %s\n" , os);return ; }
Signature · 1 line
2.43.0
Quoted 8 lines · Aristo Chen
The AM62x family (TI EVMs, phytec phycore, toradex verdin) ships two or three mutually-exclusive tifsstub variants per tispl.bin FIT image (tifsstub-hs, tifsstub-fs, tifsstub-gp), all assigned the same load address
0x9dc00000. The current platform code loads every variant and discards the wrong ones at runtime by zeroing*p_sizeinboard_fit_image_post_process()(arch/arm/mach-k3/r5/common.c).[...]
Applied to u-boot/main, thanks!
[1/4] arm: k3: select tifsstub via board_fit_config_name_match
commit: c85bf61b14f9caa34662d9b767b61ba2b5da74f0
[2/4] board: phytec: phycore-am62: select tifsstub via FIT config
commit: 857c2151ca8d41add88fec01a7fea8965d0d2c74
[3/4] board: toradex: verdin-am62: select tifsstub via FIT config
commit: feb2b13377534725ee0f428ed4252db7fddaa57f
[4/4] arm: k3: drop redundant tifsstub runtime filter
commit: a5567f46697a733a9ad03eaec9941c8d80e6fb40Signature · 1 line
Tom