Hi Joey, On Thu, May 29, 2025 at 02:55:48PM +0100, Joey Gouly wrote: > 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. > > Changes since v1[3]: > - Authorship fixed on 2 patches > - Tested and fixed EFI support > - Recactored assembly and added init_el macro > - Clear trap registers, trying to avoid relying on default register > state > - Cleaned up PMU changes > > The debug tests fail with --nested, but pass with --nested --e2h0, I > need to investigate this. That's because the code does not check for the absence of FEAT_E2H0, and it sets HCR_EL2.E2H to 0 when writing INIT_HCR_EL2_EL1_ONLY even if KVM doesn't support that. Have you considered using parts of el2_setup.h as-is instead of rolling out your own EL2 init code? When I was looking at the init_el macro I was comparing it with el2_setup.h, and having some of the code shared would make things easier with updates and fixes too. Either way, not a deal breaker if you want to write your own init code. Thanks, Alex > > 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/20250220141354.2565567-1-joey.gouly@xxxxxxx/ > > Alexandru Elisei (2): > arm64: micro-bench: use smc when at EL2 > arm64: selftest: update test for running at EL2 > > Joey Gouly (7): > arm64: drop to EL1 if booted at EL2 > arm64: efi: initialise SCTLR_ELx fully > arm64: efi: initialise the EL > arm64: timer: use hypervisor timers when at EL2 > arm64: micro-bench: fix timer IRQ > arm64: pmu: count EL2 cycles > arm64: run at EL2 if supported > > arm/cstart64.S | 56 ++++++++++++++++++++++++++++++++++++-- > arm/efi/crt0-efi-aarch64.S | 5 ++++ > arm/micro-bench.c | 26 ++++++++++++++++-- > arm/pmu.c | 13 ++++++--- > arm/selftest.c | 18 ++++++++---- > arm/timer.c | 10 +++++-- > lib/acpi.h | 2 ++ > lib/arm/asm/setup.h | 1 + > lib/arm/asm/timer.h | 11 ++++++++ > lib/arm/setup.c | 6 ++++ > lib/arm/timer.c | 19 +++++++++++-- > lib/arm64/asm/sysreg.h | 19 +++++++++++++ > 12 files changed, 167 insertions(+), 19 deletions(-) > > -- > 2.25.1 >