[1/6] boot/arm-trusted-firmware: support 32bit Arm targets

Message ID 7f15bfd5388e2171b13b44722b84149d9f361551.1551866509.git.etienne.carriere@linaro.org
State Superseded
Headers show
Series
  • [1/6] boot/arm-trusted-firmware: support 32bit Arm targets
Related show

Commit Message

Etienne Carriere March 6, 2019, 10:11 a.m.
This change allows one to build the TF-A (Trusted Firmware A) for
32bit Armv7 and Armv8 platforms which arm-trusted-firmware supports
since release v1.5.

BR2_aarch64 is changed to BR2_ARM_CPU_ARMV8A as the later complemented
by BR2_ARM_CPU_ARMV7A better represents to architectures that can
support Arm Trusted Firmware A.

When BR2_arm is enabled, TF-A is built in Aarch32 mode.
Selection between Armv8-A (default) and Armv7-A (ARM_ARCH_MAJOR=7) is
expected from BR2_TARGET_ARM_TRUSTED_FIRMWARE_ADDITIONAL_VARIABLES.

Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
---
 boot/arm-trusted-firmware/Config.in               | 3 ++-
 boot/arm-trusted-firmware/arm-trusted-firmware.mk | 4 ++++
 2 files changed, 6 insertions(+), 1 deletion(-)

Comments

Etienne Carriere March 7, 2019, 7:43 a.m. | #1
Hello Ricardo,

Sorry for pollution through this series. I think you may be interested
only with the last commit of it:
http://lists.busybox.net/pipermail/buildroot/2019-March/244400.html

Regards,
etienne

On Wed, 6 Mar 2019 at 11:11, Etienne Carriere
<etienne.carriere@linaro.org> wrote:
>
> This change allows one to build the TF-A (Trusted Firmware A) for
> 32bit Armv7 and Armv8 platforms which arm-trusted-firmware supports
> since release v1.5.
>
> BR2_aarch64 is changed to BR2_ARM_CPU_ARMV8A as the later complemented
> by BR2_ARM_CPU_ARMV7A better represents to architectures that can
> support Arm Trusted Firmware A.
>
> When BR2_arm is enabled, TF-A is built in Aarch32 mode.
> Selection between Armv8-A (default) and Armv7-A (ARM_ARCH_MAJOR=7) is
> expected from BR2_TARGET_ARM_TRUSTED_FIRMWARE_ADDITIONAL_VARIABLES.
>
> Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
> ---
>  boot/arm-trusted-firmware/Config.in               | 3 ++-
>  boot/arm-trusted-firmware/arm-trusted-firmware.mk | 4 ++++
>  2 files changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/boot/arm-trusted-firmware/Config.in b/boot/arm-trusted-firmware/Config.in
> index 823a351..428a4ce 100644
> --- a/boot/arm-trusted-firmware/Config.in
> +++ b/boot/arm-trusted-firmware/Config.in
> @@ -1,6 +1,7 @@
>  config BR2_TARGET_ARM_TRUSTED_FIRMWARE
>         bool "ARM Trusted Firmware (ATF)"
> -       depends on BR2_aarch64 && BR2_TARGET_UBOOT
> +       depends on (BR2_ARM_CPU_ARMV8A || BR2_ARM_CPU_ARMV7A) && \
> +                  BR2_TARGET_UBOOT
>         help
>           Enable this option if you want to build the ATF for your ARM
>           based embedded device.
> diff --git a/boot/arm-trusted-firmware/arm-trusted-firmware.mk b/boot/arm-trusted-firmware/arm-trusted-firmware.mk
> index 8ca3864..3e8df1d 100644
> --- a/boot/arm-trusted-firmware/arm-trusted-firmware.mk
> +++ b/boot/arm-trusted-firmware/arm-trusted-firmware.mk
> @@ -35,6 +35,10 @@ ARM_TRUSTED_FIRMWARE_MAKE_OPTS += \
>         $(call qstrip,$(BR2_TARGET_ARM_TRUSTED_FIRMWARE_ADDITIONAL_VARIABLES)) \
>         PLAT=$(ARM_TRUSTED_FIRMWARE_PLATFORM)
>
> +ifeq ($(BR2_arm),y)
> +ARM_TRUSTED_FIRMWARE_MAKE_OPTS += ARCH=aarch32
> +endif
> +
>  ifeq ($(BR2_TARGET_ARM_TRUSTED_FIRMWARE_UBOOT_AS_BL33),y)
>  ARM_TRUSTED_FIRMWARE_MAKE_OPTS += BL33=$(BINARIES_DIR)/u-boot.bin
>  ARM_TRUSTED_FIRMWARE_DEPENDENCIES += uboot
> --
> 1.9.1
>
Thomas Petazzoni March 14, 2019, 10:24 p.m. | #2
Hello,

On Wed,  6 Mar 2019 11:11:35 +0100
Etienne Carriere <etienne.carriere@linaro.org> wrote:

> This change allows one to build the TF-A (Trusted Firmware A) for
> 32bit Armv7 and Armv8 platforms which arm-trusted-firmware supports
> since release v1.5.
> 
> BR2_aarch64 is changed to BR2_ARM_CPU_ARMV8A as the later complemented
> by BR2_ARM_CPU_ARMV7A better represents to architectures that can
> support Arm Trusted Firmware A.
> 
> When BR2_arm is enabled, TF-A is built in Aarch32 mode.
> Selection between Armv8-A (default) and Armv7-A (ARM_ARCH_MAJOR=7) is
> expected from BR2_TARGET_ARM_TRUSTED_FIRMWARE_ADDITIONAL_VARIABLES.

It seems a bit annoying to require passing ARM_ARCH_MAJOR=7 in those
additional variable. Why don't we do it automatically in
arm-trusted-firmware.mk. We have all the knowledge required, no?

> +ifeq ($(BR2_arm),y)
> +ARM_TRUSTED_FIRMWARE_MAKE_OPTS += ARCH=aarch32

Can we do:

ifeq ($(BR2_arm),y)
ARM_TRUSTED_FIRMWARE_MAKE_OPTS += ARCH=aarch32 ARM_ARCH_MAJOR=7
else
ARM_TRUSTED_FIRMWARE_MAKE_OPTS += ARCH=aarch64 ARM_ARCH_MAJOR=8
endif

for example ?

Thomas
Etienne Carriere March 15, 2019, 9 a.m. | #3
On Thu, 14 Mar 2019 at 23:24, Thomas Petazzoni
<thomas.petazzoni@bootlin.com> wrote:
>
> Hello,
>
> On Wed,  6 Mar 2019 11:11:35 +0100
> Etienne Carriere <etienne.carriere@linaro.org> wrote:
>
> > This change allows one to build the TF-A (Trusted Firmware A) for
> > 32bit Armv7 and Armv8 platforms which arm-trusted-firmware supports
> > since release v1.5.
> >
> > BR2_aarch64 is changed to BR2_ARM_CPU_ARMV8A as the later complemented
> > by BR2_ARM_CPU_ARMV7A better represents to architectures that can
> > support Arm Trusted Firmware A.
> >
> > When BR2_arm is enabled, TF-A is built in Aarch32 mode.
> > Selection between Armv8-A (default) and Armv7-A (ARM_ARCH_MAJOR=7) is
> > expected from BR2_TARGET_ARM_TRUSTED_FIRMWARE_ADDITIONAL_VARIABLES.
>
> It seems a bit annoying to require passing ARM_ARCH_MAJOR=7 in those
> additional variable. Why don't we do it automatically in
> arm-trusted-firmware.mk. We have all the knowledge required, no?
>
> > +ifeq ($(BR2_arm),y)
> > +ARM_TRUSTED_FIRMWARE_MAKE_OPTS += ARCH=aarch32
>
> Can we do:
>
> ifeq ($(BR2_arm),y)
> ARM_TRUSTED_FIRMWARE_MAKE_OPTS += ARCH=aarch32 ARM_ARCH_MAJOR=7
> else
> ARM_TRUSTED_FIRMWARE_MAKE_OPTS += ARCH=aarch64 ARM_ARCH_MAJOR=8
> endif
>
> for example ?

Well... I guess yes. Until there comes Aarch32 Armv8-A platforms.
So, yes, you're right. Your change will relax ARM_ARCH_MAJOR from
..._ADDITIONAL_VARIABLES.

regards,
etienne

>
> Thomas
> --
> Thomas Petazzoni, CTO, Bootlin
> Embedded Linux and Kernel engineering
> https://bootlin.com
Etienne Carriere March 18, 2019, 7:22 a.m. | #4
Hello Thomas and all,

Below an alternate proposal

On Fri, 15 Mar 2019 at 10:00, Etienne Carriere
<etienne.carriere@linaro.org> wrote:
>
> On Thu, 14 Mar 2019 at 23:24, Thomas Petazzoni
> <thomas.petazzoni@bootlin.com> wrote:
> >
> > Hello,
> >
> > On Wed,  6 Mar 2019 11:11:35 +0100
> > Etienne Carriere <etienne.carriere@linaro.org> wrote:
> >
> > > This change allows one to build the TF-A (Trusted Firmware A) for
> > > 32bit Armv7 and Armv8 platforms which arm-trusted-firmware supports
> > > since release v1.5.
> > >
> > > BR2_aarch64 is changed to BR2_ARM_CPU_ARMV8A as the later complemented
> > > by BR2_ARM_CPU_ARMV7A better represents to architectures that can
> > > support Arm Trusted Firmware A.
> > >
> > > When BR2_arm is enabled, TF-A is built in Aarch32 mode.
> > > Selection between Armv8-A (default) and Armv7-A (ARM_ARCH_MAJOR=7) is
> > > expected from BR2_TARGET_ARM_TRUSTED_FIRMWARE_ADDITIONAL_VARIABLES.
> >
> > It seems a bit annoying to require passing ARM_ARCH_MAJOR=7 in those
> > additional variable. Why don't we do it automatically in
> > arm-trusted-firmware.mk. We have all the knowledge required, no?
> >
> > > +ifeq ($(BR2_arm),y)
> > > +ARM_TRUSTED_FIRMWARE_MAKE_OPTS += ARCH=aarch32
> >
> > Can we do:
> >
> > ifeq ($(BR2_arm),y)
> > ARM_TRUSTED_FIRMWARE_MAKE_OPTS += ARCH=aarch32 ARM_ARCH_MAJOR=7
> > else
> > ARM_TRUSTED_FIRMWARE_MAKE_OPTS += ARCH=aarch64 ARM_ARCH_MAJOR=8
> > endif
> >
> > for example ?
>
> Well... I guess yes. Until there comes Aarch32 Armv8-A platforms.
> So, yes, you're right. Your change will relax ARM_ARCH_MAJOR from
> ..._ADDITIONAL_VARIABLES.
>

Below will better reflect the configuration:

ifeq ($(BR2_ARM_CPU_ARMV7A),y)
ARM_TRUSTED_FIRMWARE_MAKE_OPTS += ARM_ARCH_MAJOR=7
else ifeq ($(BR2_ARM_CPU_ARMV8A),y)
ARM_TRUSTED_FIRMWARE_MAKE_OPTS += ARM_ARCH_MAJOR=8
endif

ifeq ($(BR2_arm),y)
ARM_TRUSTED_FIRMWARE_MAKE_OPTS += ARCH=aarch32
else ifeq ($(BR2_aarch64),y)
ARM_TRUSTED_FIRMWARE_MAKE_OPTS += ARCH=aarch64
endif

I will push a PATCH v3 with updates in the later commits of the series.
Thanks.

regards,
etienne


> regards,
> etienne
>
> >
> > Thomas
> > --
> > Thomas Petazzoni, CTO, Bootlin
> > Embedded Linux and Kernel engineering
> > https://bootlin.com
Etienne Carriere March 19, 2019, 6:50 a.m. | #5
Dear all,

On Mon, 18 Mar 2019 at 08:22, Etienne Carriere
<etienne.carriere@linaro.org> wrote:
>
> Hello Thomas and all,
>
> Below an alternate proposal
>
> On Fri, 15 Mar 2019 at 10:00, Etienne Carriere
> <etienne.carriere@linaro.org> wrote:
> >
> > On Thu, 14 Mar 2019 at 23:24, Thomas Petazzoni
> > <thomas.petazzoni@bootlin.com> wrote:
> > >
> > > Hello,
> > >
> > > On Wed,  6 Mar 2019 11:11:35 +0100
> > > Etienne Carriere <etienne.carriere@linaro.org> wrote:
> > >
> > > > This change allows one to build the TF-A (Trusted Firmware A) for
> > > > 32bit Armv7 and Armv8 platforms which arm-trusted-firmware supports
> > > > since release v1.5.
> > > >
> > > > BR2_aarch64 is changed to BR2_ARM_CPU_ARMV8A as the later complemented
> > > > by BR2_ARM_CPU_ARMV7A better represents to architectures that can
> > > > support Arm Trusted Firmware A.
> > > >
> > > > When BR2_arm is enabled, TF-A is built in Aarch32 mode.
> > > > Selection between Armv8-A (default) and Armv7-A (ARM_ARCH_MAJOR=7) is
> > > > expected from BR2_TARGET_ARM_TRUSTED_FIRMWARE_ADDITIONAL_VARIABLES.
> > >
> > > It seems a bit annoying to require passing ARM_ARCH_MAJOR=7 in those
> > > additional variable. Why don't we do it automatically in
> > > arm-trusted-firmware.mk. We have all the knowledge required, no?
> > >
> > > > +ifeq ($(BR2_arm),y)
> > > > +ARM_TRUSTED_FIRMWARE_MAKE_OPTS += ARCH=aarch32
> > >
> > > Can we do:
> > >
> > > ifeq ($(BR2_arm),y)
> > > ARM_TRUSTED_FIRMWARE_MAKE_OPTS += ARCH=aarch32 ARM_ARCH_MAJOR=7
> > > else
> > > ARM_TRUSTED_FIRMWARE_MAKE_OPTS += ARCH=aarch64 ARM_ARCH_MAJOR=8
> > > endif
> > >
> > > for example ?
> >
> > Well... I guess yes. Until there comes Aarch32 Armv8-A platforms.
> > So, yes, you're right. Your change will relax ARM_ARCH_MAJOR from
> > ..._ADDITIONAL_VARIABLES.
> >
>
> Below will better reflect the configuration:
>
> ifeq ($(BR2_ARM_CPU_ARMV7A),y)
> ARM_TRUSTED_FIRMWARE_MAKE_OPTS += ARM_ARCH_MAJOR=7
> else ifeq ($(BR2_ARM_CPU_ARMV8A),y)
> ARM_TRUSTED_FIRMWARE_MAKE_OPTS += ARM_ARCH_MAJOR=8
> endif
>
> ifeq ($(BR2_arm),y)
> ARM_TRUSTED_FIRMWARE_MAKE_OPTS += ARCH=aarch32
> else ifeq ($(BR2_aarch64),y)
> ARM_TRUSTED_FIRMWARE_MAKE_OPTS += ARCH=aarch64
> endif
>
> I will push a PATCH v3 with updates in the later commits of the series.
> Thanks.

Please see PATCH v2 at http://patchwork.ozlabs.org/patch/1058134/

regards,
etienne

>
> regards,
> etienne
>
>
> > regards,
> > etienne
> >
> > >
> > > Thomas
> > > --
> > > Thomas Petazzoni, CTO, Bootlin
> > > Embedded Linux and Kernel engineering
> > > https://bootlin.com

Patch

diff --git a/boot/arm-trusted-firmware/Config.in b/boot/arm-trusted-firmware/Config.in
index 823a351..428a4ce 100644
--- a/boot/arm-trusted-firmware/Config.in
+++ b/boot/arm-trusted-firmware/Config.in
@@ -1,6 +1,7 @@ 
 config BR2_TARGET_ARM_TRUSTED_FIRMWARE
 	bool "ARM Trusted Firmware (ATF)"
-	depends on BR2_aarch64 && BR2_TARGET_UBOOT
+	depends on (BR2_ARM_CPU_ARMV8A || BR2_ARM_CPU_ARMV7A) && \
+		   BR2_TARGET_UBOOT
 	help
 	  Enable this option if you want to build the ATF for your ARM
 	  based embedded device.
diff --git a/boot/arm-trusted-firmware/arm-trusted-firmware.mk b/boot/arm-trusted-firmware/arm-trusted-firmware.mk
index 8ca3864..3e8df1d 100644
--- a/boot/arm-trusted-firmware/arm-trusted-firmware.mk
+++ b/boot/arm-trusted-firmware/arm-trusted-firmware.mk
@@ -35,6 +35,10 @@  ARM_TRUSTED_FIRMWARE_MAKE_OPTS += \
 	$(call qstrip,$(BR2_TARGET_ARM_TRUSTED_FIRMWARE_ADDITIONAL_VARIABLES)) \
 	PLAT=$(ARM_TRUSTED_FIRMWARE_PLATFORM)
 
+ifeq ($(BR2_arm),y)
+ARM_TRUSTED_FIRMWARE_MAKE_OPTS += ARCH=aarch32
+endif
+
 ifeq ($(BR2_TARGET_ARM_TRUSTED_FIRMWARE_UBOOT_AS_BL33),y)
 ARM_TRUSTED_FIRMWARE_MAKE_OPTS += BL33=$(BINARIES_DIR)/u-boot.bin
 ARM_TRUSTED_FIRMWARE_DEPENDENCIES += uboot