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>
This commit is contained in:
Yang, Sheng
2007-07-31 14:23:01 +03:00
committed by Avi Kivity
parent 39214915f5
commit 002c7f7c32
4 changed files with 50 additions and 18 deletions

View File

@@ -3102,6 +3102,7 @@ int kvm_init_arch(struct kvm_arch_ops *ops, unsigned int vcpu_size,
struct module *module)
{
int r;
int cpu;
if (kvm_arch_ops) {
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,
if (r < 0)
goto out;
for_each_online_cpu(cpu) {
smp_call_function_single(cpu,
kvm_arch_ops->check_processor_compatibility,
&r, 0, 1);
if (r < 0)
goto out_free_0;
}
on_each_cpu(hardware_enable, NULL, 0, 1);
r = register_cpu_notifier(&kvm_cpu_notifier);
if (r)
@@ -3169,6 +3178,7 @@ out_free_2:
unregister_cpu_notifier(&kvm_cpu_notifier);
out_free_1:
on_each_cpu(hardware_disable, NULL, 0, 1);
out_free_0:
kvm_arch_ops->hardware_unsetup();
out:
kvm_arch_ops = NULL;