summaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/vmx
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2022-06-01 09:21:19 +0200
committerPaolo Bonzini <pbonzini@redhat.com>2022-06-08 10:48:37 +0200
commitbfb088d9fb5abdd3fbf00bae9abdfee8b92265aa (patch)
treef1a055b8beaaaf87004ce2fdf8a72a8494ee168f /arch/x86/kvm/vmx
parentKVM: x86/pmu: Ignore pmu->global_ctrl check if vPMU doesn't support global_ctrl (diff)
downloadlinux-bfb088d9fb5abdd3fbf00bae9abdfee8b92265aa.tar.xz
linux-bfb088d9fb5abdd3fbf00bae9abdfee8b92265aa.zip
KVM: vmx, pmu: accept 0 for host-initiated write to MSR_IA32_DS_AREA
Whenever an MSR is part of KVM_GET_MSR_INDEX_LIST, as is the case for MSR_IA32_DS_AREA, it has to be always settable with KVM_SET_MSR. Accept a zero value for these MSRs to obey the contract. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'arch/x86/kvm/vmx')
-rw-r--r--arch/x86/kvm/vmx/pmu_intel.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/arch/x86/kvm/vmx/pmu_intel.c b/arch/x86/kvm/vmx/pmu_intel.c
index 2fc90080dcce..5bc7cfc753fc 100644
--- a/arch/x86/kvm/vmx/pmu_intel.c
+++ b/arch/x86/kvm/vmx/pmu_intel.c
@@ -443,6 +443,8 @@ static int intel_pmu_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
}
break;
case MSR_IA32_DS_AREA:
+ if (msr_info->host_initiated && data && !guest_cpuid_has(vcpu, X86_FEATURE_DS))
+ return 1;
if (is_noncanonical_address(data, vcpu))
return 1;
pmu->ds_area = data;