[PATCH 2/5] arm: stm32mp: handle the OP-TEE nodes in DT with FIP support

Patrice CHOTARD patrice.chotard at foss.st.com
Fri Jul 9 14:42:03 CEST 2021


Hi Patrick

On 7/8/21 11:17 AM, Patrick Delaunay wrote:
> With FIP support in TF-A (when CONFIG_STM32MP15x_STM32IMAGE
> is not activated), the DT nodes needed by OP-TEE are added by OP-TEE
> firmware in U-Boot device tree, present in FIP.
> 
> These nodes are only required in trusted boot, when TF-A load the file
> u-boot.stm32, including the U-Boot device tree with STM32IMAGE header,
> in this case OP-TEE can't update the U-Boot device tree.
> 
> Moreover in trusted boot mode with FIP, as the OP-TEE nodes are present
> in U-Boot device tree only when needed the function
> stm32_fdt_disable_optee can be removed.
> 
> Signed-off-by: Patrick Delaunay <patrick.delaunay at foss.st.com>
> ---
> 
>  arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi |  3 +++
>  arch/arm/dts/stm32mp157c-ed1-u-boot.dtsi |  3 +++
>  arch/arm/mach-stm32mp/fdt.c              | 11 ++++++++++-
>  3 files changed, 16 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi b/arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi
> index 6787619290..49305979bb 100644
> --- a/arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi
> +++ b/arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi
> @@ -22,6 +22,8 @@
>  		st,stm32prog-gpios = <&gpioa 14 GPIO_ACTIVE_LOW>;
>  	};
>  
> +#ifdef CONFIG_STM32MP15x_STM32IMAGE
> +	/* only needed for boot with TF-A, witout FIP support */
>  	firmware {
>  		optee {
>  			compatible = "linaro,optee-tz";
> @@ -35,6 +37,7 @@
>  			no-map;
>  		};
>  	};
> +#endif
>  
>  	led {
>  		red {
> diff --git a/arch/arm/dts/stm32mp157c-ed1-u-boot.dtsi b/arch/arm/dts/stm32mp157c-ed1-u-boot.dtsi
> index f3002e995b..956332ea9a 100644
> --- a/arch/arm/dts/stm32mp157c-ed1-u-boot.dtsi
> +++ b/arch/arm/dts/stm32mp157c-ed1-u-boot.dtsi
> @@ -22,6 +22,8 @@
>  		st,stm32prog-gpios = <&gpioa 14 GPIO_ACTIVE_LOW>;
>  	};
>  
> +#ifdef CONFIG_STM32MP15x_STM32IMAGE
> +	/* only needed for boot with TF-A, witout FIP support */
>  	firmware {
>  		optee {
>  			compatible = "linaro,optee-tz";
> @@ -35,6 +37,7 @@
>  			no-map;
>  		};
>  	};
> +#endif
>  
>  	led {
>  		red {
> diff --git a/arch/arm/mach-stm32mp/fdt.c b/arch/arm/mach-stm32mp/fdt.c
> index ce2fe0206f..a19e954cf7 100644
> --- a/arch/arm/mach-stm32mp/fdt.c
> +++ b/arch/arm/mach-stm32mp/fdt.c
> @@ -332,7 +332,16 @@ int ft_system_setup(void *blob, struct bd_info *bd)
>  				       "st,package", pkg, false);
>  	}
>  
> -	if (!CONFIG_IS_ENABLED(OPTEE) ||
> +	/*
> +	 * TEMP: remove OP-TEE nodes in kernel device tree
> +	 *       copied from U-Boot device tree by optee_copy_fdt_nodes
> +	 *       when OP-TEE is not detected (probe failed)
> +	 * these OP-TEE nodes are present in <board>-u-boot.dtsi
> +	 * under CONFIG_STM32MP15x_STM32IMAGE only for compatibility
> +	 * when FIP is not used by TF-A
> +	 */
> +	if (CONFIG_IS_ENABLED(STM32MP15x_STM32IMAGE) &&
> +	    CONFIG_IS_ENABLED(OPTEE) &&
>  	    !tee_find_device(NULL, NULL, NULL, NULL))
>  		stm32_fdt_disable_optee(blob);
>  
> 

Reviewed-by: Patrice Chotard <patrice.chotard at foss.st.com>

Thanks
Patrice


More information about the U-Boot mailing list