2022-08-04 17:28:21

by Dmitry Rokosov

[permalink] [raw]
Subject: [PATCH v1] arm64: dts: meson-axg: reserve memory region for Amlogic TrustOS

For the all AXG SoC based boards, which run Amlogic vendor ATF and
TrustOS this memory region 0x5300000-0x6300000 is reserved by BL32,
so tag it as no-map in the kernel iomem.

Signed-off-by: Dmitry Rokosov <[email protected]>
---
arch/arm64/boot/dts/amlogic/meson-axg.dtsi | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/arch/arm64/boot/dts/amlogic/meson-axg.dtsi b/arch/arm64/boot/dts/amlogic/meson-axg.dtsi
index 3f5254eeb47b..1fa0d3805969 100644
--- a/arch/arm64/boot/dts/amlogic/meson-axg.dtsi
+++ b/arch/arm64/boot/dts/amlogic/meson-axg.dtsi
@@ -142,6 +142,12 @@ secmon_reserved: secmon@5000000 {
reg = <0x0 0x05000000 0x0 0x300000>;
no-map;
};
+
+ /* 16 MiB reserved for Amlogic Trust OS (BL32) */
+ secos_reserved: secos@5300000 {
+ reg = <0x0 0x05300000 0x0 0x1000000>;
+ no-map;
+ };
};

scpi {
--
2.36.0


2022-08-05 08:46:37

by Jerome Brunet

[permalink] [raw]
Subject: Re: [PATCH v1] arm64: dts: meson-axg: reserve memory region for Amlogic TrustOS


On Thu 04 Aug 2022 at 16:52, Dmitry Rokosov <[email protected]> wrote:

> For the all AXG SoC based boards, which run Amlogic vendor ATF and
> TrustOS this memory region 0x5300000-0x6300000 is reserved by BL32,
> so tag it as no-map in the kernel iomem.

This may be true for the boards you have seen so far but not all ship
with this specific AML TEE. Some don't have TEE at all, other may have
different TEE regions.

16 MB may be a significant part of the available memory on some AXG
devices. Reserving that memory on all AXG devices, regardless of what is
actually running does not seem appropriate.

I know the same has been done for other devices but I don't think we should
continue to do so. This should be set either
* per device if it is fixed
* dynamically by the bootloader depending on the ATF (which is probably better)

>
> Signed-off-by: Dmitry Rokosov <[email protected]>
> ---
> arch/arm64/boot/dts/amlogic/meson-axg.dtsi | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/arch/arm64/boot/dts/amlogic/meson-axg.dtsi b/arch/arm64/boot/dts/amlogic/meson-axg.dtsi
> index 3f5254eeb47b..1fa0d3805969 100644
> --- a/arch/arm64/boot/dts/amlogic/meson-axg.dtsi
> +++ b/arch/arm64/boot/dts/amlogic/meson-axg.dtsi
> @@ -142,6 +142,12 @@ secmon_reserved: secmon@5000000 {
> reg = <0x0 0x05000000 0x0 0x300000>;
> no-map;
> };
> +
> + /* 16 MiB reserved for Amlogic Trust OS (BL32) */
> + secos_reserved: secos@5300000 {
> + reg = <0x0 0x05300000 0x0 0x1000000>;
> + no-map;
> + };
> };
>
> scpi {


2022-08-05 13:55:14

by Dmitry Rokosov

[permalink] [raw]
Subject: Re: [PATCH v1] arm64: dts: meson-axg: reserve memory region for Amlogic TrustOS

Hello Jerome,

Thank you for the feedback.

On Fri, Aug 05, 2022 at 10:03:34AM +0200, Jerome Brunet wrote:
>
> On Thu 04 Aug 2022 at 16:52, Dmitry Rokosov <[email protected]> wrote:
>
> > For the all AXG SoC based boards, which run Amlogic vendor ATF and
> > TrustOS this memory region 0x5300000-0x6300000 is reserved by BL32,
> > so tag it as no-map in the kernel iomem.
>
> This may be true for the boards you have seen so far but not all ship
> with this specific AML TEE. Some don't have TEE at all, other may have
> different TEE regions.
>
> 16 MB may be a significant part of the available memory on some AXG
> devices. Reserving that memory on all AXG devices, regardless of what is
> actually running does not seem appropriate.
>
> I know the same has been done for other devices but I don't think we should
> continue to do so. This should be set either
> * per device if it is fixed
> * dynamically by the bootloader depending on the ATF (which is probably better)
>

I agree with you, *.dtsi is a common device tree base file which is
included in the all board trees. But looks like I don't understand meson
dtsi policy about TEE reserved memory regions. I mean g12 and gx dtsi
have statically defined TrustOS regions inside, and all meson dtsi have
hardcoded ATF regions. All of these regions are aligned with Amlogic ATF
and Amlogic Trust OS reserved memory addresses. And if I want to use
upstream ATF or optee build for Amlogic board, I need to patch dtsi file,
which is not right way as you mentioned.

If we want to use per-board TEE memory regions definitions I suppose we
need to move secos reserved ranges from gx and g12 dtsi files and move
all secmon definitions from all meson dtsi files to appropriate board
dtses (or mark them with status = "disable").

What do you think?

> >
> > Signed-off-by: Dmitry Rokosov <[email protected]>
> > ---
> > arch/arm64/boot/dts/amlogic/meson-axg.dtsi | 6 ++++++
> > 1 file changed, 6 insertions(+)
> >
> > diff --git a/arch/arm64/boot/dts/amlogic/meson-axg.dtsi b/arch/arm64/boot/dts/amlogic/meson-axg.dtsi
> > index 3f5254eeb47b..1fa0d3805969 100644
> > --- a/arch/arm64/boot/dts/amlogic/meson-axg.dtsi
> > +++ b/arch/arm64/boot/dts/amlogic/meson-axg.dtsi
> > @@ -142,6 +142,12 @@ secmon_reserved: secmon@5000000 {
> > reg = <0x0 0x05000000 0x0 0x300000>;
> > no-map;
> > };
> > +
> > + /* 16 MiB reserved for Amlogic Trust OS (BL32) */
> > + secos_reserved: secos@5300000 {
> > + reg = <0x0 0x05300000 0x0 0x1000000>;
> > + no-map;
> > + };
> > };
> >
> > scpi {
>

--
Thank you,
Dmitry