Add falcon support for am62a, 62p and 62x
Subsystems (3)
v7 cover Add falcon support for am62a, 62p and 62x
This patch set adds support for falcon boot on AM62a, 62p and 62x by bypassing A53 SPL and U-boot.
Existing Boot flow:
R5 SPL -> ATF -> A53 SPL -> U-Boot -> Linux Kernel
Updated flow:
R5 SPL -> ATF -> Linux Kernel
U-boot's falcon flow expects the jump from SPL to kernel to happen on the same core which is not directly applicable for our heterogeneous platforms since ATF, OPTEE and other non SPL binaries from tispl.bin should be loaded before the kernel by the R5 SPL.
So we have to use a non std flow to bypass A53 SPL and U-Boot, we first load the newly added tispl_falcon.bin instead of tispl.bin which lacks u-boot-spl.bin (A53's SPL) and the corresponding fdt. This sets up dm, tifs, optee and atf. Once loaded, we load the kernel and the dtb (with fixups) at ATF's PRELOADED_BL33_BASE and K3_HW_CONFIG_BASE.
NOTE:
Since we're now using the SPL to load the kernel and kernel expects a 2MiB aligned load address, the existing PRELOADED_BL33_BASE has to be changed for ATF to 0x82000000 with K3_HW_CONFIG_BASE set to 0x88000000 for the DTB.
---
Changes in v7:
* Replaced AM62a/p documentation with a hyperlink to AM62x's docs
* Made CMD_BOOTZ disabled for TI_SECURE_DEVICE
v6: https://lore.kernel.org/u-boot/[email protected]/
Changes in v6:
* Added A53 build steps in docs
* Had git add SVGs as text instead of blob
* Added memory map for standard boot flow
v5: https://lore.kernel.org/u-boot/[email protected]/
Changes in v5:
* Added documentation
* Moved address for kernel and dtb to 0x82000000 and 0x88000000 respectively
v4: https://lore.kernel.org/u-boot/[email protected]/
Changes in v4:
* Move emmc boot fixes to saperate patch
* Update load address for kernel to 0x82200000
* Add jump_stub config
v3: https://lore.kernel.org/u-boot/[email protected]/
Changes in v3:
* Make tifs load and entry address consistent with tispl for am62a and 62p
* Update loadables order to be same as tispl.bin
* Use rootfs for boot instead of boot partition
* Disable SPL_HAS_BOOTZ to save space
* Add default dtbs for each board in Kconfig
* Fix fdt totalsize in the header before applying fixups
* Update Makefile to clean tispl_falcon.bin on make clean
v2: https://lore.kernel.org/u-boot/[email protected]/
Changes in v2:
* Move to CONFIG_SYS_SPI_*
* Remove the need for CMD_BOOTI
v1: https://lore.kernel.org/u-boot/[email protected]/
---
Anshul Dalal (10):
spl: Kconfig: allow K3 devices to use falcon mode
spl: make CMD_BOOTZ exclusive with TI_SECURE_DEVICE
mach-k3: fix reading size and addr from fdt on R5
arch: arm: k3-binman: add fit for falcon boot
mach-k3: sysfw-loader: update img_hdr for falcon
config: add falcon boot config fragment for am62x
board: ti: add default dtb for am62 in falcon mode
mach-k3: common: enable falcon mode for 62 platform
Makefile: update tispl regex to also clean falcon spl
doc: ti: am62: add falcon mode documentation
Makefile | 2 +- arch/arm/dts/k3-am625-sk-binman.dtsi | 64 ++++ arch/arm/dts/k3-am62a-sk-binman.dtsi | 64 ++++ arch/arm/dts/k3-am62p-sk-binman.dtsi | 51 ++++ arch/arm/dts/k3-binman.dtsi | 54 ++++ arch/arm/mach-k3/common.c | 107 +++++++ arch/arm/mach-k3/common_fdt.c | 4 +- arch/arm/mach-k3/r5/sysfw-loader.c | 6 +- board/ti/am62ax/Kconfig | 3 + board/ti/am62px/Kconfig | 3 + board/ti/am62x/Kconfig | 3 + cmd/Kconfig | 1 + common/spl/Kconfig | 2 +- configs/am62x_r5_falcon.config | 38 +++ doc/board/ti/am62ax_sk.rst | 7 + doc/board/ti/am62px_sk.rst | 7 + doc/board/ti/am62x_sk.rst | 289 ++++++++++++++++++ doc/board/ti/img/fitImage_falcon.svg | 180 +++++++++++ .../ti/img/tifsstub_dm_tispl_falcon.bin.svg | 285 +++++++++++++++++ 19 files changed, 1166 insertions(+), 4 deletions(-) create mode 100644 configs/am62x_r5_falcon.config create mode 100644 doc/board/ti/img/fitImage_falcon.svg create mode 100644 doc/board/ti/img/tifsstub_dm_tispl_falcon.bin.svg
Signature · 1 line
2.49.0
PATCH v7 1/10 spl: Kconfig: allow K3 devices to use falcon mode
Falcon mode was disabled for TI_SECURE_DEVICE at commit e95b9b4437bc ("ti_armv7_common: Disable Falcon Mode on HS devices") for older 32-bit HS devices and can be enabled on K3 devices.
For secure boot, the kernel with x509 headers can be packaged in a fit container (fitImage) signed with TIFS keys for authentication.
--- common/spl/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
common/spl/Kconfig +1 -1
@@ -1190,7 +1190,7 @@ config SPL_ONENAND_SUPPORT config SPL_OS_BOOT bool "Activate Falcon Mode" - depends on !TI_SECURE_DEVICE + depends on !TI_SECURE_DEVICE || ARCH_K3 help Enable booting directly to an OS from SPL. for more info read doc/README.falcon
Signature · 1 line
2.49.0
Re: [PATCH v7 01/10] spl: Kconfig: allow K3 devices to use falcon mode
Quoted 17 lines · Anshul Dalal
Falcon mode was disabled for
TI_SECURE_DEVICEat commite95b9b4437bc("ti_armv7_common: Disable Falcon Mode on HS devices") for older 32-bit HS devices and can be enabled on K3 devices.For secure boot, the kernel with x509 headers can be packaged in a fit container (fitImage) signed with TIFS keys for authentication.
Signed-off-by Anshul Dalal <[email protected]>--- common/spl/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)common/spl/Kconfig +0
-0
common/spl/Kconfig config SPL_ONENAND_SUPPORT · line 1196
Quoted 8 lines
common/spl/Kconfig +1
-1@@ -1190,7 +1190,7 @@ config SPL_ONENAND_SUPPORT config SPL_OS_BOOT bool "Activate Falcon Mode" - depends on !TI_SECURE_DEVICE + depends on !TI_SECURE_DEVICE || ARCH_K3 help Enable booting directly to an OS from SPL. for more info read doc/README.falcon
I wonder if overloading ARCH_K3 like this isn't a great idea. Or perhaps TI_SECURE_DEVICE is too generic a name. I kind of want to introduce something that means TI Secure Boot is supported but also Falcon is supported, and then use that as how we disable in Kconfig various insecure options. And I assume that it's a matter of effort not technical restrictions for supporting falcon mode on older HS parts?
Signature · 1 line
Tom
Re: [PATCH v7 01/10] spl: Kconfig: allow K3 devices to use falcon mode
Quoted 20 lines · Tom Rini
Quoted 18 lines · Anshul Dalal
Falcon mode was disabled for
TI_SECURE_DEVICEat commite95b9b4437bc("ti_armv7_common: Disable Falcon Mode on HS devices") for older 32-bit HS devices and can be enabled on K3 devices.For secure boot, the kernel with x509 headers can be packaged in a fit container (fitImage) signed with TIFS keys for authentication.
Signed-off-by Anshul Dalal <[email protected]>--- common/spl/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)common/spl/Kconfig +0
-0@@ -1190,7 +1190,7 @@ config SPL_ONENAND_SUPPORT
Quoted 14 lines
common/spl/Kconfig config SPL_ONENAND_SUPPORT · line 1196
Quoted 7 lines
common/spl/Kconfig +1
-1config SPL_OS_BOOT bool "Activate Falcon Mode" - depends on !TI_SECURE_DEVICE + depends on !TI_SECURE_DEVICE || ARCH_K3 help Enable booting directly to an OS from SPL. for more info read doc/README.falconI wonder if overloading
ARCH_K3like this isn't a great idea. Or perhapsTI_SECURE_DEVICEis too generic a name. I kind of want to introduce something that means TI Secure Boot is supported but also Falcon is supported, and then use that as how we disable inKconfigvarious insecure options. And I assume that it's a matter of effort not technical restrictions for supporting falcon mode on older HS parts?
I second your opinion here, the falcon boot flow we do have in K3 devices is quite different from existing platforms but still enabled by the same SPL_OS_BOOT config. Perhaps adding a config like K3_FALCON makes sense here.
And yes, older HS *K3* parts should be able to support a similar falcon style boot flow with not much changes to the k3_falcon_prep function.
Re: [PATCH v7 01/10] spl: Kconfig: allow K3 devices to use falcon mode
Quoted 36 lines · Anshul Dalal
Quoted 20 lines · Tom Rini
Quoted 18 lines · Anshul Dalal
Falcon mode was disabled for
TI_SECURE_DEVICEat commite95b9b4437bc("ti_armv7_common: Disable Falcon Mode on HS devices") for older 32-bit HS devices and can be enabled on K3 devices.For secure boot, the kernel with x509 headers can be packaged in a fit container (fitImage) signed with TIFS keys for authentication.
Signed-off-by Anshul Dalal <[email protected]>--- common/spl/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)common/spl/Kconfig +0
-0@@ -1190,7 +1190,7 @@ config SPL_ONENAND_SUPPORTQuoted 14 lines
common/spl/Kconfig config SPL_ONENAND_SUPPORT · line 1196
Quoted 7 lines
common/spl/Kconfig +1
-1config SPL_OS_BOOT bool "Activate Falcon Mode" - depends on !TI_SECURE_DEVICE + depends on !TI_SECURE_DEVICE || ARCH_K3 help Enable booting directly to an OS from SPL. for more info read doc/README.falconI wonder if overloading
ARCH_K3like this isn't a great idea. Or perhapsTI_SECURE_DEVICEis too generic a name. I kind of want to introduce something that means TI Secure Boot is supported but also Falcon is supported, and then use that as how we disable inKconfigvarious insecure options. And I assume that it's a matter of effort not technical restrictions for supporting falcon mode on older HS parts?
Quoted 7 lines
I second your opinion here, the falcon boot flow we do have in K3 devices is quite different from existing platforms but still enabled by the same
SPL_OS_BOOTconfig. Perhaps adding a config likeK3_FALCONmakes sense here.And yes, older HS *K3* parts should be able to support a similar falcon style boot flow with not much changes to the
k3_falcon_prepfunction.
Maybe we need a common symbol for things that are common to all TI secure devices, and other symbols for K3 or AM33xx (or whatever is most appropriate for that overall era of parts).
Signature · 1 line
Tom
Re: [PATCH v7 01/10] spl: Kconfig: allow K3 devices to use falcon mode
Quoted 42 lines · Tom Rini
Quoted 41 lines · Anshul Dalal
Quoted 20 lines · Tom Rini
Quoted 18 lines · Anshul Dalal
Falcon mode was disabled for
TI_SECURE_DEVICEat commite95b9b4437bc("ti_armv7_common: Disable Falcon Mode on HS devices") for older 32-bit HS devices and can be enabled on K3 devices.For secure boot, the kernel with x509 headers can be packaged in a fit container (fitImage) signed with TIFS keys for authentication.
Signed-off-by Anshul Dalal <[email protected]>--- common/spl/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)common/spl/Kconfig +0
-0@@ -1190,7 +1190,7 @@ config SPL_ONENAND_SUPPORTQuoted 14 lines
common/spl/Kconfig config SPL_ONENAND_SUPPORT · line 1196
Quoted 7 lines
common/spl/Kconfig +1
-1config SPL_OS_BOOT bool "Activate Falcon Mode" - depends on !TI_SECURE_DEVICE + depends on !TI_SECURE_DEVICE || ARCH_K3 help Enable booting directly to an OS from SPL. for more info read doc/README.falconI wonder if overloading
ARCH_K3like this isn't a great idea. Or perhapsTI_SECURE_DEVICEis too generic a name. I kind of want to introduce something that means TI Secure Boot is supported but also Falcon is supported, and then use that as how we disable inKconfigvarious insecure options. And I assume that it's a matter of effort not technical restrictions for supporting falcon mode on older HS parts?I second your opinion here, the falcon boot flow we do have in K3 devices is quite different from existing platforms but still enabled by the same
SPL_OS_BOOTconfig. Perhaps adding a config likeK3_FALCONmakes sense here.
Quoted 6 lines
Quoted 2 lines
And yes, older HS *K3* parts should be able to support a similar falcon style boot flow with not much changes to the
k3_falcon_prepfunction.Maybe we need a common symbol for things that are common to all TI secure devices, and other symbols for K3 or AM33xx (or whatever is most appropriate for that overall era of parts).
I was thinking of adding TI_SECURE_DEVICE_(LEGACY|K3) hidden config symbols which TI_SECURE_DEVICE selects as below:
config TI_SECURE_DEVICE
bool "HS Device Type Support" depends on ARCH_KEYSTONE || ARCH_OMAP2PLUS || ARCH_K3 select TI_SECURE_DEVICE_LEGACY if ARCH_KEYSTONE || ARCH_OMAP2PLUS select TI_SECURE_DEVICE_K3 if ARCH_K3
We can then use TI_SECURE_DEVICE_LEGACY to disable OS_BOOT for older non K3 platforms instead.
Re: [PATCH v7 01/10] spl: Kconfig: allow K3 devices to use falcon mode
Quoted 53 lines · Anshul Dalal
Quoted 42 lines · Tom Rini
Quoted 41 lines · Anshul Dalal
Quoted 20 lines · Tom Rini
Quoted 18 lines · Anshul Dalal
Falcon mode was disabled for
TI_SECURE_DEVICEat commite95b9b4437bc("ti_armv7_common: Disable Falcon Mode on HS devices") for older 32-bit HS devices and can be enabled on K3 devices.For secure boot, the kernel with x509 headers can be packaged in a fit container (fitImage) signed with TIFS keys for authentication.
Signed-off-by Anshul Dalal <[email protected]>--- common/spl/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)common/spl/Kconfig +0
-0@@ -1190,7 +1190,7 @@ config SPL_ONENAND_SUPPORTQuoted 14 lines
common/spl/Kconfig config SPL_ONENAND_SUPPORT · line 1196
Quoted 7 lines
common/spl/Kconfig +1
-1config SPL_OS_BOOT bool "Activate Falcon Mode" - depends on !TI_SECURE_DEVICE + depends on !TI_SECURE_DEVICE || ARCH_K3 help Enable booting directly to an OS from SPL. for more info read doc/README.falconI wonder if overloading
ARCH_K3like this isn't a great idea. Or perhapsTI_SECURE_DEVICEis too generic a name. I kind of want to introduce something that means TI Secure Boot is supported but also Falcon is supported, and then use that as how we disable inKconfigvarious insecure options. And I assume that it's a matter of effort not technical restrictions for supporting falcon mode on older HS parts?I second your opinion here, the falcon boot flow we do have in K3 devices is quite different from existing platforms but still enabled by the same
SPL_OS_BOOTconfig. Perhaps adding a config likeK3_FALCONmakes sense here.Quoted 6 lines
Quoted 2 lines
And yes, older HS *K3* parts should be able to support a similar falcon style boot flow with not much changes to the
k3_falcon_prepfunction.Maybe we need a common symbol for things that are common to all TI secure devices, and other symbols for K3 or AM33xx (or whatever is most appropriate for that overall era of parts).
I was thinking of adding
TI_SECURE_DEVICE_(LEGACY|K3)hidden config symbols whichTI_SECURE_DEVICEselects as below:
Quoted 8 lines
config
TI_SECURE_DEVICEbool "HS Device Type Support" depends on ARCH_KEYSTONE || ARCH_OMAP2PLUS || ARCH_K3 select TI_SECURE_DEVICE_LEGACY if ARCH_KEYSTONE || ARCH_OMAP2PLUS select TI_SECURE_DEVICE_K3 if ARCH_K3We can then use
TI_SECURE_DEVICE_LEGACYto disableOS_BOOTfor older non K3 platforms instead.
The current tech today is the legacy tech tomorrow, so I think a better symbol name is needed for ARCH_KEYSTONE || ARCH_OMAP2PLUS, especially since the next question is how much do they in fact share in terms of tooling and features. But I was also thinking that TI_SECURE_DEVICE should be a hidden symbol too, and used for the common-if-any parts, and so SPL_OS_BOOT would depend on !TI_SECURE_DEVICE_K2_OMAP2PLUS or whatever.
Signature · 1 line
Tom
Re: [PATCH v7 01/10] spl: Kconfig: allow K3 devices to use falcon mode
Quoted 60 lines · Tom Rini
Quoted 59 lines · Anshul Dalal
Quoted 42 lines · Tom Rini
Quoted 41 lines · Anshul Dalal
Quoted 20 lines · Tom Rini
Quoted 18 lines · Anshul Dalal
Falcon mode was disabled for
TI_SECURE_DEVICEat commite95b9b4437bc("ti_armv7_common: Disable Falcon Mode on HS devices") for older 32-bit HS devices and can be enabled on K3 devices.For secure boot, the kernel with x509 headers can be packaged in a fit container (fitImage) signed with TIFS keys for authentication.
Signed-off-by Anshul Dalal <[email protected]>--- common/spl/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)common/spl/Kconfig +0
-0@@ -1190,7 +1190,7 @@ config SPL_ONENAND_SUPPORTQuoted 14 lines
common/spl/Kconfig config SPL_ONENAND_SUPPORT · line 1196
Quoted 7 lines
common/spl/Kconfig +1
-1config SPL_OS_BOOT bool "Activate Falcon Mode" - depends on !TI_SECURE_DEVICE + depends on !TI_SECURE_DEVICE || ARCH_K3 help Enable booting directly to an OS from SPL. for more info read doc/README.falconI wonder if overloading
ARCH_K3like this isn't a great idea. Or perhapsTI_SECURE_DEVICEis too generic a name. I kind of want to introduce something that means TI Secure Boot is supported but also Falcon is supported, and then use that as how we disable inKconfigvarious insecure options. And I assume that it's a matter of effort not technical restrictions for supporting falcon mode on older HS parts?I second your opinion here, the falcon boot flow we do have in K3 devices is quite different from existing platforms but still enabled by the same
SPL_OS_BOOTconfig. Perhaps adding a config likeK3_FALCONmakes sense here.Quoted 6 lines
Quoted 2 lines
And yes, older HS *K3* parts should be able to support a similar falcon style boot flow with not much changes to the
k3_falcon_prepfunction.Maybe we need a common symbol for things that are common to all TI secure devices, and other symbols for K3 or AM33xx (or whatever is most appropriate for that overall era of parts).
I was thinking of adding
TI_SECURE_DEVICE_(LEGACY|K3)hidden config symbols whichTI_SECURE_DEVICEselects as below:config
TI_SECURE_DEVICEbool "HS Device Type Support" depends on ARCH_KEYSTONE || ARCH_OMAP2PLUS || ARCH_K3 select TI_SECURE_DEVICE_LEGACY if ARCH_KEYSTONE || ARCH_OMAP2PLUS select TI_SECURE_DEVICE_K3 if ARCH_K3
Quoted 6 lines
Quoted 2 lines
We can then use
TI_SECURE_DEVICE_LEGACYto disableOS_BOOTfor older non K3 platforms instead.The current tech today is the legacy tech tomorrow, so I think a better symbol name is needed for
ARCH_KEYSTONE||ARCH_OMAP2PLUS, especially since the next question is how much do they in fact share in terms of
Agreed, I will update the names to be more descriptive of specific device.
Quoted 4 lines
tooling and features. But I was also thinking that
TI_SECURE_DEVICEshould be a hidden symbol too, and used for the common-if-any parts, and soSPL_OS_BOOTwould depend on !TI_SECURE_DEVICE_K2_OMAP2PLUS or whatever.
I don't think we should make TI_SECURE_DEVICE hidden since iot2050 is a defconfig that disables TI_SECURE_DEVICE while being ARCH_K3, it's also useful to expose it as a config to users in cases of GP devices for example.
If we are in agreement here, I can post v8 with the suggested changes ;)
Re: [PATCH v7 01/10] spl: Kconfig: allow K3 devices to use falcon mode
Quoted 75 lines · Anshul Dalal
Quoted 60 lines · Tom Rini
Quoted 59 lines · Anshul Dalal
Quoted 42 lines · Tom Rini
Quoted 41 lines · Anshul Dalal
Quoted 20 lines · Tom Rini
Quoted 18 lines · Anshul Dalal
Falcon mode was disabled for
TI_SECURE_DEVICEat commite95b9b4437bc("ti_armv7_common: Disable Falcon Mode on HS devices") for older 32-bit HS devices and can be enabled on K3 devices.For secure boot, the kernel with x509 headers can be packaged in a fit container (fitImage) signed with TIFS keys for authentication.
Signed-off-by Anshul Dalal <[email protected]>--- common/spl/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)common/spl/Kconfig +0
-0@@ -1190,7 +1190,7 @@ config SPL_ONENAND_SUPPORTQuoted 14 lines
common/spl/Kconfig config SPL_ONENAND_SUPPORT · line 1196
Quoted 7 lines
common/spl/Kconfig +1
-1config SPL_OS_BOOT bool "Activate Falcon Mode" - depends on !TI_SECURE_DEVICE + depends on !TI_SECURE_DEVICE || ARCH_K3 help Enable booting directly to an OS from SPL. for more info read doc/README.falconI wonder if overloading
ARCH_K3like this isn't a great idea. Or perhapsTI_SECURE_DEVICEis too generic a name. I kind of want to introduce something that means TI Secure Boot is supported but also Falcon is supported, and then use that as how we disable inKconfigvarious insecure options. And I assume that it's a matter of effort not technical restrictions for supporting falcon mode on older HS parts?I second your opinion here, the falcon boot flow we do have in K3 devices is quite different from existing platforms but still enabled by the same
SPL_OS_BOOTconfig. Perhaps adding a config likeK3_FALCONmakes sense here.Quoted 6 lines
Quoted 2 lines
And yes, older HS *K3* parts should be able to support a similar falcon style boot flow with not much changes to the
k3_falcon_prepfunction.Maybe we need a common symbol for things that are common to all TI secure devices, and other symbols for K3 or AM33xx (or whatever is most appropriate for that overall era of parts).
I was thinking of adding
TI_SECURE_DEVICE_(LEGACY|K3)hidden config symbols whichTI_SECURE_DEVICEselects as below:config
TI_SECURE_DEVICEbool "HS Device Type Support" depends on ARCH_KEYSTONE || ARCH_OMAP2PLUS || ARCH_K3 select TI_SECURE_DEVICE_LEGACY if ARCH_KEYSTONE || ARCH_OMAP2PLUS select TI_SECURE_DEVICE_K3 if ARCH_K3Quoted 6 lines
Quoted 2 lines
We can then use
TI_SECURE_DEVICE_LEGACYto disableOS_BOOTfor older non K3 platforms instead.The current tech today is the legacy tech tomorrow, so I think a better symbol name is needed for
ARCH_KEYSTONE||ARCH_OMAP2PLUS, especially since the next question is how much do they in fact share in terms ofAgreed, I will update the names to be more descriptive of specific device.
Quoted 4 lines
tooling and features. But I was also thinking that
TI_SECURE_DEVICEshould be a hidden symbol too, and used for the common-if-any parts, and soSPL_OS_BOOTwould depend on !TI_SECURE_DEVICE_K2_OMAP2PLUS or whatever.
Quoted 6 lines
I don't think we should make
TI_SECURE_DEVICEhidden since iot2050 is a defconfig that disablesTI_SECURE_DEVICEwhile beingARCH_K3, it's also useful to expose it as a config to users in cases of GP devices for example.If we are in agreement here, I can post v8 with the suggested changes ;)
Well, with TI_SECURE_DEVICE hidden but TI_SECURE_DEVICE_K3 not, iot2050 can be migrated easily. That should also cover the legacy-within-K3 GP parts too, yes?
Signature · 1 line
Tom
Re: [PATCH v7 01/10] spl: Kconfig: allow K3 devices to use falcon mode
Quoted 81 lines · Tom Rini
Quoted 80 lines · Anshul Dalal
Quoted 60 lines · Tom Rini
Quoted 59 lines · Anshul Dalal
Quoted 42 lines · Tom Rini
Quoted 41 lines · Anshul Dalal
Quoted 20 lines · Tom Rini
Quoted 18 lines · Anshul Dalal
Falcon mode was disabled for
TI_SECURE_DEVICEat commite95b9b4437bc("ti_armv7_common: Disable Falcon Mode on HS devices") for older 32-bit HS devices and can be enabled on K3 devices.For secure boot, the kernel with x509 headers can be packaged in a fit container (fitImage) signed with TIFS keys for authentication.
Signed-off-by Anshul Dalal <[email protected]>--- common/spl/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)common/spl/Kconfig +0
-0@@ -1190,7 +1190,7 @@ config SPL_ONENAND_SUPPORTQuoted 14 lines
common/spl/Kconfig config SPL_ONENAND_SUPPORT · line 1196
Quoted 7 lines
common/spl/Kconfig +1
-1config SPL_OS_BOOT bool "Activate Falcon Mode" - depends on !TI_SECURE_DEVICE + depends on !TI_SECURE_DEVICE || ARCH_K3 help Enable booting directly to an OS from SPL. for more info read doc/README.falconI wonder if overloading
ARCH_K3like this isn't a great idea. Or perhapsTI_SECURE_DEVICEis too generic a name. I kind of want to introduce something that means TI Secure Boot is supported but also Falcon is supported, and then use that as how we disable inKconfigvarious insecure options. And I assume that it's a matter of effort not technical restrictions for supporting falcon mode on older HS parts?I second your opinion here, the falcon boot flow we do have in K3 devices is quite different from existing platforms but still enabled by the same
SPL_OS_BOOTconfig. Perhaps adding a config likeK3_FALCONmakes sense here.Quoted 6 lines
Quoted 2 lines
And yes, older HS *K3* parts should be able to support a similar falcon style boot flow with not much changes to the
k3_falcon_prepfunction.Maybe we need a common symbol for things that are common to all TI secure devices, and other symbols for K3 or AM33xx (or whatever is most appropriate for that overall era of parts).
I was thinking of adding
TI_SECURE_DEVICE_(LEGACY|K3)hidden config symbols whichTI_SECURE_DEVICEselects as below:config
TI_SECURE_DEVICEbool "HS Device Type Support" depends on ARCH_KEYSTONE || ARCH_OMAP2PLUS || ARCH_K3 select TI_SECURE_DEVICE_LEGACY if ARCH_KEYSTONE || ARCH_OMAP2PLUS select TI_SECURE_DEVICE_K3 if ARCH_K3Quoted 6 lines
Quoted 2 lines
We can then use
TI_SECURE_DEVICE_LEGACYto disableOS_BOOTfor older non K3 platforms instead.The current tech today is the legacy tech tomorrow, so I think a better symbol name is needed for
ARCH_KEYSTONE||ARCH_OMAP2PLUS, especially since the next question is how much do they in fact share in terms ofAgreed, I will update the names to be more descriptive of specific device.
Quoted 4 lines
tooling and features. But I was also thinking that
TI_SECURE_DEVICEshould be a hidden symbol too, and used for the common-if-any parts, and soSPL_OS_BOOTwould depend on !TI_SECURE_DEVICE_K2_OMAP2PLUS or whatever.I don't think we should make
TI_SECURE_DEVICEhidden since iot2050 is a defconfig that disablesTI_SECURE_DEVICEwhile beingARCH_K3, it's also useful to expose it as a config to users in cases of GP devices for example.
Quoted 5 lines
Quoted 1 line
If we are in agreement here, I can post v8 with the suggested changes ;)
Well, with
TI_SECURE_DEVICEhidden butTI_SECURE_DEVICE_K3not, iot2050 can be migrated easily. That should also cover the legacy-within-K3 GP parts too, yes?
Yes, that would work but why expose two symbols (TI_SECURE_DEVICE_K3 and non K3) which essentially mean the same thing "disable insecure features on this TI device" whatever the device be. We can handle the distinction between K3 and non K3 device without exposing it to the defconfigs by keeping the two device specific options hidden. The end user just unsets the TI_SECURE_DEIVCE if they need to regardless of the underlying platform.
Re: [PATCH v7 01/10] spl: Kconfig: allow K3 devices to use falcon mode
Quoted 88 lines · Anshul Dalal
Quoted 81 lines · Tom Rini
Quoted 80 lines · Anshul Dalal
Quoted 60 lines · Tom Rini
Quoted 59 lines · Anshul Dalal
Quoted 42 lines · Tom Rini
Quoted 41 lines · Anshul Dalal
Quoted 20 lines · Tom Rini
Quoted 18 lines · Anshul Dalal
Falcon mode was disabled for
TI_SECURE_DEVICEat commite95b9b4437bc("ti_armv7_common: Disable Falcon Mode on HS devices") for older 32-bit HS devices and can be enabled on K3 devices.For secure boot, the kernel with x509 headers can be packaged in a fit container (fitImage) signed with TIFS keys for authentication.
Signed-off-by Anshul Dalal <[email protected]>--- common/spl/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)common/spl/Kconfig +0
-0@@ -1190,7 +1190,7 @@ config SPL_ONENAND_SUPPORTQuoted 14 lines
common/spl/Kconfig config SPL_ONENAND_SUPPORT · line 1196
Quoted 7 lines
common/spl/Kconfig +1
-1config SPL_OS_BOOT bool "Activate Falcon Mode" - depends on !TI_SECURE_DEVICE + depends on !TI_SECURE_DEVICE || ARCH_K3 help Enable booting directly to an OS from SPL. for more info read doc/README.falconI wonder if overloading
ARCH_K3like this isn't a great idea. Or perhapsTI_SECURE_DEVICEis too generic a name. I kind of want to introduce something that means TI Secure Boot is supported but also Falcon is supported, and then use that as how we disable inKconfigvarious insecure options. And I assume that it's a matter of effort not technical restrictions for supporting falcon mode on older HS parts?I second your opinion here, the falcon boot flow we do have in K3 devices is quite different from existing platforms but still enabled by the same
SPL_OS_BOOTconfig. Perhaps adding a config likeK3_FALCONmakes sense here.Quoted 6 lines
Quoted 2 lines
And yes, older HS *K3* parts should be able to support a similar falcon style boot flow with not much changes to the
k3_falcon_prepfunction.Maybe we need a common symbol for things that are common to all TI secure devices, and other symbols for K3 or AM33xx (or whatever is most appropriate for that overall era of parts).
I was thinking of adding
TI_SECURE_DEVICE_(LEGACY|K3)hidden config symbols whichTI_SECURE_DEVICEselects as below:config
TI_SECURE_DEVICEbool "HS Device Type Support" depends on ARCH_KEYSTONE || ARCH_OMAP2PLUS || ARCH_K3 select TI_SECURE_DEVICE_LEGACY if ARCH_KEYSTONE || ARCH_OMAP2PLUS select TI_SECURE_DEVICE_K3 if ARCH_K3Quoted 6 lines
Quoted 2 lines
We can then use
TI_SECURE_DEVICE_LEGACYto disableOS_BOOTfor older non K3 platforms instead.The current tech today is the legacy tech tomorrow, so I think a better symbol name is needed for
ARCH_KEYSTONE||ARCH_OMAP2PLUS, especially since the next question is how much do they in fact share in terms ofAgreed, I will update the names to be more descriptive of specific device.
Quoted 4 lines
tooling and features. But I was also thinking that
TI_SECURE_DEVICEshould be a hidden symbol too, and used for the common-if-any parts, and soSPL_OS_BOOTwould depend on !TI_SECURE_DEVICE_K2_OMAP2PLUS or whatever.I don't think we should make
TI_SECURE_DEVICEhidden since iot2050 is a defconfig that disablesTI_SECURE_DEVICEwhile beingARCH_K3, it's also useful to expose it as a config to users in cases of GP devices for example.Quoted 5 lines
Quoted 1 line
If we are in agreement here, I can post v8 with the suggested changes ;)
Well, with
TI_SECURE_DEVICEhidden butTI_SECURE_DEVICE_K3not, iot2050 can be migrated easily. That should also cover the legacy-within-K3 GP parts too, yes?
Quoted 7 lines
Yes, that would work but why expose two symbols (
TI_SECURE_DEVICE_K3and non K3) which essentially mean the same thing "disable insecure features on this TI device" whatever the device be. We can handle the distinction between K3 and non K3 device without exposing it to the defconfigs by keeping the two device specific options hidden. The end user just unsets theTI_SECURE_DEIVCEif they need to regardless of the underlying platform.
I worry that'll end up being more complicated than the two arch symbols and a hidden common symbol. But lets see your suggestion in implementation. Thanks.
Signature · 1 line
Tom
PATCH v7 2/10 spl: make CMD_BOOTZ exclusive with TI_SECURE_DEVICE
In reply to Anshul DalalIn the secure OS_BOOT spl execution code path, CMD_BOOTZ enables loading of a zImage which might allow an attacker to bypass the authenticated boot with fitImage by replacing it with a malicious image with header identical to zImage.
Disabling CMD_BOOTZ ensures this code path is never hit inside spl_parse_image_header.
--- cmd/Kconfig | 1 + 1 file changed, 1 insertion(+)
cmd/Kconfig +1 -0
@@ -353,6 +353,7 @@ config BOOTM_ELF config CMD_BOOTZ bool "bootz" + depends on !TI_SECURE_DEVICE help Boot the Linux zImage
Signature · 1 line
2.49.0
Re: [PATCH v7 02/10] spl: make CMD_BOOTZ exclusive with TI_SECURE_DEVICE
Quoted 9 lines · Anshul Dalal
In the secure
OS_BOOTspl execution code path,CMD_BOOTZenables loading of a zImage which might allow an attacker to bypass the authenticated boot with fitImage by replacing it with a malicious image with header identical to zImage.Disabling
CMD_BOOTZensures this code path is never hit insidespl_parse_image_header.Signed-off-by Anshul Dalal <[email protected]>
Signature · 1 line
Tom
PATCH v7 3/10 mach-k3: fix reading size and addr from fdt on R5
In reply to Anshul Dalalfdtdec_get_addr_size uses architecture dependent datatypes which causes the 32-bit R5 to fail when reading the 64-bit size and addr fields of reg nodes from the fdt.
This changes it to a common api for both 64 and 32 bit platforms. Now fdt fixups can be applied to the fdt from R5.
--- arch/arm/mach-k3/common_fdt.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
arch/arm/mach-k3/common_fdt.c +3 -1
@@ -140,7 +140,9 @@ int fdt_fixup_reserved(void *blob, const char *name,return -EINVAL ;if (!strncmp (node_name, name,strlen (name))) {/* Read out old size first */ - addr =fdtdec_get_addr_size (blob, subnode,"reg" , &size); + addr =fdtdec_get_addr_size_fixed ( + blob, subnode,"reg" ,0 ,8 /sizeof (fdt32_t), +8 /sizeof (fdt32_t), &size, false);if (addr ==FDT_ADDR_T_NONE )return -EINVAL ; new_size = size;
Signature · 1 line
2.49.0
PATCH v7 4/10 arch: arm: k3-binman: add fit for falcon boot
In reply to Anshul DalalThis adds creation of tispl_falcon.bin for the am62a, 62p and 62x.
The contents are the same as the existing tispl.bin but A53's spl and the fdt have been removed as they are not needed in falcon boot.
This reduces boot time since the payload size is smaller and we also aren't authenticating the spl and fdt in secure boot.
--- arch/arm/dts/k3-am625-sk-binman.dtsi | 64 ++++++++++++++++++++++++++++ arch/arm/dts/k3-am62a-sk-binman.dtsi | 64 ++++++++++++++++++++++++++++ arch/arm/dts/k3-am62p-sk-binman.dtsi | 51 ++++++++++++++++++++++ arch/arm/dts/k3-binman.dtsi | 54 +++++++++++++++++++++++ 4 files changed, 233 insertions(+)
arch/arm/dts/k3-am625-sk-binman.dtsi +64 -0
@@ -211,6 +211,70 @@ }; }; + ti-falcon { + insert-template = <&ti_falcon_template>; + + fit { + images { + tifsstub-hs { + description = "TIFSSTUB"; + type = "firmware"; + arch = "arm32"; + compression = "none"; + os = "tifsstub-hs"; + load = <0x9dc00000>; + entry = <0x9dc00000>; + blob-ext { + filename = "tifsstub.bin_hs"; + }; + }; + tifsstub-fs { + description = "TIFSSTUB"; + type = "firmware"; + arch = "arm32"; + compression = "none"; + os = "tifsstub-fs"; + load = <0x9dc00000>; + entry = <0x9dc00000>; + blob-ext { + filename = "tifsstub.bin_fs"; + }; + }; + tifsstub-gp { + description = "TIFSSTUB"; + type = "firmware"; + arch = "arm32"; + compression = "none"; + os = "tifsstub-gp"; + load = <0x9dc00000>; + entry = <0x9dc00000>; + blob-ext { + filename = "tifsstub.bin_gp"; + }; + }; + dm { + ti-secure { + content = <&dm_falcon>; + keyfile = "custMpk.pem"; + }; + dm_falcon: ti-dm { + filename = "ti-dm.bin"; + }; + }; + }; + + configurations { + default = "conf-0"; + conf-0 { + description = "k3-am625-sk-falcon"; + firmware = "atf"; + loadables = "tee", "tifsstub-hs", "tifsstub-fs", + "tifsstub-gp", "dm"; + }; + }; + }; + }; + ti-spl { insert-template = <&ti_spl_template>;
arch/arm/dts/k3-am62a-sk-binman.dtsi +64 -0
70 lines not on this page · raw message
arch/arm/dts/k3-am62p-sk-binman.dtsi +51 -0
57 lines not on this page · raw message
arch/arm/dts/k3-binman.dtsi +54 -0
60 lines not on this page · raw message
Signature · 1 line
2.49.0
Re: [PATCH v7 04/10] arch: arm: k3-binman: add fit for falcon boot
On June 3, 2025 thus sayeth Anshul Dalal:
Quoted 20 lines
This adds creation of tispl_falcon.bin for the am62a, 62p and 62x.
The contents are the same as the existing tispl.bin but A53's spl and the fdt have been removed as they are not needed in falcon boot.
This reduces boot time since the payload size is smaller and we also aren't authenticating the spl and fdt in secure boot.
Signed-off-by Anshul Dalal <[email protected]>--- arch/arm/dts/k3-am625-sk-binman.dtsi | 64 ++++++++++++++++++++++++++++ arch/arm/dts/k3-am62a-sk-binman.dtsi | 64 ++++++++++++++++++++++++++++ arch/arm/dts/k3-am62p-sk-binman.dtsi | 51 ++++++++++++++++++++++ arch/arm/dts/k3-binman.dtsi | 54 +++++++++++++++++++++++ 4 files changed, 233 insertions(+)arch/arm/dts/k3-am625-sk-binman.dtsi +0
-0
...
arch/arm/dts/k3-am625-sk-binman.dtsi line 262
Quoted 8 lines
arch/arm/dts/k3-am625-sk-binman.dtsi +8
-0+ dm { + ti-secure { + content = <&dm_falcon>; + keyfile = "custMpk.pem"; + }; + dm_falcon: ti-dm { + filename = "ti-dm.bin"; + };
When you build this are you using the TI_DM argument? Or are you using BINMAN_INDIRS to point to all the firmware? I think this will only look for "${BINMAN_INDIRS}/ti-dm.bin" and error out now that DM is mandatory unless you use TI_DM which will break a few distro builders' recipes
...
arch/arm/dts/k3-binman.dtsi line 493
Quoted 10 lines
arch/arm/dts/k3-binman.dtsi +2
-0@@ -489,6 +489,60 @@ end_address = <0x0 0x9fffffff>; }; + ti_falcon_template: template-9 { + filename = "tispl_falcon.bin";
Small nitpick: We could probably just call this tifalcon.bin or something shorter. It's not really an SPL now.
The bigger issue here (in my mind) is this requires our falcon.config fragment to work properly. I don't think it is wise of use to produce this image if that fragment isn't applied. It would be a debugging nightmare for others outside of the U-Boot space.
Quoted 58 lines
arch/arm/dts/k3-binman.dtsi +52
-0+ pad-byte = <0xff>; + + fit { + description = "Configuration without SPL and FDT"; + #address-cells = <1>; + + images { + atf { + description = "ARM Trusted Firmware"; + type = "firmware"; + arch = "arm64"; + compression = "none"; + os = "arm-trusted-firmware"; + load = <CONFIG_K3_ATF_LOAD_ADDR>; + entry = <CONFIG_K3_ATF_LOAD_ADDR>; + ti-secure { + content = <&atf_falcon>; + keyfile = "custMpk.pem"; + }; + atf_falcon: atf-bl31 { + }; + }; + tee { + description = "OP-TEE"; + type = "tee"; + arch = "arm64"; + compression = "none"; + os = "tee"; + load = <CONFIG_K3_OPTEE_LOAD_ADDR>; + entry = <CONFIG_K3_OPTEE_LOAD_ADDR>; + ti-secure { + content = <&tee_falcon>; + keyfile = "custMpk.pem"; + }; + tee_falcon: tee-os { + optional; + }; + }; + dm { + description = "DM binary"; + type = "firmware"; + arch = "arm32"; + compression = "none"; + os = "DM"; + load = <0x89000000>; + entry = <0x89000000>; + }; + + }; + }; + }; + }; #endifSignature · 1 line
2.49.0
Re: [PATCH v7 04/10] arch: arm: k3-binman: add fit for falcon boot
Quoted 24 lines · Bryan Brattlof
On June 3, 2025 thus sayeth Anshul Dalal:
Quoted 20 lines
This adds creation of tispl_falcon.bin for the am62a, 62p and 62x.
The contents are the same as the existing tispl.bin but A53's spl and the fdt have been removed as they are not needed in falcon boot.
This reduces boot time since the payload size is smaller and we also aren't authenticating the spl and fdt in secure boot.
Signed-off-by Anshul Dalal <[email protected]>--- arch/arm/dts/k3-am625-sk-binman.dtsi | 64 ++++++++++++++++++++++++++++ arch/arm/dts/k3-am62a-sk-binman.dtsi | 64 ++++++++++++++++++++++++++++ arch/arm/dts/k3-am62p-sk-binman.dtsi | 51 ++++++++++++++++++++++ arch/arm/dts/k3-binman.dtsi | 54 +++++++++++++++++++++++ 4 files changed, 233 insertions(+)arch/arm/dts/k3-am625-sk-binman.dtsi +0
-0...
Quoted 14 lines
arch/arm/dts/k3-am625-sk-binman.dtsi line 262
Quoted 8 lines
arch/arm/dts/k3-am625-sk-binman.dtsi +8
-0+ dm { + ti-secure { + content = <&dm_falcon>; + keyfile = "custMpk.pem"; + }; + dm_falcon: ti-dm { + filename = "ti-dm.bin"; + };When you build this are you using the
TI_DMargument? Or are you usingBINMAN_INDIRSto point to all the firmware? I think this will only look for "${BINMAN_INDIRS}/ti-dm.bin" and error out now that DM is mandatory unless you useTI_DMwhich will break a few distro builders' recipes
It relies on BINMAN_INDIRS still and I hadn't updated the dm node since c492a55fe4 ("arm: dts: k3: binman: Fix DM firmware selection"). I will fix this in the next revision. Thanks for bringing it to my attention.
Quoted 15 lines
arch/arm/dts/k3-binman.dtsi line 493
Quoted 11 lines
arch/arm/dts/k3-binman.dtsi +2
-0@@ -489,6 +489,60 @@ end_address = <0x0 0x9fffffff>; }; + ti_falcon_template: template-9 { + filename = "tispl_falcon.bin";Small nitpick: We could probably just call this tifalcon.bin or something shorter. It's not really an SPL now.
Quoted 5 lines
The bigger issue here (in my mind) is this requires our falcon.config fragment to work properly. I don't think it is wise of use to produce this image if that fragment isn't applied. It would be a debugging nightmare for others outside of the U-Boot space.
The fragment applies to r5's defconfig which prevents us from doing a conditional build of tispl or tifalcon at the a53 stage.
Either we move the tifalcon.bin generation to r5 stage which would require not only changes to the build arguments as we would now have to pass OPTEE/ATF and DM's path at r5 stage but considerable changes to the SDK recipes as we would now have to deploy a binary from r5's build output to rootfs.
Binman already produces a lot of binaries during the A-core build most of which the end users doesn't care about. I don't see how adding tifalcon could become a "debugging nightmare".
Regards,
Anshul
Re: [PATCH v7 04/10] arch: arm: k3-binman: add fit for falcon boot
Quoted 59 lines · Anshul Dalal
Quoted 24 lines · Bryan Brattlof
On June 3, 2025 thus sayeth Anshul Dalal:
Quoted 20 lines
This adds creation of tispl_falcon.bin for the am62a, 62p and 62x.
The contents are the same as the existing tispl.bin but A53's spl and the fdt have been removed as they are not needed in falcon boot.
This reduces boot time since the payload size is smaller and we also aren't authenticating the spl and fdt in secure boot.
Signed-off-by Anshul Dalal <[email protected]>--- arch/arm/dts/k3-am625-sk-binman.dtsi | 64 ++++++++++++++++++++++++++++ arch/arm/dts/k3-am62a-sk-binman.dtsi | 64 ++++++++++++++++++++++++++++ arch/arm/dts/k3-am62p-sk-binman.dtsi | 51 ++++++++++++++++++++++ arch/arm/dts/k3-binman.dtsi | 54 +++++++++++++++++++++++ 4 files changed, 233 insertions(+)arch/arm/dts/k3-am625-sk-binman.dtsi +0
-0...
Quoted 14 lines
arch/arm/dts/k3-am625-sk-binman.dtsi line 262
Quoted 8 lines
arch/arm/dts/k3-am625-sk-binman.dtsi +8
-0+ dm { + ti-secure { + content = <&dm_falcon>; + keyfile = "custMpk.pem"; + }; + dm_falcon: ti-dm { + filename = "ti-dm.bin"; + };When you build this are you using the
TI_DMargument? Or are you usingBINMAN_INDIRSto point to all the firmware? I think this will only look for "${BINMAN_INDIRS}/ti-dm.bin" and error out now that DM is mandatory unless you useTI_DMwhich will break a few distro builders' recipesIt relies on
BINMAN_INDIRSstill and I hadn't updated the dm node sincec492a55fe4("arm: dts: k3: binman: Fix DM firmware selection"). I will fix this in the next revision. Thanks for bringing it to my attention.Quoted 15 lines
arch/arm/dts/k3-binman.dtsi line 493
Quoted 11 lines
arch/arm/dts/k3-binman.dtsi +2
-0@@ -489,6 +489,60 @@ end_address = <0x0 0x9fffffff>; }; + ti_falcon_template: template-9 { + filename = "tispl_falcon.bin";Small nitpick: We could probably just call this tifalcon.bin or something shorter. It's not really an SPL now.
Quoted 9 lines
Quoted 5 lines
The bigger issue here (in my mind) is this requires our falcon.config fragment to work properly. I don't think it is wise of use to produce this image if that fragment isn't applied. It would be a debugging nightmare for others outside of the U-Boot space.
The fragment applies to r5's defconfig which prevents us from doing a conditional build of tispl or tifalcon at the a53 stage.
You might also be able to add a config fragment that would be applied to the A53 stage. It would only be used for this one binman task, but isn't that all the A53 build does in the falcon boot case anyway?
Quoted 6 lines
Either we move the tifalcon.bin generation to r5 stage which would require not only changes to the build arguments as we would now have to pass OPTEE/ATF and DM's path at r5 stage but considerable changes to the SDK recipes as we would now have to deploy a binary from r5's build output to rootfs.
I wouldn't worry too much about the SDK, that is something we control and is not the only user of U-Boot.
Why do we do the A53 build at all in the falcon case? If we move the tifalcon.bin generation to R5 stage we can skip the second build, which might be something worth doing just for that reason. Side benefit is it would fix the above issue with non-functional tispl_falcon.bin.
Andrew
Quoted 6 lines
Binman already produces a lot of binaries during the A-core build most of which the end users doesn't care about. I don't see how adding tifalcon could become a "debugging nightmare".
Regards,
Anshul
Re: [PATCH v7 04/10] arch: arm: k3-binman: add fit for falcon boot
Quoted 66 lines · Andrew Davis
Quoted 65 lines · Anshul Dalal
Quoted 24 lines · Bryan Brattlof
On June 3, 2025 thus sayeth Anshul Dalal:
Quoted 20 lines
This adds creation of tispl_falcon.bin for the am62a, 62p and 62x.
The contents are the same as the existing tispl.bin but A53's spl and the fdt have been removed as they are not needed in falcon boot.
This reduces boot time since the payload size is smaller and we also aren't authenticating the spl and fdt in secure boot.
Signed-off-by Anshul Dalal <[email protected]>--- arch/arm/dts/k3-am625-sk-binman.dtsi | 64 ++++++++++++++++++++++++++++ arch/arm/dts/k3-am62a-sk-binman.dtsi | 64 ++++++++++++++++++++++++++++ arch/arm/dts/k3-am62p-sk-binman.dtsi | 51 ++++++++++++++++++++++ arch/arm/dts/k3-binman.dtsi | 54 +++++++++++++++++++++++ 4 files changed, 233 insertions(+)arch/arm/dts/k3-am625-sk-binman.dtsi +0
-0...
Quoted 14 lines
arch/arm/dts/k3-am625-sk-binman.dtsi line 262
Quoted 8 lines
arch/arm/dts/k3-am625-sk-binman.dtsi +8
-0+ dm { + ti-secure { + content = <&dm_falcon>; + keyfile = "custMpk.pem"; + }; + dm_falcon: ti-dm { + filename = "ti-dm.bin"; + };When you build this are you using the
TI_DMargument? Or are you usingBINMAN_INDIRSto point to all the firmware? I think this will only look for "${BINMAN_INDIRS}/ti-dm.bin" and error out now that DM is mandatory unless you useTI_DMwhich will break a few distro builders' recipesIt relies on
BINMAN_INDIRSstill and I hadn't updated the dm node sincec492a55fe4("arm: dts: k3: binman: Fix DM firmware selection"). I will fix this in the next revision. Thanks for bringing it to my attention.Quoted 20 lines
arch/arm/dts/k3-binman.dtsi line 493
Quoted 11 lines
arch/arm/dts/k3-binman.dtsi +2
-0@@ -489,6 +489,60 @@ end_address = <0x0 0x9fffffff>; }; + ti_falcon_template: template-9 { + filename = "tispl_falcon.bin";Small nitpick: We could probably just call this tifalcon.bin or something shorter. It's not really an SPL now.
The bigger issue here (in my mind) is this requires our falcon.config fragment to work properly. I don't think it is wise of use to produce this image if that fragment isn't applied. It would be a debugging nightmare for others outside of the U-Boot space.
Quoted 8 lines
Quoted 3 lines
The fragment applies to r5's defconfig which prevents us from doing a conditional build of tispl or tifalcon at the a53 stage.
You might also be able to add a config fragment that would be applied to the A53 stage. It would only be used for this one binman task, but isn't that all the A53 build does in the falcon boot case anyway?
I don't see much value to such a config fragment, we already create unsigned binaries without having a conditional build for it. Existing customers can continue using tispl as usual and ignore the tifalcon.bin file just like any other binaries binman produces.
Quoted 7 lines
Quoted 6 lines
Either we move the tifalcon.bin generation to r5 stage which would require not only changes to the build arguments as we would now have to pass OPTEE/ATF and DM's path at r5 stage but considerable changes to the SDK recipes as we would now have to deploy a binary from r5's build output to rootfs.
Quoted 8 lines
I wouldn't worry too much about the SDK, that is something we control and is not the only user of U-Boot.
Why do we do the A53 build at all in the falcon case? If we move the tifalcon.bin generation to R5 stage we can skip the second build, which might be something worth doing just for that reason. Side benefit is it would fix the above issue with non-functional
tispl_falcon.bin.
I agree that A53 build is just an overly complicated way to package binaries for falcon boot if you only consider OS_BOOT use case but I expect most users would have built A53 at least once from where they can directly use the tifalcon binary.
Having tifalcon be part of A53 build also keep the clean separation between R5 binaries (tiboot3) and **mostly** A53 ones (optee and atf).
PATCH v7 5/10 mach-k3: sysfw-loader: update img_hdr for falcon
In reply to Anshul DalalThe returned legacy_img_hdr is used by booti_setup to compute the load address for the kernel image.
This change ensures the kernel load address is CONFIG_SYS_LOAD_ADDR in falcon boot.
--- arch/arm/mach-k3/r5/sysfw-loader.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
arch/arm/mach-k3/r5/sysfw-loader.c +5 -1
@@ -89,7 +89,11 @@ static void *sysfw_load_address;struct legacy_img_hdr *spl_get_load_buffer (ssize_t offset,size_t size) {if (sysfw_loaded) -return (struct legacy_img_hdr *)(CONFIG_TEXT_BASE + offset); +if (IS_ENABLED (CONFIG_SPL_OS_BOOT )) +return (struct legacy_img_hdr *)CONFIG_SYS_LOAD_ADDR ; +else +return (struct legacy_img_hdr *)(CONFIG_TEXT_BASE + + offset);else if (sysfw_load_address)return sysfw_load_address;else
Signature · 1 line
2.49.0
PATCH v7 6/10 config: add falcon boot config fragment for am62x
In reply to Anshul DalalThis fragment enables falcon boot for the am62x, 62a and 62p.
To have enough stack and heap space for loading kernel image as FIT the memory map was modified by expanding stack + heap size, the PRELOADED_BL33_BASE in ATF has to also be updated to 0x82000000 since the kernel requires to be loaded at 2MiB aligned address along with change changing K3_HW_CONFIG_BASE to 0x88000000 for the DT passed to kernel.
Modified memory map for R5 SPL (modified addresses marked with *):
0x80000000 +-------------------------------+ Start of DDR
512KiB | ATF reserved memory space | CONFIG_K3_ATF_LOAD_ADDR*0x80080000 +-------------------------------+
31.5MiB | Unused |0x82000000 +-------------------------------+ PRELOADED_BL33_BASE* in ATF
| | CONFIG_SYS_LOAD_ADDR*
57MiB | Kernel + initramfs Image | CONFIG_SPL_LOAD_FIT_ADDRESS*
| |
0x85900000 +-------------------------------+
| |
| R5 U-Boot SPL Stack + Heap |
39MiB | (size defined by |
|SPL_STACK_R_MALLOC_SIMPLE_LEN*)|
| |
0x88000000 +-------------------------------+ CONFIG_SPL_STACK_R_ADDR*
| | K3_HW_CONFIG_BASE* in ATF
16MiB | Kernel DTB | CONFIG_SPL_PAYLOAD_ARGS_ADDR*
| |0x89000000 +-------------------------------+
331MiB | Device Manager (DM) Load Addr |0x9db00000 +-------------------------------+
12MiB | DM Reserved |0x9e700000 +-------------------------------+
1MiB | Unused |0x9e800000 +-------------------------------+ BL32_BASE in ATF
24MiB | OPTEE |0xa0000000 +-------------------------------+ End of DDR (512MiB)
--- configs/am62x_r5_falcon.config | 38 ++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 configs/am62x_r5_falcon.config
configs/am62x_r5_falcon.config new file +38 -0
@@ -0,0 +1,38 @@ +# Enable falcon mode +CONFIG_SPL_OS_BOOT=y + +# We use envs for setting bootargs and optionally for `falcon_(image|args)_file` +CONFIG_SPL_ENV_SUPPORT=y + +# Perform FDT fixups from SPL +CONFIG_OF_SYSTEM_SETUP=y + +# Enabling this causes issues with EMMC FS boot, +# When enabled the SPL tries to detect FS on boot[01] hw partition which fails +# since we need the raw tiboot3.bin there for the board to boot instead +CONFIG_SUPPORT_EMMC_BOOT=n + +# Used as the 2MiB aligned load address for kernel +CONFIG_SYS_LOAD_ADDR=0x82000000 +CONFIG_SPL_PAYLOAD_ARGS_ADDR=0x88000000 +CONFIG_SPL_LOAD_FIT_ADDRESS=0x82000000 +CONFIG_SPL_STACK_R_ADDR=0x88000000 +CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x2700000 + +# We use the rootfs (i.e partition 2) for booting which is ext4 not FAT +CONFIG_SYS_MMCSD_FS_BOOT_PARTITION=2 +CONFIG_SPL_FS_EXT4=y +CONFIG_SPL_FS_FAT=n + +# Loading tispl_falcon instead of tispl which has fdt and A53 spl saves time +CONFIG_SPL_FS_LOAD_PAYLOAD_NAME="boot/tispl_falcon.bin" +CONFIG_SPL_FS_LOAD_KERNEL_NAME="boot/fitImage" + +# Disabled to save space on the spl +CONFIG_TI_K3_NAVSS_UDMA=n + +# During SPI boot, kernel and args are loaded from the eMMC or SD and not SPI, +# therefore we don't actually make use of these config values. +CONFIG_SYS_SPI_KERNEL_OFFS=0 +CONFIG_SYS_SPI_ARGS_OFFS=0 +CONFIG_SYS_SPI_ARGS_SIZE=0
Signature · 1 line
2.49.0
PATCH v7 7/10 board: ti: add default dtb for am62 in falcon mode
In reply to Anshul DalalThe SPL_FS_LOAD_ARGS_NAME config is used for the arguments to the kernel (dtb in our case) in falcon boot.
Setting it in board specific Kconfig allows us to reuse the same config fragment 'am62x_r5_falcon.config' for all 3 platforms for enabling falcon boot.
--- board/ti/am62ax/Kconfig | 3 +++ board/ti/am62px/Kconfig | 3 +++ board/ti/am62x/Kconfig | 3 +++ 3 files changed, 9 insertions(+)
board/ti/am62ax/Kconfig +3 -0
@@ -23,4 +23,7 @@ if TARGET_AM62A7_R5_EVM config SPL_LDSCRIPT default "arch/arm/mach-omap2/u-boot-spl.lds" +config SPL_FS_LOAD_ARGS_NAME + default "boot/dtb/ti/k3-am62a7-sk.dtb" + endif
board/ti/am62px/Kconfig +3 -0
@@ -23,4 +23,7 @@ if TARGET_AM62P5_R5_EVM config SPL_LDSCRIPT default "arch/arm/mach-omap2/u-boot-spl.lds" +config SPL_FS_LOAD_ARGS_NAME + default "boot/dtb/ti/k3-am62p5-sk.dtb" + endif
board/ti/am62x/Kconfig +3 -0
@@ -32,6 +32,9 @@ config SYS_CONFIG_NAME config SPL_LDSCRIPT default "arch/arm/mach-omap2/u-boot-spl.lds" +config SPL_FS_LOAD_ARGS_NAME + default "boot/dtb/ti/k3-am625-sk.dtb" + source "board/ti/common/Kconfig" endif
Signature · 1 line
2.49.0
Re: [PATCH v7 07/10] board: ti: add default dtb for am62 in falcon mode
Quoted 7 lines · Anshul Dalal
The
SPL_FS_LOAD_ARGS_NAMEconfig is used for the arguments to the kernel (dtb in our case) in falcon boot.Setting it in board specific
Kconfigallows us to reuse the same config fragment 'am62x_r5_falcon.config' for all 3 platforms for enabling falcon boot.
Quoted 6 lines
Signed-off-by Anshul Dalal <[email protected]>--- board/ti/am62ax/Kconfig | 3 +++ board/ti/am62px/Kconfig | 3 +++ board/ti/am62x/Kconfig | 3 +++ 3 files changed, 9 insertions(+)
Why can't whatever is using the fragment also set this? Is it because you're only using this as part of say:
make am62ax_evm_r5_defconfig am62x_falcon.config
?
Signature · 1 line
Tom
Re: [PATCH v7 07/10] board: ti: add default dtb for am62 in falcon mode
Quoted 16 lines · Tom Rini
Quoted 7 lines · Anshul Dalal
The
SPL_FS_LOAD_ARGS_NAMEconfig is used for the arguments to the kernel (dtb in our case) in falcon boot.Setting it in board specific
Kconfigallows us to reuse the same config fragment 'am62x_r5_falcon.config' for all 3 platforms for enabling falcon boot.Quoted 6 lines
Signed-off-by Anshul Dalal <[email protected]>--- board/ti/am62ax/Kconfig | 3 +++ board/ti/am62px/Kconfig | 3 +++ board/ti/am62x/Kconfig | 3 +++ 3 files changed, 9 insertions(+)
Quoted 4 lines
Why can't whatever is using the fragment also set this? Is it because you're only using this as part of say:
makeam62ax_evm_r5_defconfigam62x_falcon.config
?
Correct, having three different config fragments with only changes to the dtb path doesn't seem very useful imo.
Re: [PATCH v7 07/10] board: ti: add default dtb for am62 in falcon mode
Quoted 17 lines · Anshul Dalal
Quoted 16 lines · Tom Rini
Quoted 13 lines · Anshul Dalal
The
SPL_FS_LOAD_ARGS_NAMEconfig is used for the arguments to the kernel (dtb in our case) in falcon boot.Setting it in board specific
Kconfigallows us to reuse the same config fragment 'am62x_r5_falcon.config' for all 3 platforms for enabling falcon boot.Signed-off-by Anshul Dalal <[email protected]>--- board/ti/am62ax/Kconfig | 3 +++ board/ti/am62px/Kconfig | 3 +++ board/ti/am62x/Kconfig | 3 +++ 3 files changed, 9 insertions(+)
Quoted 7 lines
Quoted 4 lines
Why can't whatever is using the fragment also set this? Is it because you're only using this as part of say:
makeam62ax_evm_r5_defconfigam62x_falcon.config
?Correct, having three different config fragments with only changes to the dtb path doesn't seem very useful imo.
Then these belong back in the main defconfig itself I think.
Signature · 1 line
Tom
Re: [PATCH v7 07/10] board: ti: add default dtb for am62 in falcon mode
Quoted 23 lines · Tom Rini
Quoted 22 lines · Anshul Dalal
Quoted 20 lines · Tom Rini
Quoted 7 lines · Anshul Dalal
The
SPL_FS_LOAD_ARGS_NAMEconfig is used for the arguments to the kernel (dtb in our case) in falcon boot.Setting it in board specific
Kconfigallows us to reuse the same config fragment 'am62x_r5_falcon.config' for all 3 platforms for enabling falcon boot.Quoted 6 lines
Signed-off-by Anshul Dalal <[email protected]>--- board/ti/am62ax/Kconfig | 3 +++ board/ti/am62px/Kconfig | 3 +++ board/ti/am62x/Kconfig | 3 +++ 3 files changed, 9 insertions(+)Why can't whatever is using the fragment also set this? Is it because you're only using this as part of say:
makeam62ax_evm_r5_defconfigam62x_falcon.config
?
Quoted 4 lines
Quoted 2 lines
Correct, having three different config fragments with only changes to the dtb path doesn't seem very useful imo.
Then these belong back in the main defconfig itself I think.
That's not an option since SPL_FS_LOAD_ARGS_NAME depends on SPL_OS_BOOT[1] and due to the way config fragments are applied. Since we only set OS_BOOT to y inside of the fragment, we can not define any configs that depend on it before that in the defconfig like SPL_FS_LOAD_ARGS_NAME, it would just default to "args" instead.
[1]: common/spl/Kconfig:794
config SPL_FS_LOAD_ARGS_NAME
string "File to load for the OS kernel argument parameters from the filesystem" depends on (SPL_FS_EXT4 || SPL_FS_FAT || SPL_FS_SQUASHFS) && SPL_OS_BOOT default "args"
Re: [PATCH v7 07/10] board: ti: add default dtb for am62 in falcon mode
Quoted 35 lines · Anshul Dalal
Quoted 23 lines · Tom Rini
Quoted 22 lines · Anshul Dalal
Quoted 20 lines · Tom Rini
Quoted 7 lines · Anshul Dalal
The
SPL_FS_LOAD_ARGS_NAMEconfig is used for the arguments to the kernel (dtb in our case) in falcon boot.Setting it in board specific
Kconfigallows us to reuse the same config fragment 'am62x_r5_falcon.config' for all 3 platforms for enabling falcon boot.Quoted 6 lines
Signed-off-by Anshul Dalal <[email protected]>--- board/ti/am62ax/Kconfig | 3 +++ board/ti/am62px/Kconfig | 3 +++ board/ti/am62x/Kconfig | 3 +++ 3 files changed, 9 insertions(+)Why can't whatever is using the fragment also set this? Is it because you're only using this as part of say:
makeam62ax_evm_r5_defconfigam62x_falcon.config
?Quoted 4 lines
Quoted 2 lines
Correct, having three different config fragments with only changes to the dtb path doesn't seem very useful imo.
Then these belong back in the main defconfig itself I think.
That's not an option since
SPL_FS_LOAD_ARGS_NAMEdepends on SPL_OS_BOOT[1] and due to the way config fragments are applied. Since we only setOS_BOOTto y inside of the fragment, we can not define any configs that depend on it before that in the defconfig likeSPL_FS_LOAD_ARGS_NAME, it would just default to "args" instead.
Quoted 5 lines
[1]: common/spl/Kconfig:794
configSPL_FS_LOAD_ARGS_NAMEstring "File to load for the OS kernel argument parameters from the filesystem" depends on (SPL_FS_EXT4 || SPL_FS_FAT || SPL_FS_SQUASHFS) && SPL_OS_BOOT default "args"
Config fragments can be nested, so maybe the falcon variant will need to include the main defconfig, the falcon fragment and then set the args to the dtb.
Signature · 1 line
Tom
Re: [PATCH v7 07/10] board: ti: add default dtb for am62 in falcon mode
Quoted 42 lines · Tom Rini
Quoted 35 lines · Anshul Dalal
Quoted 23 lines · Tom Rini
Quoted 22 lines · Anshul Dalal
Quoted 20 lines · Tom Rini
Quoted 7 lines · Anshul Dalal
The
SPL_FS_LOAD_ARGS_NAMEconfig is used for the arguments to the kernel (dtb in our case) in falcon boot.Setting it in board specific
Kconfigallows us to reuse the same config fragment 'am62x_r5_falcon.config' for all 3 platforms for enabling falcon boot.Quoted 6 lines
Signed-off-by Anshul Dalal <[email protected]>--- board/ti/am62ax/Kconfig | 3 +++ board/ti/am62px/Kconfig | 3 +++ board/ti/am62x/Kconfig | 3 +++ 3 files changed, 9 insertions(+)Why can't whatever is using the fragment also set this? Is it because you're only using this as part of say:
makeam62ax_evm_r5_defconfigam62x_falcon.config
?Quoted 4 lines
Quoted 2 lines
Correct, having three different config fragments with only changes to the dtb path doesn't seem very useful imo.
Then these belong back in the main defconfig itself I think.
That's not an option since
SPL_FS_LOAD_ARGS_NAMEdepends on SPL_OS_BOOT[1] and due to the way config fragments are applied. Since we only setOS_BOOTto y inside of the fragment, we can not define any configs that depend on it before that in the defconfig likeSPL_FS_LOAD_ARGS_NAME, it would just default to "args" instead.Quoted 5 lines
[1]: common/spl/Kconfig:794
configSPL_FS_LOAD_ARGS_NAMEstring "File to load for the OS kernel argument parameters from the filesystem" depends on (SPL_FS_EXT4 || SPL_FS_FAT || SPL_FS_SQUASHFS) && SPL_OS_BOOT default "args"
Quoted 3 lines
Config fragments can be nested, so maybe the falcon variant will need to include the main defconfig, the falcon fragment and then set the args to the dtb.
So we add 3 new defconfigs for each platforms that include their respective defconfigs and the fragment with only the dtb changes?
That sounds good to me though why not modify the Kconfig's directly like I did in the patch originally?
Re: [PATCH v7 07/10] board: ti: add default dtb for am62 in falcon mode
Quoted 47 lines · Anshul Dalal
Quoted 42 lines · Tom Rini
Quoted 35 lines · Anshul Dalal
Quoted 23 lines · Tom Rini
Quoted 22 lines · Anshul Dalal
Quoted 20 lines · Tom Rini
Quoted 7 lines · Anshul Dalal
The
SPL_FS_LOAD_ARGS_NAMEconfig is used for the arguments to the kernel (dtb in our case) in falcon boot.Setting it in board specific
Kconfigallows us to reuse the same config fragment 'am62x_r5_falcon.config' for all 3 platforms for enabling falcon boot.Quoted 6 lines
Signed-off-by Anshul Dalal <[email protected]>--- board/ti/am62ax/Kconfig | 3 +++ board/ti/am62px/Kconfig | 3 +++ board/ti/am62x/Kconfig | 3 +++ 3 files changed, 9 insertions(+)Why can't whatever is using the fragment also set this? Is it because you're only using this as part of say:
makeam62ax_evm_r5_defconfigam62x_falcon.config
?Quoted 4 lines
Quoted 2 lines
Correct, having three different config fragments with only changes to the dtb path doesn't seem very useful imo.
Then these belong back in the main defconfig itself I think.
That's not an option since
SPL_FS_LOAD_ARGS_NAMEdepends on SPL_OS_BOOT[1] and due to the way config fragments are applied. Since we only setOS_BOOTto y inside of the fragment, we can not define any configs that depend on it before that in the defconfig likeSPL_FS_LOAD_ARGS_NAME, it would just default to "args" instead.Quoted 5 lines
[1]: common/spl/Kconfig:794
configSPL_FS_LOAD_ARGS_NAMEstring "File to load for the OS kernel argument parameters from the filesystem" depends on (SPL_FS_EXT4 || SPL_FS_FAT || SPL_FS_SQUASHFS) && SPL_OS_BOOT default "args"Quoted 3 lines
Config fragments can be nested, so maybe the falcon variant will need to include the main defconfig, the falcon fragment and then set the args to the dtb.
Quoted 5 lines
So we add 3 new defconfigs for each platforms that include their respective defconfigs and the fragment with only the dtb changes?
That sounds good to me though why not modify the Kconfig's directly like I did in the patch originally?
The problem is that just because we can put values in a Kconfig file, and are much more relaxed about it than the linux kernel is, does not mean it's the right place for values used on a single platform. We do have a few anti-pattern examples of this, but they should be fixed and not expanded upon.
Signature · 1 line
Tom
PATCH v7 8/10 mach-k3: common: enable falcon mode for 62 platform
In reply to Anshul DalalWe use the spl_board_prepare_for_boot hook to call k3_falcon_prep which is ran after tispl is loaded but before jump_to_image.
In here, we find the boot media and load the image just as std falcon flow (since spl_start_uboot returns 0 now). Once the kernel and args are loaded, we perform fdt fixups on the fdt accompanying the kernel (if loaded as FIT) or the loaded up args and return.
Now when the flow goes to jump_to_image, we do the regular pre-jump procedure and jump to ATF which jumps to the kernel directly since we have already loaded the kernel and dtb at their respective addresses (PRELOADED_BL33_BASE and K3_HW_CONFIG_BASE).
--- arch/arm/mach-k3/common.c | 107 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 107 insertions(+)
arch/arm/mach-k3/common.c +107 -0
@@ -259,8 +259,115 @@ static __maybe_unused void k3_dma_remove(void)pr_warn ("DMA Device not found (err=%d)\n" , rc); } +#if IS_ENABLED (CONFIG_SPL_OS_BOOT ) && !IS_ENABLED (CONFIG_ARM64 ) +static bool tispl_loaded; + +int spl_start_uboot (void ) +{ +if (!tispl_loaded) +return 1 ; +return 0 ; +} + +static int k3_falcon_fdt_fixup (void *fdt) +{ +struct disk_partition info; +struct blk_desc *dev_desc; +char bootmedia[32 ]; +char bootpart[32 ]; +char str[256 ]; +int ret; + +strcpy (bootmedia,env_get ("boot" )); +strcpy (bootpart,env_get ("bootpart" )); + ret =blk_get_device_part_str (bootmedia, bootpart, &dev_desc, &info,0 ); +if (ret <0 ) +printf ("Failed to get part details for %s %s [%d]\n" , bootmedia, + bootpart, ret); +sprintf (str,"console=%s root=PARTUUID=%s rootwait" ,env_get ("console" ), + info.uuid); + +fdt_set_totalsize (fdt,fdt_totalsize (fdt) +CONFIG_SYS_FDT_PAD ); + ret =fdt_find_and_setprop (fdt,"/chosen" ,"bootargs" , str, +strlen (str) +1 ,1 ); +if (ret) { +printf ("Could not set bootargs: %s\n" ,fdt_strerror (ret)); +return ret; + } +debug ("Set bootargs to: %s\n" , str); + +#ifdef CONFIG_OF_BOARD_SETUP + ret =ft_board_setup (fdt, gd->bd); +if (ret) { +printf ("Failed in board fdt fixups: %s\n" ,fdt_strerror (ret)); +return ret; + } +#endif + +#ifdef CONFIG_OF_SYSTEM_SETUP + ret =ft_system_setup (fdt, gd->bd); +if (ret) { +printf ("Failed in system fdt fixups: %s\n" ,fdt_strerror (ret)); +return ret; + } +#endif + +return 0 ; +} + +static int k3_falcon_prep (void ) +{ +struct spl_image_loader *loader, *drv; +struct spl_image_info kernel_image; +struct spl_boot_device bootdev; +int ret = -ENXIO , n_ents; +void *fdt; + + tispl_loaded = true; +memset (&kernel_image,'\0' ,sizeof (kernel_image)); + drv = ll_entry_start(struct spl_image_loader, spl_image_loader); + n_ents = ll_entry_count(struct spl_image_loader, spl_image_loader); + bootdev.boot_device =spl_boot_device (); +if (bootdev.boot_device ==BOOT_DEVICE_SPI ) { +if (strcmp (env_get ("mmcdev" ),"1" ) ==0 ) + bootdev.boot_device =BOOT_DEVICE_MMC ; +else + bootdev.boot_device =BOOT_DEVICE_EMMC ; + } + bootdev.boot_device_name =NULL ; + +for (loader = drv; loader != drv + n_ents; loader++) { +if (bootdev.boot_device != loader->boot_device) +continue ; +if (loader) { +printf ("Loading falcon payload from %s\n" , +spl_loader_name (loader)); + ret = loader->load_image (&kernel_image, &bootdev); +if (ret) +continue ; + + fdt =spl_image_fdt_addr (&kernel_image); +if (!fdt) + fdt = (void *)CONFIG_SPL_PAYLOAD_ARGS_ADDR ; + ret =k3_falcon_fdt_fixup (fdt); +if (ret) { +printf ("Failed performing fdt fixups in falcon flow: [%d]\n" , + ret); +return ret; + } +return 0 ; + } + } + +return ret; +} +#endif +void spl_board_prepare_for_boot (void ) { +#if IS_ENABLED (CONFIG_SPL_OS_BOOT ) && !IS_ENABLED (CONFIG_ARM64 ) +k3_falcon_prep (); +#endif #if !(defined(CONFIG_SYS_ICACHE_OFF ) && defined(CONFIG_SYS_DCACHE_OFF ))dcache_disable ();#endif
Signature · 1 line
2.49.0
Re: [PATCH v7 08/10] mach-k3: common: enable falcon mode for 62 platform
Quoted 37 lines · Anshul Dalal
We use the
spl_board_prepare_for_boothook to callk3_falcon_prepwhich is ran after tispl is loaded but beforejump_to_image.In here, we find the boot media and load the image just as std falcon flow (since
spl_start_ubootreturns 0 now). Once the kernel and args are loaded, we perform fdt fixups on the fdt accompanying the kernel (if loaded as FIT) or the loaded up args and return.Now when the flow goes to
jump_to_image, we do the regular pre-jump procedure and jump to ATF which jumps to the kernel directly since we have already loaded the kernel and dtb at their respective addresses (PRELOADED_BL33_BASEandK3_HW_CONFIG_BASE).Signed-off-by Anshul Dalal <[email protected]>--- arch/arm/mach-k3/common.c | 107 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 107 insertions(+)arch/arm/mach-k3/common.c +11
-0@@ -259,8 +259,115 @@ static __maybe_unused void k3_dma_remove(void)pr_warn ("DMA Device not found (err=%d)\n" , rc); } +#if IS_ENABLED (CONFIG_SPL_OS_BOOT ) && !IS_ENABLED (CONFIG_ARM64 ) +static bool tispl_loaded; + +int spl_start_uboot (void ) +{ +if (!tispl_loaded) +return 1 ; +return 0 ; +} + +static int k3_falcon_fdt_fixup (void *fdt)
arch/arm/mach-k3/common.c static __maybe_unused void k3_dma_remove(void) · line 282
Quoted 10 lines
arch/arm/mach-k3/common.c +10
-0+{ +struct disk_partition info; +struct blk_desc *dev_desc; +char bootmedia[32 ]; +char bootpart[32 ]; +char str[256 ]; +int ret; + +strcpy (bootmedia,env_get ("boot" )); +strcpy (bootpart,env_get ("bootpart" ));
Since we're talking secure parts, strncpy is even more important, and being aware of:
* Note that unlike userspace strncpy, this does not %NUL-pad the buffer.
* However, the result is not %NUL-terminated if the source exceeds
* @count bytes.
from lib/string.c
arch/arm/mach-k3/common.c static __maybe_unused void k3_dma_remove(void) · line 286
Quoted 4 lines
arch/arm/mach-k3/common.c +4
-0+ ret =blk_get_device_part_str (bootmedia, bootpart, &dev_desc, &info,0 ); +if (ret <0 ) +printf ("Failed to get part details for %s %s [%d]\n" , bootmedia, + bootpart, ret);
... and bail out?
I feel like all the changes here need a read with "and on failure in secure mode what can someone abuse this to do" in mind.
Signature · 1 line
Tom
Re: [PATCH v7 08/10] mach-k3: common: enable falcon mode for 62 platform
Quoted 47 lines · Tom Rini
Quoted 46 lines · Anshul Dalal
We use the
spl_board_prepare_for_boothook to callk3_falcon_prepwhich is ran after tispl is loaded but beforejump_to_image.In here, we find the boot media and load the image just as std falcon flow (since
spl_start_ubootreturns 0 now). Once the kernel and args are loaded, we perform fdt fixups on the fdt accompanying the kernel (if loaded as FIT) or the loaded up args and return.Now when the flow goes to
jump_to_image, we do the regular pre-jump procedure and jump to ATF which jumps to the kernel directly since we have already loaded the kernel and dtb at their respective addresses (PRELOADED_BL33_BASEandK3_HW_CONFIG_BASE).Signed-off-by Anshul Dalal <[email protected]>--- arch/arm/mach-k3/common.c | 107 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 107 insertions(+)arch/arm/mach-k3/common.c +20
-0@@ -259,8 +259,115 @@ static __maybe_unused void k3_dma_remove(void)pr_warn ("DMA Device not found (err=%d)\n" , rc); } +#if IS_ENABLED (CONFIG_SPL_OS_BOOT ) && !IS_ENABLED (CONFIG_ARM64 ) +static bool tispl_loaded; + +int spl_start_uboot (void ) +{ +if (!tispl_loaded) +return 1 ; +return 0 ; +} + +static int k3_falcon_fdt_fixup (void *fdt) +{ +struct disk_partition info; +struct blk_desc *dev_desc; +char bootmedia[32 ]; +char bootpart[32 ]; +char str[256 ]; +int ret; + +strcpy (bootmedia,env_get ("boot" ));
Quoted 9 lines
arch/arm/mach-k3/common.c static __maybe_unused void k3_dma_remove(void) · line 282
Quoted 1 line
arch/arm/mach-k3/common.c +1
-0+strcpy (bootpart,env_get ("bootpart" ));Since we're talking secure parts, strncpy is even more important, and being aware of:
* Note that unlike userspace strncpy, this does not %NUL-pad the buffer.
* However, the result is not %NUL-terminated if the source exceeds
* @count bytes.
fromlib/string.c
Got it, I'll update the call to strncpy(bootmedia, env_get("boot"), 32) in the next revision.
Quoted 7 lines
arch/arm/mach-k3/common.c static __maybe_unused void k3_dma_remove(void) · line 286
Quoted 4 lines
arch/arm/mach-k3/common.c +4
-0+ ret =blk_get_device_part_str (bootmedia, bootpart, &dev_desc, &info,0 ); +if (ret <0 ) +printf ("Failed to get part details for %s %s [%d]\n" , bootmedia, + bootpart, ret);... and bail out?
That makes sense, in secure world we should not be proceeding in such a case regardless. I'll propogate the error to the top and hang at spl_prepare_for_boot if anything fails.
Quoted 2 lines
I feel like all the changes here need a read with "and on failure in secure mode what can someone abuse this to do" in mind.
PATCH v7 9/10 Makefile: update tispl regex to also clean falcon spl
In reply to Anshul DalalBuild for A53 on am62 platforms now generates tispl_falcon.bin alongside tispl.bin, edit the regex for make clean so that both files are removed.
--- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Makefile +1 -1
@@ -2225,7 +2225,7 @@ CLEAN_FILES += include/autoconf.mk* include/bmp_logo.h include/bmp_logo_data.h \ include/config.h include/generated/env.* drivers/video/u_boot_logo.S \ tools/version.h u-boot* MLO* SPL System.map fit-dtb.blob* \ u-boot-ivt.img.log u-boot-dtb.imx.log SPL.log u-boot.imx.log \ - lpc32xx-* bl31.c bl31.elf bl31_*.bin image.map tispl.bin* \ + lpc32xx-* bl31.c bl31.elf bl31_*.bin image.map tispl*.bin* \ idbloader.img flash.bin flash.log defconfig keep-syms-lto.c \ mkimage-out.spl.mkimage mkimage.spl.mkimage imx-boot.map \ itb.fit.fit itb.fit.itb itb.map spl.map mkimage-out.rom.mkimage \
Signature · 1 line
2.49.0
PATCH v7 10/10 doc: ti: am62: add falcon mode documentation
In reply to Anshul DalalThis patch adds user documentation for falcon boot for am62 platforms. The main section is added to am62x_sk.rst and other documents just include the section. Steps to build falcon support, usage and the modified R5 memory map have been documented.
Two svg images have also been added for reference, one for the modified tispl_falcon.bin and other for the falcon specific fitImage format.
--- doc/board/ti/am62ax_sk.rst | 7 + doc/board/ti/am62px_sk.rst | 7 + doc/board/ti/am62x_sk.rst | 289 ++++++++++++++++++ doc/board/ti/img/fitImage_falcon.svg | 180 +++++++++++ .../ti/img/tifsstub_dm_tispl_falcon.bin.svg | 285 +++++++++++++++++ 5 files changed, 768 insertions(+) create mode 100644 doc/board/ti/img/fitImage_falcon.svg create mode 100644 doc/board/ti/img/tifsstub_dm_tispl_falcon.bin.svg
doc/board/ti/am62ax_sk.rst +7 -0
@@ -192,6 +192,13 @@ https://www.ti.com/lit/pdf/spruj16 under the `Boot Mode Pins` section. For SW2 and SW1, the switch state in the "ON" position = 1. +Falcon Mode +----------- + +AM62A platforms support falcon mode, bypassing A-core SPL and u-boot to reduce +boot times. See :ref:`falcon mode<am62x_evm_falcon_mode_start>` section on AM62 platforms page for detailed build +information. + Debugging U-Boot ----------------
doc/board/ti/am62px_sk.rst +7 -0
@@ -290,6 +290,13 @@ https://www.ti.com/lit/pdf/spruj83 under the `Boot Mode Pins` section. For SW2 and SW1, the switch state in the "ON" position = 1. +Falcon Mode +----------- + +AM62P platforms support falcon mode, bypassing A-core SPL and u-boot to reduce +boot times. See :ref:`falcon mode<am62x_evm_falcon_mode_start>` section on AM62 platforms page for detailed build +information. + Debugging U-Boot ----------------
doc/board/ti/am62x_sk.rst +289 -0
295 lines not on this page · raw message
doc/board/ti/img/fitImage_falcon.svg new file +180 -0
180 lines not on this page · raw message
doc/board/ti/img/tifsstub_dm_tispl_falcon.bin.svg new file +285 -0
285 lines not on this page · raw message
Signature · 1 line
2.49.0
Hi Anshul,
Quoted 10 lines · On Tuesday, 3 June 2025 at 16:24:40 Anshul Dalal <[email protected]> wrote:
This patch set adds support for falcon boot on AM62a, 62p and 62x by bypassing A53 SPL and U-boot.
Existing Boot flow:
R5 SPL -> ATF -> A53 SPL -> U-Boot -> Linux KernelUpdated flow:
R5 SPL -> ATF -> Linux Kernel...
I tried this series on a custom device based on AM62P. While it's working mostly fine, I noticed that PWM0 is not working after a falcon boot from R5F, while it was working correctly after a boot through full U-Boot.
After a bit of debugging, I noticed that the epwm_tbclk0 is marked as disabled in hardware in debugfs's clk_summary even if enabled by software:
$ head -n 2 /sys/kernel/debug/clk/clk_summary && cat /sys/kernel/debug/clk/clk_summary | grep pwm
enable prepare protect duty hardware connection
clock count count count rate accuracy phase cycle enable consumer id clk:86:0 0 0 0 250000000 0 0 50000 Y 23000000.pwm fck epwm_tbclk2 0 0 0 0 0 0 50000 N deviceless no_connection_id epwm_tbclk1 0 0 0 0 0 0 50000 N deviceless no_connection_id epwm_tbclk0 1 1 0 0 0 0 50000 N 23000000.pwm tbclk
Reading the associated register (0x00104130) returns in fact 0x00000000, while writing to it has no effect (and after a write the register reads back as 0x00000000).
Do you have any idea on the reason of this behaviour? I don't think it is directly related to the Falcon boot implementation, but probably a side effect of it (maybe something that was enabled by A53 SPL?).
Thank you very much for the very valuable work!
Kind regards,
Francesco
Hi Francesco
Quoted 31 lines · Francesco Valla
Hi Anshul,
Quoted 10 lines · On Tuesday, 3 June 2025 at 16:24:40 Anshul Dalal <[email protected]> wrote:
This patch set adds support for falcon boot on AM62a, 62p and 62x by bypassing A53 SPL and U-boot.
Existing Boot flow:
R5 SPL -> ATF -> A53 SPL -> U-Boot -> Linux KernelUpdated flow:
R5 SPL -> ATF -> Linux Kernel...
I tried this series on a custom device based on AM62P. While it's working mostly fine, I noticed that PWM0 is not working after a falcon boot from R5F, while it was working correctly after a boot through full U-Boot.
After a bit of debugging, I noticed that the
epwm_tbclk0is marked as disabled in hardware in debugfs'sclk_summaryeven if enabled by software:$ head -n 2 /sys/kernel/debug/clk/clk_summary && cat /sys/kernel/debug/clk/clk_summary | grep pwmenable prepare protect duty hardware connection
clock count count count rate accuracy phase cycle enable consumer id clk:86:0 0 0 0 250000000 0 0 50000 Y 23000000.pwm fck epwm_tbclk2 0 0 0 0 0 0 50000 N deviceless no_connection_id epwm_tbclk1 0 0 0 0 0 0 50000 N deviceless no_connection_id epwm_tbclk0 1 1 0 0 0 0 50000 N 23000000.pwm tbclk
Quoted 9 lines
Reading the associated register (
0x00104130) returns in fact0x00000000, while writing to it has no effect (and after a write the register reads back as0x00000000).Do you have any idea on the reason of this behaviour? I don't think it is directly related to the Falcon boot implementation, but probably a side effect of it (maybe something that was enabled by A53 SPL?).
My guess is that CTRL_MMR region which hosts TB_CLKEN isn't unlocked.
We unlock the CTRL_MMR here:
https://elixir.bootlin.com/u-boot/v2025.04/source/arch/arm/mach-k3/am62px/am62p5_init.c#L156
But its possible that DM firmware that runs after R5 SPL re-locks these registers and Linux is no longer able to write to those registers. So this may need fix in the DM firmware to keep these regions unlocked.
Looking at address of tbclk (0x00104130), it should be under region 4. Could you try after running the equivalent ofmmr_unlock(CTRL_MMR0_BASE, 4); at Linux prompt using devmem2 and then modify the TB_CLKEN?
[...]
Regards
Vignesh
Hi Vignesh,
Il 2025-07-01 09:14 Raghavendra, Vignesh ha scritto:
Quoted 60 lines
Hi Francesco
Quoted 42 lines · Francesco Valla
Hi Anshul,
Quoted 10 lines · On Tuesday, 3 June 2025 at 16:24:40 Anshul Dalal <[email protected]> wrote:
This patch set adds support for falcon boot on AM62a, 62p and 62x by bypassing A53 SPL and U-boot.
Existing Boot flow:
R5 SPL -> ATF -> A53 SPL -> U-Boot -> Linux KernelUpdated flow:
R5 SPL -> ATF -> Linux Kernel...
I tried this series on a custom device based on AM62P. While it's working mostly fine, I noticed that PWM0 is not working after a falcon boot from R5F, while it was working correctly after a boot through full U-Boot.
After a bit of debugging, I noticed that the
epwm_tbclk0is marked as disabled in hardware in debugfs'sclk_summaryeven if enabled by software:$ head -n 2 /sys/kernel/debug/clk/clk_summary && cat /sys/kernel/debug/clk/clk_summary | grep pwmenable prepare protect
duty hardware connection
clock count count count rate
accuracy phase cycle enable consumer id
clk:86:0 0 0 0
250000000 0 0 50000 Y 23000000.pwm
fck
epwm_tbclk20 0 0 0
0 0 50000 N devicelessno_connection_id
epwm_tbclk10 0 0 0
0 0 50000 N devicelessno_connection_id
epwm_tbclk01 1 0 00 0 50000 N 23000000.pwmtbclk
Quoted 9 lines
Reading the associated register (
0x00104130) returns in fact0x00000000, while writing to it has no effect (and after a write the register reads back as0x00000000).Do you have any idea on the reason of this behaviour? I don't think it is directly related to the Falcon boot implementation, but probably a side effect of it (maybe something that was enabled by A53 SPL?).
My guess is that
CTRL_MMRregion which hostsTB_CLKENisn't unlocked.We unlock the
CTRL_MMRhere:
https://elixir.bootlin.com/u-boot/v2025.04/source/arch/arm/mach-k3/am62px/am62p5_init.c#L156
Quoted 8 lines
But its possible that DM firmware that runs after R5 SPL re-locks these registers and Linux is no longer able to write to those registers. So this may need fix in the DM firmware to keep these regions unlocked.
Looking at address of tbclk (
0x00104130), it should be under region 4. Could you try after running the equivalent ofmmr_unlock(CTRL_MMR0_BASE, 4); at Linux prompt using devmem2 and then modify theTB_CLKEN?
that was exactly the issue, after unlocking the CTRL_MMR region the TB_CLKEN bits wrote correctly and the PWM started working again. According to TRM, the correct region is number 1.
These were the issued commands to unlock the CTRL_MMR region 1:
$ devmem2 0x105008 w 0x68EF3490 $ devmem2 0x10500C w 0xD172BC5A
and then to write TB_CLKEN for PWM channel 0:
$ devmem2 0x00104130 w 0x1
The clock then is marked as enabled also from a hardware point of view:
$ head -n 2 /sys/kernel/debug/clk/clk_summary && cat /sys/kernel/debug/clk/clk_summary | grep pwm
enable prepare protect
duty hardware connection
clock count count count rate
accuracy phase cycle enable consumer id
epwm_tbclk2 0 0 0 0
0 0 50000 Y devicelessno_connection_id
epwm_tbclk1 0 0 0 0
0 0 50000 N devicelessno_connection_id
epwm_tbclk0 1 1 0 0
0 0 50000 N 23000000.pwm tbclk
clk:86:0 0 0 0 250000000
0 0 50000 Y 23000000.pwm fck
What's the correct path to issue a bug for the DM firmware?
Thank you!
Regards,
Francesco
Hi,
On 7/1/2025 3:53 PM, Francesco Valla wrote:
[...]
Quoted 5 lines
that was exactly the issue, after unlocking the
CTRL_MMRregion theTB_CLKENbits wrote correctly and the PWM started working again. According to TRM, the correct region is number 1.
Ah yes, sorry for the confusion
Quoted 30 lines
These were the issued commands to unlock the
CTRL_MMRregion 1:$ devmem2 0x105008 w 0x68EF3490 $ devmem2 0x10500C w 0xD172BC5Aand then to write
TB_CLKENfor PWM channel 0:$ devmem2 0x00104130 w 0x1The clock then is marked as enabled also from a hardware point of view:
$ head -n 2 /sys/kernel/debug/clk/clk_summary && cat /sys/kernel/debug/ clk/clk_summary | grep pwmenable prepare protect duty hardware connection clock count count count rate accuracy phase cycle enable consumer id epwm_tbclk2 0 0 0 0 0 0 50000 Y deviceless
no_connection_id
epwm_tbclk1 0 0 0 0 0 0 50000 N devicelessno_connection_id
epwm_tbclk0 1 1 0 0 0 0 50000 N 23000000.pwm tbclk clk:86:0 0 0 0 250000000 0 0 50000 Y 23000000.pwm fck
Quoted 2 lines
What's the correct path to issue a bug for the DM firmware?
Thanks for the confirmation. I am tracking this internally with firmware team. Will let you know once the fix is available.
Quoted 4 lines
Thank you!
Regards,
Francesco