diff options
author | Joerg Roedel <joerg.roedel@amd.com> | 2010-04-22 06:33:11 -0400 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2010-05-17 05:19:23 -0400 |
commit | d4330ef2fb2236a1e3a176f0f68360f4c0a8661b (patch) | |
tree | 5b5c8776dd370fc2c12a57c5ed4565f59ecb45a6 /arch/x86 | |
parent | 228070b1b31abc16c331b57bf965101c6eb1d167 (diff) |
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: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/x86')
-rw-r--r-- | arch/x86/include/asm/kvm_host.h | 2 | ||||
-rw-r--r-- | arch/x86/kvm/svm.c | 6 | ||||
-rw-r--r-- | arch/x86/kvm/vmx.c | 6 | ||||
-rw-r--r-- | arch/x86/kvm/x86.c | 3 |
4 files changed, 17 insertions, 0 deletions
diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h index d47d087568fe..357573af974f 100644 --- a/arch/x86/include/asm/kvm_host.h +++ b/arch/x86/include/asm/kvm_host.h | |||
@@ -528,6 +528,8 @@ struct kvm_x86_ops { | |||
528 | int (*get_lpage_level)(void); | 528 | int (*get_lpage_level)(void); |
529 | bool (*rdtscp_supported)(void); | 529 | bool (*rdtscp_supported)(void); |
530 | 530 | ||
531 | void (*set_supported_cpuid)(u32 func, struct kvm_cpuid_entry2 *entry); | ||
532 | |||
531 | const struct trace_print_flags *exit_reasons_str; | 533 | const struct trace_print_flags *exit_reasons_str; |
532 | }; | 534 | }; |
533 | 535 | ||
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index b10d1630c203..0fa2035bd8e7 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c | |||
@@ -3152,6 +3152,10 @@ static void svm_cpuid_update(struct kvm_vcpu *vcpu) | |||
3152 | { | 3152 | { |
3153 | } | 3153 | } |
3154 | 3154 | ||
3155 | static void svm_set_supported_cpuid(u32 func, struct kvm_cpuid_entry2 *entry) | ||
3156 | { | ||
3157 | } | ||
3158 | |||
3155 | static const struct trace_print_flags svm_exit_reasons_str[] = { | 3159 | static const struct trace_print_flags svm_exit_reasons_str[] = { |
3156 | { SVM_EXIT_READ_CR0, "read_cr0" }, | 3160 | { SVM_EXIT_READ_CR0, "read_cr0" }, |
3157 | { SVM_EXIT_READ_CR3, "read_cr3" }, | 3161 | { SVM_EXIT_READ_CR3, "read_cr3" }, |
@@ -3297,6 +3301,8 @@ static struct kvm_x86_ops svm_x86_ops = { | |||
3297 | .cpuid_update = svm_cpuid_update, | 3301 | .cpuid_update = svm_cpuid_update, |
3298 | 3302 | ||
3299 | .rdtscp_supported = svm_rdtscp_supported, | 3303 | .rdtscp_supported = svm_rdtscp_supported, |
3304 | |||
3305 | .set_supported_cpuid = svm_set_supported_cpuid, | ||
3300 | }; | 3306 | }; |
3301 | 3307 | ||
3302 | static int __init svm_init(void) | 3308 | static int __init svm_init(void) |
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 54c0035a63f0..9f8532b1fa9a 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c | |||
@@ -4119,6 +4119,10 @@ static void vmx_cpuid_update(struct kvm_vcpu *vcpu) | |||
4119 | } | 4119 | } |
4120 | } | 4120 | } |
4121 | 4121 | ||
4122 | static void vmx_set_supported_cpuid(u32 func, struct kvm_cpuid_entry2 *entry) | ||
4123 | { | ||
4124 | } | ||
4125 | |||
4122 | static struct kvm_x86_ops vmx_x86_ops = { | 4126 | static struct kvm_x86_ops vmx_x86_ops = { |
4123 | .cpu_has_kvm_support = cpu_has_kvm_support, | 4127 | .cpu_has_kvm_support = cpu_has_kvm_support, |
4124 | .disabled_by_bios = vmx_disabled_by_bios, | 4128 | .disabled_by_bios = vmx_disabled_by_bios, |
@@ -4191,6 +4195,8 @@ static struct kvm_x86_ops vmx_x86_ops = { | |||
4191 | .cpuid_update = vmx_cpuid_update, | 4195 | .cpuid_update = vmx_cpuid_update, |
4192 | 4196 | ||
4193 | .rdtscp_supported = vmx_rdtscp_supported, | 4197 | .rdtscp_supported = vmx_rdtscp_supported, |
4198 | |||
4199 | .set_supported_cpuid = vmx_set_supported_cpuid, | ||
4194 | }; | 4200 | }; |
4195 | 4201 | ||
4196 | static int __init vmx_init(void) | 4202 | static int __init vmx_init(void) |
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 848c814e8c3c..6e6434332f21 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c | |||
@@ -1960,6 +1960,9 @@ static void do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function, | |||
1960 | entry->ecx &= kvm_supported_word6_x86_features; | 1960 | entry->ecx &= kvm_supported_word6_x86_features; |
1961 | break; | 1961 | break; |
1962 | } | 1962 | } |
1963 | |||
1964 | kvm_x86_ops->set_supported_cpuid(function, entry); | ||
1965 | |||
1963 | put_cpu(); | 1966 | put_cpu(); |
1964 | } | 1967 | } |
1965 | 1968 | ||