Skip to content

Commit a306425

Browse files
committed
KVM: x86: Update comments about MSR lists exposed to userspace
Refresh comments about msrs_to_save, emulated_msrs, and msr_based_features to remove stale references left behind by commit 2374b73 (KVM: x86/pmu: Use separate array for defining "PMU MSRs to save"), and to better reflect the current reality, e.g. emulated_msrs is no longer just for MSRs that are "kvm-specific". Reported-by: Binbin Wu <binbin.wu@linux.intel.com> Link: https://lore.kernel.org/r/20230607004636.1421424-1-seanjc@google.com Signed-off-by: Sean Christopherson <seanjc@google.com>
1 parent e12fa4b commit a306425

File tree

1 file changed

+13
-14
lines changed

1 file changed

+13
-14
lines changed

arch/x86/kvm/x86.c

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1423,15 +1423,14 @@ int kvm_emulate_rdpmc(struct kvm_vcpu *vcpu)
14231423
EXPORT_SYMBOL_GPL(kvm_emulate_rdpmc);
14241424

14251425
/*
1426-
* List of msr numbers which we expose to userspace through KVM_GET_MSRS
1427-
* and KVM_SET_MSRS, and KVM_GET_MSR_INDEX_LIST.
1428-
*
1429-
* The three MSR lists(msrs_to_save, emulated_msrs, msr_based_features)
1430-
* extract the supported MSRs from the related const lists.
1431-
* msrs_to_save is selected from the msrs_to_save_all to reflect the
1432-
* capabilities of the host cpu. This capabilities test skips MSRs that are
1433-
* kvm-specific. Those are put in emulated_msrs_all; filtering of emulated_msrs
1434-
* may depend on host virtualization features rather than host cpu features.
1426+
* The three MSR lists(msrs_to_save, emulated_msrs, msr_based_features) track
1427+
* the set of MSRs that KVM exposes to userspace through KVM_GET_MSRS,
1428+
* KVM_SET_MSRS, and KVM_GET_MSR_INDEX_LIST. msrs_to_save holds MSRs that
1429+
* require host support, i.e. should be probed via RDMSR. emulated_msrs holds
1430+
* MSRs that KVM emulates without strictly requiring host support.
1431+
* msr_based_features holds MSRs that enumerate features, i.e. are effectively
1432+
* CPUID leafs. Note, msr_based_features isn't mutually exclusive with
1433+
* msrs_to_save and emulated_msrs.
14351434
*/
14361435

14371436
static const u32 msrs_to_save_base[] = {
@@ -1527,11 +1526,11 @@ static const u32 emulated_msrs_all[] = {
15271526
MSR_IA32_UCODE_REV,
15281527

15291528
/*
1530-
* The following list leaves out MSRs whose values are determined
1531-
* by arch/x86/kvm/vmx/nested.c based on CPUID or other MSRs.
1532-
* We always support the "true" VMX control MSRs, even if the host
1533-
* processor does not, so I am putting these registers here rather
1534-
* than in msrs_to_save_all.
1529+
* KVM always supports the "true" VMX control MSRs, even if the host
1530+
* does not. The VMX MSRs as a whole are considered "emulated" as KVM
1531+
* doesn't strictly require them to exist in the host (ignoring that
1532+
* KVM would refuse to load in the first place if the core set of MSRs
1533+
* aren't supported).
15351534
*/
15361535
MSR_IA32_VMX_BASIC,
15371536
MSR_IA32_VMX_TRUE_PINBASED_CTLS,

0 commit comments

Comments
 (0)