Skip to contentSkip to conversation

KVM: arm64: selftests: Sync ID_AA64PFR1, MPIDR, CLIDR in guest

PATCH Applied Zenghui Yu 4 participants 5 messages Oct 12, 2025 – Oct 14, 2025

Subsystems (3)
lore
Share & tools
lore

Zenghui Yu

author
#0 lore raw

PATCH 1/1 KVM: arm64: selftests: Sync ID_AA64PFR1, MPIDR, CLIDR in guest

We forgot to sync several registers (ID_AA64PFR1, MPIDR, CLIDR) in guest to make sure that the guest had seen the written value.

Add them to the list.

---
 tools/testing/selftests/kvm/arm64/set_id_regs.c | 3 +++
 1 file changed, 3 insertions(+)
tools/testing/selftests/kvm/arm64/set_id_regs.c +3 -0
index 8ff1e853f7f8..5e24f77868b5 100644
@@ -249,11 +249,14 @@ static void guest_code(void)
 	GUEST_REG_SYNC(SYS_ID_AA64ISAR2_EL1);
 	GUEST_REG_SYNC(SYS_ID_AA64ISAR3_EL1);
 	GUEST_REG_SYNC(SYS_ID_AA64PFR0_EL1);
+	GUEST_REG_SYNC(SYS_ID_AA64PFR1_EL1);
 	GUEST_REG_SYNC(SYS_ID_AA64MMFR0_EL1);
 	GUEST_REG_SYNC(SYS_ID_AA64MMFR1_EL1);
 	GUEST_REG_SYNC(SYS_ID_AA64MMFR2_EL1);
 	GUEST_REG_SYNC(SYS_ID_AA64MMFR3_EL1);
 	GUEST_REG_SYNC(SYS_ID_AA64ZFR0_EL1);
+	GUEST_REG_SYNC(SYS_MPIDR_EL1);
+	GUEST_REG_SYNC(SYS_CLIDR_EL1);
 	GUEST_REG_SYNC(SYS_CTR_EL0);
 	GUEST_REG_SYNC(SYS_MIDR_EL1);
 	GUEST_REG_SYNC(SYS_REVIDR_EL1);
Signature · 1 line
2.34.1
Reviewed-by on v1 1/1
#1 lore raw

Hi Zenghui,

Quoted 16 lines · Zenghui Yu

We forgot to sync several registers (ID_AA64PFR1, MPIDR, CLIDR) in guest to make sure that the guest had seen the written value.

Add them to the list.

---
 tools/testing/selftests/kvm/arm64/set_id_regs.c | 3 +++
 1 file changed, 3 insertions(+)
tools/testing/selftests/kvm/arm64/set_id_regs.c +0 -0
index 8ff1e853f7f8..5e24f77868b5 100644
@@ -249,11 +249,14 @@ static void guest_code(void)
 	GUEST_REG_SYNC(SYS_ID_AA64ISAR2_EL1);

tools/testing/selftests/kvm/arm64/set_id_regs.c static void guest_code(void) · line 259

Quoted 10 lines
tools/testing/selftests/kvm/arm64/set_id_regs.c +3 -0
 	GUEST_REG_SYNC(SYS_ID_AA64ISAR3_EL1);
 	GUEST_REG_SYNC(SYS_ID_AA64PFR0_EL1);
+	GUEST_REG_SYNC(SYS_ID_AA64PFR1_EL1);
 	GUEST_REG_SYNC(SYS_ID_AA64MMFR0_EL1);
 	GUEST_REG_SYNC(SYS_ID_AA64MMFR1_EL1);
 	GUEST_REG_SYNC(SYS_ID_AA64MMFR2_EL1);
 	GUEST_REG_SYNC(SYS_ID_AA64MMFR3_EL1);
 	GUEST_REG_SYNC(SYS_ID_AA64ZFR0_EL1);
+	GUEST_REG_SYNC(SYS_MPIDR_EL1);
+	GUEST_REG_SYNC(SYS_CLIDR_EL1);

Why did you choose this position in the list for these 2?

tools/testing/selftests/kvm/arm64/set_id_regs.c static void guest_code(void) · line 262

Quoted 3 lines
tools/testing/selftests/kvm/arm64/set_id_regs.c +0 -0
 	GUEST_REG_SYNC(SYS_CTR_EL0);
 	GUEST_REG_SYNC(SYS_MIDR_EL1);
 	GUEST_REG_SYNC(SYS_REVIDR_EL1);

Looks good to me.

Thanks,

Ben

#2 lore raw
Quoted 36 lines · Ben Horgan

Hi Zenghui,

Quoted 16 lines · Zenghui Yu

We forgot to sync several registers (ID_AA64PFR1, MPIDR, CLIDR) in guest to make sure that the guest had seen the written value.

Add them to the list.

---
 tools/testing/selftests/kvm/arm64/set_id_regs.c | 3 +++
 1 file changed, 3 insertions(+)
tools/testing/selftests/kvm/arm64/set_id_regs.c +0 -0
index 8ff1e853f7f8..5e24f77868b5 100644
@@ -249,11 +249,14 @@ static void guest_code(void)
 	GUEST_REG_SYNC(SYS_ID_AA64ISAR2_EL1);

tools/testing/selftests/kvm/arm64/set_id_regs.c static void guest_code(void) · line 259

Quoted 10 lines
tools/testing/selftests/kvm/arm64/set_id_regs.c +3 -0
 	GUEST_REG_SYNC(SYS_ID_AA64ISAR3_EL1);
 	GUEST_REG_SYNC(SYS_ID_AA64PFR0_EL1);
+	GUEST_REG_SYNC(SYS_ID_AA64PFR1_EL1);
 	GUEST_REG_SYNC(SYS_ID_AA64MMFR0_EL1);
 	GUEST_REG_SYNC(SYS_ID_AA64MMFR1_EL1);
 	GUEST_REG_SYNC(SYS_ID_AA64MMFR2_EL1);
 	GUEST_REG_SYNC(SYS_ID_AA64MMFR3_EL1);
 	GUEST_REG_SYNC(SYS_ID_AA64ZFR0_EL1);
+	GUEST_REG_SYNC(SYS_MPIDR_EL1);
+	GUEST_REG_SYNC(SYS_CLIDR_EL1);

Why did you choose this position in the list for these 2?

tools/testing/selftests/kvm/arm64/set_id_regs.c static void guest_code(void) · line 262

Quoted 3 lines
tools/testing/selftests/kvm/arm64/set_id_regs.c +0 -0
 	GUEST_REG_SYNC(SYS_CTR_EL0);
 	GUEST_REG_SYNC(SYS_MIDR_EL1);
 	GUEST_REG_SYNC(SYS_REVIDR_EL1);
Quoted 7 lines

Looks good to me.

Thanks,

Ben

On running this, I note test_guest_reg_read() doesn't announce its presence. How about adding a ksft_test_result_pass("%s\n", __func__) and bumping the number of tests?

Thanks,

Ben

reviewer
#3 lore raw
Quoted 26 lines · Ben Horgan
Quoted 23 lines · Ben Horgan

Hi Zenghui,

Quoted 20 lines · Zenghui Yu

We forgot to sync several registers (ID_AA64PFR1, MPIDR, CLIDR) in guest to make sure that the guest had seen the written value.

Add them to the list.

---
 tools/testing/selftests/kvm/arm64/set_id_regs.c | 3 +++
 1 file changed, 3 insertions(+)
tools/testing/selftests/kvm/arm64/set_id_regs.c +1 -0
index 8ff1e853f7f8..5e24f77868b5 100644
@@ -249,11 +249,14 @@ static void guest_code(void)
 	GUEST_REG_SYNC(SYS_ID_AA64ISAR2_EL1);
 	GUEST_REG_SYNC(SYS_ID_AA64ISAR3_EL1);
 	GUEST_REG_SYNC(SYS_ID_AA64PFR0_EL1);
+	GUEST_REG_SYNC(SYS_ID_AA64PFR1_EL1);
 	GUEST_REG_SYNC(SYS_ID_AA64MMFR0_EL1);
Quoted 8 lines
Quoted 8 lines

tools/testing/selftests/kvm/arm64/set_id_regs.c static void guest_code(void) · line 259

Quoted 6 lines
tools/testing/selftests/kvm/arm64/set_id_regs.c +2 -0
 	GUEST_REG_SYNC(SYS_ID_AA64MMFR1_EL1);
 	GUEST_REG_SYNC(SYS_ID_AA64MMFR2_EL1);
 	GUEST_REG_SYNC(SYS_ID_AA64MMFR3_EL1);
 	GUEST_REG_SYNC(SYS_ID_AA64ZFR0_EL1);
+	GUEST_REG_SYNC(SYS_MPIDR_EL1);
+	GUEST_REG_SYNC(SYS_CLIDR_EL1);

Why did you choose this position in the list for these 2?

Technically there are no restrictions on the order. I just want it to look consistent with test_reset_preserves_id_regs().

Quoted 8 lines
Quoted 8 lines

tools/testing/selftests/kvm/arm64/set_id_regs.c static void guest_code(void) · line 262

Quoted 4 lines
tools/testing/selftests/kvm/arm64/set_id_regs.c +0 -0
 	GUEST_REG_SYNC(SYS_CTR_EL0);
 	GUEST_REG_SYNC(SYS_MIDR_EL1);
 	GUEST_REG_SYNC(SYS_REVIDR_EL1);

Looks good to me.

Thanks!

Quoted 3 lines

On running this, I note test_guest_reg_read() doesn't announce its presence. How about adding a ksft_test_result_pass("%s\n", __func__) and bumping the number of tests?

Yup, I agreed.

Thanks,
Zenghui

maintainer Applied
#4 lore raw
In reply to Zenghui Yu
Quoted 6 lines · Zenghui Yu

We forgot to sync several registers (ID_AA64PFR1, MPIDR, CLIDR) in guest to make sure that the guest had seen the written value.

Add them to the list.

Applied to fixes, thanks!

[1/1] KVM: arm64: selftests: Sync ID_AA64PFR1, MPIDR, CLIDR in guest

      commit: 9a7f87eb587da49993f47f44c4c5535d8de76750

Cheers,

	M.
Signature · 1 line
Without deviation from the norm, progress is not possible.