diff options
Diffstat (limited to 'virt')
-rw-r--r-- | virt/kvm/irqchip.c | 2 | ||||
-rw-r--r-- | virt/kvm/kvm_main.c | 94 |
2 files changed, 47 insertions, 49 deletions
diff --git a/virt/kvm/irqchip.c b/virt/kvm/irqchip.c index 7f256f31df10..1d56a901e791 100644 --- a/virt/kvm/irqchip.c +++ b/virt/kvm/irqchip.c | |||
@@ -105,7 +105,7 @@ int kvm_set_irq(struct kvm *kvm, int irq_source_id, u32 irq, int level, | |||
105 | i = kvm_irq_map_gsi(kvm, irq_set, irq); | 105 | i = kvm_irq_map_gsi(kvm, irq_set, irq); |
106 | srcu_read_unlock(&kvm->irq_srcu, idx); | 106 | srcu_read_unlock(&kvm->irq_srcu, idx); |
107 | 107 | ||
108 | while(i--) { | 108 | while (i--) { |
109 | int r; | 109 | int r; |
110 | r = irq_set[i].set(&irq_set[i], kvm, irq_source_id, level, | 110 | r = irq_set[i].set(&irq_set[i], kvm, irq_source_id, level, |
111 | line_status); | 111 | line_status); |
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index a1093700f3a4..ce7888a15128 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c | |||
@@ -66,13 +66,13 @@ | |||
66 | MODULE_AUTHOR("Qumranet"); | 66 | MODULE_AUTHOR("Qumranet"); |
67 | MODULE_LICENSE("GPL"); | 67 | MODULE_LICENSE("GPL"); |
68 | 68 | ||
69 | unsigned int halt_poll_ns = 0; | 69 | static unsigned int halt_poll_ns; |
70 | module_param(halt_poll_ns, uint, S_IRUGO | S_IWUSR); | 70 | module_param(halt_poll_ns, uint, S_IRUGO | S_IWUSR); |
71 | 71 | ||
72 | /* | 72 | /* |
73 | * Ordering of locks: | 73 | * Ordering of locks: |
74 | * | 74 | * |
75 | * kvm->lock --> kvm->slots_lock --> kvm->irq_lock | 75 | * kvm->lock --> kvm->slots_lock --> kvm->irq_lock |
76 | */ | 76 | */ |
77 | 77 | ||
78 | DEFINE_SPINLOCK(kvm_lock); | 78 | DEFINE_SPINLOCK(kvm_lock); |
@@ -80,7 +80,7 @@ static DEFINE_RAW_SPINLOCK(kvm_count_lock); | |||
80 | LIST_HEAD(vm_list); | 80 | LIST_HEAD(vm_list); |
81 | 81 | ||
82 | static cpumask_var_t cpus_hardware_enabled; | 82 | static cpumask_var_t cpus_hardware_enabled; |
83 | static int kvm_usage_count = 0; | 83 | static int kvm_usage_count; |
84 | static atomic_t hardware_enable_failed; | 84 | static atomic_t hardware_enable_failed; |
85 | 85 | ||
86 | struct kmem_cache *kvm_vcpu_cache; | 86 | struct kmem_cache *kvm_vcpu_cache; |
@@ -539,20 +539,12 @@ void *kvm_kvzalloc(unsigned long size) | |||
539 | return kzalloc(size, GFP_KERNEL); | 539 | return kzalloc(size, GFP_KERNEL); |
540 | } | 540 | } |
541 | 541 | ||
542 | void kvm_kvfree(const void *addr) | ||
543 | { | ||
544 | if (is_vmalloc_addr(addr)) | ||
545 | vfree(addr); | ||
546 | else | ||
547 | kfree(addr); | ||
548 | } | ||
549 | |||
550 | static void kvm_destroy_dirty_bitmap(struct kvm_memory_slot *memslot) | 542 | static void kvm_destroy_dirty_bitmap(struct kvm_memory_slot *memslot) |
551 | { | 543 | { |
552 | if (!memslot->dirty_bitmap) | 544 | if (!memslot->dirty_bitmap) |
553 | return; | 545 | return; |
554 | 546 | ||
555 | kvm_kvfree(memslot->dirty_bitmap); | 547 | kvfree(memslot->dirty_bitmap); |
556 | memslot->dirty_bitmap = NULL; | 548 | memslot->dirty_bitmap = NULL; |
557 | } | 549 | } |
558 | 550 | ||
@@ -888,8 +880,8 @@ int __kvm_set_memory_region(struct kvm *kvm, | |||
888 | * or moved, memslot will be created. | 880 | * or moved, memslot will be created. |
889 | * | 881 | * |
890 | * validation of sp->gfn happens in: | 882 | * validation of sp->gfn happens in: |
891 | * - gfn_to_hva (kvm_read_guest, gfn_to_pfn) | 883 | * - gfn_to_hva (kvm_read_guest, gfn_to_pfn) |
892 | * - kvm_is_visible_gfn (mmu_check_roots) | 884 | * - kvm_is_visible_gfn (mmu_check_roots) |
893 | */ | 885 | */ |
894 | kvm_arch_flush_shadow_memslot(kvm, slot); | 886 | kvm_arch_flush_shadow_memslot(kvm, slot); |
895 | 887 | ||
@@ -1061,9 +1053,11 @@ int kvm_get_dirty_log_protect(struct kvm *kvm, | |||
1061 | mask = xchg(&dirty_bitmap[i], 0); | 1053 | mask = xchg(&dirty_bitmap[i], 0); |
1062 | dirty_bitmap_buffer[i] = mask; | 1054 | dirty_bitmap_buffer[i] = mask; |
1063 | 1055 | ||
1064 | offset = i * BITS_PER_LONG; | 1056 | if (mask) { |
1065 | kvm_arch_mmu_enable_log_dirty_pt_masked(kvm, memslot, offset, | 1057 | offset = i * BITS_PER_LONG; |
1066 | mask); | 1058 | kvm_arch_mmu_enable_log_dirty_pt_masked(kvm, memslot, |
1059 | offset, mask); | ||
1060 | } | ||
1067 | } | 1061 | } |
1068 | 1062 | ||
1069 | spin_unlock(&kvm->mmu_lock); | 1063 | spin_unlock(&kvm->mmu_lock); |
@@ -1481,7 +1475,6 @@ struct page *gfn_to_page(struct kvm *kvm, gfn_t gfn) | |||
1481 | 1475 | ||
1482 | return kvm_pfn_to_page(pfn); | 1476 | return kvm_pfn_to_page(pfn); |
1483 | } | 1477 | } |
1484 | |||
1485 | EXPORT_SYMBOL_GPL(gfn_to_page); | 1478 | EXPORT_SYMBOL_GPL(gfn_to_page); |
1486 | 1479 | ||
1487 | void kvm_release_page_clean(struct page *page) | 1480 | void kvm_release_page_clean(struct page *page) |
@@ -1517,6 +1510,7 @@ void kvm_set_pfn_dirty(pfn_t pfn) | |||
1517 | { | 1510 | { |
1518 | if (!kvm_is_reserved_pfn(pfn)) { | 1511 | if (!kvm_is_reserved_pfn(pfn)) { |
1519 | struct page *page = pfn_to_page(pfn); | 1512 | struct page *page = pfn_to_page(pfn); |
1513 | |||
1520 | if (!PageReserved(page)) | 1514 | if (!PageReserved(page)) |
1521 | SetPageDirty(page); | 1515 | SetPageDirty(page); |
1522 | } | 1516 | } |
@@ -1742,7 +1736,7 @@ int kvm_clear_guest(struct kvm *kvm, gpa_t gpa, unsigned long len) | |||
1742 | int offset = offset_in_page(gpa); | 1736 | int offset = offset_in_page(gpa); |
1743 | int ret; | 1737 | int ret; |
1744 | 1738 | ||
1745 | while ((seg = next_segment(len, offset)) != 0) { | 1739 | while ((seg = next_segment(len, offset)) != 0) { |
1746 | ret = kvm_clear_guest_page(kvm, gfn, offset, seg); | 1740 | ret = kvm_clear_guest_page(kvm, gfn, offset, seg); |
1747 | if (ret < 0) | 1741 | if (ret < 0) |
1748 | return ret; | 1742 | return ret; |
@@ -1800,6 +1794,7 @@ void kvm_vcpu_block(struct kvm_vcpu *vcpu) | |||
1800 | start = cur = ktime_get(); | 1794 | start = cur = ktime_get(); |
1801 | if (halt_poll_ns) { | 1795 | if (halt_poll_ns) { |
1802 | ktime_t stop = ktime_add_ns(ktime_get(), halt_poll_ns); | 1796 | ktime_t stop = ktime_add_ns(ktime_get(), halt_poll_ns); |
1797 | |||
1803 | do { | 1798 | do { |
1804 | /* | 1799 | /* |
1805 | * This sets KVM_REQ_UNHALT if an interrupt | 1800 | * This sets KVM_REQ_UNHALT if an interrupt |
@@ -2135,6 +2130,7 @@ static long kvm_vcpu_ioctl(struct file *filp, | |||
2135 | /* The thread running this VCPU changed. */ | 2130 | /* The thread running this VCPU changed. */ |
2136 | struct pid *oldpid = vcpu->pid; | 2131 | struct pid *oldpid = vcpu->pid; |
2137 | struct pid *newpid = get_task_pid(current, PIDTYPE_PID); | 2132 | struct pid *newpid = get_task_pid(current, PIDTYPE_PID); |
2133 | |||
2138 | rcu_assign_pointer(vcpu->pid, newpid); | 2134 | rcu_assign_pointer(vcpu->pid, newpid); |
2139 | if (oldpid) | 2135 | if (oldpid) |
2140 | synchronize_rcu(); | 2136 | synchronize_rcu(); |
@@ -2205,7 +2201,7 @@ out_free1: | |||
2205 | if (r) | 2201 | if (r) |
2206 | goto out; | 2202 | goto out; |
2207 | r = -EFAULT; | 2203 | r = -EFAULT; |
2208 | if (copy_to_user(argp, &mp_state, sizeof mp_state)) | 2204 | if (copy_to_user(argp, &mp_state, sizeof(mp_state))) |
2209 | goto out; | 2205 | goto out; |
2210 | r = 0; | 2206 | r = 0; |
2211 | break; | 2207 | break; |
@@ -2214,7 +2210,7 @@ out_free1: | |||
2214 | struct kvm_mp_state mp_state; | 2210 | struct kvm_mp_state mp_state; |
2215 | 2211 | ||
2216 | r = -EFAULT; | 2212 | r = -EFAULT; |
2217 | if (copy_from_user(&mp_state, argp, sizeof mp_state)) | 2213 | if (copy_from_user(&mp_state, argp, sizeof(mp_state))) |
2218 | goto out; | 2214 | goto out; |
2219 | r = kvm_arch_vcpu_ioctl_set_mpstate(vcpu, &mp_state); | 2215 | r = kvm_arch_vcpu_ioctl_set_mpstate(vcpu, &mp_state); |
2220 | break; | 2216 | break; |
@@ -2223,13 +2219,13 @@ out_free1: | |||
2223 | struct kvm_translation tr; | 2219 | struct kvm_translation tr; |
2224 | 2220 | ||
2225 | r = -EFAULT; | 2221 | r = -EFAULT; |
2226 | if (copy_from_user(&tr, argp, sizeof tr)) | 2222 | if (copy_from_user(&tr, argp, sizeof(tr))) |
2227 | goto out; | 2223 | goto out; |
2228 | r = kvm_arch_vcpu_ioctl_translate(vcpu, &tr); | 2224 | r = kvm_arch_vcpu_ioctl_translate(vcpu, &tr); |
2229 | if (r) | 2225 | if (r) |
2230 | goto out; | 2226 | goto out; |
2231 | r = -EFAULT; | 2227 | r = -EFAULT; |
2232 | if (copy_to_user(argp, &tr, sizeof tr)) | 2228 | if (copy_to_user(argp, &tr, sizeof(tr))) |
2233 | goto out; | 2229 | goto out; |
2234 | r = 0; | 2230 | r = 0; |
2235 | break; | 2231 | break; |
@@ -2238,7 +2234,7 @@ out_free1: | |||
2238 | struct kvm_guest_debug dbg; | 2234 | struct kvm_guest_debug dbg; |
2239 | 2235 | ||
2240 | r = -EFAULT; | 2236 | r = -EFAULT; |
2241 | if (copy_from_user(&dbg, argp, sizeof dbg)) | 2237 | if (copy_from_user(&dbg, argp, sizeof(dbg))) |
2242 | goto out; | 2238 | goto out; |
2243 | r = kvm_arch_vcpu_ioctl_set_guest_debug(vcpu, &dbg); | 2239 | r = kvm_arch_vcpu_ioctl_set_guest_debug(vcpu, &dbg); |
2244 | break; | 2240 | break; |
@@ -2252,14 +2248,14 @@ out_free1: | |||
2252 | if (argp) { | 2248 | if (argp) { |
2253 | r = -EFAULT; | 2249 | r = -EFAULT; |
2254 | if (copy_from_user(&kvm_sigmask, argp, | 2250 | if (copy_from_user(&kvm_sigmask, argp, |
2255 | sizeof kvm_sigmask)) | 2251 | sizeof(kvm_sigmask))) |
2256 | goto out; | 2252 | goto out; |
2257 | r = -EINVAL; | 2253 | r = -EINVAL; |
2258 | if (kvm_sigmask.len != sizeof sigset) | 2254 | if (kvm_sigmask.len != sizeof(sigset)) |
2259 | goto out; | 2255 | goto out; |
2260 | r = -EFAULT; | 2256 | r = -EFAULT; |
2261 | if (copy_from_user(&sigset, sigmask_arg->sigset, | 2257 | if (copy_from_user(&sigset, sigmask_arg->sigset, |
2262 | sizeof sigset)) | 2258 | sizeof(sigset))) |
2263 | goto out; | 2259 | goto out; |
2264 | p = &sigset; | 2260 | p = &sigset; |
2265 | } | 2261 | } |
@@ -2321,14 +2317,14 @@ static long kvm_vcpu_compat_ioctl(struct file *filp, | |||
2321 | if (argp) { | 2317 | if (argp) { |
2322 | r = -EFAULT; | 2318 | r = -EFAULT; |
2323 | if (copy_from_user(&kvm_sigmask, argp, | 2319 | if (copy_from_user(&kvm_sigmask, argp, |
2324 | sizeof kvm_sigmask)) | 2320 | sizeof(kvm_sigmask))) |
2325 | goto out; | 2321 | goto out; |
2326 | r = -EINVAL; | 2322 | r = -EINVAL; |
2327 | if (kvm_sigmask.len != sizeof csigset) | 2323 | if (kvm_sigmask.len != sizeof(csigset)) |
2328 | goto out; | 2324 | goto out; |
2329 | r = -EFAULT; | 2325 | r = -EFAULT; |
2330 | if (copy_from_user(&csigset, sigmask_arg->sigset, | 2326 | if (copy_from_user(&csigset, sigmask_arg->sigset, |
2331 | sizeof csigset)) | 2327 | sizeof(csigset))) |
2332 | goto out; | 2328 | goto out; |
2333 | sigset_from_compat(&sigset, &csigset); | 2329 | sigset_from_compat(&sigset, &csigset); |
2334 | r = kvm_vcpu_ioctl_set_sigmask(vcpu, &sigset); | 2330 | r = kvm_vcpu_ioctl_set_sigmask(vcpu, &sigset); |
@@ -2524,7 +2520,7 @@ static long kvm_vm_ioctl(struct file *filp, | |||
2524 | 2520 | ||
2525 | r = -EFAULT; | 2521 | r = -EFAULT; |
2526 | if (copy_from_user(&kvm_userspace_mem, argp, | 2522 | if (copy_from_user(&kvm_userspace_mem, argp, |
2527 | sizeof kvm_userspace_mem)) | 2523 | sizeof(kvm_userspace_mem))) |
2528 | goto out; | 2524 | goto out; |
2529 | 2525 | ||
2530 | r = kvm_vm_ioctl_set_memory_region(kvm, &kvm_userspace_mem); | 2526 | r = kvm_vm_ioctl_set_memory_region(kvm, &kvm_userspace_mem); |
@@ -2534,7 +2530,7 @@ static long kvm_vm_ioctl(struct file *filp, | |||
2534 | struct kvm_dirty_log log; | 2530 | struct kvm_dirty_log log; |
2535 | 2531 | ||
2536 | r = -EFAULT; | 2532 | r = -EFAULT; |
2537 | if (copy_from_user(&log, argp, sizeof log)) | 2533 | if (copy_from_user(&log, argp, sizeof(log))) |
2538 | goto out; | 2534 | goto out; |
2539 | r = kvm_vm_ioctl_get_dirty_log(kvm, &log); | 2535 | r = kvm_vm_ioctl_get_dirty_log(kvm, &log); |
2540 | break; | 2536 | break; |
@@ -2542,16 +2538,18 @@ static long kvm_vm_ioctl(struct file *filp, | |||
2542 | #ifdef KVM_COALESCED_MMIO_PAGE_OFFSET | 2538 | #ifdef KVM_COALESCED_MMIO_PAGE_OFFSET |
2543 | case KVM_REGISTER_COALESCED_MMIO: { | 2539 | case KVM_REGISTER_COALESCED_MMIO: { |
2544 | struct kvm_coalesced_mmio_zone zone; | 2540 | struct kvm_coalesced_mmio_zone zone; |
2541 | |||
2545 | r = -EFAULT; | 2542 | r = -EFAULT; |
2546 | if (copy_from_user(&zone, argp, sizeof zone)) | 2543 | if (copy_from_user(&zone, argp, sizeof(zone))) |
2547 | goto out; | 2544 | goto out; |
2548 | r = kvm_vm_ioctl_register_coalesced_mmio(kvm, &zone); | 2545 | r = kvm_vm_ioctl_register_coalesced_mmio(kvm, &zone); |
2549 | break; | 2546 | break; |
2550 | } | 2547 | } |
2551 | case KVM_UNREGISTER_COALESCED_MMIO: { | 2548 | case KVM_UNREGISTER_COALESCED_MMIO: { |
2552 | struct kvm_coalesced_mmio_zone zone; | 2549 | struct kvm_coalesced_mmio_zone zone; |
2550 | |||
2553 | r = -EFAULT; | 2551 | r = -EFAULT; |
2554 | if (copy_from_user(&zone, argp, sizeof zone)) | 2552 | if (copy_from_user(&zone, argp, sizeof(zone))) |
2555 | goto out; | 2553 | goto out; |
2556 | r = kvm_vm_ioctl_unregister_coalesced_mmio(kvm, &zone); | 2554 | r = kvm_vm_ioctl_unregister_coalesced_mmio(kvm, &zone); |
2557 | break; | 2555 | break; |
@@ -2561,7 +2559,7 @@ static long kvm_vm_ioctl(struct file *filp, | |||
2561 | struct kvm_irqfd data; | 2559 | struct kvm_irqfd data; |
2562 | 2560 | ||
2563 | r = -EFAULT; | 2561 | r = -EFAULT; |
2564 | if (copy_from_user(&data, argp, sizeof data)) | 2562 | if (copy_from_user(&data, argp, sizeof(data))) |
2565 | goto out; | 2563 | goto out; |
2566 | r = kvm_irqfd(kvm, &data); | 2564 | r = kvm_irqfd(kvm, &data); |
2567 | break; | 2565 | break; |
@@ -2570,7 +2568,7 @@ static long kvm_vm_ioctl(struct file *filp, | |||
2570 | struct kvm_ioeventfd data; | 2568 | struct kvm_ioeventfd data; |
2571 | 2569 | ||
2572 | r = -EFAULT; | 2570 | r = -EFAULT; |
2573 | if (copy_from_user(&data, argp, sizeof data)) | 2571 | if (copy_from_user(&data, argp, sizeof(data))) |
2574 | goto out; | 2572 | goto out; |
2575 | r = kvm_ioeventfd(kvm, &data); | 2573 | r = kvm_ioeventfd(kvm, &data); |
2576 | break; | 2574 | break; |
@@ -2591,7 +2589,7 @@ static long kvm_vm_ioctl(struct file *filp, | |||
2591 | struct kvm_msi msi; | 2589 | struct kvm_msi msi; |
2592 | 2590 | ||
2593 | r = -EFAULT; | 2591 | r = -EFAULT; |
2594 | if (copy_from_user(&msi, argp, sizeof msi)) | 2592 | if (copy_from_user(&msi, argp, sizeof(msi))) |
2595 | goto out; | 2593 | goto out; |
2596 | r = kvm_send_userspace_msi(kvm, &msi); | 2594 | r = kvm_send_userspace_msi(kvm, &msi); |
2597 | break; | 2595 | break; |
@@ -2603,7 +2601,7 @@ static long kvm_vm_ioctl(struct file *filp, | |||
2603 | struct kvm_irq_level irq_event; | 2601 | struct kvm_irq_level irq_event; |
2604 | 2602 | ||
2605 | r = -EFAULT; | 2603 | r = -EFAULT; |
2606 | if (copy_from_user(&irq_event, argp, sizeof irq_event)) | 2604 | if (copy_from_user(&irq_event, argp, sizeof(irq_event))) |
2607 | goto out; | 2605 | goto out; |
2608 | 2606 | ||
2609 | r = kvm_vm_ioctl_irq_line(kvm, &irq_event, | 2607 | r = kvm_vm_ioctl_irq_line(kvm, &irq_event, |
@@ -2613,7 +2611,7 @@ static long kvm_vm_ioctl(struct file *filp, | |||
2613 | 2611 | ||
2614 | r = -EFAULT; | 2612 | r = -EFAULT; |
2615 | if (ioctl == KVM_IRQ_LINE_STATUS) { | 2613 | if (ioctl == KVM_IRQ_LINE_STATUS) { |
2616 | if (copy_to_user(argp, &irq_event, sizeof irq_event)) | 2614 | if (copy_to_user(argp, &irq_event, sizeof(irq_event))) |
2617 | goto out; | 2615 | goto out; |
2618 | } | 2616 | } |
2619 | 2617 | ||
@@ -2646,7 +2644,7 @@ static long kvm_vm_ioctl(struct file *filp, | |||
2646 | goto out_free_irq_routing; | 2644 | goto out_free_irq_routing; |
2647 | r = kvm_set_irq_routing(kvm, entries, routing.nr, | 2645 | r = kvm_set_irq_routing(kvm, entries, routing.nr, |
2648 | routing.flags); | 2646 | routing.flags); |
2649 | out_free_irq_routing: | 2647 | out_free_irq_routing: |
2650 | vfree(entries); | 2648 | vfree(entries); |
2651 | break; | 2649 | break; |
2652 | } | 2650 | } |
@@ -2821,8 +2819,7 @@ static void hardware_enable_nolock(void *junk) | |||
2821 | if (r) { | 2819 | if (r) { |
2822 | cpumask_clear_cpu(cpu, cpus_hardware_enabled); | 2820 | cpumask_clear_cpu(cpu, cpus_hardware_enabled); |
2823 | atomic_inc(&hardware_enable_failed); | 2821 | atomic_inc(&hardware_enable_failed); |
2824 | printk(KERN_INFO "kvm: enabling virtualization on " | 2822 | pr_info("kvm: enabling virtualization on CPU%d failed\n", cpu); |
2825 | "CPU%d failed\n", cpu); | ||
2826 | } | 2823 | } |
2827 | } | 2824 | } |
2828 | 2825 | ||
@@ -2898,12 +2895,12 @@ static int kvm_cpu_hotplug(struct notifier_block *notifier, unsigned long val, | |||
2898 | val &= ~CPU_TASKS_FROZEN; | 2895 | val &= ~CPU_TASKS_FROZEN; |
2899 | switch (val) { | 2896 | switch (val) { |
2900 | case CPU_DYING: | 2897 | case CPU_DYING: |
2901 | printk(KERN_INFO "kvm: disabling virtualization on CPU%d\n", | 2898 | pr_info("kvm: disabling virtualization on CPU%d\n", |
2902 | cpu); | 2899 | cpu); |
2903 | hardware_disable(); | 2900 | hardware_disable(); |
2904 | break; | 2901 | break; |
2905 | case CPU_STARTING: | 2902 | case CPU_STARTING: |
2906 | printk(KERN_INFO "kvm: enabling virtualization on CPU%d\n", | 2903 | pr_info("kvm: enabling virtualization on CPU%d\n", |
2907 | cpu); | 2904 | cpu); |
2908 | hardware_enable(); | 2905 | hardware_enable(); |
2909 | break; | 2906 | break; |
@@ -2920,7 +2917,7 @@ static int kvm_reboot(struct notifier_block *notifier, unsigned long val, | |||
2920 | * | 2917 | * |
2921 | * And Intel TXT required VMX off for all cpu when system shutdown. | 2918 | * And Intel TXT required VMX off for all cpu when system shutdown. |
2922 | */ | 2919 | */ |
2923 | printk(KERN_INFO "kvm: exiting hardware virtualization\n"); | 2920 | pr_info("kvm: exiting hardware virtualization\n"); |
2924 | kvm_rebooting = true; | 2921 | kvm_rebooting = true; |
2925 | on_each_cpu(hardware_disable_nolock, NULL, 1); | 2922 | on_each_cpu(hardware_disable_nolock, NULL, 1); |
2926 | return NOTIFY_OK; | 2923 | return NOTIFY_OK; |
@@ -2944,7 +2941,7 @@ static void kvm_io_bus_destroy(struct kvm_io_bus *bus) | |||
2944 | } | 2941 | } |
2945 | 2942 | ||
2946 | static inline int kvm_io_bus_cmp(const struct kvm_io_range *r1, | 2943 | static inline int kvm_io_bus_cmp(const struct kvm_io_range *r1, |
2947 | const struct kvm_io_range *r2) | 2944 | const struct kvm_io_range *r2) |
2948 | { | 2945 | { |
2949 | if (r1->addr < r2->addr) | 2946 | if (r1->addr < r2->addr) |
2950 | return -1; | 2947 | return -1; |
@@ -3268,6 +3265,7 @@ struct kvm_vcpu *preempt_notifier_to_vcpu(struct preempt_notifier *pn) | |||
3268 | static void kvm_sched_in(struct preempt_notifier *pn, int cpu) | 3265 | static void kvm_sched_in(struct preempt_notifier *pn, int cpu) |
3269 | { | 3266 | { |
3270 | struct kvm_vcpu *vcpu = preempt_notifier_to_vcpu(pn); | 3267 | struct kvm_vcpu *vcpu = preempt_notifier_to_vcpu(pn); |
3268 | |||
3271 | if (vcpu->preempted) | 3269 | if (vcpu->preempted) |
3272 | vcpu->preempted = false; | 3270 | vcpu->preempted = false; |
3273 | 3271 | ||
@@ -3349,7 +3347,7 @@ int kvm_init(void *opaque, unsigned vcpu_size, unsigned vcpu_align, | |||
3349 | 3347 | ||
3350 | r = misc_register(&kvm_dev); | 3348 | r = misc_register(&kvm_dev); |
3351 | if (r) { | 3349 | if (r) { |
3352 | printk(KERN_ERR "kvm: misc device register failed\n"); | 3350 | pr_err("kvm: misc device register failed\n"); |
3353 | goto out_unreg; | 3351 | goto out_unreg; |
3354 | } | 3352 | } |
3355 | 3353 | ||
@@ -3360,7 +3358,7 @@ int kvm_init(void *opaque, unsigned vcpu_size, unsigned vcpu_align, | |||
3360 | 3358 | ||
3361 | r = kvm_init_debug(); | 3359 | r = kvm_init_debug(); |
3362 | if (r) { | 3360 | if (r) { |
3363 | printk(KERN_ERR "kvm: create debugfs files failed\n"); | 3361 | pr_err("kvm: create debugfs files failed\n"); |
3364 | goto out_undebugfs; | 3362 | goto out_undebugfs; |
3365 | } | 3363 | } |
3366 | 3364 | ||