Skip to contentSkip to conversation

add support for hs bootflows on am62 devices

PATCH In review [email protected] 3 participants 12 messages Mar 2, 2023 – Mar 22, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover add support for hs bootflows on am62 devices

From: Kamlesh Gurudasani <[email protected]>

Add support for high security bootflow on am62 devices.

On HS devices, ROM and TIFS will protect the RAM regions with firewalls. This means the wakeup domain's SPL will need to move the stack and heap to HSM RAM to ensure it stays within its allotted memory regions.

Kamlesh Gurudasani (2):
arm: mach-k3: am62: move scratch board area to HSM RAM
configs: am62: move stack and heap to HSM RAM

 arch/arm/mach-k3/include/mach/am62_hardware.h |  3 +--
 configs/am62x_evm_r5_defconfig                | 16 +++++++++++-----
 2 files changed, 12 insertions(+), 7 deletions(-)
Signature · 1 line
2.34.1
#1 lore raw

PATCH 1/2 arm: mach-k3: am62: move scratch board area to HSM RAM

From: Kamlesh Gurudasani <[email protected]>

On high security devices, ROM enables firewalls to protect the OCSRAM region access during bootup. Only after TIFS has started (and had time to disable the OCSRAM firewall region) will we have write access to the region.

So, move scratch board area to HSM RAM.

---
 arch/arm/mach-k3/include/mach/am62_hardware.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
arch/arm/mach-k3/include/mach/am62_hardware.h +1 -2
index 17d3228cba..db4a32cd46 100644
@@ -55,7 +55,6 @@
 
 #define ROM_EXTENDED_BOOT_DATA_INFO		0x43c3f1e0
 
-/* Use Last 2K as Scratch pad */
-#define TI_SRAM_SCRATCH_BOARD_EEPROM_START		0x70000000
+#define TI_SRAM_SCRATCH_BOARD_EEPROM_START	0x43c30000
 
 #endif /* __ASM_ARCH_AM62_HARDWARE_H */
Signature · 1 line
2.34.1
#2 lore raw

Re: [PATCH 1/2] arm: mach-k3: am62: move scratch board area to HSM RAM

Quoted 10 lines · On Thu, Mar 02, 2023 at 07:40:46PM +0530, [email protected] wrote:

From: Kamlesh Gurudasani <[email protected]>

On high security devices, ROM enables firewalls to protect the OCSRAM region access during bootup. Only after TIFS has started (and had time to disable the OCSRAM firewall region) will we have write access to the region.

So, move scratch board area to HSM RAM.

Applied to u-boot/master, thanks!

Signature · 1 line
Tom
#3 lore raw

PATCH 2/2 configs: am62: move stack and heap to HSM RAM

In reply to [email protected]

From: Kamlesh Gurudasani <[email protected]>

On high security devices, ROM enables firewalls to protect the OCSRAM region access during bootup. Only after TIFS has started (and had time to disable the OCSRAM firewall region) will we have write access to the region.

This means we will need to move the stack & heap from OCSRAM to HSM RAM and reduce the size of BSS and the SPL to allow it to fit properly.

To protect us from overflowing our ~256k of HSM SRAM, add limits and check during the wakeup SPL build.

---
 configs/am62x_evm_r5_defconfig | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)
configs/am62x_evm_r5_defconfig +11 -5
index 4f9ecf2661..44a9130d99 100644
@@ -8,7 +8,7 @@ CONFIG_NR_DRAM_BANKS=2
 CONFIG_SOC_K3_AM625=y
 CONFIG_TARGET_AM625_R5_EVM=y
 CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
-CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x7000ffff
+CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x43c3a7f0
 CONFIG_ENV_SIZE=0x20000
 CONFIG_DM_GPIO=y
 CONFIG_SPL_DM_SPI=y
@@ -19,7 +19,9 @@ CONFIG_SPL_MMC=y
 CONFIG_SPL_SERIAL=y
 CONFIG_SPL_DRIVERS_MISC=y
 CONFIG_SPL_STACK_R_ADDR=0x82000000
-CONFIG_SPL_SIZE_LIMIT=0x40000
+CONFIG_SPL_SYS_MALLOC_F_LEN=0x7000
+CONFIG_SPL_SIZE_LIMIT=0x3A7F0
+CONFIG_SPL_SIZE_LIMIT_PROVIDE_STACK=0x3500
 CONFIG_SPL_FS_FAT=y
 CONFIG_SPL_LIBDISK_SUPPORT=y
 CONFIG_SPL_SPI_FLASH_SUPPORT=y
@@ -28,10 +30,14 @@ CONFIG_SPL_LOAD_FIT=y
 CONFIG_SPL_LOAD_FIT_ADDRESS=0x80080000
 CONFIG_SPL_FIT_IMAGE_POST_PROCESS=y
 # CONFIG_DISPLAY_CPUINFO is not set
-CONFIG_SPL_MAX_SIZE=0x58000
+CONFIG_SPL_SIZE_LIMIT_SUBTRACT_GD=y
+CONFIG_SPL_SIZE_LIMIT_SUBTRACT_MALLOC=y
+CONFIG_SPL_MAX_SIZE=0x3B000
+CONFIG_SPL_PAD_TO=0x0
 CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
-CONFIG_SPL_BSS_START_ADDR=0x43c37800
-CONFIG_SPL_BSS_MAX_SIZE=0x5000
+CONFIG_SPL_BSS_START_ADDR=0x43c3b000
+CONFIG_SPL_BSS_MAX_SIZE=0x3000
+CONFIG_SPL_SYS_REPORT_STACK_F_USAGE=y
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
 CONFIG_SPL_STACK_R=y
 CONFIG_SPL_SEPARATE_BSS=y
Signature · 1 line
2.34.1
#4 lore raw

Re: [PATCH 2/2] configs: am62: move stack and heap to HSM RAM

Quoted 7 lines · On Thu, Mar 02, 2023 at 07:40:47PM +0530, [email protected] wrote:

From: Kamlesh Gurudasani <[email protected]>

On high security devices, ROM enables firewalls to protect the OCSRAM region access during bootup. Only after TIFS has started (and had time to disable the OCSRAM firewall region) will we have write access to the region.

Quoted 7 lines

This means we will need to move the stack & heap from OCSRAM to HSM RAM and reduce the size of BSS and the SPL to allow it to fit properly.

To protect us from overflowing our ~256k of HSM SRAM, add limits and check during the wakeup SPL build.

Applied to u-boot/master, thanks!

Signature · 1 line
Tom
Reviewed-by on the v1 series
#5 lore raw
In reply to [email protected]

Hi Kamlesh!

On March 2, 2023 thus sayeth [email protected]:

Quoted 9 lines

From: Kamlesh Gurudasani <[email protected]>

Add support for high security bootflow on am62 devices.

On HS devices, ROM and TIFS will protect the RAM regions with firewalls. This means the wakeup domain's SPL will need to move the stack and heap to HSM RAM to ensure it stays within its allotted memory regions.

Quoted 7 lines

Kamlesh Gurudasani (2):
arm: mach-k3: am62: move scratch board area to HSM RAM
configs: am62: move stack and heap to HSM RAM

 arch/arm/mach-k3/include/mach/am62_hardware.h |  3 +--
 configs/am62x_evm_r5_defconfig                | 16 +++++++++++-----
 2 files changed, 12 insertions(+), 7 deletions(-)

Thanks for getting this fixed! Does TIFS drop the On Chip SRAM firewall completely once it's started? or only for the r5?

~Bryan

#6 lore raw
Quoted 11 lines · Bryan Brattlof

Hi Kamlesh!

On March 2, 2023 thus sayeth [email protected]:

Quoted 8 lines

From: Kamlesh Gurudasani <[email protected]>

Add support for high security bootflow on am62 devices.

On HS devices, ROM and TIFS will protect the RAM regions with firewalls. This means the wakeup domain's SPL will need to move the stack and heap to HSM RAM to ensure it stays within its allotted memory regions.

...

Quoted 3 lines

Thanks for getting this fixed! Does TIFS drop the On Chip SRAM firewall completely once it's started? or only for the r5?

It is open completely after TIFS drops it.

It is generic RAM, should be available for use to
all cores. Ideally, it should have been opened up by ROM only, then we wouldn't have run in to this issue. (r5 accessing it before TIFS opens it up)

Thanks for the review.

Quoted 3 lines

~Bryan

#7 lore raw
In reply to Bryan Brattlof
Quoted 20 lines · Bryan Brattlof

Hi Kamlesh!

On March 2, 2023 thus sayeth [email protected]:

Quoted 9 lines

From: Kamlesh Gurudasani <[email protected]>

Add support for high security bootflow on am62 devices.

On HS devices, ROM and TIFS will protect the RAM regions with firewalls. This means the wakeup domain's SPL will need to move the stack and heap to HSM RAM to ensure it stays within its allotted memory regions.

Quoted 7 lines

Kamlesh Gurudasani (2):
arm: mach-k3: am62: move scratch board area to HSM RAM
configs: am62: move stack and heap to HSM RAM

 arch/arm/mach-k3/include/mach/am62_hardware.h |  3 +--
 configs/am62x_evm_r5_defconfig                | 16 +++++++++++-----
 2 files changed, 12 insertions(+), 7 deletions(-)
Quoted 6 lines

Thanks for getting this fixed! Does TIFS drop the On Chip SRAM firewall completely once it's started? or only for the r5?

~Bryan

Hi Tom,

Could you please review and merge this patches as these are bug fixes to get HS devices working.

Thanks.

~Kamlesh

#8 lore raw
Quoted 25 lines · Kamlesh Gurudasani
Quoted 23 lines · Bryan Brattlof

Hi Kamlesh!

On March 2, 2023 thus sayeth [email protected]:

Quoted 9 lines

From: Kamlesh Gurudasani <[email protected]>

Add support for high security bootflow on am62 devices.

On HS devices, ROM and TIFS will protect the RAM regions with firewalls. This means the wakeup domain's SPL will need to move the stack and heap to HSM RAM to ensure it stays within its allotted memory regions.

Quoted 7 lines

Kamlesh Gurudasani (2):
arm: mach-k3: am62: move scratch board area to HSM RAM
configs: am62: move stack and heap to HSM RAM

 arch/arm/mach-k3/include/mach/am62_hardware.h |  3 +--
 configs/am62x_evm_r5_defconfig                | 16 +++++++++++-----
 2 files changed, 12 insertions(+), 7 deletions(-)

Thanks for getting this fixed! Does TIFS drop the On Chip SRAM firewall completely once it's started? or only for the r5?

Quoted 7 lines
Quoted 3 lines

~Bryan

Hi Tom,

Could you please review and merge this patches as these are bug fixes to get HS devices working.

Is this a regression fix vs v2023.01 or new feature support? Thanks.

Signature · 1 line
Tom
#9 lore raw

Tom Rini <[email protected]> writes:
...

Quoted 6 lines
Quoted 4 lines

Hi Tom,

Could you please review and merge this patches as these are bug fixes to get HS devices working.

Is this a regression fix vs v2023.01 or new feature support? Thanks.

Its regression fix vs 2023.01 for HS devices. Thanks.

~Kamlesh

Quoted 3 lines
Signature · 2 lines
-- 
Tom
#10 lore raw
Quoted 9 lines · Kamlesh Gurudasani

Tom Rini <[email protected]> writes:
...

Quoted 6 lines
Quoted 4 lines

Hi Tom,

Could you please review and merge this patches as these are bug fixes to get HS devices working.

Is this a regression fix vs v2023.01 or new feature support? Thanks.

Its regression fix vs 2023.01 for HS devices. Thanks.

To be clear, when did HS support work on am62, upstream?

Signature · 1 line
Tom
#11 lore raw
Quoted 5 lines · Tom Rini
Quoted 4 lines · Kamlesh Gurudasani

Tom Rini <[email protected]> writes:
...

Quoted 2 lines
Quoted 2 lines

Hi Tom,

Quoted 7 lines
Quoted 5 lines
Quoted 4 lines
Quoted 2 lines

Could you please review and merge this patches as these are bug fixes to get HS devices working.

Is this a regression fix vs v2023.01 or new feature support? Thanks.

Its regression fix vs 2023.01 for HS devices. Thanks.

To be clear, when did HS support work on am62, upstream?

We have three devices GP, HS-FS and HS-SE
GP and HS-FS works with same r5 spl config.

With recent changes in system firmware update it broke HS-FS, beacuse firewall condition were overlooked while adding r5-spl config. This series make sure that those firewall conditions are satisfied.

Once HS-FS is working it needs small change in r5-spl config to get HS-SE working. Changes needed for HS-SE to work will be sent in another patch.

~Kamlesh

Quoted 3 lines
Signature · 2 lines
-- 
Tom