Skip to contentSkip to conversation

J721E HS Fixes

PATCH Superseded Manorit Chawdhry 3 participants 8 messages Mar 3, 2023 – Mar 6, 2023

Subsystems (2)

v3 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#0 lore raw

v3 cover J721E HS Fixes

This series fixes the support for J721E board along with some maintainance for it.

v3:
- drop fixes related to other boards ( make series j721e specific )
- memory map added in docs
- applied reviewed-by

v2:
- Merge two series
- Include some more commits that fix the gp builds when merging defconfigs
- Update MAINTAINERS to remove hs related defconfigs
- applied Acks

Andrew Davis (1):
arm: k3: config.mk: Add missing dependencies on tispl.bin HS

Dave Gerlach (1):
arm: mach-k3: Increase SYSFW max image size

Manorit Chawdhry (2):
configs: j721e: Merge the HS and non-HS defconfigs
Kconfig: j721e: Change K3_MCU_SCRATCHPAD_BASE to non firewalled region

 MAINTAINERS                        |   2 -
 arch/arm/mach-k3/Kconfig           |   6 +-
 arch/arm/mach-k3/config.mk         |   2 +
 configs/j721e_evm_a72_defconfig    |   3 +-
 configs/j721e_evm_r5_defconfig     |  11 +-
 configs/j721e_hs_evm_a72_defconfig | 208 -----------------------------
 configs/j721e_hs_evm_r5_defconfig  | 176 ------------------------
 doc/board/ti/j721e_evm.rst         |  24 ++++
 8 files changed, 40 insertions(+), 392 deletions(-)
 delete mode 100644 configs/j721e_hs_evm_a72_defconfig
 delete mode 100644 configs/j721e_hs_evm_r5_defconfig
Signature · 1 line
2.34.1
#1 lore raw

PATCH v3 1/4 arm: k3: config.mk: Add missing dependencies on tispl.bin HS

From: Andrew Davis <[email protected]>

When building for secure devices using non-buildman based image generation the signed tispl.bin file is called tispl.bin_HS. Also build the unsigned tispl.bin file as expected.

---
 arch/arm/mach-k3/config.mk | 2 ++
 1 file changed, 2 insertions(+)
arch/arm/mach-k3/config.mk +2 -0
index 9306f2627d9a..cbf9c10210a6 100644
@@ -68,6 +68,8 @@ ifeq ($(CONFIG_TI_SECURE_DEVICE),y)
 SPL_ITS := u-boot-spl-k3_HS.its
 $(SPL_ITS): export IS_HS=1
 INPUTS-y	+= tispl.bin_HS
+INPUTS-y	+= tispl.bin
+tispl.bin: $(obj)/u-boot-spl-nodtb.bin_HS $(patsubst %,$(obj)/dts/%.dtb_HS,$(subst ",,$(CONFIG_SPL_OF_LIST)))
 else
 SPL_ITS := u-boot-spl-k3.its
 INPUTS-y	+= tispl.bin
Signature · 1 line
2.34.1
#2 lore raw

PATCH v3 2/4 configs: j721e: Merge the HS and non-HS defconfigs

In reply to Manorit Chawdhry

K3 devices have runtime type board detection. Make the default defconfig include the secure configuration. Then remove the HS specific config.

Non-HS devices will continue to boot due to runtime device type detection. If TI_SECURE_DEV_PKG is not set the build will emit warnings, for non-HS devices these can be ignored.

---
 MAINTAINERS                        |   2 -
 configs/j721e_evm_a72_defconfig    |   3 +-
 configs/j721e_evm_r5_defconfig     |   1 +
 configs/j721e_hs_evm_a72_defconfig | 208 -----------------------------
 configs/j721e_hs_evm_r5_defconfig  | 176 ------------------------
 5 files changed, 3 insertions(+), 387 deletions(-)
 delete mode 100644 configs/j721e_hs_evm_a72_defconfig
 delete mode 100644 configs/j721e_hs_evm_r5_defconfig
MAINTAINERS +0 -2
index 41c9f265f815..9e5e51b2eeeb 100644
@@ -1462,8 +1462,6 @@ F:	configs/am65x_hs_evm_r5_defconfig
 F:	configs/am65x_hs_evm_a53_defconfig
 F:	configs/j7200_hs_evm_a72_defconfig
 F:	configs/j7200_hs_evm_r5_defconfig
-F:	configs/j721e_hs_evm_a72_defconfig
-F:	configs/j721e_hs_evm_r5_defconfig
 F:	configs/j721s2_hs_evm_a72_defconfig
 F:	configs/j721s2_hs_evm_r5_defconfig
 
configs/j721e_evm_a72_defconfig +2 -1
index 2190df1f3a51..48b48f43e7ec 100644
@@ -1,5 +1,6 @@
 CONFIG_ARM=y
 CONFIG_ARCH_K3=y
+CONFIG_TI_SECURE_DEVICE=y
 CONFIG_SYS_MALLOC_LEN=0x2000000
 CONFIG_SYS_MALLOC_F_LEN=0x8000
 CONFIG_SPL_GPIO=y
@@ -30,7 +31,7 @@ CONFIG_DISTRO_DEFAULTS=y
 CONFIG_SPL_LOAD_FIT=y
 CONFIG_SPL_LOAD_FIT_ADDRESS=0x81000000
 CONFIG_OF_BOARD_SETUP=y
-CONFIG_BOOTCOMMAND="run findfdt; run distro_bootcmd; run init_${boot}; run main_cpsw0_qsgmii_phyinit; run boot_rprocs; run get_kern_${boot}; run get_fdt_${boot}; run get_overlay_${boot}; run run_kern"
+CONFIG_BOOTCOMMAND="run findfdt; run envboot; run init_${boot}; run main_cpsw0_qsgmii_phyinit; run boot_rprocs; if test ${boot_fit} -eq 1; then run get_fit_${boot}; run get_overlaystring; run run_fit; else; run get_kern_${boot}; run get_fdt_${boot}; run get_overlay_${boot}; run run_kern; fi;"
 CONFIG_LOGLEVEL=7
 CONFIG_SPL_MAX_SIZE=0xc0000
 CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
configs/j721e_evm_r5_defconfig +1 -0
index 16fa386792d4..476072659571 100644
@@ -1,5 +1,6 @@
 CONFIG_ARM=y
 CONFIG_ARCH_K3=y
+CONFIG_TI_SECURE_DEVICE=y
 CONFIG_SYS_MALLOC_LEN=0x2000000
 CONFIG_SYS_MALLOC_F_LEN=0x70000
 CONFIG_SPL_GPIO=y
configs/j721e_hs_evm_a72_defconfig deleted +0 -208

208 lines not on this page · raw message

configs/j721e_hs_evm_r5_defconfig deleted +0 -176

176 lines not on this page · raw message

Signature · 1 line
2.34.1
#3 lore raw

PATCH v3 3/4 Kconfig: j721e: Change K3_MCU_SCRATCHPAD_BASE to non firewalled region

In reply to Manorit Chawdhry

In non-combined boot flow for K3, all the firewalls are locked by default until sysfw comes up. Rom configures some of the firewall for its usage along with the SRAM for R5 but the PSRAM region is still locked.

The K3 MCU Scratchpad for j721e was set to a PSRAM region triggering the firewall exception before sysfw came up. The exception started happening after adding multi dtb support that accesses the scratchpad for reading EEPROM contents.

The commit changes R5 MCU scratchpad for j721e to an SRAM region.

Old Map:

┌─────────────────────────────────────┐ 0x41c00000
│                 SPL                 │
├─────────────────────────────────────┤ 0x41c40000 (approx)
│                STACK                │
├─────────────────────────────────────┤ 0x41c85b20
│             Global data             │
│  sizeof(struct global_data) = 0xd8  │
├─────────────────────────────────────┤ gd->malloc_base = 0x41c85bfc
│                HEAP                 │
│  CONFIG_SYS_MALLOC_F_LEN = 0x70000  │
├─────────────────────────────────────┤ CONFIG_SPL_BSS_START_ADDR
│               SPL BSS               │ (0x41cf5bfc)
│  CONFIG_SPL_BSS_MAX_SIZE = 0xA000   │
└─────────────────────────────────────┘ CONFIG_SYS_K3_BOOT_PARAM_TABLE_INDEX
			                (0x41cffbfc)

New Map:

┌─────────────────────────────────────┐ 0x41c00000
│                 SPL                 │
├─────────────────────────────────────┤ 0x41c40000 (approx)
│                EMPTY                │
├─────────────────────────────────────┤ 0x41c81920
│                STACK                │
│ SPL_SIZE_LIMIT_PROVIDE_STACK=0x4000 │
├─────────────────────────────────────┤ 0x41c85920
│             Global data             │
│  sizeof(struct global_data) = 0xd8  │
├─────────────────────────────────────┤ gd->malloc_base = 0x41c859f0
│                HEAP                 │
│  CONFIG_SYS_MALLOC_F_LEN = 0x70000  │
├─────────────────────────────────────┤ CONFIG_SPL_BSS_START_ADDR
│               SPL BSS               │ (0x41cf59f0)
│  CONFIG_SPL_BSS_MAX_SIZE = 0xA000   │
├─────────────────────────────────────┤ 0x41cff9fc
│         NEW MCU SCRATCHPAD          │
│  SYS_K3_MCU_SCRATCHPAD_SIZE = 0x200 │
└─────────────────────────────────────┘ CONFIG_SYS_K3_BOOT_PARAM_TABLE_INDEX
			                (0x41cffbfc)
Fixes ab977c8b91b4 ("configs: j721s2_evm_r5: Enable support for building multiple dtbs into FIT")
[[email protected]: SRAM allocation addressing diagram]
---
 arch/arm/mach-k3/Kconfig       |  3 ++-
 configs/j721e_evm_r5_defconfig | 10 ++++++++--
 doc/board/ti/j721e_evm.rst     | 24 ++++++++++++++++++++++++
 3 files changed, 34 insertions(+), 3 deletions(-)
arch/arm/mach-k3/Kconfig +2 -1
index a8c3a593d570..0991b42423a0 100644
@@ -52,7 +52,8 @@ config SYS_K3_MAX_DOWNLODABLE_IMAGE_SIZE
 config SYS_K3_MCU_SCRATCHPAD_BASE
 	hex
 	default 0x40280000 if SOC_K3_AM654
-	default 0x40280000 if SOC_K3_J721E || SOC_K3_J721S2
+	default 0x40280000 if SOC_K3_J721S2
+	default 0x41cff9fc if SOC_K3_J721E
 	help
 	  Describes the base address of MCU Scratchpad RAM.
 
configs/j721e_evm_r5_defconfig +8 -2
index 476072659571..afe1f3a31306 100644
@@ -21,10 +21,16 @@ CONFIG_SPL_MMC=y
 CONFIG_SPL_SERIAL=y
 CONFIG_SPL_DRIVERS_MISC=y
 CONFIG_SPL_STACK_R_ADDR=0x82000000
+CONFIG_SPL_SIZE_LIMIT=0xf59f0
+CONFIG_SPL_SIZE_LIMIT_SUBTRACT_GD=y
+CONFIG_SPL_SIZE_LIMIT_SUBTRACT_MALLOC=y
+CONFIG_SPL_SIZE_LIMIT_PROVIDE_STACK=0x4000
 CONFIG_SPL_FS_FAT=y
 CONFIG_SPL_LIBDISK_SUPPORT=y
 CONFIG_SPL_SPI_FLASH_SUPPORT=y
 CONFIG_SPL_SPI=y
+CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
+CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x41cf59f0
 # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
 CONFIG_SPL_LOAD_FIT=y
 CONFIG_SPL_LOAD_FIT_ADDRESS=0x80080000
@@ -32,9 +38,9 @@ CONFIG_SPL_FIT_IMAGE_POST_PROCESS=y
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_USE_BOOTCOMMAND=y
 # CONFIG_DISPLAY_CPUINFO is not set
-CONFIG_SPL_MAX_SIZE=0xc0000
+CONFIG_SPL_MAX_SIZE=0xf59f0
 CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
-CONFIG_SPL_BSS_START_ADDR=0x41cf5bfc
+CONFIG_SPL_BSS_START_ADDR=0x41cf59f0
 CONFIG_SPL_BSS_MAX_SIZE=0xa000
 CONFIG_SPL_BOARD_INIT=y
 CONFIG_SPL_STACK_R=y
doc/board/ti/j721e_evm.rst +24 -0
index e898601c41ea..7cfb475465a6 100644
@@ -268,6 +268,30 @@ Image formats:
                 | +-------------------+ |
                 +-----------------------+
 
+R5 Memory Map:
+--------------
+┌─────────────────────────────────────┐ 0x41c00000
+│                 SPL                 │
+├─────────────────────────────────────┤ 0x41c40000 (approx)
+│                EMPTY                │
+├─────────────────────────────────────┤ 0x41c81920
+│                STACK                │
+│ SPL_SIZE_LIMIT_PROVIDE_STACK=0x4000 │
+├─────────────────────────────────────┤ 0x41c85920
+│             Global data             │
+│  sizeof(struct global_data) = 0xd8  │
+├─────────────────────────────────────┤ gd->malloc_base = 0x41c859f0
+│                HEAP                 │
+│  CONFIG_SYS_MALLOC_F_LEN = 0x70000  │
+├─────────────────────────────────────┤ CONFIG_SPL_BSS_START_ADDR
+│               SPL BSS               │ (0x41cf59f0)
+│  CONFIG_SPL_BSS_MAX_SIZE = 0xA000   │
+├─────────────────────────────────────┤ 0x41cff9fc
+│         NEW MCU SCRATCHPAD          │
+│  SYS_K3_MCU_SCRATCHPAD_SIZE = 0x200 │
+└─────────────────────────────────────┘ CONFIG_SYS_K3_BOOT_PARAM_TABLE_INDEX
+			                (0x41cffbfc)
+
 OSPI:
 -----
 ROM supports booting from OSPI from offset 0x0.
Signature · 1 line
2.34.1
Reviewed-by on v3 3/4
#4 lore raw

Re: [PATCH v3 3/4] Kconfig: j721e: Change K3_MCU_SCRATCHPAD_BASE to non firewalled region

Quoted 11 lines · Manorit Chawdhry

In non-combined boot flow for K3, all the firewalls are locked by default until sysfw comes up. Rom configures some of the firewall for its usage along with the SRAM for R5 but the PSRAM region is still locked.

The K3 MCU Scratchpad for j721e was set to a PSRAM region triggering the firewall exception before sysfw came up. The exception started happening after adding multi dtb support that accesses the scratchpad for reading EEPROM contents.

The commit changes R5 MCU scratchpad for j721e to an SRAM region.

...

#5 lore raw

Re: [PATCH v3 3/4] Kconfig: j721e: Change K3_MCU_SCRATCHPAD_BASE to non firewalled region

In reply to Manorit Chawdhry
Quoted 53 lines · Manorit Chawdhry

In non-combined boot flow for K3, all the firewalls are locked by default until sysfw comes up. Rom configures some of the firewall for its usage along with the SRAM for R5 but the PSRAM region is still locked.

The K3 MCU Scratchpad for j721e was set to a PSRAM region triggering the firewall exception before sysfw came up. The exception started happening after adding multi dtb support that accesses the scratchpad for reading EEPROM contents.

The commit changes R5 MCU scratchpad for j721e to an SRAM region.

Old Map:

┌─────────────────────────────────────┐ 0x41c00000
│                 SPL                 │
├─────────────────────────────────────┤ 0x41c40000 (approx)
│                STACK                │
├─────────────────────────────────────┤ 0x41c85b20
│             Global data             │
│  sizeof(struct global_data) = 0xd8  │
├─────────────────────────────────────┤ gd->malloc_base = 0x41c85bfc
│                HEAP                 │
│  CONFIG_SYS_MALLOC_F_LEN = 0x70000  │
├─────────────────────────────────────┤ CONFIG_SPL_BSS_START_ADDR
│               SPL BSS               │ (0x41cf5bfc)
│  CONFIG_SPL_BSS_MAX_SIZE = 0xA000   │
└─────────────────────────────────────┘ CONFIG_SYS_K3_BOOT_PARAM_TABLE_INDEX
			                (0x41cffbfc)

New Map:

┌─────────────────────────────────────┐ 0x41c00000
│                 SPL                 │
├─────────────────────────────────────┤ 0x41c40000 (approx)
│                EMPTY                │
├─────────────────────────────────────┤ 0x41c81920
│                STACK                │
│ SPL_SIZE_LIMIT_PROVIDE_STACK=0x4000 │
├─────────────────────────────────────┤ 0x41c85920
│             Global data             │
│  sizeof(struct global_data) = 0xd8  │
├─────────────────────────────────────┤ gd->malloc_base = 0x41c859f0
│                HEAP                 │
│  CONFIG_SYS_MALLOC_F_LEN = 0x70000  │
├─────────────────────────────────────┤ CONFIG_SPL_BSS_START_ADDR
│               SPL BSS               │ (0x41cf59f0)
│  CONFIG_SPL_BSS_MAX_SIZE = 0xA000   │
├─────────────────────────────────────┤ 0x41cff9fc
│         NEW MCU SCRATCHPAD          │
│  SYS_K3_MCU_SCRATCHPAD_SIZE = 0x200 │
└─────────────────────────────────────┘ CONFIG_SYS_K3_BOOT_PARAM_TABLE_INDEX
			                (0x41cffbfc)
Fixes ab977c8b91b4 ("configs: j721s2_evm_r5: Enable support for building multiple dtbs into FIT")
Quoted 8 lines
[[email protected]: SRAM allocation addressing diagram]
---
 arch/arm/mach-k3/Kconfig       |  3 ++-
 configs/j721e_evm_r5_defconfig | 10 ++++++++--
 doc/board/ti/j721e_evm.rst     | 24 ++++++++++++++++++++++++

OK, sorry. I'm glad you added this to the rst, but it's not a literal drop-in. The first issue is that "make htmldocs" notices indentation problems, and I was checking this because I'm not sure how what you did would render. Please make sure "make htmldocs" at least passes, and check the output in a browser as well to make sure the table reads well. FWIW, this is the same sphinx docbook stuff as the kernel, so there's probably some other examples in tree there you can look at if you can't find anything in-tree here that gets you the output you want.

Signature · 1 line
Tom
#6 lore raw

Re: [PATCH v3 3/4] Kconfig: j721e: Change K3_MCU_SCRATCHPAD_BASE to non firewalled region

Quoted 64 lines · Tom Rini
Quoted 53 lines · Manorit Chawdhry

In non-combined boot flow for K3, all the firewalls are locked by default until sysfw comes up. Rom configures some of the firewall for its usage along with the SRAM for R5 but the PSRAM region is still locked.

The K3 MCU Scratchpad for j721e was set to a PSRAM region triggering the firewall exception before sysfw came up. The exception started happening after adding multi dtb support that accesses the scratchpad for reading EEPROM contents.

The commit changes R5 MCU scratchpad for j721e to an SRAM region.

Old Map:

┌─────────────────────────────────────┐ 0x41c00000
│                 SPL                 │
├─────────────────────────────────────┤ 0x41c40000 (approx)
│                STACK                │
├─────────────────────────────────────┤ 0x41c85b20
│             Global data             │
│  sizeof(struct global_data) = 0xd8  │
├─────────────────────────────────────┤ gd->malloc_base = 0x41c85bfc
│                HEAP                 │
│  CONFIG_SYS_MALLOC_F_LEN = 0x70000  │
├─────────────────────────────────────┤ CONFIG_SPL_BSS_START_ADDR
│               SPL BSS               │ (0x41cf5bfc)
│  CONFIG_SPL_BSS_MAX_SIZE = 0xA000   │
└─────────────────────────────────────┘ CONFIG_SYS_K3_BOOT_PARAM_TABLE_INDEX
			                (0x41cffbfc)

New Map:

┌─────────────────────────────────────┐ 0x41c00000
│                 SPL                 │
├─────────────────────────────────────┤ 0x41c40000 (approx)
│                EMPTY                │
├─────────────────────────────────────┤ 0x41c81920
│                STACK                │
│ SPL_SIZE_LIMIT_PROVIDE_STACK=0x4000 │
├─────────────────────────────────────┤ 0x41c85920
│             Global data             │
│  sizeof(struct global_data) = 0xd8  │
├─────────────────────────────────────┤ gd->malloc_base = 0x41c859f0
│                HEAP                 │
│  CONFIG_SYS_MALLOC_F_LEN = 0x70000  │
├─────────────────────────────────────┤ CONFIG_SPL_BSS_START_ADDR
│               SPL BSS               │ (0x41cf59f0)
│  CONFIG_SPL_BSS_MAX_SIZE = 0xA000   │
├─────────────────────────────────────┤ 0x41cff9fc
│         NEW MCU SCRATCHPAD          │
│  SYS_K3_MCU_SCRATCHPAD_SIZE = 0x200 │
└─────────────────────────────────────┘ CONFIG_SYS_K3_BOOT_PARAM_TABLE_INDEX
			                (0x41cffbfc)
Fixes ab977c8b91b4 ("configs: j721s2_evm_r5: Enable support for building multiple dtbs into FIT")
Quoted 8 lines
[[email protected]: SRAM allocation addressing diagram]
---
 arch/arm/mach-k3/Kconfig       |  3 ++-
 configs/j721e_evm_r5_defconfig | 10 ++++++++--
 doc/board/ti/j721e_evm.rst     | 24 ++++++++++++++++++++++++
Quoted 9 lines

OK, sorry. I'm glad you added this to the rst, but it's not a literal drop-in. The first issue is that "make htmldocs" notices indentation problems, and I was checking this because I'm not sure how what you did would render. Please make sure "make htmldocs" at least passes, and check the output in a browser as well to make sure the table reads well. FWIW, this is the same sphinx docbook stuff as the kernel, so there's probably some other examples in tree there you can look at if you can't find anything in-tree here that gets you the output you want.

Ah, am sorry, had no idea on this. Will run all this and send the next revision, thanks for telling!

Thanks and regards,
Manorit

Quoted 2 lines
Signature · 1 line
Tom
#7 lore raw

PATCH v3 4/4 arm: mach-k3: Increase SYSFW max image size

In reply to Manorit Chawdhry

From: Dave Gerlach <[email protected]>

When booting with HS silicon, the system firmware image is 278270, which is slightly larger than currently allocated amount.

This can cause unexpected behavior if this overlap interferes with other things in memory, so increase this with a slightly margin added as well to avoid any boot issues that can appear after system firmware gets loaded.

---
 arch/arm/mach-k3/Kconfig | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
arch/arm/mach-k3/Kconfig +1 -2
index 0991b42423a0..bae0a827c29f 100644
@@ -141,8 +141,7 @@ config K3_SYSFW_IMAGE_MMCSD_RAW_MODE_PART
 config K3_SYSFW_IMAGE_SIZE_MAX
 	int "Amount of memory dynamically allocated for loading SYSFW blob"
 	depends on K3_LOAD_SYSFW
-	default 163840 if SOC_K3_AM625 || SOC_K3_AM62A7
-	default	278000
+	default	280000
 	help
 	  Amount of memory (in bytes) reserved through dynamic allocation at
 	  runtime for loading the combined System Firmware and configuration image
Signature · 1 line
2.34.1