Skip to contentSkip to conversation

KVM: x86/pmu: Clear anythread deprecated bit when 0xa leaf is unsupported on the SVM

PATCH Applied Like Xu 2 participants 2 messages Jun 28, 2021 – Jul 8, 2021

Subsystems (3)
lore
Share & tools
lore

Like Xu

author
#0 lore raw

PATCH 1/1 KVM: x86/pmu: Clear anythread deprecated bit when 0xa leaf is unsupported on the SVM

The AMD platform does not support the functions Ah CPUID leaf. The returned results for this entry should all remain zero just like the native does:

AMD host:
0x0000000a 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
(uncanny) AMD guest:
0x0000000a 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00008000

Fixes cadbaa039b99 ("perf/x86/intel: Make anythread filter support conditional")
---
 arch/x86/kvm/cpuid.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
arch/x86/kvm/cpuid.c +2 -1
index 0edda1fc4fe7..b1808e4fc7d5 100644
@@ -765,7 +765,8 @@ static inline int __do_cpuid_func(struct kvm_cpuid_array *array, u32 function)
 
 		edx.split.num_counters_fixed = min(cap.num_counters_fixed, MAX_FIXED_COUNTERS);
 		edx.split.bit_width_fixed = cap.bit_width_fixed;
-		edx.split.anythread_deprecated = 1;
+		if (cap.version)
+			edx.split.anythread_deprecated = 1;
 		edx.split.reserved1 = 0;
 		edx.split.reserved2 = 0;
 
Signature · 1 line
2.32.0
maintainer Applied
#1 lore raw
Quoted 20 lines · Like Xu

The AMD platform does not support the functions Ah CPUID leaf. The returned results for this entry should all remain zero just like the native does:

AMD host:

    0x0000000a 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
(uncanny) AMD guest:
    0x0000000a 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00008000
Fixes cadbaa039b99 ("perf/x86/intel: Make anythread filter support conditional")
---
  arch/x86/kvm/cpuid.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
arch/x86/kvm/cpuid.c +0 -0
index 0edda1fc4fe7..b1808e4fc7d5 100644

arch/x86/kvm/cpuid.c static inline int __do_cpuid_func(struct kvm_cpuid_array *array, u32 function) · line 772

Quoted 9 lines
arch/x86/kvm/cpuid.c +2 -1
@@ -765,7 +765,8 @@ static inline int __do_cpuid_func(struct kvm_cpuid_array *array, u32 function)
 
  		edx.split.num_counters_fixed = min(cap.num_counters_fixed, MAX_FIXED_COUNTERS);
  		edx.split.bit_width_fixed = cap.bit_width_fixed;
-		edx.split.anythread_deprecated = 1;
+		if (cap.version)
+			edx.split.anythread_deprecated = 1;
  		edx.split.reserved1 = 0;
  		edx.split.reserved2 = 0;
 

Queued, thanks.

Paolo