[PATCH v1 17/19] ARM: tegra: dt-setup: convert TrustZone remove into config
Svyatoslav Ryhel
clamor95 at gmail.com
Tue Aug 22 13:22:15 CEST 2023
Remove of TrustZone nodes is required by many product devices
which require repetable calls of same function from device board.
To simplify this, TZ remove is converted into Kconfig option.
Signed-off-by: Svyatoslav Ryhel <clamor95 at gmail.com>
---
arch/arm/mach-tegra/Kconfig | 14 ++++++++++++++
arch/arm/mach-tegra/dt-setup.c | 7 +++++++
2 files changed, 21 insertions(+)
diff --git a/arch/arm/mach-tegra/Kconfig b/arch/arm/mach-tegra/Kconfig
index 464bd0798f..650f5c7984 100644
--- a/arch/arm/mach-tegra/Kconfig
+++ b/arch/arm/mach-tegra/Kconfig
@@ -172,6 +172,20 @@ config TEGRA_DISCONNECT_UDC_ON_BOOT
USB controller when U-Boot boots to avoid leaving a stale USB device
present.
+config TEGRA_REMOVE_TZ_NODES
+ bool "Remove TrustZone node and alias from Linux DTS before boot"
+ depends on !SKIP_LOWLEVEL_INIT
+ select OF_LIBFDT
+ help
+ U-Boot cannot deploy TrustZone on its own on product devices since
+ vendors usually do not provide device specific TrustOS images. Same
+ time vendor bootloaders establish TrustZone and Linux device trees
+ take this into account and bind Trusted Foundation devices. If u-boot
+ tries to boot such tree it will stuck. This option automatically
+ removes TZ nodes from device tree used for booting Linux kernel to
+ avoid bootloop and preserve compatibility of Linux device trees with
+ vendor kernels.
+
config CI_UDC_HAS_HOSTPC
def_bool y
depends on CI_UDC && !TEGRA20
diff --git a/arch/arm/mach-tegra/dt-setup.c b/arch/arm/mach-tegra/dt-setup.c
index c11494722b..8f8e1aee1b 100644
--- a/arch/arm/mach-tegra/dt-setup.c
+++ b/arch/arm/mach-tegra/dt-setup.c
@@ -5,6 +5,7 @@
#include <common.h>
#include <fdtdec.h>
+#include <fdt_support.h>
#include <stdlib.h>
#include <asm/arch-tegra/cboot.h>
#include <asm/arch-tegra/gpu.h>
@@ -32,6 +33,12 @@ int ft_system_setup(void *blob, struct bd_info *bd)
return ret;
}
+#ifdef CONFIG_TEGRA_REMOVE_TZ_NODES
+ /* Remove TrustZone nodes */
+ fdt_del_node_and_alias(blob, "/firmware");
+ fdt_del_node_and_alias(blob, "/reserved-memory/trustzone at bfe00000");
+#endif
+
return 0;
}
--
2.39.2
More information about the U-Boot
mailing list