KVM: x86: Handle PERF_CAPABILITIES in common x86's kvm_get_msr_feature()
authorSean Christopherson <seanjc@google.com>
Thu, 6 Oct 2022 00:03:13 +0000 (00:03 +0000)
committerPaolo Bonzini <pbonzini@redhat.com>
Wed, 9 Nov 2022 17:31:12 +0000 (12:31 -0500)
Handle PERF_CAPABILITIES directly in kvm_get_msr_feature() now that the
supported value is available in kvm_caps.

No functional change intended.

Signed-off-by: Sean Christopherson <seanjc@google.com>
Message-Id: <20221006000314.73240-8-seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/svm/svm.c
arch/x86/kvm/vmx/vmx.c
arch/x86/kvm/x86.c

index d15f193..3fc8e49 100644 (file)
@@ -2713,9 +2713,6 @@ static int svm_get_msr_feature(struct kvm_msr_entry *msr)
                if (boot_cpu_has(X86_FEATURE_LFENCE_RDTSC))
                        msr->data |= MSR_F10H_DECFG_LFENCE_SERIALIZE;
                break;
-       case MSR_IA32_PERF_CAPABILITIES:
-               msr->data = kvm_caps.supported_perf_cap;
-               return 0;
        default:
                return KVM_MSR_RET_INVALID;
        }
index 3fec439..7a7e14d 100644 (file)
@@ -1849,9 +1849,6 @@ static int vmx_get_msr_feature(struct kvm_msr_entry *msr)
                if (!nested)
                        return 1;
                return vmx_get_vmx_msr(&vmcs_config.nested, msr->index, &msr->data);
-       case MSR_IA32_PERF_CAPABILITIES:
-               msr->data = kvm_caps.supported_perf_cap;
-               return 0;
        default:
                return KVM_MSR_RET_INVALID;
        }
index 6ce7c80..6f8a370 100644 (file)
@@ -1648,6 +1648,9 @@ static int kvm_get_msr_feature(struct kvm_msr_entry *msr)
        case MSR_IA32_ARCH_CAPABILITIES:
                msr->data = kvm_get_arch_capabilities();
                break;
+       case MSR_IA32_PERF_CAPABILITIES:
+               msr->data = kvm_caps.supported_perf_cap;
+               break;
        case MSR_IA32_UCODE_REV:
                rdmsrl_safe(msr->index, &msr->data);
                break;