arm: mach-k3: use Kconfig options for ATF/OPTEE size
Subsystems (2)
PATCH v2 1/1 arm: mach-k3: use Kconfig options for ATF/OPTEE size
The reserved memory sizes for ATF and OPTEE were hard-coded for K3 devices, this patch replaces them with a Kconfig option allowing for easier modifications.
---
Changes in v2:
- Update help text to mention firewall configuration
- Pick R/Ack-by tags
- Link to v1: https://lore.kernel.org/r/[email protected]
--- arch/arm/dts/k3-binman.dtsi | 4 ++-- arch/arm/mach-k3/Kconfig | 17 +++++++++++++++++ arch/arm/mach-k3/common_fdt.c | 5 +++-- 3 files changed, 22 insertions(+), 4 deletions(-)
arch/arm/dts/k3-binman.dtsi +2 -2
@@ -477,7 +477,7 @@ FWPERM_SECURE_PRIV_RWCD | FWPERM_SECURE_USER_RWCD)>; start_address = <0x0 CONFIG_K3_ATF_LOAD_ADDR>; - end_address = <0x0 (CONFIG_K3_ATF_LOAD_ADDR + 0x1ffff)>; + end_address = <0x0 (CONFIG_K3_ATF_LOAD_ADDR + CONFIG_K3_ATF_RESERVED_SIZE - 1)>; }; firewall_armv8_optee_fg: template-8 { control = <(FWCTRL_EN | FWCTRL_LOCK |
@@ -486,7 +486,7 @@ FWPERM_SECURE_PRIV_RWCD | FWPERM_SECURE_USER_RWCD)>; start_address = <0x0 CONFIG_K3_OPTEE_LOAD_ADDR>; - end_address = <0x0 (CONFIG_K3_OPTEE_LOAD_ADDR + 0x17fffff)>; + end_address = <0x0 (CONFIG_K3_OPTEE_LOAD_ADDR + CONFIG_K3_OPTEE_RESERVED_SIZE - 1)>; }; ti_falcon_template: template-9 {
arch/arm/mach-k3/Kconfig +17 -0
@@ -130,6 +130,15 @@ config K3_ATF_LOAD_ADDR The load address for the ATF image. This value is used to build the FIT image header that places ATF in memory where it will run. +config K3_ATF_RESERVED_SIZE + hex "Reserved DDR size for ATF" + default 0x80000 if (SOC_K3_AM625 || SOC_K3_AM62A7 || SOC_K3_AM62P5 || SOC_K3_J722S) + default 0x20000 + help + The runtime DDR size reserved for ATF. This value is used to fixup the + kernel device-tree's reserved-memory node for ATF and configure the + firewall. + config K3_OPTEE_LOAD_ADDR hex "Load address of OPTEE image" default 0x9e800000
@@ -137,6 +146,14 @@ config K3_OPTEE_LOAD_ADDR The load address for the OPTEE image. This value defaults to 0x9e800000 if not provided in the board defconfig file. +config K3_OPTEE_RESERVED_SIZE + hex "Reserved DDR size for OPTEE" + default 0x1800000 + help + The runtime DDR size reserved for OPTEE. This value is used to fixup the + kernel device-tree's reserved-memory node for OPTEE and configure the + firewall. + config K3_DM_FW bool "Separate DM firmware image" depends on CPU_V7R && !SOC_K3_AM642 && !SOC_K3_AM654 && !CLK_TI_SCI && !TI_SCI_POWER_DOMAIN
arch/arm/mach-k3/common_fdt.c +3 -2
@@ -173,12 +173,13 @@ int fdt_fixup_reserved(void *blob)int ret; ret =fdt_fixup_reserved_memory (blob,"tfa" ,CONFIG_K3_ATF_LOAD_ADDR , -0x80000 ); +CONFIG_K3_ATF_RESERVED_SIZE );if (ret)return ret;return fdt_fixup_reserved_memory (blob,"optee" , -CONFIG_K3_OPTEE_LOAD_ADDR ,0x1800000 ); +CONFIG_K3_OPTEE_LOAD_ADDR , +CONFIG_K3_OPTEE_RESERVED_SIZE ); }static int fdt_fixup_critical_trips (void *blob,int zoneoffset,int maxc)
---
base-commit: 8bc2a5196c1c0bb5dbdaca073323da0015a0de37
change-id: 20260310-tfa_tee_addr_kconfig_refactor-2bf77949df0f
Best regards,
Signature · 1 line
Anshul Dalal <[email protected]>
Hi Anshul,
Quoted 45 lines · Anshul Dalal
The reserved memory sizes for ATF and OPTEE were hard-coded for K3 devices, this patch replaces them with a
Kconfigoption allowing for easier modifications.Acked-by Andrew Davis <[email protected]>Reviewed-by Dhruva Gole <[email protected]>Signed-off-by Anshul Dalal <[email protected]>---
Changes in v2:
- Update help text to mention firewall configuration
- Pick R/Ack-by tags
- Link to v1: https://lore.kernel.org/r/[email protected]--- arch/arm/dts/k3-binman.dtsi | 4 ++-- arch/arm/mach-k3/Kconfig | 17 +++++++++++++++++ arch/arm/mach-k3/common_fdt.c | 5 +++-- 3 files changed, 22 insertions(+), 4 deletions(-)arch/arm/dts/k3-binman.dtsi +2
-2@@ -477,7 +477,7 @@ FWPERM_SECURE_PRIV_RWCD | FWPERM_SECURE_USER_RWCD)>; start_address = <0x0 CONFIG_K3_ATF_LOAD_ADDR>; - end_address = <0x0 (CONFIG_K3_ATF_LOAD_ADDR + 0x1ffff)>; + end_address = <0x0 (CONFIG_K3_ATF_LOAD_ADDR + CONFIG_K3_ATF_RESERVED_SIZE - 1)>; }; firewall_armv8_optee_fg: template-8 { control = <(FWCTRL_EN | FWCTRL_LOCK |@@ -486,7 +486,7 @@ FWPERM_SECURE_PRIV_RWCD | FWPERM_SECURE_USER_RWCD)>; start_address = <0x0 CONFIG_K3_OPTEE_LOAD_ADDR>; - end_address = <0x0 (CONFIG_K3_OPTEE_LOAD_ADDR + 0x17fffff)>; + end_address = <0x0 (CONFIG_K3_OPTEE_LOAD_ADDR + CONFIG_K3_OPTEE_RESERVED_SIZE - 1)>; }; ti_falcon_template: template-9 {arch/arm/mach-k3/Kconfig +0
-0
arch/arm/mach-k3/Kconfig config K3_ATF_LOAD_ADDR · line 134
Quoted 5 lines
arch/arm/mach-k3/Kconfig +2
-0@@ -130,6 +130,15 @@ config K3_ATF_LOAD_ADDR The load address for the ATF image. This value is used to build the FIT image header that places ATF in memory where it will run. +config K3_ATF_RESERVED_SIZE + hex "Reserved DDR size for ATF"
Not every device has ATF running through DDR, maybe keeping it generic might be good like "memory size"
arch/arm/mach-k3/Kconfig config K3_ATF_LOAD_ADDR · line 138
Quoted 4 lines
arch/arm/mach-k3/Kconfig +4
-0+ default 0x80000 if (SOC_K3_AM625 || SOC_K3_AM62A7 || SOC_K3_AM62P5 || SOC_K3_J722S) + default 0x20000 + help + The runtime DDR size reserved for ATF. This value is used to fixup the
Same here
Quoted 46 lines
arch/arm/mach-k3/Kconfig +11
-0+ kernel device-tree's reserved-memory node for ATF and configure the + firewall. + config K3_OPTEE_LOAD_ADDR hex "Load address of OPTEE image" default 0x9e800000@@ -137,6 +146,14 @@ config K3_OPTEE_LOAD_ADDR The load address for the OPTEE image. This value defaults to 0x9e800000 if not provided in the board defconfig file. +config K3_OPTEE_RESERVED_SIZE + hex "Reserved DDR size for OPTEE" + default 0x1800000 + help + The runtime DDR size reserved for OPTEE. This value is used to fixup the + kernel device-tree's reserved-memory node for OPTEE and configure the + firewall. + config K3_DM_FW bool "Separate DM firmware image" depends on CPU_V7R && !SOC_K3_AM642 && !SOC_K3_AM654 && !CLK_TI_SCI && !TI_SCI_POWER_DOMAINarch/arm/mach-k3/common_fdt.c +3
-3@@ -173,12 +173,13 @@ int fdt_fixup_reserved(void *blob)int ret; ret =fdt_fixup_reserved_memory (blob,"tfa" ,CONFIG_K3_ATF_LOAD_ADDR , -0x80000 ); +CONFIG_K3_ATF_RESERVED_SIZE );if (ret)return ret;return fdt_fixup_reserved_memory (blob,"optee" , -CONFIG_K3_OPTEE_LOAD_ADDR ,0x1800000 ); +CONFIG_K3_OPTEE_LOAD_ADDR , +CONFIG_K3_OPTEE_RESERVED_SIZE ); }static int fdt_fixup_critical_trips (void *blob,int zoneoffset,int maxc) ---base-commit:
8bc2a5196c1c0bb5dbdaca073323da0015a0de37
change-id: 20260310-tfa_tee_addr_kconfig_refactor-2bf77949df0f
Quoted 1 line
Best regards,
With that addressed,
Regards,
Manorit
Quoted 51 lines · Manorit Chawdhry
Hi Anshul,
Quoted 48 lines · Anshul Dalal
The reserved memory sizes for ATF and OPTEE were hard-coded for K3 devices, this patch replaces them with a
Kconfigoption allowing for easier modifications.Acked-by Andrew Davis <[email protected]>Reviewed-by Dhruva Gole <[email protected]>Signed-off-by Anshul Dalal <[email protected]>---
Changes in v2:
- Update help text to mention firewall configuration
- Pick R/Ack-by tags
- Link to v1: https://lore.kernel.org/r/[email protected]--- arch/arm/dts/k3-binman.dtsi | 4 ++-- arch/arm/mach-k3/Kconfig | 17 +++++++++++++++++ arch/arm/mach-k3/common_fdt.c | 5 +++-- 3 files changed, 22 insertions(+), 4 deletions(-)arch/arm/dts/k3-binman.dtsi +2
-2@@ -477,7 +477,7 @@ FWPERM_SECURE_PRIV_RWCD | FWPERM_SECURE_USER_RWCD)>; start_address = <0x0 CONFIG_K3_ATF_LOAD_ADDR>; - end_address = <0x0 (CONFIG_K3_ATF_LOAD_ADDR + 0x1ffff)>; + end_address = <0x0 (CONFIG_K3_ATF_LOAD_ADDR + CONFIG_K3_ATF_RESERVED_SIZE - 1)>; }; firewall_armv8_optee_fg: template-8 { control = <(FWCTRL_EN | FWCTRL_LOCK |@@ -486,7 +486,7 @@ FWPERM_SECURE_PRIV_RWCD | FWPERM_SECURE_USER_RWCD)>; start_address = <0x0 CONFIG_K3_OPTEE_LOAD_ADDR>; - end_address = <0x0 (CONFIG_K3_OPTEE_LOAD_ADDR + 0x17fffff)>; + end_address = <0x0 (CONFIG_K3_OPTEE_LOAD_ADDR + CONFIG_K3_OPTEE_RESERVED_SIZE - 1)>; }; ti_falcon_template: template-9 {arch/arm/mach-k3/Kconfig +0
-0@@ -130,6 +130,15 @@ config K3_ATF_LOAD_ADDR The load address for the ATF image. This value is used to build the FIT image header that places ATF in memory where it will run.
Quoted 6 lines
arch/arm/mach-k3/Kconfig config K3_ATF_LOAD_ADDR · line 134
Quoted 2 lines
arch/arm/mach-k3/Kconfig +2
-0+config K3_ATF_RESERVED_SIZE + hex "Reserved DDR size for ATF"Not every device has ATF running through DDR, maybe keeping it generic might be good like "memory size"
Good catch, I'll incorporate it in the next revision.
Thanks for the review,
Anshul
Quoted 59 lines
arch/arm/mach-k3/Kconfig config K3_ATF_LOAD_ADDR · line 138
Quoted 4 lines
arch/arm/mach-k3/Kconfig +4
-0+ default 0x80000 if (SOC_K3_AM625 || SOC_K3_AM62A7 || SOC_K3_AM62P5 || SOC_K3_J722S) + default 0x20000 + help + The runtime DDR size reserved for ATF. This value is used to fixup theSame here
Quoted 46 lines
arch/arm/mach-k3/Kconfig +11
-0+ kernel device-tree's reserved-memory node for ATF and configure the + firewall. + config K3_OPTEE_LOAD_ADDR hex "Load address of OPTEE image" default 0x9e800000@@ -137,6 +146,14 @@ config K3_OPTEE_LOAD_ADDR The load address for the OPTEE image. This value defaults to 0x9e800000 if not provided in the board defconfig file. +config K3_OPTEE_RESERVED_SIZE + hex "Reserved DDR size for OPTEE" + default 0x1800000 + help + The runtime DDR size reserved for OPTEE. This value is used to fixup the + kernel device-tree's reserved-memory node for OPTEE and configure the + firewall. + config K3_DM_FW bool "Separate DM firmware image" depends on CPU_V7R && !SOC_K3_AM642 && !SOC_K3_AM654 && !CLK_TI_SCI && !TI_SCI_POWER_DOMAINarch/arm/mach-k3/common_fdt.c +3
-3@@ -173,12 +173,13 @@ int fdt_fixup_reserved(void *blob)int ret; ret =fdt_fixup_reserved_memory (blob,"tfa" ,CONFIG_K3_ATF_LOAD_ADDR , -0x80000 ); +CONFIG_K3_ATF_RESERVED_SIZE );if (ret)return ret;return fdt_fixup_reserved_memory (blob,"optee" , -CONFIG_K3_OPTEE_LOAD_ADDR ,0x1800000 ); +CONFIG_K3_OPTEE_LOAD_ADDR , +CONFIG_K3_OPTEE_RESERVED_SIZE ); }static int fdt_fixup_critical_trips (void *blob,int zoneoffset,int maxc) ---base-commit:
8bc2a5196c1c0bb5dbdaca073323da0015a0de37
change-id: 20260310-tfa_tee_addr_kconfig_refactor-2bf77949df0fQuoted 1 line
Best regards,
With that addressed,
Reviewed-by Manorit Chawdhry <[email protected]>Regards,
Manorit