Commit d59679db authored by Wanpeng Li's avatar Wanpeng Li Committed by Stefan Bader

KVM: X86: Introduce kvm_get_msr_feature()

Introduce kvm_get_msr_feature() to handle the msrs which are supported
by different vendors and sharing the same emulation logic.

Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Radim Krčmář <rkrcmar@redhat.com>
Cc: Liran Alon <liran.alon@oracle.com>
Cc: Nadav Amit <nadav.amit@gmail.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: default avatarWanpeng Li <wanpengli@tencent.com>
Reviewed-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
Signed-off-by: default avatarRadim Krčmář <rkrcmar@redhat.com>

CVE-2018-3620
CVE-2018-3646

(cherry picked from commit 66421c1e)
Signed-off-by: default avatarTyler Hicks <tyhicks@canonical.com>
Signed-off-by: default avatarStefan Bader <stefan.bader@canonical.com>
parent b8d3ddd8
......@@ -1002,13 +1002,25 @@ static u32 msr_based_features[] = {
static unsigned int num_msr_based_features;
static int kvm_get_msr_feature(struct kvm_msr_entry *msr)
{
switch (msr->index) {
default:
if (kvm_x86_ops->get_msr_feature(msr))
return 1;
}
return 0;
}
static int do_get_msr_feature(struct kvm_vcpu *vcpu, unsigned index, u64 *data)
{
struct kvm_msr_entry msr;
int r;
msr.index = index;
if (kvm_x86_ops->get_msr_feature(&msr))
return 1;
r = kvm_get_msr_feature(&msr);
if (r)
return r;
*data = msr.data;
......@@ -4170,7 +4182,7 @@ static void kvm_init_msr_list(void)
struct kvm_msr_entry msr;
msr.index = msr_based_features[i];
if (kvm_x86_ops->get_msr_feature(&msr))
if (kvm_get_msr_feature(&msr))
continue;
if (j < i)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment