aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/kvm/x86.c
diff options
context:
space:
mode:
authorZhang Xiantao <xiantao.zhang@intel.com>2007-11-14 07:40:21 -0500
committerAvi Kivity <avi@qumranet.com>2008-01-30 10:53:03 -0500
commitf8c16bbaa9e14b309ffcf29cac0ea377a35b0dd2 (patch)
treefde560989f7c3aa77d0f869a90084369c72d7dc4 /drivers/kvm/x86.c
parentcb498ea2ce1d3f3c0bc0a2522241dca10263e437 (diff)
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/x86.c')
-rw-r--r--drivers/kvm/x86.c27
1 files changed, 26 insertions, 1 deletions
diff --git a/drivers/kvm/x86.c b/drivers/kvm/x86.c
index 4902b35060f5..bbfa810bf8bd 100644
--- a/drivers/kvm/x86.c
+++ b/drivers/kvm/x86.c
@@ -1645,11 +1645,36 @@ int kvm_emulate_pio_string(struct kvm_vcpu *vcpu, struct kvm_run *run, int in,
1645} 1645}
1646EXPORT_SYMBOL_GPL(kvm_emulate_pio_string); 1646EXPORT_SYMBOL_GPL(kvm_emulate_pio_string);
1647 1647
1648__init void kvm_arch_init(void) 1648int kvm_arch_init(void *opaque)
1649{ 1649{
1650 struct kvm_x86_ops *ops = (struct kvm_x86_ops *)opaque;
1651
1650 kvm_init_msr_list(); 1652 kvm_init_msr_list();
1653
1654 if (kvm_x86_ops) {
1655 printk(KERN_ERR "kvm: already loaded the other module\n");
1656 return -EEXIST;
1657 }
1658
1659 if (!ops->cpu_has_kvm_support()) {
1660 printk(KERN_ERR "kvm: no hardware support\n");
1661 return -EOPNOTSUPP;
1662 }
1663 if (ops->disabled_by_bios()) {
1664 printk(KERN_ERR "kvm: disabled by bios\n");
1665 return -EOPNOTSUPP;
1666 }
1667
1668 kvm_x86_ops = ops;
1669
1670 return 0;
1651} 1671}
1652 1672
1673void kvm_arch_exit(void)
1674{
1675 kvm_x86_ops = NULL;
1676 }
1677
1653int kvm_emulate_halt(struct kvm_vcpu *vcpu) 1678int kvm_emulate_halt(struct kvm_vcpu *vcpu)
1654{ 1679{
1655 ++vcpu->stat.halt_exits; 1680 ++vcpu->stat.halt_exits;