Commit 22dc1d00 authored by Joerg Roedel's avatar Joerg Roedel Committed by Greg Kroah-Hartman

KVM: x86: Add callback to let modules decide over some supported cpuid bits

This patch adds the get_supported_cpuid callback to
kvm_x86_ops. It will be used in do_cpuid_ent to delegate the
decission about some supported cpuid bits to the
architecture modules.

Cc: stable@kernel.org
Signed-off-by: default avatarJoerg Roedel <joerg.roedel@amd.com>
Signed-off-by: default avatarAvi Kivity <avi@redhat.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>

(Cherry-picked from commit d4330ef2)
parent 12f08e96
...@@ -541,6 +541,8 @@ struct kvm_x86_ops { ...@@ -541,6 +541,8 @@ struct kvm_x86_ops {
int (*get_lpage_level)(void); int (*get_lpage_level)(void);
bool (*rdtscp_supported)(void); bool (*rdtscp_supported)(void);
void (*set_supported_cpuid)(u32 func, struct kvm_cpuid_entry2 *entry);
const struct trace_print_flags *exit_reasons_str; const struct trace_print_flags *exit_reasons_str;
}; };
......
...@@ -2907,6 +2907,10 @@ static void svm_cpuid_update(struct kvm_vcpu *vcpu) ...@@ -2907,6 +2907,10 @@ static void svm_cpuid_update(struct kvm_vcpu *vcpu)
{ {
} }
static void svm_set_supported_cpuid(u32 func, struct kvm_cpuid_entry2 *entry)
{
}
static const struct trace_print_flags svm_exit_reasons_str[] = { static const struct trace_print_flags svm_exit_reasons_str[] = {
{ SVM_EXIT_READ_CR0, "read_cr0" }, { SVM_EXIT_READ_CR0, "read_cr0" },
{ SVM_EXIT_READ_CR3, "read_cr3" }, { SVM_EXIT_READ_CR3, "read_cr3" },
...@@ -3051,6 +3055,8 @@ static struct kvm_x86_ops svm_x86_ops = { ...@@ -3051,6 +3055,8 @@ static struct kvm_x86_ops svm_x86_ops = {
.cpuid_update = svm_cpuid_update, .cpuid_update = svm_cpuid_update,
.rdtscp_supported = svm_rdtscp_supported, .rdtscp_supported = svm_rdtscp_supported,
.set_supported_cpuid = svm_set_supported_cpuid,
}; };
static int __init svm_init(void) static int __init svm_init(void)
......
...@@ -4115,6 +4115,10 @@ static void vmx_cpuid_update(struct kvm_vcpu *vcpu) ...@@ -4115,6 +4115,10 @@ static void vmx_cpuid_update(struct kvm_vcpu *vcpu)
} }
} }
static void vmx_set_supported_cpuid(u32 func, struct kvm_cpuid_entry2 *entry)
{
}
static struct kvm_x86_ops vmx_x86_ops = { static struct kvm_x86_ops vmx_x86_ops = {
.cpu_has_kvm_support = cpu_has_kvm_support, .cpu_has_kvm_support = cpu_has_kvm_support,
.disabled_by_bios = vmx_disabled_by_bios, .disabled_by_bios = vmx_disabled_by_bios,
...@@ -4186,6 +4190,8 @@ static struct kvm_x86_ops vmx_x86_ops = { ...@@ -4186,6 +4190,8 @@ static struct kvm_x86_ops vmx_x86_ops = {
.cpuid_update = vmx_cpuid_update, .cpuid_update = vmx_cpuid_update,
.rdtscp_supported = vmx_rdtscp_supported, .rdtscp_supported = vmx_rdtscp_supported,
.set_supported_cpuid = vmx_set_supported_cpuid,
}; };
static int __init vmx_init(void) static int __init vmx_init(void)
......
...@@ -1917,6 +1917,9 @@ static void do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function, ...@@ -1917,6 +1917,9 @@ static void do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function,
entry->ecx &= kvm_supported_word6_x86_features; entry->ecx &= kvm_supported_word6_x86_features;
break; break;
} }
kvm_x86_ops->set_supported_cpuid(function, entry);
put_cpu(); put_cpu();
} }
......
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