aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/kvm/kvm_main.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/kvm/kvm_main.c')
-rw-r--r--drivers/kvm/kvm_main.c26
1 files changed, 6 insertions, 20 deletions
diff --git a/drivers/kvm/kvm_main.c b/drivers/kvm/kvm_main.c
index 2b3736e7483c..e0f20d020281 100644
--- a/drivers/kvm/kvm_main.c
+++ b/drivers/kvm/kvm_main.c
@@ -1434,7 +1434,7 @@ static void kvm_sched_out(struct preempt_notifier *pn,
1434 kvm_arch_vcpu_put(vcpu); 1434 kvm_arch_vcpu_put(vcpu);
1435} 1435}
1436 1436
1437int kvm_init(struct kvm_x86_ops *ops, unsigned int vcpu_size, 1437int kvm_init(void *opaque, unsigned int vcpu_size,
1438 struct module *module) 1438 struct module *module)
1439{ 1439{
1440 int r; 1440 int r;
@@ -1446,7 +1446,9 @@ int kvm_init(struct kvm_x86_ops *ops, unsigned int vcpu_size,
1446 1446
1447 kvm_init_debug(); 1447 kvm_init_debug();
1448 1448
1449 kvm_arch_init(); 1449 r = kvm_arch_init(opaque);
1450 if (r)
1451 goto out4;
1450 1452
1451 bad_page = alloc_page(GFP_KERNEL | __GFP_ZERO); 1453 bad_page = alloc_page(GFP_KERNEL | __GFP_ZERO);
1452 1454
@@ -1455,22 +1457,6 @@ int kvm_init(struct kvm_x86_ops *ops, unsigned int vcpu_size,
1455 goto out; 1457 goto out;
1456 } 1458 }
1457 1459
1458 if (kvm_x86_ops) {
1459 printk(KERN_ERR "kvm: already loaded the other module\n");
1460 return -EEXIST;
1461 }
1462
1463 if (!ops->cpu_has_kvm_support()) {
1464 printk(KERN_ERR "kvm: no hardware support\n");
1465 return -EOPNOTSUPP;
1466 }
1467 if (ops->disabled_by_bios()) {
1468 printk(KERN_ERR "kvm: disabled by bios\n");
1469 return -EOPNOTSUPP;
1470 }
1471
1472 kvm_x86_ops = ops;
1473
1474 r = kvm_arch_hardware_setup(); 1460 r = kvm_arch_hardware_setup();
1475 if (r < 0) 1461 if (r < 0)
1476 goto out; 1462 goto out;
@@ -1534,7 +1520,7 @@ out_free_1:
1534out_free_0: 1520out_free_0:
1535 kvm_arch_hardware_unsetup(); 1521 kvm_arch_hardware_unsetup();
1536out: 1522out:
1537 kvm_x86_ops = NULL; 1523 kvm_arch_exit();
1538 kvm_exit_debug(); 1524 kvm_exit_debug();
1539 kvm_mmu_module_exit(); 1525 kvm_mmu_module_exit();
1540out4: 1526out4:
@@ -1552,7 +1538,7 @@ void kvm_exit(void)
1552 unregister_cpu_notifier(&kvm_cpu_notifier); 1538 unregister_cpu_notifier(&kvm_cpu_notifier);
1553 on_each_cpu(hardware_disable, NULL, 0, 1); 1539 on_each_cpu(hardware_disable, NULL, 0, 1);
1554 kvm_arch_hardware_unsetup(); 1540 kvm_arch_hardware_unsetup();
1555 kvm_x86_ops = NULL; 1541 kvm_arch_exit();
1556 kvm_exit_debug(); 1542 kvm_exit_debug();
1557 __free_page(bad_page); 1543 __free_page(bad_page);
1558 kvm_mmu_module_exit(); 1544 kvm_mmu_module_exit();