[PATCH 01/15] Convert CONFIG_ARMV7_SECURE_BASE et al to Kconfig

Tom Rini trini at konsulko.com
Thu Mar 10 02:43:50 CET 2022


This converts the following to Kconfig:
   CONFIG_ARMV7_SECURE_BASE
   CONFIG_ARMV7_SECURE_MAX_SIZE
   CONFIG_ARMV7_SECURE_RESERVE_SIZE

Signed-off-by: Tom Rini <trini at konsulko.com>
---
 arch/arm/cpu/armv7/Kconfig             | 31 ++++++++++++++++++++++++++
 configs/Bananapi_M2_Ultra_defconfig    |  1 +
 configs/LicheePi_Zero_defconfig        |  1 +
 configs/bananapi_m2_berry_defconfig    |  1 +
 configs/mx7ulp_evk_defconfig           |  1 +
 configs/mx7ulp_evk_plugin_defconfig    |  1 +
 configs/pg_wcom_expu1_defconfig        |  1 +
 configs/pg_wcom_expu1_update_defconfig |  1 +
 configs/pg_wcom_seli8_defconfig        |  1 +
 configs/pg_wcom_seli8_update_defconfig |  1 +
 configs/pinecube_defconfig             |  1 +
 include/configs/apalis-tk1.h           |  4 ----
 include/configs/cei-tk1-som.h          |  4 ----
 include/configs/jetson-tk1.h           |  4 ----
 include/configs/ls1021aiot.h           |  2 --
 include/configs/ls1021aqds.h           |  2 --
 include/configs/ls1021atsn.h           |  2 --
 include/configs/ls1021atwr.h           |  2 --
 include/configs/mx7_common.h           |  2 --
 include/configs/mx7ulp_com.h           |  2 --
 include/configs/stm32mp15_common.h     |  6 -----
 include/configs/sun6i.h                |  7 ------
 include/configs/sun7i.h                |  7 ------
 include/configs/sun8i.h                | 10 ---------
 24 files changed, 41 insertions(+), 54 deletions(-)

diff --git a/arch/arm/cpu/armv7/Kconfig b/arch/arm/cpu/armv7/Kconfig
index 2eeef3cba96c..f1e4e26b8f00 100644
--- a/arch/arm/cpu/armv7/Kconfig
+++ b/arch/arm/cpu/armv7/Kconfig
@@ -27,6 +27,37 @@ config ARMV7_BOOT_SEC_DEFAULT
 	This can be overridden at run-time by setting the bootm_boot_mode env.
 	variable to "sec" or "nonsec".
 
+config HAS_ARMV7_SECURE_BASE
+	bool "Enable support for a ahardware secure memory area"
+	default y if ARCH_LS1021A || ARCH_MX7 || ARCH_MX7ULP || ARCH_STM32MP \
+			|| MACH_SUN6I || MACH_SUN7I || MACH_SUN8I || TEGRA124
+
+config ARMV7_SECURE_BASE
+	hex "Base address for secure mode memory"
+	depends on HAS_ARMV7_SECURE_BASE
+	default 0xfff00000 if TEGRA124
+	default 0x2ffc0000 if ARCH_STM32MP
+	default 0x2f000000 if ARCH_MX7ULP
+	default 0x10010000 if ARCH_LS1021A
+	default 0x00900000 if ARCH_MX7
+	default 0x00044000 if MACH_SUN8I
+	default 0x00020000 if MACH_SUN6I || MACH_SUN7I
+
+config ARMV7_SECURE_RESERVE_SIZE
+	hex
+	depends on TEGRA124 && HAS_ARMV7_SECURE_BASE
+	default 0x100000
+	help
+	  Reserve top 1M for secure RAM
+
+config ARMV7_SECURE_MAX_SIZE
+	hex
+	depends on ARMV7_SECURE_BASE && ARCH_STM32MP || MACH_SUN6I \
+			|| MACH_SUN7I || MACH_SUN8I
+	default 0xbc00 if MACH_SUN8I && !MACH_SUN8I_H3
+	default 0x3c00 if MACH_SUN8I && MACH_SUN8I_H3
+	default 0x10000
+
 config ARMV7_VIRT
 	bool "Enable support for hardware virtualization" if EXPERT
 	depends on CPU_V7_HAS_VIRT && ARMV7_NONSEC
diff --git a/configs/Bananapi_M2_Ultra_defconfig b/configs/Bananapi_M2_Ultra_defconfig
index 8917af3c93ac..a66aef0755ad 100644
--- a/configs/Bananapi_M2_Ultra_defconfig
+++ b/configs/Bananapi_M2_Ultra_defconfig
@@ -9,6 +9,7 @@ CONFIG_MMC0_CD_PIN="PH13"
 CONFIG_MMC_SUNXI_SLOT_EXTRA=2
 CONFIG_USB1_VBUS_PIN="PH23"
 CONFIG_USB2_VBUS_PIN="PH23"
+# CONFIG_HAS_ARMV7_SECURE_BASE is not set
 CONFIG_AHCI=y
 # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
 CONFIG_SPL_I2C=y
diff --git a/configs/LicheePi_Zero_defconfig b/configs/LicheePi_Zero_defconfig
index b50bae9bbdea..9815348badd1 100644
--- a/configs/LicheePi_Zero_defconfig
+++ b/configs/LicheePi_Zero_defconfig
@@ -4,4 +4,5 @@ CONFIG_DEFAULT_DEVICE_TREE="sun8i-v3s-licheepi-zero"
 CONFIG_SPL=y
 CONFIG_MACH_SUN8I_V3S=y
 CONFIG_DRAM_CLK=360
+# CONFIG_HAS_ARMV7_SECURE_BASE is not set
 # CONFIG_NETDEVICES is not set
diff --git a/configs/bananapi_m2_berry_defconfig b/configs/bananapi_m2_berry_defconfig
index 2d65d0fd1989..a35fcdb64e8d 100644
--- a/configs/bananapi_m2_berry_defconfig
+++ b/configs/bananapi_m2_berry_defconfig
@@ -6,6 +6,7 @@ CONFIG_MACH_SUN8I_R40=y
 CONFIG_DRAM_CLK=576
 CONFIG_MMC0_CD_PIN="PH13"
 CONFIG_USB1_VBUS_PIN="PH23"
+# CONFIG_HAS_ARMV7_SECURE_BASE is not set
 CONFIG_AHCI=y
 # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
 CONFIG_SPL_I2C=y
diff --git a/configs/mx7ulp_evk_defconfig b/configs/mx7ulp_evk_defconfig
index 4f641471acbc..192e9df2e49b 100644
--- a/configs/mx7ulp_evk_defconfig
+++ b/configs/mx7ulp_evk_defconfig
@@ -10,6 +10,7 @@ CONFIG_ENV_OFFSET=0xC0000
 CONFIG_DM_GPIO=y
 CONFIG_DEFAULT_DEVICE_TREE="imx7ulp-evk"
 CONFIG_TARGET_MX7ULP_EVK=y
+# CONFIG_HAS_ARMV7_SECURE_BASE is not set
 CONFIG_SYS_LOAD_ADDR=0x60800000
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_USE_BOOTCOMMAND=y
diff --git a/configs/mx7ulp_evk_plugin_defconfig b/configs/mx7ulp_evk_plugin_defconfig
index 0f8e9e886ed0..a152c6e93a8a 100644
--- a/configs/mx7ulp_evk_plugin_defconfig
+++ b/configs/mx7ulp_evk_plugin_defconfig
@@ -10,6 +10,7 @@ CONFIG_ENV_OFFSET=0xC0000
 CONFIG_DM_GPIO=y
 CONFIG_DEFAULT_DEVICE_TREE="imx7ulp-evk"
 CONFIG_TARGET_MX7ULP_EVK=y
+# CONFIG_HAS_ARMV7_SECURE_BASE is not set
 CONFIG_SYS_LOAD_ADDR=0x60800000
 CONFIG_USE_BOOTCOMMAND=y
 CONFIG_BOOTCOMMAND="mmc dev ${mmcdev}; if mmc rescan; then if run loadbootscript; then run bootscript; else if run loadimage; then run mmcboot; fi; fi; fi"
diff --git a/configs/pg_wcom_expu1_defconfig b/configs/pg_wcom_expu1_defconfig
index 706aacfea008..2dd40019ddac 100644
--- a/configs/pg_wcom_expu1_defconfig
+++ b/configs/pg_wcom_expu1_defconfig
@@ -21,6 +21,7 @@ CONFIG_DEFAULT_DEVICE_TREE="ls1021a-pg-wcom-expu1"
 CONFIG_BOOTCOUNT_BOOTLIMIT=3
 CONFIG_SYS_BOOTCOUNT_ADDR=0x70000020
 CONFIG_SYS_CLK_FREQ=66666666
+# CONFIG_HAS_ARMV7_SECURE_BASE is not set
 CONFIG_AHCI=y
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_SYS_LOAD_ADDR=0x82000000
diff --git a/configs/pg_wcom_expu1_update_defconfig b/configs/pg_wcom_expu1_update_defconfig
index 9cd479877ec8..0518d9932d5e 100644
--- a/configs/pg_wcom_expu1_update_defconfig
+++ b/configs/pg_wcom_expu1_update_defconfig
@@ -19,6 +19,7 @@ CONFIG_SYS_I2C_MXC_I2C3=y
 CONFIG_DEFAULT_DEVICE_TREE="ls1021a-pg-wcom-expu1"
 CONFIG_BOOTCOUNT_BOOTLIMIT=3
 CONFIG_SYS_BOOTCOUNT_ADDR=0x70000020
+# CONFIG_HAS_ARMV7_SECURE_BASE is not set
 CONFIG_AHCI=y
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_SYS_LOAD_ADDR=0x82000000
diff --git a/configs/pg_wcom_seli8_defconfig b/configs/pg_wcom_seli8_defconfig
index 8ca1a60e1116..4fc0b124d86a 100644
--- a/configs/pg_wcom_seli8_defconfig
+++ b/configs/pg_wcom_seli8_defconfig
@@ -21,6 +21,7 @@ CONFIG_DEFAULT_DEVICE_TREE="ls1021a-pg-wcom-seli8"
 CONFIG_BOOTCOUNT_BOOTLIMIT=3
 CONFIG_SYS_BOOTCOUNT_ADDR=0x70000020
 CONFIG_SYS_CLK_FREQ=66666666
+# CONFIG_HAS_ARMV7_SECURE_BASE is not set
 CONFIG_AHCI=y
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_SYS_LOAD_ADDR=0x82000000
diff --git a/configs/pg_wcom_seli8_update_defconfig b/configs/pg_wcom_seli8_update_defconfig
index 5575ee8115fc..433dda2362dd 100644
--- a/configs/pg_wcom_seli8_update_defconfig
+++ b/configs/pg_wcom_seli8_update_defconfig
@@ -19,6 +19,7 @@ CONFIG_SYS_I2C_MXC_I2C3=y
 CONFIG_DEFAULT_DEVICE_TREE="ls1021a-pg-wcom-seli8"
 CONFIG_BOOTCOUNT_BOOTLIMIT=3
 CONFIG_SYS_BOOTCOUNT_ADDR=0x70000020
+# CONFIG_HAS_ARMV7_SECURE_BASE is not set
 CONFIG_AHCI=y
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_SYS_LOAD_ADDR=0x82000000
diff --git a/configs/pinecube_defconfig b/configs/pinecube_defconfig
index 0c71d5941859..b02998e13008 100644
--- a/configs/pinecube_defconfig
+++ b/configs/pinecube_defconfig
@@ -7,6 +7,7 @@ CONFIG_SUNXI_DRAM_DDR3_1333=y
 CONFIG_DRAM_CLK=504
 CONFIG_DRAM_ODT_EN=y
 CONFIG_I2C0_ENABLE=y
+# CONFIG_HAS_ARMV7_SECURE_BASE is not set
 CONFIG_SPL_I2C=y
 CONFIG_SPL_SYS_I2C_LEGACY=y
 CONFIG_SYS_I2C_MVTWSI=y
diff --git a/include/configs/apalis-tk1.h b/include/configs/apalis-tk1.h
index 57192649ecc9..da935f77b9a6 100644
--- a/include/configs/apalis-tk1.h
+++ b/include/configs/apalis-tk1.h
@@ -114,8 +114,4 @@
 #include "tegra-common-usb-gadget.h"
 #include "tegra-common-post.h"
 
-/* Reserve top 1M for secure RAM */
-#define CONFIG_ARMV7_SECURE_BASE		0xfff00000
-#define CONFIG_ARMV7_SECURE_RESERVE_SIZE	0x00100000
-
 #endif /* __CONFIG_H */
diff --git a/include/configs/cei-tk1-som.h b/include/configs/cei-tk1-som.h
index 2c406d318666..1cc86091022b 100644
--- a/include/configs/cei-tk1-som.h
+++ b/include/configs/cei-tk1-som.h
@@ -28,8 +28,4 @@
 #include "tegra-common-usb-gadget.h"
 #include "tegra-common-post.h"
 
-/* Reserve top 1M for secure RAM */
-#define CONFIG_ARMV7_SECURE_BASE		0xfff00000
-#define CONFIG_ARMV7_SECURE_RESERVE_SIZE	0x00100000
-
 #endif /* __CONFIG_H */
diff --git a/include/configs/jetson-tk1.h b/include/configs/jetson-tk1.h
index a3c385b6e22a..b4c42fd37229 100644
--- a/include/configs/jetson-tk1.h
+++ b/include/configs/jetson-tk1.h
@@ -26,8 +26,4 @@
 #include "tegra-common-usb-gadget.h"
 #include "tegra-common-post.h"
 
-/* Reserve top 1M for secure RAM */
-#define CONFIG_ARMV7_SECURE_BASE		0xfff00000
-#define CONFIG_ARMV7_SECURE_RESERVE_SIZE	0x00100000
-
 #endif /* __CONFIG_H */
diff --git a/include/configs/ls1021aiot.h b/include/configs/ls1021aiot.h
index 4e5228aa219b..810eee895b80 100644
--- a/include/configs/ls1021aiot.h
+++ b/include/configs/ls1021aiot.h
@@ -7,8 +7,6 @@
 #ifndef __CONFIG_H
 #define __CONFIG_H
 
-#define CONFIG_ARMV7_SECURE_BASE OCRAM_BASE_S_ADDR
-
 #define CONFIG_SYS_INIT_RAM_ADDR	OCRAM_BASE_ADDR
 #define CONFIG_SYS_INIT_RAM_SIZE	OCRAM_SIZE
 
diff --git a/include/configs/ls1021aqds.h b/include/configs/ls1021aqds.h
index b6501e87b41f..27a074c745bd 100644
--- a/include/configs/ls1021aqds.h
+++ b/include/configs/ls1021aqds.h
@@ -7,8 +7,6 @@
 #ifndef __CONFIG_H
 #define __CONFIG_H
 
-#define CONFIG_ARMV7_SECURE_BASE	OCRAM_BASE_S_ADDR
-
 #define CONFIG_DEEP_SLEEP
 
 #define CONFIG_SYS_INIT_RAM_ADDR	OCRAM_BASE_ADDR
diff --git a/include/configs/ls1021atsn.h b/include/configs/ls1021atsn.h
index 824078dd27de..374220327835 100644
--- a/include/configs/ls1021atsn.h
+++ b/include/configs/ls1021atsn.h
@@ -6,8 +6,6 @@
 #ifndef __CONFIG_H
 #define __CONFIG_H
 
-#define CONFIG_ARMV7_SECURE_BASE	OCRAM_BASE_S_ADDR
-
 #define CONFIG_DEEP_SLEEP
 
 #define CONFIG_SYS_INIT_RAM_ADDR	OCRAM_BASE_ADDR
diff --git a/include/configs/ls1021atwr.h b/include/configs/ls1021atwr.h
index fada8aa61db8..a2e4c80bd9a0 100644
--- a/include/configs/ls1021atwr.h
+++ b/include/configs/ls1021atwr.h
@@ -7,8 +7,6 @@
 #ifndef __CONFIG_H
 #define __CONFIG_H
 
-#define CONFIG_ARMV7_SECURE_BASE	OCRAM_BASE_S_ADDR
-
 #define CONFIG_DEEP_SLEEP
 
 #define CONFIG_SYS_INIT_RAM_ADDR	OCRAM_BASE_ADDR
diff --git a/include/configs/mx7_common.h b/include/configs/mx7_common.h
index 2e976df6985f..76c374af2532 100644
--- a/include/configs/mx7_common.h
+++ b/include/configs/mx7_common.h
@@ -31,8 +31,6 @@
 
 /* MMC */
 
-#define CONFIG_ARMV7_SECURE_BASE	0x00900000
-
 /*
  * If we have defined the OPTEE ram size and not OPTEE it means that we were
  * launched by OPTEE, because of that we shall skip all the low level
diff --git a/include/configs/mx7ulp_com.h b/include/configs/mx7ulp_com.h
index 319de9b01429..d3ba1449279a 100644
--- a/include/configs/mx7ulp_com.h
+++ b/include/configs/mx7ulp_com.h
@@ -70,7 +70,5 @@
 #define CONFIG_SYS_INIT_SP_ADDR \
 	(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)
 
-#define CONFIG_ARMV7_SECURE_BASE	0x2F000000
-
 #define CONFIG_MXC_USB_PORTSC		(PORT_PTS_UTMI | PORT_PTS_PTW)
 #endif	/* __CONFIG_H */
diff --git a/include/configs/stm32mp15_common.h b/include/configs/stm32mp15_common.h
index 175d546a158c..6b40cdb01779 100644
--- a/include/configs/stm32mp15_common.h
+++ b/include/configs/stm32mp15_common.h
@@ -10,12 +10,6 @@
 #include <linux/sizes.h>
 #include <asm/arch/stm32.h>
 
-#ifdef CONFIG_ARMV7_PSCI
-/* PSCI support */
-#define CONFIG_ARMV7_SECURE_BASE		STM32_SYSRAM_BASE
-#define CONFIG_ARMV7_SECURE_MAX_SIZE		STM32_SYSRAM_SIZE
-#endif
-
 /*
  * Configuration of the external SRAM memory used by U-Boot
  */
diff --git a/include/configs/sun6i.h b/include/configs/sun6i.h
index 1e490daac17d..0b1fedda1081 100644
--- a/include/configs/sun6i.h
+++ b/include/configs/sun6i.h
@@ -10,13 +10,6 @@
 #ifndef __CONFIG_H
 #define __CONFIG_H
 
-/*
- * A31 specific configuration
- */
-
-#define CONFIG_ARMV7_SECURE_BASE	SUNXI_SRAM_B_BASE
-#define CONFIG_ARMV7_SECURE_MAX_SIZE    (64 * 1024) /* 64 KB */
-
 /*
  * Include common sunxi configuration where most the settings are
  */
diff --git a/include/configs/sun7i.h b/include/configs/sun7i.h
index 803a7514cc06..bc2779fa26f8 100644
--- a/include/configs/sun7i.h
+++ b/include/configs/sun7i.h
@@ -8,13 +8,6 @@
 #ifndef __CONFIG_H
 #define __CONFIG_H
 
-/*
- * A20 specific configuration
- */
-
-#define CONFIG_ARMV7_SECURE_BASE	SUNXI_SRAM_B_BASE
-#define CONFIG_ARMV7_SECURE_MAX_SIZE	(64 * 1024) /* 64 KB */
-
 /*
  * Include common sunxi configuration where most the settings are
  */
diff --git a/include/configs/sun8i.h b/include/configs/sun8i.h
index 563635636624..106139d0904a 100644
--- a/include/configs/sun8i.h
+++ b/include/configs/sun8i.h
@@ -14,16 +14,6 @@
 
 #include <asm/arch/cpu.h>
 
-#ifdef SUNXI_SRAM_A2_SIZE
-/*
- * If the SoC has enough SRAM A2, use that for the secure monitor.
- * Skip the first 16 KiB of SRAM A2, which is not usable, as only certain bytes
- * are writable. Reserve the last 17 KiB for the resume shim and SCP firmware.
- */
-#define CONFIG_ARMV7_SECURE_BASE	(SUNXI_SRAM_A2_BASE + 16 * 1024)
-#define CONFIG_ARMV7_SECURE_MAX_SIZE	(SUNXI_SRAM_A2_SIZE - 33 * 1024)
-#endif
-
 /*
  * Include common sunxi configuration where most the settings are
  */
-- 
2.25.1



More information about the U-Boot mailing list