mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] ARM: rockchip: make ATF installation optional
@ 2023-01-09 18:00 Ahmad Fatoum
  2023-01-10 14:37 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Ahmad Fatoum @ 2023-01-09 18:00 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

On RK3399, ATF running as BL31 will disable normal world access to
some peripherals. To make it easier to develop PBL code that accesses
these peripherals prior to ATF installation, support running barebox
proper in EL3, so all of memory can be poked from the barebox shell.

This is strictly a development feature. Linux on ARM64 is not meant to
be booted without PSCI, which the secure monitor provides.

Signed-off-by: Ahmad Fatoum <ahmad@a3f.at>
---
 arch/arm/mach-rockchip/Kconfig            | 13 +++++++++++--
 arch/arm/mach-rockchip/Makefile           |  2 +-
 arch/arm/mach-rockchip/include/mach/atf.h |  5 +++++
 3 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig
index 1f3ba706ee9f..4ac75ab9475c 100644
--- a/arch/arm/mach-rockchip/Kconfig
+++ b/arch/arm/mach-rockchip/Kconfig
@@ -88,16 +88,25 @@ config MACH_RADXA_ROCK3
 
 comment "select board features:"
 
+config ARCH_ROCKCHIP_ATF
+	bool "Build rockchip ATF binaries into barebox"
+	depends on ARCH_ROCKCHIP_V8
+	default y
+	help
+	  When deselected, barebox proper will run in EL3. This can be
+	  useful for debugging early startup, but for all other cases,
+	  say y here.
+
 config ARCH_RK3399_OPTEE
 	bool "Build rk3399 OP-TEE binary into barebox"
-	depends on ARCH_RK3399
+	depends on ARCH_ROCKCHIP_ATF && ARCH_RK3399
 	help
 	  With this option enabled the RK3399 OP-TEE binary is compiled
 	  into barebox and started along with the BL31 trusted firmware.
 
 config ARCH_RK3568_OPTEE
 	bool "Build rk3568 OP-TEE binary into barebox"
-	depends on ARCH_RK3568
+	depends on ARCH_ROCKCHIP_ATF && ARCH_RK3568
 	help
 	  With this option enabled the RK3568 OP-TEE binary is compiled
 	  into barebox and started along with the BL31 trusted firmware.
diff --git a/arch/arm/mach-rockchip/Makefile b/arch/arm/mach-rockchip/Makefile
index a86ee71617c8..2529af7c7e97 100644
--- a/arch/arm/mach-rockchip/Makefile
+++ b/arch/arm/mach-rockchip/Makefile
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0-only
 
 obj-y += rockchip.o
-pbl-$(CONFIG_ARCH_ROCKCHIP_V8) += atf.o
+pbl-$(CONFIG_ARCH_ROCKCHIP_ATF) += atf.o
 obj-$(CONFIG_ARCH_RK3188) += rk3188.o
 obj-$(CONFIG_ARCH_RK3288) += rk3288.o
 obj-pbl-$(CONFIG_ARCH_RK3568) += rk3568.o
diff --git a/arch/arm/mach-rockchip/include/mach/atf.h b/arch/arm/mach-rockchip/include/mach/atf.h
index d1bae5a7714f..e5d55af3d74a 100644
--- a/arch/arm/mach-rockchip/include/mach/atf.h
+++ b/arch/arm/mach-rockchip/include/mach/atf.h
@@ -19,8 +19,13 @@
 #define RK3568_BAREBOX_LOAD_ADDRESS	(RK3568_DRAM_BOTTOM + 1024*1024)
 
 #ifndef __ASSEMBLY__
+#ifdef CONFIG_ARCH_ROCKCHIP_ATF
 void rk3399_atf_load_bl31(void *fdt);
 void rk3568_atf_load_bl31(void *fdt);
+#else
+static inline void rk3399_atf_load_bl31(void *fdt) { }
+static inline void rk3568_atf_load_bl31(void *fdt) { }
+#endif
 #endif
 
 #endif /* __MACH_ATF_H */
-- 
2.38.1




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] ARM: rockchip: make ATF installation optional
  2023-01-09 18:00 [PATCH] ARM: rockchip: make ATF installation optional Ahmad Fatoum
@ 2023-01-10 14:37 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2023-01-10 14:37 UTC (permalink / raw)
  To: Ahmad Fatoum; +Cc: barebox

On Mon, Jan 09, 2023 at 07:00:24PM +0100, Ahmad Fatoum wrote:
> On RK3399, ATF running as BL31 will disable normal world access to
> some peripherals. To make it easier to develop PBL code that accesses
> these peripherals prior to ATF installation, support running barebox
> proper in EL3, so all of memory can be poked from the barebox shell.
> 
> This is strictly a development feature. Linux on ARM64 is not meant to
> be booted without PSCI, which the secure monitor provides.
> 
> Signed-off-by: Ahmad Fatoum <ahmad@a3f.at>
> ---
>  arch/arm/mach-rockchip/Kconfig            | 13 +++++++++++--
>  arch/arm/mach-rockchip/Makefile           |  2 +-
>  arch/arm/mach-rockchip/include/mach/atf.h |  5 +++++
>  3 files changed, 17 insertions(+), 3 deletions(-)

Applied, thanks

Sascha

> 
> diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig
> index 1f3ba706ee9f..4ac75ab9475c 100644
> --- a/arch/arm/mach-rockchip/Kconfig
> +++ b/arch/arm/mach-rockchip/Kconfig
> @@ -88,16 +88,25 @@ config MACH_RADXA_ROCK3
>  
>  comment "select board features:"
>  
> +config ARCH_ROCKCHIP_ATF
> +	bool "Build rockchip ATF binaries into barebox"
> +	depends on ARCH_ROCKCHIP_V8
> +	default y
> +	help
> +	  When deselected, barebox proper will run in EL3. This can be
> +	  useful for debugging early startup, but for all other cases,
> +	  say y here.
> +
>  config ARCH_RK3399_OPTEE
>  	bool "Build rk3399 OP-TEE binary into barebox"
> -	depends on ARCH_RK3399
> +	depends on ARCH_ROCKCHIP_ATF && ARCH_RK3399
>  	help
>  	  With this option enabled the RK3399 OP-TEE binary is compiled
>  	  into barebox and started along with the BL31 trusted firmware.
>  
>  config ARCH_RK3568_OPTEE
>  	bool "Build rk3568 OP-TEE binary into barebox"
> -	depends on ARCH_RK3568
> +	depends on ARCH_ROCKCHIP_ATF && ARCH_RK3568
>  	help
>  	  With this option enabled the RK3568 OP-TEE binary is compiled
>  	  into barebox and started along with the BL31 trusted firmware.
> diff --git a/arch/arm/mach-rockchip/Makefile b/arch/arm/mach-rockchip/Makefile
> index a86ee71617c8..2529af7c7e97 100644
> --- a/arch/arm/mach-rockchip/Makefile
> +++ b/arch/arm/mach-rockchip/Makefile
> @@ -1,7 +1,7 @@
>  # SPDX-License-Identifier: GPL-2.0-only
>  
>  obj-y += rockchip.o
> -pbl-$(CONFIG_ARCH_ROCKCHIP_V8) += atf.o
> +pbl-$(CONFIG_ARCH_ROCKCHIP_ATF) += atf.o
>  obj-$(CONFIG_ARCH_RK3188) += rk3188.o
>  obj-$(CONFIG_ARCH_RK3288) += rk3288.o
>  obj-pbl-$(CONFIG_ARCH_RK3568) += rk3568.o
> diff --git a/arch/arm/mach-rockchip/include/mach/atf.h b/arch/arm/mach-rockchip/include/mach/atf.h
> index d1bae5a7714f..e5d55af3d74a 100644
> --- a/arch/arm/mach-rockchip/include/mach/atf.h
> +++ b/arch/arm/mach-rockchip/include/mach/atf.h
> @@ -19,8 +19,13 @@
>  #define RK3568_BAREBOX_LOAD_ADDRESS	(RK3568_DRAM_BOTTOM + 1024*1024)
>  
>  #ifndef __ASSEMBLY__
> +#ifdef CONFIG_ARCH_ROCKCHIP_ATF
>  void rk3399_atf_load_bl31(void *fdt);
>  void rk3568_atf_load_bl31(void *fdt);
> +#else
> +static inline void rk3399_atf_load_bl31(void *fdt) { }
> +static inline void rk3568_atf_load_bl31(void *fdt) { }
> +#endif
>  #endif
>  
>  #endif /* __MACH_ATF_H */
> -- 
> 2.38.1
> 
> 
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-01-10 14:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-09 18:00 [PATCH] ARM: rockchip: make ATF installation optional Ahmad Fatoum
2023-01-10 14:37 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox