Skip to contentSkip to conversation

KVM: x86: Hide IA32_PLATFORM_DCA_CAP[31:0] from the guest

PATCH Applied Jim Mattson 2 participants 2 messages Sep 22, 2022 – Sep 27, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 KVM: x86: Hide IA32_PLATFORM_DCA_CAP[31:0] from the guest

The only thing reported by CPUID.9 is the value of IA32_PLATFORM_DCA_CAP[31:0] in EAX. This MSR doesn't even exist in the guest, since CPUID.1:ECX.DCA[bit 18] is clear in the guest.

Clear CPUID.9 in KVM_GET_SUPPORTED_CPUID.

Fixes 24c82e576b78 ("KVM: Sanitize cpuid")
---
 arch/x86/kvm/cpuid.c | 2 --
 1 file changed, 2 deletions(-)
arch/x86/kvm/cpuid.c +0 -2
index 75dcf7a72605..675eb9ae3948 100644
@@ -897,8 +897,6 @@ static inline int __do_cpuid_func(struct kvm_cpuid_array *array, u32 function)
 			entry->edx = 0;
 		}
 		break;
-	case 9:
-		break;
 	case 0xa: { /* Architectural Performance Monitoring */
 		union cpuid10_eax eax;
 		union cpuid10_edx edx;
Signature · 1 line
2.37.3.998.g577e59143f-goog
maintainer Applied
#1 lore raw
Quoted 17 lines · Jim Mattson

The only thing reported by CPUID.9 is the value of IA32_PLATFORM_DCA_CAP[31:0] in EAX. This MSR doesn't even exist in the guest, since CPUID.1:ECX.DCA[bit 18] is clear in the guest.

Clear CPUID.9 in KVM_GET_SUPPORTED_CPUID.

Fixes 24c82e576b78 ("KVM: Sanitize cpuid")
---
  arch/x86/kvm/cpuid.c | 2 --
  1 file changed, 2 deletions(-)
arch/x86/kvm/cpuid.c +0 -0
index 75dcf7a72605..675eb9ae3948 100644

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

Quoted 8 lines
arch/x86/kvm/cpuid.c +0 -2
@@ -897,8 +897,6 @@ static inline int __do_cpuid_func(struct kvm_cpuid_array *array, u32 function)
  			entry->edx = 0;
  		}
  		break;
-	case 9:
-		break;
  	case 0xa: { /* Architectural Performance Monitoring */
  		union cpuid10_eax eax;
  		union cpuid10_edx edx;

Queued, thanks.

Paolo