[PATCH 0/2] KVM: vmx, pmu: respect KVM_GET_MSR_INDEX_LIST/KVM_SET_MSR contracts

From: Paolo Bonzini
Date: Tue May 31 2022 - 13:55:00 EST


Whenever an MSR is part of KVM_GET_MSR_INDEX_LIST, it has to be always
settable with KVM_SET_MSR. Right now MSR_IA32_DS_AREA, MSR_ARCH_LBR_DEPTH
and MSR_ARCH_LBR_CTL are not fulfilling this, resulting in selftests
failures on <=Skylake processors.

Fix this, and in general allow host-initiated writes of a default
value for all PMU MSRs

Paolo Bonzini (2):
KVM: vmx, pmu: accept 0 for absent MSRs when host-initiated
KVM: x86: always allow host-initiated writes to PMU MSRs

arch/x86/kvm/pmu.c | 4 ++--
arch/x86/kvm/pmu.h | 4 ++--
arch/x86/kvm/svm/pmu.c | 2 +-
arch/x86/kvm/vmx/pmu_intel.c | 42 +++++++++++++++++++++++++-----------
arch/x86/kvm/x86.c | 10 ++++-----
5 files changed, 39 insertions(+), 23 deletions(-)

--
2.31.1