Skip to contentSkip to conversation

arch/arm: properly handle ARM processors with optional VFP units (branch yem/arm-vfp-2)

PATCH New Yann E. MORIN 2 participants 7 messages Dec 26, 2015 – Dec 27, 2015

lore
Share & tools
lore
#0 lore raw

v2 cover arch/arm: properly handle ARM processors with optional VFP units (branch yem/arm-vfp-2)

Hello All!

Certain ARM SoCs are not guaranteed to have a VFP. For example, on Cortex-A9, the availability of a VFP is optional. Such ARM processors select one of the BR2_ARM_CPU_MAYBE_HAS_VFPVx options to indicate the potential availability of such FPUs.

Then, Config.in.arm provides a "choice" that allows to select which floating point strategy to use. VFPv3 is provided as a possible strategy when either the VFPv3 is guaranteed to be available (BR2_ARM_CPU_HAS_VFPV3) or when it *might* be available (BR2_ARM_CPU_MAYBE_HAS_VFPV3).

The problem is that once a given floating point strategy has been selected, the BR2_ARM_CPU_HAS_VFPx symbol does not get enabled, even if the selected floating point strategy clearly indicates that this given VFP version is available.

Taking again the example of Cortex-A9, if you select the VFPv3 strategy, then BR2_ARM_CPU_HAS_VFPV2 and BR2_ARM_CPU_HAS_VFPV3 still remain disabled.

Due to this, packages that use the BR2_ARM_CPU_HAS_VFPVx symbols (currently ffmpeg, gstreamer1, mpg123 and nodejs) do not realize that the processor has a VFP.

To solve this, we add a new boolean option that the user may enable to confirm whether the CPU actually has a VFP unit, like we already have for the NEON extension case.

So, you end up with up to five things to choose:

- The processor core, which defines if a VFP is available or might be available

- The availibilty of the NEON extension.

- The availability of the VFP unit, in case the selection of the processor core doesn't allow to know if a VFP is available or not. This new configuration option will select the appropriate BR2_ARM_CPU_HAS_VFPVx symbols so that packages looking at such symbols will find the right values.

- The ABI to use, EABI of EABIhf, depending on whether the CPU does have a VFP unit or not.

- The chosen floating point strategy.

(This intro is basically what Thomas wrote in his proposal [0], adapted to this new series.)

Changes v1 -> v2:
- squash the additional choice into a single boolean
- reorder the NEON option
- only show EABIhf when a VFP unit is present
- only show VFP strategies when a VFP unit is present
- only show the Arago external toolchain when a VFP unit is present

Regards,
Yann E. MORIN.

The following changes since commit 3068555c47c15afb62988d35e5e148dc691c6eb9:

python-ipaddress: new package (2015-12-25 19:48:22 +0100)

are available in the git repository at:

git://git.busybox.net/~ymorin/git/buildroot yem/arm-vfp-2

for you to fetch changes up to 3b91070c5e3b2bd39c1c263f8b9dd3733a03e409:

toolchain/external: Arago armv7 toolchain really requires a VFPv3 (2015-12-26 16:54:03 +0100)

----------------------------------------------------------------
Yann E. MORIN (5):
arch/arm: reorder NEON option
arch/arm: add option to enable an optional VFP unit arch/arm: only expose EABIhf when the CPU *has* a VFP unit arch/arm: only expose VFP in FP strategy when the CPU *has* a VFP unit toolchain/external: Arago armv7 toolchain really requires a VFPv3

 arch/Config.in.arm                     | 39 ++++++++++++++++++++--------------
 toolchain/toolchain-external/Config.in |  2 +-
 2 files changed, 24 insertions(+), 17 deletions(-)
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#1 lore raw

PATCH v2 1/5 arch/arm: reorder NEON option

Stating whether to use the NEON extensions when it is optional in the CPU really is completing the definition of the CPU we've just selected.

Move the ENABLE_NEON option just after the choice of the CPU variant, and before any "software" option (ABI/VFP).

This will make sense in a moment, when we introduce a similar option for enabling an optional VFP unit.

Cc Thomas Petazzoni <[email protected]>
---
 arch/Config.in.arm | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)
arch/Config.in.arm +9 -9
index 67ff384..feac16d 100644
@@ -185,6 +185,15 @@ config BR2_iwmmxt
 	select BR2_ARCH_HAS_MMU_OPTIONAL
 endchoice
 
+config BR2_ARM_ENABLE_NEON
+	bool "Enable NEON SIMD extension support"
+	depends on BR2_ARM_CPU_MAYBE_HAS_NEON
+	select BR2_ARM_CPU_HAS_NEON
+	help
+	  For some CPU cores, the NEON SIMD extension is optional.
+	  Select this option if you are certain your particular
+	  implementation has NEON support and you want to use it.
+
 choice
 	prompt "Target ABI"
 	depends on BR2_arm || BR2_armeb
@@ -240,15 +249,6 @@ config BR2_ARM_EABIHF
 
 endchoice
 
-config BR2_ARM_ENABLE_NEON
-	bool "Enable NEON SIMD extension support"
-	depends on BR2_ARM_CPU_MAYBE_HAS_NEON
-	select BR2_ARM_CPU_HAS_NEON
-	help
-	  For some CPU cores, the NEON SIMD extension is optional.
-	  Select this option if you are certain your particular
-	  implementation has NEON support and you want to use it.
-
 choice
 	prompt "Floating point strategy"
 	depends on BR2_ARM_EABI || BR2_ARM_EABIHF
Signature · 1 line
1.9.1
#2 lore raw

PATCH v2 2/5 arch/arm: add option to enable an optional VFP unit

In reply to Yann E. MORIN

Currently, the VFP selection for ARM is a little bit muddy:
- some CPUs definitely do not have a VFP or NEON,
- some CPUs definitely do have a VFP or NEON,
- some CPUs may have a VFP or NEON.

However, we currently conflate the availability of the VFP/NEON with the possibility to use them. Even is the user chooses a floating point strategy with a 'lower' solution (i.e. VFPv2 when a VFPv3 exists, or not using NEON when the CPU has it), some packages are still using the CPU-defined HW availaibility rather thean the usr's selection.

Furthermore, for CPU that may have a VFP/NEON, there is no way for the user to actually specify that the HW is indeed available; the user can only specify the floating point strategy. This means that some packages or some package versions, like nodejs for example, can not be properly selected on some CPU cores, like Cortex-A9 which only may have a VFP.

Like we have an option to enable an optional NEON unit, add a similar option to enable an optional VFP unit.

Cc Thomas Petazzoni <[email protected]>
---
 arch/Config.in.arm | 7 +++++++
 1 file changed, 7 insertions(+)
arch/Config.in.arm +7 -0
index feac16d..f2c5a58 100644
@@ -194,6 +194,13 @@ config BR2_ARM_ENABLE_NEON
 	  Select this option if you are certain your particular
 	  implementation has NEON support and you want to use it.
 
+config BR2_ARM_ENABLE_VFP
+	bool "Enable VFP extension support"
+	depends on BR2_ARM_CPU_MAYBE_HAS_VFPV2
+	select BR2_ARM_CPU_HAS_VFPV4 if BR2_ARM_CPU_MAYBE_HAS_VFPV4
+	select BR2_ARM_CPU_HAS_VFPV3 if BR2_ARM_CPU_MAYBE_HAS_VFPV3
+	select BR2_ARM_CPU_HAS_VFPV2 if BR2_ARM_CPU_MAYBE_HAS_VFPV2
+
 choice
 	prompt "Target ABI"
 	depends on BR2_arm || BR2_armeb
Signature · 1 line
1.9.1
#3 lore raw

PATCH v2 3/5 arch/arm: only expose EABIhf when the CPU *has* a VFP unit

In reply to Yann E. MORIN

There's no point in offering the user an option to select EABIhf when the CPU does not really have a VFP unit.

Cc Thomas Petazzoni <[email protected]>
---
 arch/Config.in.arm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/Config.in.arm +1 -1
index f2c5a58..d63a26c 100644
@@ -238,7 +238,7 @@ config BR2_ARM_EABI
 
 config BR2_ARM_EABIHF
 	bool "EABIhf"
-	depends on BR2_ARM_CPU_MAYBE_HAS_VFPV2 || BR2_ARM_CPU_HAS_VFPV2
+	depends on BR2_ARM_CPU_HAS_VFPV2
 	help
 	  The EABIhf is an extension of EABI which supports the 'hard'
 	  floating point model. This model uses the floating point
Signature · 1 line
1.9.1
#4 lore raw

PATCH v2 4/5 arch/arm: only expose VFP in FP strategy when the CPU *has* a VFP unit

In reply to Yann E. MORIN

There's no point in offering the user an option to select an FP strategy when the CPU does not actually have a VFP unit.

Cc Thomas Petazzoni <[email protected]>
---
 arch/Config.in.arm | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
arch/Config.in.arm +6 -6
index d63a26c..01555a6 100644
@@ -276,7 +276,7 @@ config BR2_ARM_SOFT_FLOAT
 
 config BR2_ARM_FPU_VFPV2
 	bool "VFPv2"
-	depends on BR2_ARM_CPU_HAS_VFPV2 || BR2_ARM_CPU_MAYBE_HAS_VFPV2
+	depends on BR2_ARM_CPU_HAS_VFPV2
 	help
 	  This option allows to use the VFPv2 floating point unit, as
 	  available in some ARMv5 processors (ARM926EJ-S) and some
@@ -289,7 +289,7 @@ config BR2_ARM_FPU_VFPV2
 
 config BR2_ARM_FPU_VFPV3
 	bool "VFPv3"
-	depends on BR2_ARM_CPU_HAS_VFPV3 || BR2_ARM_CPU_MAYBE_HAS_VFPV3
+	depends on BR2_ARM_CPU_HAS_VFPV3
 	help
 	  This option allows to use the VFPv3 floating point unit, as
 	  available in some ARMv7 processors (Cortex-A{8, 9}). This
@@ -305,7 +305,7 @@ config BR2_ARM_FPU_VFPV3
 
 config BR2_ARM_FPU_VFPV3D16
 	bool "VFPv3-D16"
-	depends on BR2_ARM_CPU_HAS_VFPV3 || BR2_ARM_CPU_MAYBE_HAS_VFPV3
+	depends on BR2_ARM_CPU_HAS_VFPV3
 	help
 	  This option allows to use the VFPv3 floating point unit, as
 	  available in some ARMv7 processors (Cortex-A{8, 9}). This
@@ -320,7 +320,7 @@ config BR2_ARM_FPU_VFPV3D16
 
 config BR2_ARM_FPU_VFPV4
 	bool "VFPv4"
-	depends on BR2_ARM_CPU_HAS_VFPV4 || BR2_ARM_CPU_MAYBE_HAS_VFPV4
+	depends on BR2_ARM_CPU_HAS_VFPV4
 	help
 	  This option allows to use the VFPv4 floating point unit, as
 	  available in some ARMv7 processors (Cortex-A{5, 7, 12,
@@ -335,7 +335,7 @@ config BR2_ARM_FPU_VFPV4
 
 config BR2_ARM_FPU_VFPV4D16
 	bool "VFPv4-D16"
-	depends on BR2_ARM_CPU_HAS_VFPV4 || BR2_ARM_CPU_MAYBE_HAS_VFPV4
+	depends on BR2_ARM_CPU_HAS_VFPV4
 	help
 	  This option allows to use the VFPv4 floating point unit, as
 	  available in some ARMv7 processors (Cortex-A{5, 7, 12,
@@ -360,7 +360,7 @@ config BR2_ARM_FPU_NEON
 
 config BR2_ARM_FPU_NEON_VFPV4
 	bool "NEON/VFPv4"
-	depends on BR2_ARM_CPU_HAS_VFPV4 || BR2_ARM_CPU_MAYBE_HAS_VFPV4
+	depends on BR2_ARM_CPU_HAS_VFPV4
 	depends on BR2_ARM_CPU_HAS_NEON
 	help
 	  This option allows to use both the VFPv4 and the NEON SIMD
Signature · 1 line
1.9.1
#5 lore raw

PATCH v2 5/5 toolchain/external: Arago armv7 toolchain really requires a VFPv3

In reply to Yann E. MORIN

The Arago armv7 toolchain really requires a VFPv3 unit, so only expose it to the user when the CPU actually has such a VFP unit

Cc Thomas Petazzoni <[email protected]>
---
 toolchain/toolchain-external/Config.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
toolchain/toolchain-external/Config.in +1 -1
index 8d4a835..35d8b7a 100644
@@ -140,7 +140,7 @@ config BR2_TOOLCHAIN_EXTERNAL_ARAGO_ARMV7A
 	depends on BR2_HOSTARCH = "x86_64" || BR2_HOSTARCH = "x86"
 	depends on BR2_ARM_CPU_ARMV7A
 	depends on BR2_ARM_EABI
-	depends on BR2_ARM_CPU_HAS_VFPV3 || BR2_ARM_CPU_MAYBE_HAS_VFPV3
+	depends on BR2_ARM_CPU_HAS_VFPV3
 	depends on !BR2_STATIC_LIBS
 	select BR2_TOOLCHAIN_EXTERNAL_GLIBC
 	select BR2_TOOLCHAIN_HAS_NATIVE_RPC
Signature · 1 line
1.9.1
#6 lore raw

v2 cover arch/arm: properly handle ARM processors with optional VFP units (branch yem/arm-vfp-2)

In reply to Yann E. MORIN

Dear Yann E. MORIN,

Quoted 6 lines · Yann E. MORIN

Yann E. MORIN (5):
arch/arm: reorder NEON option
arch/arm: add option to enable an optional VFP unit arch/arm: only expose EABIhf when the CPU *has* a VFP unit arch/arm: only expose VFP in FP strategy when the CPU *has* a VFP unit toolchain/external: Arago armv7 toolchain really requires a VFPv3

Thanks, I've applied, after adding one more commit to add a help text to the new BR2_ARM_ENABLE_VFP option.

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com