Skip to contentSkip to conversation

KVM: arm64: selftests: Request PMU feature in get-reg-list

PATCH In review Gavin Shan 2 participants 3 messages May 13, 2021

Subsystems (3)
lore
Share & tools
lore

Gavin Shan

author
#0 lore raw

PATCH 1/1 KVM: arm64: selftests: Request PMU feature in get-reg-list

Since the following commit, PMU registers are hidden from user until it's explicitly requested by feeding feature (KVM_ARM_VCPU_PMU_V3). Otherwise, 74 missing PMU registers are missing as the following log indicates.

11663111cd49 ("KVM: arm64: Hide PMU registers from userspace when not available")

   # ./get-reg-list
   Number blessed registers:   308
   Number registers:           238

There are 74 missing registers.
The following lines are missing registers:

      	ARM64_SYS_REG(3, 0, 9, 14, 1),
	ARM64_SYS_REG(3, 0, 9, 14, 2),
             :
	ARM64_SYS_REG(3, 3, 14, 15, 7),

This fixes the issue of wrongly reported missing PMU registers by requesting it explicitly.

---
 tools/testing/selftests/kvm/aarch64/get-reg-list.c | 2 ++
 1 file changed, 2 insertions(+)
tools/testing/selftests/kvm/aarch64/get-reg-list.c +2 -0
index 486932164cf2..6c6bdc6f5dc3 100644
@@ -314,6 +314,8 @@ static void core_reg_fixup(void)
 
 static void prepare_vcpu_init(struct kvm_vcpu_init *init)
 {
+	init->features[0] |= 1 << KVM_ARM_VCPU_PMU_V3;
+
 	if (reg_list_sve())
 		init->features[0] |= 1 << KVM_ARM_VCPU_SVE;
 }
Signature · 6 lines
2.23.0

_______________________________________________
kvmarm mailing list
[email protected]
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
maintainer
#1 lore raw
Quoted 34 lines · Gavin Shan

Since the following commit, PMU registers are hidden from user until it's explicitly requested by feeding feature (KVM_ARM_VCPU_PMU_V3). Otherwise, 74 missing PMU registers are missing as the following log indicates.

11663111cd49 ("KVM: arm64: Hide PMU registers from userspace when
not available")

   # ./get-reg-list
   Number blessed registers:   308
   Number registers:           238
   There are 74 missing registers.
   The following lines are missing registers:

      	ARM64_SYS_REG(3, 0, 9, 14, 1),
	ARM64_SYS_REG(3, 0, 9, 14, 2),
             :
	ARM64_SYS_REG(3, 3, 14, 15, 7),

This fixes the issue of wrongly reported missing PMU registers by requesting it explicitly.

---
 tools/testing/selftests/kvm/aarch64/get-reg-list.c | 2 ++
 1 file changed, 2 insertions(+)
tools/testing/selftests/kvm/aarch64/get-reg-list.c +0 -0
index 486932164cf2..6c6bdc6f5dc3 100644

tools/testing/selftests/kvm/aarch64/get-reg-list.c static void core_reg_fixup(void) · line 321

Quoted 8 lines
tools/testing/selftests/kvm/aarch64/get-reg-list.c +2 -0
@@ -314,6 +314,8 @@ static void core_reg_fixup(void)
 
 static void prepare_vcpu_init(struct kvm_vcpu_init *init)
 {
+	init->features[0] |= 1 << KVM_ARM_VCPU_PMU_V3;
+
 	if (reg_list_sve())
 		init->features[0] |= 1 << KVM_ARM_VCPU_SVE;
 }

Please see Andrew's series[1], which actually deals with options.

        M.

[1] https://lore.kernel.org/r/[email protected]

Signature · 5 lines
Jazz is not dead. It just smells funny...
_______________________________________________
kvmarm mailing list
[email protected]
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
author
#2 lore raw
Quoted 46 lines · Marc Zyngier
Quoted 34 lines · Gavin Shan

Since the following commit, PMU registers are hidden from user until it's explicitly requested by feeding feature (KVM_ARM_VCPU_PMU_V3). Otherwise, 74 missing PMU registers are missing as the following log indicates.

   11663111cd49 ("KVM: arm64: Hide PMU registers from userspace when not available")

   # ./get-reg-list
   Number blessed registers:   308
   Number registers:           238

   There are 74 missing registers.
   The following lines are missing registers:

          ARM64_SYS_REG(3, 0, 9, 14, 1),
    ARM64_SYS_REG(3, 0, 9, 14, 2),
             :
    ARM64_SYS_REG(3, 3, 14, 15, 7),

This fixes the issue of wrongly reported missing PMU registers by requesting it explicitly.

---
 tools/testing/selftests/kvm/aarch64/get-reg-list.c | 2 ++

 1 file changed, 2 insertions(+)
tools/testing/selftests/kvm/aarch64/get-reg-list.c +0 -0
index 486932164cf2..6c6bdc6f5dc3 100644

tools/testing/selftests/kvm/aarch64/get-reg-list.c static void core_reg_fixup(void) · line 321

Quoted 8 lines
tools/testing/selftests/kvm/aarch64/get-reg-list.c +2 -0
@@ -314,6 +314,8 @@ static void core_reg_fixup(void)
 
  static void prepare_vcpu_init(struct kvm_vcpu_init *init)
  {
+    init->features[0] |= 1 << KVM_ARM_VCPU_PMU_V3;
+
      if (reg_list_sve())
          init->features[0] |= 1 << KVM_ARM_VCPU_SVE;
  }

Please see Andrew's series[1], which actually deals with options.

Quoted 4 lines

        M.

[1] https://lore.kernel.org/r/[email protected]

Thanks, Marc. Yes, Drew's series already had the fix. Sorry about the noise and please ignore this.

Thanks,
Gavin

_______________________________________________
kvmarm mailing list
[email protected]
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm