[kvm-unit-tests PATCH v1 0/7] arm64: support EL2

Joey Gouly
2025-02-20T14:14:09Z

Hi all,

This series is for adding support to running the kvm-unit-tests at EL2. These
have been tested with Marc Zyngier's Linux kvm-arm64/nv-next branch [1] and
kvmtool branch arm64/nv-6.13 [2]

The goal is to later extend and add new tests for Nested Virtualisation,
however they should also work with bare metal as well.

- The EFI/ACPI change has not been tested yet.
- The PMU tests don't all work in NV, a patch has been submitted that fixes it
[3].
- The debug tests fail in NV
- micro-bench ipi test fails in 'bare metal' QEMU
- PMU pmu-mem-access, pmu-chain-promotion, pmu-overflow-interrupt fail
on FVP, but fail when run from EL1 already. So not an EL2 issue.

I will continue to debug the above, but wanted to send this series out to make
some progress. We could even drop the last patch (actually enabling EL2), and
merge the rest, if people don't want to have some tests broken.

This is a continuation/reworking of Alexandru's patches at [4].

Thanks,

Joey

[1] https://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms.git kvm-arm64/nv-next (commit a35d752b17f4)
[2] https://git.kernel.org/pub/scm/linux/kernel/git/maz/kvmtool.git arm64/nv-6.13 (commit 5b6fe295ea7)
[3] https://lore.kernel.org/kvmarm/20250217112412.3963324-1-maz@kernel.org/T/#t
[4] https://lore.kernel.org/all/1577972806-16184-1-git-send-email-alexandru.elisei@arm.com/

Joey Gouly (7):
arm64: drop to EL1 if booted at EL2
arm64: timer: use hypervisor timers when at EL2
arm64: micro-bench: fix timer IRQ
arm64: micro-bench: use smc when at EL2
arm64: selftest: update test for running at EL2
arm64: pmu: count EL2 cycles
arm64: run at EL2 if supported

arm/cstart64.S | 55 ++++++++++++++++++++++++++++++++++++++++--
arm/micro-bench.c | 26 +++++++++++++++++---
arm/pmu.c | 21 +++++++++++++---
arm/selftest.c | 18 ++++++++++----
arm/timer.c | 10 ++++++--
lib/acpi.h | 2 ++
lib/arm/asm/timer.h | 11 +++++++++
lib/arm/timer.c | 19 +++++++++++++--
lib/arm64/asm/sysreg.h | 5 ++++
9 files changed, 150 insertions(+), 17 deletions(-)

--
2.25.1