k3: migrate SPL_TEXT_BASE to new address
Subsystems (2)
cover k3: migrate SPL_TEXT_BASE to new address
The change to ATF's PRELOADED_BL33_BASE[1] requires respective changes to SPL_TEXT_BASE on u-boot side. This is necessary to allow the ATF to jump directly to linux kernel (like in falcon mode) which requires a 2MiB aligned load address[2]. The current address ATF jumps to is 0x80080000 which is not 2MiB aligned.
Therefore in parallel to the ATF change, this patch set makes the corresponding changes to u-boot. To maintain backwards compatibility with older ATF builds (that still use older address of 0x80080000), the patch set also adds a jump-stub which modifies the execution as follows:
Old ATF -> 0x80080000 -> 0x822000000 (Main domain SPL or kernel image)
jump stub SPL_TEXT_BASE
With the following instructions loaded by the jump-stub:
ADDR | Instruction 0x80080000 | mov x15, CONFIG_SPL_TEXT_BASE (0x822000000) 0x80080004 | br x15
Depends on:
* [PATCH v3] configs: set SPL_TEXT_BASE by default for k3 platforms
https://lore.kernel.org/u-boot/[email protected]/
[1]:
https://review.trustedfirmware.org/c/TF-A/trusted-firmware-a/+/37447
[2]:
"The Image must be placed text_offset bytes from a 2MB aligned base address anywhere in usable system RAM and called there."
- Documentation/arch/arm64/booting.rst (linux kernel)
Anshul Dalal (4):
spl: Kconfig: k3: set SPL_TEXT_BASE to 0x82200000
mach-k3: add a jump stub to support older ATF builds
binman: k3: add jump-stub to tispl.bin
binman: k3: add jump-stub as loadable
arch/arm/dts/k3-am625-beagleplay-u-boot.dtsi | 2 +- arch/arm/dts/k3-am625-phycore-som-binman.dtsi | 4 +-- arch/arm/dts/k3-am625-sk-binman.dtsi | 4 +-- .../dts/k3-am625-verdin-wifi-dev-binman.dtsi | 4 +-- arch/arm/dts/k3-am62a-phycore-som-binman.dtsi | 4 +-- arch/arm/dts/k3-am62a-sk-binman.dtsi | 4 +-- arch/arm/dts/k3-am62p-sk-binman.dtsi | 2 +- arch/arm/dts/k3-am642-phycore-som-binman.dtsi | 8 ++--- arch/arm/dts/k3-am64x-binman.dtsi | 8 ++--- arch/arm/dts/k3-am65-iot2050-boot-image.dtsi | 2 +- arch/arm/dts/k3-am65x-binman.dtsi | 4 +-- arch/arm/dts/k3-am67a-beagley-ai-u-boot.dtsi | 2 +- arch/arm/dts/k3-binman.dtsi | 31 +++++++++++++++++++ arch/arm/dts/k3-j7200-binman.dtsi | 4 +-- .../dts/k3-j721e-beagleboneai64-u-boot.dtsi | 2 +- arch/arm/dts/k3-j721e-binman.dtsi | 4 +-- arch/arm/dts/k3-j721s2-binman.dtsi | 4 +-- arch/arm/dts/k3-j722s-binman.dtsi | 2 +- arch/arm/dts/k3-j784s4-binman.dtsi | 4 +-- arch/arm/mach-k3/Makefile | 7 +++++ arch/arm/mach-k3/jump_stub.S | 16 ++++++++++ common/spl/Kconfig | 2 +- 22 files changed, 89 insertions(+), 35 deletions(-) create mode 100644 arch/arm/mach-k3/jump_stub.S
Signature · 1 line
2.49.0
PATCH 1/4 spl: Kconfig: k3: set SPL_TEXT_BASE to 0x82200000
In falcon boot, the kernel should be loaded to the same address as main domain SPL, which necessitates the address to be 2MiB aligned[1].
Therefore this patch updates the SPL_TEXT_BASE to a 2MiB aligned address.
[1]:
"The Image must be placed text_offset bytes from a 2MB aligned baseaddress anywhere in usable system RAM and called there."
- Documentation/arch/arm64/booting.rst (linux kernel)
--- common/spl/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
common/spl/Kconfig +1 -1
@@ -270,7 +270,7 @@ config SPL_TEXT_BASE default 0x40200000 if OMAP34XX default 0x402F4000 if AM43XX default 0x402F0400 if AM33XX - default 0x80080000 if ARCH_K3 && ARM64 + default 0x82200000 if ARCH_K3 && ARM64 default 0x43c00000 if ARCH_K3 && !ARM64 default 0x00908000 if ARCH_MX6 default 0x00912000 if ARCH_MX7
Signature · 1 line
2.49.0
PATCH 2/4 mach-k3: add a jump stub to support older ATF builds
In reply to Anshul DalalThe older ATF had it's PRELOADED_BL33_BASE set to 0x80080000, changing SPL_TEXT_BASE to the newer address of 0x822000000 is incompatible with older ATF builds.
Therefore, this patch adds a jump stub to move execution back to SPL_TEXT_BASE with the stub being loaded at the older ATF address of 0x80080000.
--- arch/arm/mach-k3/Makefile | 7 +++++++ arch/arm/mach-k3/jump_stub.S | 16 ++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 arch/arm/mach-k3/jump_stub.S
arch/arm/mach-k3/Makefile +7 -0
@@ -17,3 +17,10 @@ obj-$(CONFIG_SOC_K3_J7200) += j7200/ obj-$(CONFIG_SOC_K3_J721S2) += j721s2/ obj-$(CONFIG_SOC_K3_J722S) += j722s/ obj-$(CONFIG_SOC_K3_J784S4) += j784s4/ + +ifdef CONFIG_ARM64 +obj-y += jump_stub.o +$(src)/jump_stub.o: $(src)/jump_stub.s + $(AS) $(src)/jump_stub.s -o $(src)/jump_stub.o + $(OBJCOPY) -O binary --only-section .text $(src)/jump_stub.o jump_stub.bin +endif
arch/arm/mach-k3/jump_stub.S new file +16 -0
@@ -0,0 +1,16 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Copyright (C) 2025 Texas Instruments Incorporated - https://www.ti.com/ + * Anshul Dalal <[email protected]> + */ + +/* + This jump stub is to be loaded at the older PRELOADED_BL33_BASE to forward + execution to SPL_TEXT_BASE when using older ATF builds. + */ + +.text + +jump_stub: + mov x15, CONFIG_SPL_TEXT_BASE + br x15
Signature · 1 line
2.49.0
PATCH 3/4 binman: k3: add jump-stub to tispl.bin
In reply to Anshul DalalTo preserve backwards compatibility with older ATF builds with PRELOADED_BL33_BASE set to 0x80080000, we add a jump-stub component to all tispl derrivatives which jumps execution to the address where u-boot spl is actually loaded (SPL_LOAD_TEXT).
--- arch/arm/dts/k3-binman.dtsi | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+)
arch/arm/dts/k3-binman.dtsi +31 -0
@@ -5,6 +5,8 @@ #include "k3-security.h" +#define LEGACY_ATF_PRELOADED_BL33_BASE 0x80080000 + / { binman: binman { multiple-images;
@@ -325,6 +327,22 @@ }; }; + jump-stub { + description = "Jump stub for backwards compatibility with older ATF builds"; + type = "firmware"; + arch = "arm64"; + compression = "none"; + load = <LEGACY_ATF_PRELOADED_BL33_BASE>; + entry = <LEGACY_ATF_PRELOADED_BL33_BASE>; + ti-secure { + content = <&jump_stub>; + keyfile = "custMpk.pem"; + }; + jump_stub: blob-ext { + filename = "jump_stub.bin"; + }; + }; + }; }; };
@@ -387,6 +405,19 @@ filename = "spl/u-boot-spl-nodtb.bin"; }; }; + + jump-stub { + description = "Jump stub for backwards compatibility with older ATF builds"; + type = "firmware"; + arch = "arm64"; + compression = "none"; + load = <LEGACY_ATF_PRELOADED_BL33_BASE>; + entry = <LEGACY_ATF_PRELOADED_BL33_BASE>; + blob-ext { + filename = "jump_stub.bin"; + }; + }; + }; }; };
Signature · 1 line
2.49.0
PATCH 4/4 binman: k3: add jump-stub as loadable
In reply to Anshul DalalSince all k3 platforms use the same ATF build, the jump-stub is required for each to preserve backwards compatibility.
This patch adds jump-stub as a loadable for each platform's binman dts which enables the R5 SPL to load the jump stub where older ATF build would expect main domain SPL to be.
--- arch/arm/dts/k3-am625-beagleplay-u-boot.dtsi | 2 +- arch/arm/dts/k3-am625-phycore-som-binman.dtsi | 4 ++-- arch/arm/dts/k3-am625-sk-binman.dtsi | 4 ++-- arch/arm/dts/k3-am625-verdin-wifi-dev-binman.dtsi | 4 ++-- arch/arm/dts/k3-am62a-phycore-som-binman.dtsi | 4 ++-- arch/arm/dts/k3-am62a-sk-binman.dtsi | 4 ++-- arch/arm/dts/k3-am62p-sk-binman.dtsi | 2 +- arch/arm/dts/k3-am642-phycore-som-binman.dtsi | 8 ++++---- arch/arm/dts/k3-am64x-binman.dtsi | 8 ++++---- arch/arm/dts/k3-am65-iot2050-boot-image.dtsi | 2 +- arch/arm/dts/k3-am65x-binman.dtsi | 4 ++-- arch/arm/dts/k3-am67a-beagley-ai-u-boot.dtsi | 2 +- arch/arm/dts/k3-j7200-binman.dtsi | 4 ++-- arch/arm/dts/k3-j721e-beagleboneai64-u-boot.dtsi | 2 +- arch/arm/dts/k3-j721e-binman.dtsi | 4 ++-- arch/arm/dts/k3-j721s2-binman.dtsi | 4 ++-- arch/arm/dts/k3-j722s-binman.dtsi | 2 +- arch/arm/dts/k3-j784s4-binman.dtsi | 4 ++-- 18 files changed, 34 insertions(+), 34 deletions(-)
arch/arm/dts/k3-am625-beagleplay-u-boot.dtsi +1 -1
@@ -188,7 +188,7 @@ conf-0 { description = "k3-am625-beagleplay"; firmware = "atf"; - loadables = "tee", "dm", "spl", + loadables = "tee", "dm", "spl", "jump-stub", "tifsstub-gp"; fdt = "fdt-0"; };
arch/arm/dts/k3-am625-phycore-som-binman.dtsi +2 -2
@@ -297,7 +297,7 @@ description = "k3-am625-phyboard-lyra-rdk"; firmware = "atf"; loadables = "tee", "tifsstub-hs", "tifsstub-fs", - "tifsstub-gp", "dm", "spl"; + "tifsstub-gp", "dm", "spl", "jump-stub"; fdt = "fdt-0"; }; };
@@ -441,7 +441,7 @@ description = "k3-am625-phyboard-lyra-rdk"; firmware = "atf"; loadables = "tee", "tifsstub-hs", "tifsstub-fs", - "tifsstub-gp", "dm", "spl"; + "tifsstub-gp", "dm", "spl", "jump-stub"; fdt = "fdt-0"; }; };
arch/arm/dts/k3-am625-sk-binman.dtsi +2 -2
@@ -298,7 +298,7 @@ description = "k3-am625-sk"; firmware = "atf"; loadables = "tee", "tifsstub-hs", "tifsstub-fs", - "tifsstub-gp", "dm", "spl"; + "tifsstub-gp", "dm", "spl", "jump-stub"; fdt = "fdt-0"; }; };
@@ -419,7 +419,7 @@ description = "k3-am625-sk"; firmware = "atf"; loadables = "tee", "tifsstub-hs", "tifsstub-fs", - "tifsstub-gp", "dm", "spl"; + "tifsstub-gp", "dm", "spl", "jump-stub"; fdt = "fdt-0"; }; };
arch/arm/dts/k3-am625-verdin-wifi-dev-binman.dtsi +2 -2
@@ -283,7 +283,7 @@ description = "k3-am625-verdin-wifi-dev"; firmware = "atf"; loadables = "tee", "tifsstub-hs", "tifsstub-fs", - "tifsstub-gp", "dm", "spl"; + "tifsstub-gp", "dm", "spl", "jump-stub"; fdt = "fdt-0"; }; };
@@ -402,7 +402,7 @@ description = "k3-am625-verdin-wifi-dev"; firmware = "atf"; loadables = "tee", "tifsstub-hs", "tifsstub-fs", - "tifsstub-gp", "dm", "spl"; + "tifsstub-gp", "dm", "spl", "jump-stub"; fdt = "fdt-0"; }; };
arch/arm/dts/k3-am62a-phycore-som-binman.dtsi +2 -2
@@ -302,7 +302,7 @@ description = "k3-am62a7-phyboard-lyra-rdk"; firmware = "atf"; loadables = "tee", "dm", "spl", - "tifsstub-hs", "tifsstub-fs", "tifsstub-gp"; + "tifsstub-hs", "tifsstub-fs", "tifsstub-gp", "jump-stub"; fdt = "fdt-0"; }; };
@@ -483,7 +483,7 @@ conf-0 { description = "k3-am62a7-phyboard-lyra-rdk"; firmware = "atf"; - loadables = "tee", "dm", "spl", + loadables = "tee", "dm", "spl", "jump-stub", "tifsstub-hs", "tifsstub-fs", "tifsstub-gp"; fdt = "fdt-0"; };
arch/arm/dts/k3-am62a-sk-binman.dtsi +2 -2
@@ -287,7 +287,7 @@ conf-0 { description = "k3-am62a7-sk"; firmware = "atf"; - loadables = "tee", "dm", "spl", + loadables = "tee", "dm", "spl", "jump-stub", "tifsstub-hs", "tifsstub-fs", "tifsstub-gp"; fdt = "fdt-0"; };
@@ -407,7 +407,7 @@ description = "k3-am62a7-sk"; firmware = "atf"; loadables = "tee", "dm", "spl", - "tifsstub-hs", "tifsstub-fs", "tifsstub-gp"; + "tifsstub-hs", "tifsstub-fs", "tifsstub-gp", "jump-stub"; fdt = "fdt-0"; }; };
arch/arm/dts/k3-am62p-sk-binman.dtsi +1 -1
@@ -239,7 +239,7 @@ conf-0 { description = "k3-am62px-sk"; firmware = "atf"; - loadables = "tee", "dm", "spl", + loadables = "tee", "dm", "spl", "jump-stub", "tifsstub-hs", "tifsstub-fs"; fdt = "fdt-0"; };
arch/arm/dts/k3-am642-phycore-som-binman.dtsi +4 -4
@@ -174,7 +174,7 @@ conf-0 { description = "k3-am642-phyboard-electra-rdk"; firmware = "atf"; - loadables = "tee", "dm", "spl"; + loadables = "tee", "dm", "spl", "jump-stub"; fdt = "fdt-0"; }; };
@@ -253,7 +253,7 @@ conf-0 { description = "k3-am642-phyboard-electra-rdk"; firmware = "atf"; - loadables = "tee", "dm", "spl"; + loadables = "tee", "dm", "spl", "jump-stub"; fdt = "fdt-0"; }; };
@@ -339,7 +339,7 @@ conf-0 { description = "k3-am642-phyboard-electra-rdk"; firmware = "atf"; - loadables = "tee", "dm", "spl"; + loadables = "tee", "dm", "spl", "jump-stub"; fdt = "fdt-0"; }; };
@@ -482,7 +482,7 @@ conf-0 { description = "k3-am642-phyboard-electra-rdk"; firmware = "atf"; - loadables = "tee", "dm", "spl"; + loadables = "tee", "dm", "spl", "jump-stub"; fdt = "fdt-0"; }; };
arch/arm/dts/k3-am64x-binman.dtsi +4 -4
@@ -188,14 +188,14 @@ conf-0 { description = "k3-am642-evm"; firmware = "atf"; - loadables = "tee", "dm", "spl"; + loadables = "tee", "dm", "spl", "jump-stub"; fdt = "fdt-0"; }; conf-1 { description = "k3-am642-sk"; firmware = "atf"; - loadables = "tee", "dm", "spl"; + loadables = "tee", "dm", "spl", "jump-stub"; fdt = "fdt-1"; }; };
@@ -312,14 +312,14 @@ conf-0 { description = "k3-am642-evm"; firmware = "atf"; - loadables = "tee", "dm", "spl"; + loadables = "tee", "dm", "spl", "jump-stub"; fdt = "fdt-0"; }; conf-1 { description = "k3-am642-sk"; firmware = "atf"; - loadables = "tee", "dm", "spl"; + loadables = "tee", "dm", "spl", "jump-stub"; fdt = "fdt-1"; }; };
arch/arm/dts/k3-am65-iot2050-boot-image.dtsi +1 -1
@@ -99,7 +99,7 @@ spl { fdt = "fdt-0"; firmware = "atf"; - loadables = "tee", "dm", "spl"; + loadables = "tee", "dm", "spl", "jump-stub"; }; }; };
arch/arm/dts/k3-am65x-binman.dtsi +2 -2
@@ -148,7 +148,7 @@ conf-0 { description = "k3-am654-base-board"; firmware = "atf"; - loadables = "tee", "dm", "spl"; + loadables = "tee", "dm", "spl", "jump-stub"; fdt = "fdt-0", "fdt-1"; }; };
@@ -257,7 +257,7 @@ conf-0 { description = "k3-am654-base-board"; firmware = "atf"; - loadables = "tee", "dm", "spl"; + loadables = "tee", "dm", "spl", "jump-stub"; fdt = "fdt-0", "fdt-1"; }; };
arch/arm/dts/k3-am67a-beagley-ai-u-boot.dtsi +1 -1
@@ -214,7 +214,7 @@ conf-0 { description = "k3-am67a-beagley-ai"; firmware = "atf"; - loadables = "tee", "dm", "spl"; + loadables = "tee", "dm", "spl", "jump-stub"; fdt = "fdt-0"; }; };
arch/arm/dts/k3-j7200-binman.dtsi +2 -2
@@ -371,7 +371,7 @@ conf-0 { description = "k3-j7200-common-proc-board"; firmware = "atf"; - loadables = "tee", "dm", "spl"; + loadables = "tee", "dm", "spl", "jump-stub"; fdt = "fdt-0"; }; };
@@ -451,7 +451,7 @@ conf-1 { description = "k3-j7200-common-proc-board"; firmware = "atf"; - loadables = "tee", "dm", "spl"; + loadables = "tee", "dm", "spl", "jump-stub"; fdt = "fdt-1"; }; };
arch/arm/dts/k3-j721e-beagleboneai64-u-boot.dtsi +1 -1
@@ -298,7 +298,7 @@ conf-0 { description = "k3-j721e-beagleboneai64"; firmware = "atf"; - loadables = "tee", "dm", "spl"; + loadables = "tee", "dm", "spl", "jump-stub"; fdt = "fdt-0"; }; };
arch/arm/dts/k3-j721e-binman.dtsi +2 -2
@@ -492,7 +492,7 @@ conf-0 { description = "k3-j721e-common-proc-board"; firmware = "atf"; - loadables = "tee", "dm", "spl"; + loadables = "tee", "dm", "spl", "jump-stub"; fdt = "fdt-0"; }; };
@@ -572,7 +572,7 @@ conf-0 { description = "k3-j721e-common-proc-board"; firmware = "atf"; - loadables = "tee", "dm", "spl"; + loadables = "tee", "dm", "spl", "jump-stub"; fdt = "fdt-0"; }; };
arch/arm/dts/k3-j721s2-binman.dtsi +2 -2
@@ -312,7 +312,7 @@ conf-0 { description = "k3-j721s2-common-proc-board"; firmware = "atf"; - loadables = "tee", "dm", "spl"; + loadables = "tee", "dm", "spl", "jump-stub"; fdt = "fdt-0"; }; };
@@ -392,7 +392,7 @@ conf-0 { description = "k3-j721s2-common-proc-board"; firmware = "atf"; - loadables = "tee", "dm", "spl"; + loadables = "tee", "dm", "spl", "jump-stub"; fdt = "fdt-0"; }; };
arch/arm/dts/k3-j722s-binman.dtsi +1 -1
@@ -166,7 +166,7 @@ conf-0 { description = "k3-j722s-evm"; firmware = "atf"; - loadables = "tee", "dm", "spl"; + loadables = "tee", "dm", "spl", "jump-stub"; fdt = "fdt-0"; }; };
arch/arm/dts/k3-j784s4-binman.dtsi +2 -2
@@ -194,7 +194,7 @@ conf-0 { description = BOARD_DESCRIPTION; firmware = "atf"; - loadables = "tee", "dm", "spl"; + loadables = "tee", "dm", "spl", "jump-stub"; fdt = "fdt-0"; }; };
@@ -277,7 +277,7 @@ conf-0 { description = BOARD_DESCRIPTION; firmware = "atf"; - loadables = "tee", "dm", "spl"; + loadables = "tee", "dm", "spl", "jump-stub"; fdt = "fdt-0"; }; };
Signature · 1 line
2.49.0
Quoted 30 lines · Anshul Dalal
The change to ATF's PRELOADED_BL33_BASE[1] requires respective changes to
SPL_TEXT_BASEon u-boot side. This is necessary to allow the ATF to jump directly to linux kernel (like in falcon mode) which requires a 2MiB aligned load address[2]. The current address ATF jumps to is0x80080000which is not 2MiB aligned.Therefore in parallel to the ATF change, this patch set makes the corresponding changes to u-boot. To maintain backwards compatibility with older ATF builds (that still use older address of
0x80080000), the patch set also adds a jump-stub which modifies the execution as follows:Old ATF ->
0x80080000->0x822000000(Main domain SPL or kernel image)
jump stubSPL_TEXT_BASEWith the following instructions loaded by the jump-stub:
ADDR | Instruction 0x80080000 | mov x15, CONFIG_SPL_TEXT_BASE (0x822000000) 0x80080004 | br x15Depends on:
* [PATCH v3] configs: setSPL_TEXT_BASEby default for k3 platforms
https://lore.kernel.org/u-boot/[email protected]/[1]:
https://review.trustedfirmware.org/c/TF-A/trusted-firmware-a/+/37447
[2]:
"The Image must be placedtext_offsetbytes from a 2MB aligned base address anywhere in usable system RAM and called there."
-Documentation/arch/arm64/booting.rst(linux kernel)
Quoted 5 lines
Anshul Dalal (4):
spl:Kconfig: k3: setSPL_TEXT_BASEto0x82200000
mach-k3: add a jump stub to support older ATF builds
binman: k3: add jump-stub to tispl.bin
binman: k3: add jump-stub as loadable
How about u-boot documentation?
Quoted 29 lines
arch/arm/dts/k3-am625-beagleplay-u-boot.dtsi | 2 +- arch/arm/dts/k3-am625-phycore-som-binman.dtsi | 4 +-- arch/arm/dts/k3-am625-sk-binman.dtsi | 4 +-- .../dts/k3-am625-verdin-wifi-dev-binman.dtsi | 4 +-- arch/arm/dts/k3-am62a-phycore-som-binman.dtsi | 4 +-- arch/arm/dts/k3-am62a-sk-binman.dtsi | 4 +-- arch/arm/dts/k3-am62p-sk-binman.dtsi | 2 +- arch/arm/dts/k3-am642-phycore-som-binman.dtsi | 8 ++--- arch/arm/dts/k3-am64x-binman.dtsi | 8 ++--- arch/arm/dts/k3-am65-iot2050-boot-image.dtsi | 2 +- arch/arm/dts/k3-am65x-binman.dtsi | 4 +-- arch/arm/dts/k3-am67a-beagley-ai-u-boot.dtsi | 2 +- arch/arm/dts/k3-binman.dtsi | 31 +++++++++++++++++++ arch/arm/dts/k3-j7200-binman.dtsi | 4 +-- .../dts/k3-j721e-beagleboneai64-u-boot.dtsi | 2 +- arch/arm/dts/k3-j721e-binman.dtsi | 4 +-- arch/arm/dts/k3-j721s2-binman.dtsi | 4 +-- arch/arm/dts/k3-j722s-binman.dtsi | 2 +- arch/arm/dts/k3-j784s4-binman.dtsi | 4 +-- arch/arm/mach-k3/Makefile | 7 +++++ arch/arm/mach-k3/jump_stub.S | 16 ++++++++++ common/spl/Kconfig | 2 +- 22 files changed, 89 insertions(+), 35 deletions(-) create mode 100644 arch/arm/mach-k3/jump_stub.SSignature · 1 line
2.49.0
Signature · 3 lines
Regards, Nishanth Menon Key (0xDDB5849D1736249D) / Fingerprint: F8A2 8693 54EB 8232 17A3 1A34 DDB5 849D 1736 249D
Quoted 31 lines · Nishanth Menon
Quoted 30 lines · Anshul Dalal
The change to ATF's PRELOADED_BL33_BASE[1] requires respective changes to
SPL_TEXT_BASEon u-boot side. This is necessary to allow the ATF to jump directly to linux kernel (like in falcon mode) which requires a 2MiB aligned load address[2]. The current address ATF jumps to is0x80080000which is not 2MiB aligned.Therefore in parallel to the ATF change, this patch set makes the corresponding changes to u-boot. To maintain backwards compatibility with older ATF builds (that still use older address of
0x80080000), the patch set also adds a jump-stub which modifies the execution as follows:Old ATF ->
0x80080000->0x822000000(Main domain SPL or kernel image)
jump stubSPL_TEXT_BASEWith the following instructions loaded by the jump-stub:
ADDR | Instruction 0x80080000 | mov x15, CONFIG_SPL_TEXT_BASE (0x822000000) 0x80080004 | br x15Depends on:
* [PATCH v3] configs: setSPL_TEXT_BASEby default for k3 platforms
https://lore.kernel.org/u-boot/[email protected]/[1]:
https://review.trustedfirmware.org/c/TF-A/trusted-firmware-a/+/37447
[2]:
"The Image must be placedtext_offsetbytes from a 2MB aligned base address anywhere in usable system RAM and called there."
-Documentation/arch/arm64/booting.rst(linux kernel)
Quoted 8 lines
Quoted 5 lines
Anshul Dalal (4):
spl:Kconfig: k3: setSPL_TEXT_BASEto0x82200000
mach-k3: add a jump stub to support older ATF builds
binman: k3: add jump-stub to tispl.bin
binman: k3: add jump-stub as loadableHow about u-boot documentation?
I will update that in the next revision along with any feedback I receive on this patch.
Regards
Quoted 29 lines
Quoted 29 lines
arch/arm/dts/k3-am625-beagleplay-u-boot.dtsi | 2 +- arch/arm/dts/k3-am625-phycore-som-binman.dtsi | 4 +-- arch/arm/dts/k3-am625-sk-binman.dtsi | 4 +-- .../dts/k3-am625-verdin-wifi-dev-binman.dtsi | 4 +-- arch/arm/dts/k3-am62a-phycore-som-binman.dtsi | 4 +-- arch/arm/dts/k3-am62a-sk-binman.dtsi | 4 +-- arch/arm/dts/k3-am62p-sk-binman.dtsi | 2 +- arch/arm/dts/k3-am642-phycore-som-binman.dtsi | 8 ++--- arch/arm/dts/k3-am64x-binman.dtsi | 8 ++--- arch/arm/dts/k3-am65-iot2050-boot-image.dtsi | 2 +- arch/arm/dts/k3-am65x-binman.dtsi | 4 +-- arch/arm/dts/k3-am67a-beagley-ai-u-boot.dtsi | 2 +- arch/arm/dts/k3-binman.dtsi | 31 +++++++++++++++++++ arch/arm/dts/k3-j7200-binman.dtsi | 4 +-- .../dts/k3-j721e-beagleboneai64-u-boot.dtsi | 2 +- arch/arm/dts/k3-j721e-binman.dtsi | 4 +-- arch/arm/dts/k3-j721s2-binman.dtsi | 4 +-- arch/arm/dts/k3-j722s-binman.dtsi | 2 +- arch/arm/dts/k3-j784s4-binman.dtsi | 4 +-- arch/arm/mach-k3/Makefile | 7 +++++ arch/arm/mach-k3/jump_stub.S | 16 ++++++++++ common/spl/Kconfig | 2 +- 22 files changed, 89 insertions(+), 35 deletions(-) create mode 100644 arch/arm/mach-k3/jump_stub.SSignature · 1 line
2.49.0
Quoted 39 lines · Anshul Dalal
Quoted 38 lines · Nishanth Menon
Quoted 35 lines · Anshul Dalal
The change to ATF's PRELOADED_BL33_BASE[1] requires respective changes to
SPL_TEXT_BASEon u-boot side. This is necessary to allow the ATF to jump directly to linux kernel (like in falcon mode) which requires a 2MiB aligned load address[2]. The current address ATF jumps to is0x80080000which is not 2MiB aligned.Therefore in parallel to the ATF change, this patch set makes the corresponding changes to u-boot. To maintain backwards compatibility with older ATF builds (that still use older address of
0x80080000), the patch set also adds a jump-stub which modifies the execution as follows:Old ATF ->
0x80080000->0x822000000(Main domain SPL or kernel image)
jump stubSPL_TEXT_BASEWith the following instructions loaded by the jump-stub:
ADDR | Instruction 0x80080000 | mov x15, CONFIG_SPL_TEXT_BASE (0x822000000) 0x80080004 | br x15Depends on:
* [PATCH v3] configs: setSPL_TEXT_BASEby default for k3 platforms
https://lore.kernel.org/u-boot/[email protected]/[1]:
https://review.trustedfirmware.org/c/TF-A/trusted-firmware-a/+/37447
[2]:
"The Image must be placedtext_offsetbytes from a 2MB aligned base address anywhere in usable system RAM and called there."
-Documentation/arch/arm64/booting.rst(linux kernel)Anshul Dalal (4):
spl:Kconfig: k3: setSPL_TEXT_BASEto0x82200000
mach-k3: add a jump stub to support older ATF builds
binman: k3: add jump-stub to tispl.bin
binman: k3: add jump-stub as loadable
Quoted 4 lines
Quoted 1 line
How about u-boot documentation?
I will update that in the next revision along with any feedback I receive on this patch.
IMHO, This change is too intrusive and impacts downstream customers including inflight production devices.
Signature · 3 lines
Regards, Nishanth Menon Key (0xDDB5849D1736249D) / Fingerprint: F8A2 8693 54EB 8232 17A3 1A34 DDB5 849D 1736 249D
Quoted 40 lines · Nishanth Menon
Quoted 39 lines · Anshul Dalal
Quoted 38 lines · Nishanth Menon
Quoted 35 lines · Anshul Dalal
The change to ATF's PRELOADED_BL33_BASE[1] requires respective changes to
SPL_TEXT_BASEon u-boot side. This is necessary to allow the ATF to jump directly to linux kernel (like in falcon mode) which requires a 2MiB aligned load address[2]. The current address ATF jumps to is0x80080000which is not 2MiB aligned.Therefore in parallel to the ATF change, this patch set makes the corresponding changes to u-boot. To maintain backwards compatibility with older ATF builds (that still use older address of
0x80080000), the patch set also adds a jump-stub which modifies the execution as follows:Old ATF ->
0x80080000->0x822000000(Main domain SPL or kernel image)
jump stubSPL_TEXT_BASEWith the following instructions loaded by the jump-stub:
ADDR | Instruction 0x80080000 | mov x15, CONFIG_SPL_TEXT_BASE (0x822000000) 0x80080004 | br x15Depends on:
* [PATCH v3] configs: setSPL_TEXT_BASEby default for k3 platformshttps://lore.kernel.org/u-boot/[email protected]/[1]:
https://review.trustedfirmware.org/c/TF-A/trusted-firmware-a/+/37447
[2]:
"The Image must be placedtext_offsetbytes from a 2MB aligned base address anywhere in usable system RAM and called there."
-Documentation/arch/arm64/booting.rst(linux kernel)Anshul Dalal (4):
spl:Kconfig: k3: setSPL_TEXT_BASEto0x82200000
mach-k3: add a jump stub to support older ATF builds
binman: k3: add jump-stub to tispl.bin
binman: k3: add jump-stub as loadable
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
How about u-boot documentation?
I will update that in the next revision along with any feedback I receive on this patch.
IMHO, This change is too intrusive and impacts downstream customers including inflight production devices.
Could you elaborate a little?
They do not even need to update their TF-A version, if they want to use their current version they simply recompile it with a single extra build flag:
PRELOADED_BL33_BASE=0x822000000
They should have no reason not to be able to do this. But even *if* they cannot do that, the whole point of the jump-stub here is to save them even having to do a simple compile.
IMHO "downstream customers including inflight production devices" should not be a reason to block good and useful changes here in upstream. But again, this change doesn't break anything for them in the first place, so why bring that up?
Andrew
Quoted 9 lines · Andrew Davis
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
How about u-boot documentation?
I will update that in the next revision along with any feedback I receive on this patch.
IMHO, This change is too intrusive and impacts downstream customers including inflight production devices.
Quoted 7 lines
Could you elaborate a little?
They do not even need to update their TF-A version, if they want to use their current version they simply recompile it with a single extra build flag:
PRELOADED_BL33_BASE=0x822000000
For folks who are trying to boot linux from TFA, they could do the same.
Quoted 9 lines
They should have no reason not to be able to do this. But even *if* they cannot do that, the whole point of the jump-stub here is to save them even having to do a simple compile.
IMHO "downstream customers including inflight production devices" should not be a reason to block good and useful changes here in upstream. But again, this change doesn't break anything for them in the first place, so why bring that up?
I dont see a specific value here. U-boot just works. For folks who want direct TFA to kernel jump (which is a niche fast boot usecase), go ahead and use TFA with the mentioned build option.
Signature · 3 lines
Regards, Nishanth Menon Key (0xDDB5849D1736249D) / Fingerprint: F8A2 8693 54EB 8232 17A3 1A34 DDB5 849D 1736 249D
Quoted 12 lines · Nishanth Menon
Quoted 11 lines · Andrew Davis
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
How about u-boot documentation?
I will update that in the next revision along with any feedback I receive on this patch.
IMHO, This change is too intrusive and impacts downstream customers including inflight production devices.
Could you elaborate a little?
Quoted 7 lines
Quoted 5 lines
They do not even need to update their TF-A version, if they want to use their current version they simply recompile it with a single extra build flag:
PRELOADED_BL33_BASE=0x822000000
For folks who are trying to boot linux from TFA, they could do the same.
This change would allow us to support both standard boot flow and falcon mode from the same upstream source. With the only downside being the slight overhead added by the jump-stub (~1.7KiB added to tispl.bin and two extra instructions to jump to u-boot from older ATF builds).
And we can remove the stub altogether once all the customers have migrated over to the new address.
In addition to that this also frees up the bottom of DDR which allows us to more easily support low memory systems (512MiB or less) as we can use the freed up space for more tightly packing OP-TEE, DM etc. instead of having the binaries loaded at scattered addresses like we do now.
Quoted 13 lines
Quoted 9 lines
They should have no reason not to be able to do this. But even *if* they cannot do that, the whole point of the jump-stub here is to save them even having to do a simple compile.
IMHO "downstream customers including inflight production devices" should not be a reason to block good and useful changes here in upstream. But again, this change doesn't break anything for them in the first place, so why bring that up?
I dont see a specific value here. U-boot just works. For folks who want direct TFA to kernel jump (which is a niche fast boot usecase), go ahead and use TFA with the mentioned build option.
Quoted 17 lines · Anshul Dalal
Quoted 16 lines · Nishanth Menon
Quoted 15 lines · Andrew Davis
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
How about u-boot documentation?
I will update that in the next revision along with any feedback I receive on this patch.
IMHO, This change is too intrusive and impacts downstream customers including inflight production devices.
Could you elaborate a little?
They do not even need to update their TF-A version, if they want to use their current version they simply recompile it with a single extra build flag:
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
PRELOADED_BL33_BASE=0x822000000
For folks who are trying to boot linux from TFA, they could do the same.
This change would allow us to support both standard boot flow and falcon mode from the same upstream source. With the only downside being the
Other than trivial usecases, no you cannot. There is a lot of monkeying of dtb that u-boot does with mac address, HS-FS based dt node enable/disable etc. In effect, at a product level it ends up as a different flow.
Quoted 2 lines
slight overhead added by the jump-stub (~1.7KiB added to tispl.bin and two extra instructions to jump to u-boot from older ATF builds).
The boot flow is already a complex flow at the moment. If we go down this road, U-boot will have no choice but to support both variants of TFA for all eternity - any fallacy that people will upgrade U-boot and TFA baselines in sync is wrong.
Quoted 3 lines
And we can remove the stub altogether once all the customers have migrated over to the new address.
When would we know? There are gazillion usage models we are not aware of. U-boot is not the only game in town for bootloaders. Barebox, and other bootloader ecosystems will also need to pony up, that too hand in hand with migration to new address proposed in TFA.
Quoted 5 lines
In addition to that this also frees up the bottom of DDR which allows us to more easily support low memory systems (512MiB or less) as we can use the freed up space for more tightly packing OP-TEE, DM etc. instead of having the binaries loaded at scattered addresses like we do now.
Now, we are suggesting an entire memory map revamp impacting more s/w components. For platforms with low DDR capabilities (e.g. PocketBeagle2), please do the necessary changes when introducing to mainline.
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
They should have no reason not to be able to do this. But even *if* they cannot do that, the whole point of the jump-stub here is to save them even having to do a simple compile.
Quoted 9 lines
Quoted 8 lines
Quoted 4 lines
IMHO "downstream customers including inflight production devices" should not be a reason to block good and useful changes here in upstream. But again, this change doesn't break anything for them in the first place, so why bring that up?
I dont see a specific value here. U-boot just works. For folks who want direct TFA to kernel jump (which is a niche fast boot usecase), go ahead and use TFA with the mentioned build option.
IMHO, there is a simpler alternate solution - build TFA, dtb etc in the model of your desire. let us leave the defaults be.
I will let Tom and other U-boot maintainers make their choice, as TFA maintainer, I have already rejected the approach. it is already PRELOADED_BL33_BASE ?= 0x80080000 which allows for override at build time instead of all the massive rework and downstream ecosystem impact.
Signature · 3 lines
Regards, Nishanth Menon Key (0xDDB5849D1736249D) / Fingerprint: F8A2 8693 54EB 8232 17A3 1A34 DDB5 849D 1736 249D
Quoted 74 lines · Nishanth Menon
Quoted 17 lines · Anshul Dalal
Quoted 16 lines · Nishanth Menon
Quoted 15 lines · Andrew Davis
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
How about u-boot documentation?
I will update that in the next revision along with any feedback I receive on this patch.
IMHO, This change is too intrusive and impacts downstream customers including inflight production devices.
Could you elaborate a little?
They do not even need to update their TF-A version, if they want to use their current version they simply recompile it with a single extra build flag:
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
PRELOADED_BL33_BASE=0x822000000
For folks who are trying to boot linux from TFA, they could do the same.
This change would allow us to support both standard boot flow and falcon mode from the same upstream source. With the only downside being the
Other than trivial usecases, no you cannot. There is a lot of monkeying of dtb that u-boot does with mac address, HS-FS based dt node enable/disable etc. In effect, at a product level it ends up as a different flow.
Quoted 2 lines
slight overhead added by the jump-stub (~1.7KiB added to tispl.bin and two extra instructions to jump to u-boot from older ATF builds).
The boot flow is already a complex flow at the moment. If we go down this road, U-boot will have no choice but to support both variants of TFA for all eternity - any fallacy that people will upgrade U-boot and TFA baselines in sync is wrong.
Quoted 3 lines
And we can remove the stub altogether once all the customers have migrated over to the new address.
When would we know? There are gazillion usage models we are not aware of. U-boot is not the only game in town for bootloaders. Barebox, and other bootloader ecosystems will also need to pony up, that too hand in hand with migration to new address proposed in TFA.
Quoted 5 lines
In addition to that this also frees up the bottom of DDR which allows us to more easily support low memory systems (512MiB or less) as we can use the freed up space for more tightly packing OP-TEE, DM etc. instead of having the binaries loaded at scattered addresses like we do now.
Now, we are suggesting an entire memory map revamp impacting more s/w components. For platforms with low DDR capabilities (e.g. PocketBeagle2), please do the necessary changes when introducing to mainline.
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
They should have no reason not to be able to do this. But even *if* they cannot do that, the whole point of the jump-stub here is to save them even having to do a simple compile.
Quoted 9 lines
Quoted 8 lines
Quoted 4 lines
IMHO "downstream customers including inflight production devices" should not be a reason to block good and useful changes here in upstream. But again, this change doesn't break anything for them in the first place, so why bring that up?
I dont see a specific value here. U-boot just works. For folks who want direct TFA to kernel jump (which is a niche fast boot usecase), go ahead and use TFA with the mentioned build option.
Quoted 7 lines
IMHO, there is a simpler alternate solution - build TFA, dtb etc in the model of your desire. let us leave the defaults be.
I will let Tom and other U-boot maintainers make their choice, as TFA maintainer, I have already rejected the approach. it is already
PRELOADED_BL33_BASE?=0x80080000which allows for override at build time instead of all the massive rework and downstream ecosystem impact.
Thanks Nishanth. As you point out, all of the relevant projects need to stay in sync for this to be useful and I agree with your position so this is nak'd here too.
Signature · 1 line
Tom
Hi,
Quoted 9 lines · Tom Rini
Quoted 8 lines · Nishanth Menon
Quoted 4 lines
Quoted 3 lines
I dont see a specific value here. U-boot just works. For folks who want direct TFA to kernel jump (which is a niche fast boot usecase), go ahead and use TFA with the mentioned build option.
IMHO, there is a simpler alternate solution - build TFA, dtb etc in the model of your desire. let us leave the defaults be.
Quoted 8 lines
Quoted 4 lines
I will let Tom and other U-boot maintainers make their choice, as TFA maintainer, I have already rejected the approach. it is already
PRELOADED_BL33_BASE?=0x80080000which allows for override at build time instead of all the massive rework and downstream ecosystem impact.Thanks Nishanth. As you point out, all of the relevant projects need to stay in sync for this to be useful and I agree with your position so this is nak'd here too.
The i.MX folks also did some switcheroos with the TF-A load address (BL31 though [1]) and at least in barebox (running as BL2), it ended up wasting a lot of time of everyone involved that could have been put to more productive use.
So thanks Nishanth and Tom for saving AM6x users from the same hassle.
[1]: https://github.com/barebox/barebox/commit/199aabdc7
Cheers,
Ahmad
Signature · 4 lines
Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |