]> Gentwo Git Trees - linux/.git/commit
KVM: arm64: selftests: Alias EL1 registers to EL2 counterparts
authorOliver Upton <oliver.upton@linux.dev>
Wed, 17 Sep 2025 21:20:36 +0000 (14:20 -0700)
committerMarc Zyngier <maz@kernel.org>
Wed, 24 Sep 2025 18:23:32 +0000 (19:23 +0100)
commit1c9604ba234711ca759f1147f2fbc7a94a5a486d
tree2c7056a8dfa55e46e4a5520c9a6939e867d6ff11
parent8911c7dbc607212bf3dfc963004b062588c0ab38
KVM: arm64: selftests: Alias EL1 registers to EL2 counterparts

FEAT_VHE has the somewhat nice property of implicitly redirecting EL1
register aliases to their corresponding EL2 representations when E2H=1.
Unfortunately, there's no such abstraction for userspace and EL2
registers are always accessed by their canonical encoding.

Introduce a helper that applies EL2 redirections to sysregs and use
aggressive inlining to catch misuse at compile time. Go a little past
the architectural definition for ease of use for test authors (e.g. the
stack pointer).

Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
Signed-off-by: Marc Zyngier <maz@kernel.org>
tools/testing/selftests/kvm/arm64/vpmu_counter_access.c
tools/testing/selftests/kvm/include/arm64/processor.h
tools/testing/selftests/kvm/include/kvm_util.h
tools/testing/selftests/kvm/lib/arm64/processor.c