KVM: x86/pmu: Don't tell userspace to save PMU MSRs if PMU is disabled
authorSean Christopherson <seanjc@google.com>
Tue, 24 Jan 2023 23:49:03 +0000 (23:49 +0000)
committerSean Christopherson <seanjc@google.com>
Fri, 27 Jan 2023 02:03:42 +0000 (18:03 -0800)
commitc3531edc79a7adbe4451d34084e8bf227c022872
tree7bd54629ac1e9333760c2a888dc20be02d3faa65
parent2374b7310b662e29e3468d510bfaded60fbae99c
KVM: x86/pmu: Don't tell userspace to save PMU MSRs if PMU is disabled

Omit all PMU MSRs from the "MSRs to save" list if the PMU is disabled so
that userspace doesn't waste time saving and restoring dummy values.  KVM
provides "error" semantics (read zeros, drop writes) for such known-but-
unsupported MSRs, i.e. has fudged around this issue for quite some time.
Keep the "error" semantics as-is for now, the logic will be cleaned up in
a separate patch.

Cc: Aaron Lewis <aaronlewis@google.com>
Cc: Weijiang Yang <weijiang.yang@intel.com>
Link: https://lore.kernel.org/r/20230124234905.3774678-5-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
arch/x86/kvm/x86.c