mbox series

[0/8] Add SCMI version of ST boards

Message ID 20220422150952.20587-1-alexandre.torgue@foss.st.com
Headers show
Series Add SCMI version of ST boards | expand

Message

Alexandre TORGUE April 22, 2022, 3:09 p.m. UTC
The aim of this series is to add OPTEE and SCMI support for STM32 boards in
order to enable secure services for clocks and resets. New boards have been added
to enable this support in order to not break boot of current STM32 boards users. 

This series targets only boards provided by ST which are:
-STM32MP157A-DK1
-STM32MP157C-DK2
-STM32MP157C-ED1
-STM32MP157C-EV1

Some modifications in bindings files (yaml and .h) was needed and OPTEE/TEE
configs are now enabled by default for ARCH_STM32 architecture.

Note that patch [1] "dt-bindings: rcc: Add optional external ethernet RX clock
properties" done by Marek has been already merged in Rob tree.

Thanks
Alex

Alexandre Torgue (7):
  dt-bindings: clock: stm32mp1: describes clocks if
    "st,stm32mp1-rcc-secure"
  dt-bindings: clock: stm32mp15: rename CK_SCMI define
  dt-bindings: reset: stm32mp15: rename RST_SCMI define
  ARM: stm32: select OPTEE on MPU family
  ARM: dts: stm32: enable optee firmware and SCMI support on STM32MP15
  dt-bindings: arm: stm32: Add SCMI version of STM32 boards
    (DK1/DK2/ED1/EV1)
  ARM: dts: stm32: Add SCMI version of STM32 boards (DK1/DK2/ED1/EV1)

Marek Vasut (1):
  dt-bindings: rcc: Add optional external ethernet RX clock properties

 .../devicetree/bindings/arm/stm32/stm32.yaml  |  17 +++
 .../bindings/clock/st,stm32mp1-rcc.yaml       |  34 ++++++
 arch/arm/boot/dts/Makefile                    |   4 +
 arch/arm/boot/dts/stm32mp151.dtsi             |  41 +++++++
 arch/arm/boot/dts/stm32mp157a-dk1-scmi.dts    |  86 +++++++++++++++
 arch/arm/boot/dts/stm32mp157c-dk2-scmi.dts    |  95 +++++++++++++++++
 arch/arm/boot/dts/stm32mp157c-ed1-scmi.dts    |  91 ++++++++++++++++
 arch/arm/boot/dts/stm32mp157c-ev1-scmi.dts    | 100 ++++++++++++++++++
 arch/arm/mach-stm32/Kconfig                   |   2 +
 include/dt-bindings/clock/stm32mp1-clks.h     |  46 ++++----
 include/dt-bindings/reset/stm32mp1-resets.h   |  24 ++---
 11 files changed, 503 insertions(+), 37 deletions(-)
 create mode 100644 arch/arm/boot/dts/stm32mp157a-dk1-scmi.dts
 create mode 100644 arch/arm/boot/dts/stm32mp157c-dk2-scmi.dts
 create mode 100644 arch/arm/boot/dts/stm32mp157c-ed1-scmi.dts
 create mode 100644 arch/arm/boot/dts/stm32mp157c-ev1-scmi.dts

Comments

Ahmad Fatoum April 22, 2022, 3:37 p.m. UTC | #1
Hello Alex,

On 22.04.22 17:09, Alexandre Torgue wrote:
> Select CONFIG_OPTEE for STM32MP15 and STM32MP13 by default. Final
> activation will done thanks to device tree.
> 
> Signed-off-by: Alexandre Torgue <alexandre.torgue@foss.st.com>
> 
> diff --git a/arch/arm/mach-stm32/Kconfig b/arch/arm/mach-stm32/Kconfig
> index 98145031586f..b322cf2a136f 100644
> --- a/arch/arm/mach-stm32/Kconfig
> +++ b/arch/arm/mach-stm32/Kconfig
> @@ -6,6 +6,8 @@ menuconfig ARCH_STM32
>  	select HAVE_ARM_ARCH_TIMER if ARCH_MULTI_V7
>  	select ARM_GIC if ARCH_MULTI_V7
>  	select ARM_PSCI if ARCH_MULTI_V7
> +	select TEE if ARCH_MULTI_V7
> +	select OPTEE if ARCH_MULTI_V7

Users may want to use OPTEE as a module without it being a SCMI provider
or not use OPTEE at all. I'd prefer you drop this patch and leave it
to users to configure their kernel appropriately.

Cheers,
Ahmad


>  	select ARM_AMBA
>  	select ARCH_HAS_RESET_CONTROLLER
>  	select CLKSRC_STM32
Alexandre TORGUE April 22, 2022, 4:23 p.m. UTC | #2
Hi Ahmad,

On 4/22/22 17:37, Ahmad Fatoum wrote:
> Hello Alex,
> 
> On 22.04.22 17:09, Alexandre Torgue wrote:
>> Select CONFIG_OPTEE for STM32MP15 and STM32MP13 by default. Final
>> activation will done thanks to device tree.
>>
>> Signed-off-by: Alexandre Torgue <alexandre.torgue@foss.st.com>
>>
>> diff --git a/arch/arm/mach-stm32/Kconfig b/arch/arm/mach-stm32/Kconfig
>> index 98145031586f..b322cf2a136f 100644
>> --- a/arch/arm/mach-stm32/Kconfig
>> +++ b/arch/arm/mach-stm32/Kconfig
>> @@ -6,6 +6,8 @@ menuconfig ARCH_STM32
>>   	select HAVE_ARM_ARCH_TIMER if ARCH_MULTI_V7
>>   	select ARM_GIC if ARCH_MULTI_V7
>>   	select ARM_PSCI if ARCH_MULTI_V7
>> +	select TEE if ARCH_MULTI_V7
>> +	select OPTEE if ARCH_MULTI_V7
> 
> Users may want to use OPTEE as a module without it being a SCMI provider
> or not use OPTEE at all. I'd prefer you drop this patch and leave it
> to users to configure their kernel appropriately.
> 

Yes, I can understand, I did this one too quickly forgetting that every 
multi_v7config users will inherit of this config.

thanks
Alex

> Cheers,
> Ahmad
> 
> 
>>   	select ARM_AMBA
>>   	select ARCH_HAS_RESET_CONTROLLER
>>   	select CLKSRC_STM32
> 
> 
> 
>
Marek Vasut April 22, 2022, 4:32 p.m. UTC | #3
On 4/22/22 17:09, Alexandre Torgue wrote:
> Enable optee and SCMI clocks/reset protocols support.
> 
> Signed-off-by: Alexandre Torgue <alexandre.torgue@foss.st.com>
> 
> diff --git a/arch/arm/boot/dts/stm32mp151.dtsi b/arch/arm/boot/dts/stm32mp151.dtsi
> index 7fdc324b3cf9..1b2fd3426a81 100644
> --- a/arch/arm/boot/dts/stm32mp151.dtsi
> +++ b/arch/arm/boot/dts/stm32mp151.dtsi
> @@ -115,6 +115,33 @@
>   		status = "disabled";
>   	};
>   
> +	firmware {
> +		optee: optee {
> +			compatible = "linaro,optee-tz";
> +			method = "smc";
> +			status = "disabled";
> +		};

Doesn't this TEE node get automatically generated and patched into DT by 
the TEE ? I think OpTee-OS does that.
Etienne CARRIERE April 25, 2022, 10:19 a.m. UTC | #4
Hello Marek,

> From: Marek Vasut <marex@denx.de>
> 
> > On 4/22/22 17:09, Alexandre Torgue wrote:
> > Enable optee and SCMI clocks/reset protocols support.
> > 
> > Signed-off-by: Alexandre Torgue <alexandre.torgue@foss.st.com>
> > 
> > diff --git a/arch/arm/boot/dts/stm32mp151.dtsi
> > b/arch/arm/boot/dts/stm32mp151.dtsi
> > index 7fdc324b3cf9..1b2fd3426a81 100644
> > --- a/arch/arm/boot/dts/stm32mp151.dtsi
> > +++ b/arch/arm/boot/dts/stm32mp151.dtsi
> > @@ -115,6 +115,33 @@
> >                status = "disabled";
> >        };
> >   
> > +     firmware {
> > +             optee: optee {
> > +                     compatible = "linaro,optee-tz";
> > +                     method = "smc";
> > +                     status = "disabled";
> > +             };
> 
> Doesn't this TEE node get automatically generated and patched into DT by 
> the TEE ? I think OpTee-OS does that.

OP-TEE OS does that if it gets passed the DT from early boot stage which is not always the case.

Etienne
Marek Vasut April 25, 2022, 10:25 a.m. UTC | #5
On 4/25/22 12:19, Etienne CARRIERE wrote:
> Hello Marek,

Hi,

>> From: Marek Vasut <marex@denx.de>
>>
>>> On 4/22/22 17:09, Alexandre Torgue wrote:
>>> Enable optee and SCMI clocks/reset protocols support.
>>>
>>> Signed-off-by: Alexandre Torgue <alexandre.torgue@foss.st.com>
>>>
>>> diff --git a/arch/arm/boot/dts/stm32mp151.dtsi
>>> b/arch/arm/boot/dts/stm32mp151.dtsi
>>> index 7fdc324b3cf9..1b2fd3426a81 100644
>>> --- a/arch/arm/boot/dts/stm32mp151.dtsi
>>> +++ b/arch/arm/boot/dts/stm32mp151.dtsi
>>> @@ -115,6 +115,33 @@
>>>                  status = "disabled";
>>>          };
>>>     
>>> +     firmware {
>>> +             optee: optee {
>>> +                     compatible = "linaro,optee-tz";
>>> +                     method = "smc";
>>> +                     status = "disabled";
>>> +             };
>>
>> Doesn't this TEE node get automatically generated and patched into DT by
>> the TEE ? I think OpTee-OS does that.
> 
> OP-TEE OS does that if it gets passed the DT from early boot stage which is not always the case.

Shouldn't that be something to fix ?

I think R-Car3 does that already.
Rouven Czerwinski April 25, 2022, 10:30 a.m. UTC | #6
Hi,

On Mon, 2022-04-25 at 12:25 +0200, Marek Vasut wrote:
> On 4/25/22 12:19, Etienne CARRIERE wrote:
> > Hello Marek,
> 
> Hi,
> 
> > > From: Marek Vasut <marex@denx.de>
> > > 
> > > > On 4/22/22 17:09, Alexandre Torgue wrote:
> > > > Enable optee and SCMI clocks/reset protocols support.
> > > > 
> > > > Signed-off-by: Alexandre Torgue <alexandre.torgue@foss.st.com>
> > > > 
> > > > diff --git a/arch/arm/boot/dts/stm32mp151.dtsi
> > > > b/arch/arm/boot/dts/stm32mp151.dtsi
> > > > index 7fdc324b3cf9..1b2fd3426a81 100644
> > > > --- a/arch/arm/boot/dts/stm32mp151.dtsi
> > > > +++ b/arch/arm/boot/dts/stm32mp151.dtsi
> > > > @@ -115,6 +115,33 @@
> > > >                  status = "disabled";
> > > >          };
> > > >     
> > > > +     firmware {
> > > > +             optee: optee {
> > > > +                     compatible = "linaro,optee-tz";
> > > > +                     method = "smc";
> > > > +                     status = "disabled";
> > > > +             };
> > > 
> > > Doesn't this TEE node get automatically generated and patched into DT by
> > > the TEE ? I think OpTee-OS does that.
> > 
> > OP-TEE OS does that if it gets passed the DT from early boot stage which is not always the case.
> 
> Shouldn't that be something to fix ?
> 
> I think R-Car3 does that already.

FWIW it's also possible for OP-TEE to generate a device tree overlay
which can be applied by later boot stages.

Drawback is that you either need an additional parameter to pass
between boot stages (address of the DT overlay) or it needs to be
hardcoded. Hardcoding has it's own bag of drawbacks, but it's what we
do for some i.MX6 platforms within barebox. However there is no TF-A
there, so only OP-TEE and Barebox need to agree on the fixed location
beforehand.

Best regards,
Rouven Czerwinski
Alexandre TORGUE May 3, 2022, 2:51 p.m. UTC | #7
On 4/22/22 17:09, Alexandre Torgue wrote:
> The aim of this series is to add OPTEE and SCMI support for STM32 boards in
> order to enable secure services for clocks and resets. New boards have been added
> to enable this support in order to not break boot of current STM32 boards users.
> 
> This series targets only boards provided by ST which are:
> -STM32MP157A-DK1
> -STM32MP157C-DK2
> -STM32MP157C-ED1
> -STM32MP157C-EV1
> 
> Some modifications in bindings files (yaml and .h) was needed and OPTEE/TEE
> configs are now enabled by default for ARCH_STM32 architecture.
> 
> Note that patch [1] "dt-bindings: rcc: Add optional external ethernet RX clock
> properties" done by Marek has been already merged in Rob tree.
> 
> Thanks
> Alex
> 
> Alexandre Torgue (7):
>    dt-bindings: clock: stm32mp1: describes clocks if
>      "st,stm32mp1-rcc-secure"
>    dt-bindings: clock: stm32mp15: rename CK_SCMI define
>    dt-bindings: reset: stm32mp15: rename RST_SCMI define
>    ARM: stm32: select OPTEE on MPU family
>    ARM: dts: stm32: enable optee firmware and SCMI support on STM32MP15
>    dt-bindings: arm: stm32: Add SCMI version of STM32 boards
>      (DK1/DK2/ED1/EV1)
>    ARM: dts: stm32: Add SCMI version of STM32 boards (DK1/DK2/ED1/EV1)
> 
> Marek Vasut (1):
>    dt-bindings: rcc: Add optional external ethernet RX clock properties
> 
>   .../devicetree/bindings/arm/stm32/stm32.yaml  |  17 +++
>   .../bindings/clock/st,stm32mp1-rcc.yaml       |  34 ++++++
>   arch/arm/boot/dts/Makefile                    |   4 +
>   arch/arm/boot/dts/stm32mp151.dtsi             |  41 +++++++
>   arch/arm/boot/dts/stm32mp157a-dk1-scmi.dts    |  86 +++++++++++++++
>   arch/arm/boot/dts/stm32mp157c-dk2-scmi.dts    |  95 +++++++++++++++++
>   arch/arm/boot/dts/stm32mp157c-ed1-scmi.dts    |  91 ++++++++++++++++
>   arch/arm/boot/dts/stm32mp157c-ev1-scmi.dts    | 100 ++++++++++++++++++
>   arch/arm/mach-stm32/Kconfig                   |   2 +
>   include/dt-bindings/clock/stm32mp1-clks.h     |  46 ++++----
>   include/dt-bindings/reset/stm32mp1-resets.h   |  24 ++---
>   11 files changed, 503 insertions(+), 37 deletions(-)
>   create mode 100644 arch/arm/boot/dts/stm32mp157a-dk1-scmi.dts
>   create mode 100644 arch/arm/boot/dts/stm32mp157c-dk2-scmi.dts
>   create mode 100644 arch/arm/boot/dts/stm32mp157c-ed1-scmi.dts
>   create mode 100644 arch/arm/boot/dts/stm32mp157c-ev1-scmi.dts
> 

Series applied on stm32-next. Patch[5] has been dropped.

Alex