Skip to contentSkip to conversation

KVM: SVM: add rdmsr support for AMD event registers

PATCH In review Wei Huang 1 participant 2 messages Aug 13, 2014

Subsystems (3)
lore
Share & tools
lore

Wei Huang

author
#0 lore raw

PATCH 1/1 KVM: SVM: add rdmsr support for AMD event registers

Current KVM only supports RDMSR for K7_EVNTSEL0 and K7_EVNTSEL0 MSRs. Reading the rest MSRs will trigger KVM to inject #GP into guest VM. This causes a warning message "Failed to access perfctr msr (MSR c0010001 is ffffffffffffffff)" on AMD host. This patch adds RDMSR support for all K7_EVNTSELn and K7_EVNTSELn registers and thus supresses the warning message.

---
 arch/x86/kvm/x86.c | 6 ++++++
 1 file changed, 6 insertions(+)
arch/x86/kvm/x86.c +6 -0
index ef432f8..3f10ca2 100644
@@ -2399,7 +2399,13 @@ int kvm_get_msr_common(struct kvm_vcpu *vcpu, u32 msr, u64 *pdata)
 	case MSR_K7_HWCR:
 	case MSR_VM_HSAVE_PA:
 	case MSR_K7_EVNTSEL0:
+	case MSR_K7_EVNTSEL1:
+	case MSR_K7_EVNTSEL2:
+	case MSR_K7_EVNTSEL3:
 	case MSR_K7_PERFCTR0:
+	case MSR_K7_PERFCTR1:
+	case MSR_K7_PERFCTR2:
+	case MSR_K7_PERFCTR3:
 	case MSR_K8_INT_PENDING_MSG:
 	case MSR_AMD64_NB_CFG:
 	case MSR_FAM10H_MMIO_CONF_BASE:
Signature · 1 line
1.8.3.1
author
#1 lore raw

Wrong one, sorry. Please discard this one. Updated one will follow.

-Wei

Quoted 31 lines · Wei Huang

Current KVM only supports RDMSR for K7_EVNTSEL0 and K7_EVNTSEL0 MSRs. Reading the rest MSRs will trigger KVM to inject #GP into guest VM. This causes a warning message "Failed to access perfctr msr (MSR c0010001 is ffffffffffffffff)" on AMD host. This patch adds RDMSR support for all K7_EVNTSELn and K7_EVNTSELn registers and thus supresses the warning message.

---
  arch/x86/kvm/x86.c | 6 ++++++
  1 file changed, 6 insertions(+)
arch/x86/kvm/x86.c +6 -0
index ef432f8..3f10ca2 100644
@@ -2399,7 +2399,13 @@ int kvm_get_msr_common(struct kvm_vcpu *vcpu, u32 msr, u64 *pdata)
  	case MSR_K7_HWCR:
  	case MSR_VM_HSAVE_PA:
  	case MSR_K7_EVNTSEL0:
+	case MSR_K7_EVNTSEL1:
+	case MSR_K7_EVNTSEL2:
+	case MSR_K7_EVNTSEL3:
  	case MSR_K7_PERFCTR0:
+	case MSR_K7_PERFCTR1:
+	case MSR_K7_PERFCTR2:
+	case MSR_K7_PERFCTR3:
  	case MSR_K8_INT_PENDING_MSG:
  	case MSR_AMD64_NB_CFG:
  	case MSR_FAM10H_MMIO_CONF_BASE: