diff options
author | Yang, Sheng <sheng.yang@intel.com> | 2007-07-31 07:23:01 -0400 |
---|---|---|
committer | Avi Kivity <avi@qumranet.com> | 2007-10-13 04:18:22 -0400 |
commit | 002c7f7c32a6123f0894d7d579ffae8e98911830 (patch) | |
tree | 91d46dd1d6f04f25e4f658eb8620fe69c1557c17 /drivers/kvm/kvm_main.c | |
parent | 39214915f50f6ac2350355f2db63910d968fa790 (diff) |
KVM: VMX: Add cpu consistency check
All the physical CPUs on the board should support the same VMX feature
set. Add check_processor_compatibility to kvm_arch_ops for the consistency
check.
Signed-off-by: Sheng Yang <sheng.yang@intel.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'drivers/kvm/kvm_main.c')
-rw-r--r-- | drivers/kvm/kvm_main.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/kvm/kvm_main.c b/drivers/kvm/kvm_main.c index 5dee3024579d..2be6b1ca1a06 100644 --- a/drivers/kvm/kvm_main.c +++ b/drivers/kvm/kvm_main.c | |||
@@ -3102,6 +3102,7 @@ int kvm_init_arch(struct kvm_arch_ops *ops, unsigned int vcpu_size, | |||
3102 | struct module *module) | 3102 | struct module *module) |
3103 | { | 3103 | { |
3104 | int r; | 3104 | int r; |
3105 | int cpu; | ||
3105 | 3106 | ||
3106 | if (kvm_arch_ops) { | 3107 | if (kvm_arch_ops) { |
3107 | printk(KERN_ERR "kvm: already loaded the other module\n"); | 3108 | printk(KERN_ERR "kvm: already loaded the other module\n"); |
@@ -3123,6 +3124,14 @@ int kvm_init_arch(struct kvm_arch_ops *ops, unsigned int vcpu_size, | |||
3123 | if (r < 0) | 3124 | if (r < 0) |
3124 | goto out; | 3125 | goto out; |
3125 | 3126 | ||
3127 | for_each_online_cpu(cpu) { | ||
3128 | smp_call_function_single(cpu, | ||
3129 | kvm_arch_ops->check_processor_compatibility, | ||
3130 | &r, 0, 1); | ||
3131 | if (r < 0) | ||
3132 | goto out_free_0; | ||
3133 | } | ||
3134 | |||
3126 | on_each_cpu(hardware_enable, NULL, 0, 1); | 3135 | on_each_cpu(hardware_enable, NULL, 0, 1); |
3127 | r = register_cpu_notifier(&kvm_cpu_notifier); | 3136 | r = register_cpu_notifier(&kvm_cpu_notifier); |
3128 | if (r) | 3137 | if (r) |
@@ -3169,6 +3178,7 @@ out_free_2: | |||
3169 | unregister_cpu_notifier(&kvm_cpu_notifier); | 3178 | unregister_cpu_notifier(&kvm_cpu_notifier); |
3170 | out_free_1: | 3179 | out_free_1: |
3171 | on_each_cpu(hardware_disable, NULL, 0, 1); | 3180 | on_each_cpu(hardware_disable, NULL, 0, 1); |
3181 | out_free_0: | ||
3172 | kvm_arch_ops->hardware_unsetup(); | 3182 | kvm_arch_ops->hardware_unsetup(); |
3173 | out: | 3183 | out: |
3174 | kvm_arch_ops = NULL; | 3184 | kvm_arch_ops = NULL; |