diff mbox series

[v2,2/3] KVM: selftests: arm64: Use symbolic definitions for incorrect encodings

Message ID 20240806-kvm-arm64-get-reg-list-v2-2-1d3fbc7b6844@kernel.org (mailing list archive)
State New, archived
Headers show
Series KVM: selftests: arm64: Make use of sysreg defintions in get-reg-list | expand

Commit Message

Mark Brown Aug. 6, 2024, 2:24 p.m. UTC
Unfortunately incorrect encodings for CNTV_CTL_EL0 and CNTV_CVAL_EL0 made
their way into the KVM ABI, the encodings were swapped. The UAPI provides
custom KVM sysreg definitions with the incorrect encodings so let's update
get-reg-list to use them. Also add a comment explaining the situation to
help anyone looking at the test.

This will avoid these registers being picked up by further work to
automatically convert the test to use symbolic definitions rather than
manually repeating the encodings in the test.

Signed-off-by: Mark Brown <broonie@kernel.org>
---
 tools/testing/selftests/kvm/aarch64/get-reg-list.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/tools/testing/selftests/kvm/aarch64/get-reg-list.c b/tools/testing/selftests/kvm/aarch64/get-reg-list.c
index 97ac3f6b5c4b..a270287a4c88 100644
--- a/tools/testing/selftests/kvm/aarch64/get-reg-list.c
+++ b/tools/testing/selftests/kvm/aarch64/get-reg-list.c
@@ -313,8 +313,15 @@  static __u64 base_regs[] = {
 	KVM_REG_ARM_FW_FEAT_BMAP_REG(0),	/* KVM_REG_ARM_STD_BMAP */
 	KVM_REG_ARM_FW_FEAT_BMAP_REG(1),	/* KVM_REG_ARM_STD_HYP_BMAP */
 	KVM_REG_ARM_FW_FEAT_BMAP_REG(2),	/* KVM_REG_ARM_VENDOR_HYP_BMAP */
-	ARM64_SYS_REG(3, 3, 14, 3, 1),	/* CNTV_CTL_EL0 */
-	ARM64_SYS_REG(3, 3, 14, 3, 2),	/* CNTV_CVAL_EL0 */
+
+	/*
+	 * Incorrect encodings for CNTV_CTL_EL0 and CNTV_CVAL_EL0 made
+	 * it into the KVM ABI so we have custom encodings for them
+	 * that do not align with the architecture.
+	 */
+	KVM_REG_ARM_TIMER_CTL,
+	KVM_REG_ARM_TIMER_CVAL,
+
 	ARM64_SYS_REG(3, 3, 14, 0, 2),
 	ARM64_SYS_REG(3, 0, 0, 0, 0),	/* MIDR_EL1 */
 	ARM64_SYS_REG(3, 0, 0, 0, 6),	/* REVIDR_EL1 */