Hi Aristo,

On Thu, 2026-05-28 at 13:27 +0000, Aristo Chen wrote:
> 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.
> 
> 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]>

> ---
>  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(-)
> 

-- 
Alexander Sverdlin
Siemens AG
www.siemens.com

Reply via email to