On 2023/7/20 15:39, Alex Bee wrote:
Hi Kever,

Am 19.07.23 um 09:28 schrieb Kever Yang:
Hi Alex,


On 2023/7/18 22:57, Alex Bee wrote:
Currently the only ARM Rockchip SoC which is supported by upstream
optee-os is RK322x. For all other ARM SoCs a
vendor-provided OP-TEE binary has to be used to have a TEE available.
Those are using a calling convension different from upstream optee-os.

This introduces CONFIG_ROCKCHIP_OPTEE_BINARY which signals that any
of those vendor binaries is used and changes the calling convension
accordingly.

Signed-off-by: Alex Bee <knaerz...@gmail.com>
---
  arch/arm/mach-rockchip/Kconfig | 8 ++++++++
  common/spl/spl_optee.S         | 4 ++++
  2 files changed, 12 insertions(+)

diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig
index 17dd43155d..83d8a2a056 100644
--- a/arch/arm/mach-rockchip/Kconfig
+++ b/arch/arm/mach-rockchip/Kconfig
@@ -449,6 +449,14 @@ config ROCKCHIP_BOOT_MODE_REG
        The Soc will enter to different boot mode(defined in asm/arch-rockchip/boot_mode.h)
        according to the value from this register.
+config ROCKCHIP_OPTEE_BINARY
+    bool "Use a OP-TEE binary provided by Rockchip"
+    depends on SPL_OPTEE_IMAGE
+    default y if ROCKCHIP_RK3036 || ROCKCHIP_RK3128 || ROCKCHIP_RK3288

     This patch is not need for now.

     the  rk3036 works without OPTEE, and rk3288 is able to use ATF instead for OPTEE which upstreamed by Heiko.

Thanks for your review.

I'm aware of Heiko's ATF BL32 implemenation for RK3288. But what about RK3128/RK3036? They might wwork w/o RK OPTEE-binaries in regards of SMP bringup, but still you have no TEE.

You're right: It's not strictly required to have support for RK OPTEE-binaries, but also it doesn't hurt and it's fully optional to use it for those SoCs. Besides RK's TEE-implementations provide some more services via SMCC calls (DVFS for DRAM, for instance) which are not supported (yet) by upstream variants.
The mainline U-Boot is target to work with mainline kernel, so we don't need this patch for now.
I don't like the requirement of this patch either, but unfortunately the TEE binaries RK provides are built with wrong/incompatible flags.

The better way is to push Rockchip TEE to use the same parameter with mainline OP-TEE, I will sync with rockchip OPTEE owner, and I would like this patch stay out of tree for now.


Thanks,

- Kever


Regards,
Alex

Thanks,

- Kever

+    help
+      This option enables the usage of vendor-provided OP-TEE binaries.
+      Say Y if you are using OP-TEE binary provided by Rockchip.
+
  config ROCKCHIP_RK8XX_DISABLE_BOOT_ON_POWERON
      bool "Disable device boot on power plug-in"
      depends on PMIC_RK8XX
diff --git a/common/spl/spl_optee.S b/common/spl/spl_optee.S
index a269904d38..ea41d8adb6 100644
--- a/common/spl/spl_optee.S
+++ b/common/spl/spl_optee.S
@@ -7,6 +7,10 @@
  #include <asm/assembler.h>
  ENTRY(spl_optee_entry)
+#ifdef CONFIG_ROCKCHIP_OPTEE_BINARY
+    ldr r1, =CONFIG_TEXT_BASE
+#else
      ldr lr, =CONFIG_TEXT_BASE
+#endif
      mov pc, r3
  ENDPROC(spl_optee_entry)

Reply via email to