Skip to contentSkip to conversation

KVM: arm64: Enforce dependency on an ARMv8.4-aware toolchain

PATCH Applied Marc Zyngier 4 participants 5 messages Aug 7, 2024 – Aug 8, 2024

Subsystems (3)
lore
Share & tools
lore

Marc Zyngier

author maintainer
#0 lore raw

PATCH 1/1 KVM: arm64: Enforce dependency on an ARMv8.4-aware toolchain

With the NV support of TLBI-range operations, KVM makes use of instructions that are only supported by binutils versions >= 2.30.

This breaks the build for very old toolchains.

Make KVM support conditional on having ARMv8.4 support in the assembler, side-stepping the issue.

Fixes 5d476ca57d7d ("KVM: arm64: nv: Add handling of range-based TLBI operations")
---
 arch/arm64/kvm/Kconfig | 1 +
 1 file changed, 1 insertion(+)
arch/arm64/kvm/Kconfig +1 -0
index 58f09370d17e..8304eb342be9 100644
@@ -19,6 +19,7 @@ if VIRTUALIZATION
 
 menuconfig KVM
 	bool "Kernel-based Virtual Machine (KVM) support"
+	depends on AS_HAS_ARMV8_4
 	select KVM_COMMON
 	select KVM_GENERIC_HARDWARE_ENABLING
 	select KVM_GENERIC_MMU_NOTIFIER
Signature · 1 line
2.39.2
Acked-by on v1 1/1
#1 lore raw
Quoted 6 lines · Marc Zyngier

With the NV support of TLBI-range operations, KVM makes use of instructions that are only supported by binutils versions >= 2.30.

This breaks the build for very old toolchains.

Quoted 7 lines

Make KVM support conditional on having ARMv8.4 support in the assembler, side-stepping the issue.

Fixes 5d476ca57d7d ("KVM: arm64: nv: Add handling of range-based TLBI operations")
Quoted 6 lines

menuconfig KVM
bool "Kernel-based Virtual Machine (KVM) support"
+ depends on AS_HAS_ARMV8_4
select KVM_COMMON
select KVM_GENERIC_HARDWARE_ENABLING select KVM_GENERIC_MMU_NOTIFIER

I think this is good enough here, only slightly more limiting than we strictly need. A slightly more fine-grained approach would turn off VHE mode on old binutils but keep NVHE. That is still inaccurate of course since VHE only depends on v8.2, so I'm in favor of keeping the version you posted.

For reference, even the gcc-5.5 toolchain I built for kernel.org in 2019 came with recent enough binutils, and we are likely to soon require gcc-8 or higher anyway.

Arnd

author maintainer
#2 lore raw
Quoted 11 lines · Arnd Bergmann
Quoted 9 lines · Marc Zyngier

With the NV support of TLBI-range operations, KVM makes use of instructions that are only supported by binutils versions >= 2.30.

This breaks the build for very old toolchains.

Make KVM support conditional on having ARMv8.4 support in the assembler, side-stepping the issue.

Quoted 6 lines
Quoted 4 lines
Fixes 5d476ca57d7d ("KVM: arm64: nv: Add handling of range-based TLBI operations")

Thanks for that.

Quoted 8 lines
Quoted 7 lines

menuconfig KVM
bool "Kernel-based Virtual Machine (KVM) support"
+ depends on AS_HAS_ARMV8_4
select KVM_COMMON
select KVM_GENERIC_HARDWARE_ENABLING select KVM_GENERIC_MMU_NOTIFIER

Quoted 5 lines

I think this is good enough here, only slightly more limiting than we strictly need. A slightly more fine-grained approach would turn off VHE mode on old binutils but keep NVHE. That is still inaccurate of course since VHE only depends on v8.2, so I'm in favor of keeping the version you posted.

nit: VHE is from ARMv8.1, though there isn't a large number of v8.1 implementations (Cavium/Broadcom TX2 is the best known one).

Now, splitting VHE out would be pretty invasive. A marginally better approach would be to disable NV support for TLBI range instructions and make them UNDEF in the guest.

But overall, I really hate the idea of playing a "dice and slice" game with KVM, just because the toolchain is from a time when I could still have long hair. It leads to all sort of issues with latent bugs that only show-up in some configs (cue the repeated issues with PMU emulation, which has generally been a disaster). I would only consider this if someone came up with a valid reason why they cannot move to a toolchain that has newer binutils (like the ones you provide on k.org).

Quoted 3 lines

For reference, even the gcc-5.5 toolchain I built for kernel.org in 2019 came with recent enough binutils, and we are likely to soon require gcc-8 or higher anyway.

Definitely looking forward to this!

Thanks,

	M.
Signature · 1 line
Without deviation from the norm, progress is not possible.
Tested-by on v1 1/1
#3 lore raw
In reply to Marc Zyngier
Quoted 21 lines · Marc Zyngier

With the NV support of TLBI-range operations, KVM makes use of instructions that are only supported by binutils versions >= 2.30.

This breaks the build for very old toolchains.

Make KVM support conditional on having ARMv8.4 support in the assembler, side-stepping the issue.

Fixes 5d476ca57d7d ("KVM: arm64: nv: Add handling of range-based TLBI operations")
---
 arch/arm64/kvm/Kconfig | 1 +
 1 file changed, 1 insertion(+)
arch/arm64/kvm/Kconfig +0 -0
index 58f09370d17e..8304eb342be9 100644

arch/arm64/kvm/Kconfig if VIRTUALIZATION · line 25

Quoted 7 lines
arch/arm64/kvm/Kconfig +1 -0
@@ -19,6 +19,7 @@ if VIRTUALIZATION
 
 menuconfig KVM
 	bool "Kernel-based Virtual Machine (KVM) support"
+	depends on AS_HAS_ARMV8_4
 	select KVM_COMMON
 	select KVM_GENERIC_HARDWARE_ENABLING
 	select KVM_GENERIC_MMU_NOTIFIER

(Build only).

Signature · 1 line
viresh
Applied
#4 lore raw
In reply to Marc Zyngier
Quoted 9 lines · Marc Zyngier

With the NV support of TLBI-range operations, KVM makes use of instructions that are only supported by binutils versions >= 2.30.

This breaks the build for very old toolchains.

Make KVM support conditional on having ARMv8.4 support in the assembler, side-stepping the issue.

[...]

Applied to kvmarm/fixes, thanks!

[1/1] KVM: arm64: Enforce dependency on an ARMv8.4-aware toolchain

      https://git.kernel.org/kvmarm/kvmarm/c/10f2ad032def

--
Best,
Oliver