diff options
Diffstat (limited to 'drivers/kvm/x86.c')
-rw-r--r-- | drivers/kvm/x86.c | 27 |
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 | } |
1646 | EXPORT_SYMBOL_GPL(kvm_emulate_pio_string); | 1646 | EXPORT_SYMBOL_GPL(kvm_emulate_pio_string); |
1647 | 1647 | ||
1648 | __init void kvm_arch_init(void) | 1648 | int 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 | ||
1673 | void kvm_arch_exit(void) | ||
1674 | { | ||
1675 | kvm_x86_ops = NULL; | ||
1676 | } | ||
1677 | |||
1653 | int kvm_emulate_halt(struct kvm_vcpu *vcpu) | 1678 | int kvm_emulate_halt(struct kvm_vcpu *vcpu) |
1654 | { | 1679 | { |
1655 | ++vcpu->stat.halt_exits; | 1680 | ++vcpu->stat.halt_exits; |