summaryrefslogtreecommitdiffstats
path: root/drivers/kvm/kvm_main.c
diff options
context:
space:
mode:
authorZhang Xiantao <xiantao.zhang@intel.com>2007-11-14 20:40:21 +0800
committerAvi Kivity <avi@qumranet.com>2008-01-30 17:53:03 +0200
commitf8c16bbaa9e14b309ffcf29cac0ea377a35b0dd2 (patch)
treefde560989f7c3aa77d0f869a90084369c72d7dc4 /drivers/kvm/kvm_main.c
parentcb498ea2ce1d3f3c0bc0a2522241dca10263e437 (diff)
downloadblackbird-op-linux-f8c16bbaa9e14b309ffcf29cac0ea377a35b0dd2.tar.gz
blackbird-op-linux-f8c16bbaa9e14b309ffcf29cac0ea377a35b0dd2.zip
KVM: Portability: Move x86 specific code from kvm_init() to kvm_arch()
Signed-off-by: Zhang Xiantao <xiantao.zhang@intel.com> Acked-by: Carsten Otte <cotte@de.ibm.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
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,
kvm_arch_vcpu_put(vcpu);
}
-int kvm_init(struct kvm_x86_ops *ops, unsigned int vcpu_size,
+int kvm_init(void *opaque, unsigned int vcpu_size,
struct module *module)
{
int r;
@@ -1446,7 +1446,9 @@ int kvm_init(struct kvm_x86_ops *ops, unsigned int vcpu_size,
kvm_init_debug();
- kvm_arch_init();
+ r = kvm_arch_init(opaque);
+ if (r)
+ goto out4;
bad_page = alloc_page(GFP_KERNEL | __GFP_ZERO);
@@ -1455,22 +1457,6 @@ int kvm_init(struct kvm_x86_ops *ops, unsigned int vcpu_size,
goto out;
}
- if (kvm_x86_ops) {
- printk(KERN_ERR "kvm: already loaded the other module\n");
- return -EEXIST;
- }
-
- if (!ops->cpu_has_kvm_support()) {
- printk(KERN_ERR "kvm: no hardware support\n");
- return -EOPNOTSUPP;
- }
- if (ops->disabled_by_bios()) {
- printk(KERN_ERR "kvm: disabled by bios\n");
- return -EOPNOTSUPP;
- }
-
- kvm_x86_ops = ops;
-
r = kvm_arch_hardware_setup();
if (r < 0)
goto out;
@@ -1534,7 +1520,7 @@ out_free_1:
out_free_0:
kvm_arch_hardware_unsetup();
out:
- kvm_x86_ops = NULL;
+ kvm_arch_exit();
kvm_exit_debug();
kvm_mmu_module_exit();
out4:
@@ -1552,7 +1538,7 @@ void kvm_exit(void)
unregister_cpu_notifier(&kvm_cpu_notifier);
on_each_cpu(hardware_disable, NULL, 0, 1);
kvm_arch_hardware_unsetup();
- kvm_x86_ops = NULL;
+ kvm_arch_exit();
kvm_exit_debug();
__free_page(bad_page);
kvm_mmu_module_exit();
OpenPOWER on IntegriCloud