Skip to contentSkip to conversation

kvm-unit-tests: pass the --processor configure argument

PATCH New Arnout Vandecappelle (Essensium/Mind) 2 participants 4 messages Nov 20, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 kvm-unit-tests: pass the --processor configure argument

The configure script uses this to set the -mcpu option. If nothing is passed, it defaults to -mcpu=cortex-a15 for arm, and -mcpu=cortex-a57 for aarch64, which may conflict with the actual architecture.

The --processor option is only really used for arm and aarch64, but it doesn't hurt to also pass it for the other arches.

---
 package/kvm-unit-tests/kvm-unit-tests.mk | 1 +
 1 file changed, 1 insertion(+)
package/kvm-unit-tests/kvm-unit-tests.mk +1 -0
index 6e1c2df..0ddb017 100644
@@ -28,6 +28,7 @@ endif
 
 KVM_UNIT_TESTS_CONF_OPTS =\
 	--arch="$(KVM_UNIT_TESTS_ARCH)" \
+	--processor="$(call qstrip,$(BR2_GCC_TARGET_CPU))" \
 	--endian="$(KVM_UNIT_TESTS_ENDIAN)"
 
 # For all architectures but x86-64, we use the target
Signature · 1 line
2.10.2
#1 lore raw

PATCH 2/2 kvm-unit-tests: only enable for ARM on Cortex-A7 and A15

The library uses the hypervisor instruction HVC, which is only available on ARMv7-A with Hypervisor extensions. According to [1], this is limited to Cortex-A7 and A15.

In addition the build unconditionally passes -marm so it also needs ARM instructions to be available, but that is already implied by the CPU selection.

Implicitly fixes
http://autobuild.buildroot.net/results/53d109fd9055fd20387bb857aced5f89cf3086fd
though it is still not clear why ld doesn't accept the -Ttext=... option there.

[1] https://en.wikipedia.org/wiki/Comparison_of_ARMv7-A_cores

---
 package/kvm-unit-tests/Config.in | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
package/kvm-unit-tests/Config.in +2 -1
index f704a8e..a25495a 100644
@@ -4,7 +4,8 @@ config BR2_PACKAGE_KVM_UNIT_TESTS
 	# on i386 and x86-64, __builtin_reachable is used, so we need
 	# gcc 4.5 at least. on i386, we use the target gcc, while on
 	# x86-64 we use the host gcc (see .mk file for details)
-	depends on BR2_arm || \
+	# On ARM, it uses virtualization extensions
+	depends on (BR2_arm && (BR2_cortex_a7 || BR2_cortex_a15)) || \
 		(BR2_i386 && BR2_TOOLCHAIN_GCC_AT_LEAST_4_5) || \
 		BR2_powerpc64 || \
 		BR2_powerpc64le || \
Signature · 1 line
2.10.2
#2 lore raw

PATCH 2/2 kvm-unit-tests: only enable for ARM on Cortex-A7 and A15

Hello,

Quoted 13 lines · Arnout Vandecappelle (Essensium/Mind)

The library uses the hypervisor instruction HVC, which is only available on ARMv7-A with Hypervisor extensions. According to [1], this is limited to Cortex-A7 and A15.

In addition the build unconditionally passes -marm so it also needs ARM instructions to be available, but that is already implied by the CPU selection.

Implicitly fixes
http://autobuild.buildroot.net/results/53d109fd9055fd20387bb857aced5f89cf3086fd
though it is still not clear why ld doesn't accept the -Ttext=... option there.

Quoted 6 lines

[1] https://en.wikipedia.org/wiki/Comparison_of_ARMv7-A_cores

---
 package/kvm-unit-tests/Config.in | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

I've applied to master, but after adding A12 and A17 in the list of supported cores. Indeed, your [1] reference is incomplete, and A12 and A17 do have the hardware virtualization extensions, see:

https://en.wikipedia.org/wiki/ARM_Cortex-A12
https://en.wikipedia.org/wiki/ARM_Cortex-A17

I've also dropped the BR2_arm part of the condition: depending on BR2_cortex_a7 || BR2_cortex_a12 || ... is sufficient.

Thanks!

Thomas

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

PATCH 1/2 kvm-unit-tests: pass the --processor configure argument

In reply to Arnout Vandecappelle (Essensium/Mind)

Hello,

Quoted 11 lines · Arnout Vandecappelle (Essensium/Mind)

The configure script uses this to set the -mcpu option. If nothing is passed, it defaults to -mcpu=cortex-a15 for arm, and -mcpu=cortex-a57 for aarch64, which may conflict with the actual architecture.

The --processor option is only really used for arm and aarch64, but it doesn't hurt to also pass it for the other arches.

---
 package/kvm-unit-tests/kvm-unit-tests.mk | 1 +
 1 file changed, 1 insertion(+)

Applied to master, thanks.

Thomas

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