aboutsummaryrefslogtreecommitdiffstats
path: root/virt/kvm
diff options
context:
space:
mode:
Diffstat (limited to 'virt/kvm')
-rw-r--r--virt/kvm/kvm_main.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index f9dd20606c40..e4bf88a9ee4e 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -65,6 +65,8 @@ struct dentry *kvm_debugfs_dir;
65static long kvm_vcpu_ioctl(struct file *file, unsigned int ioctl, 65static long kvm_vcpu_ioctl(struct file *file, unsigned int ioctl,
66 unsigned long arg); 66 unsigned long arg);
67 67
68bool kvm_rebooting;
69
68static inline int valid_vcpu(int n) 70static inline int valid_vcpu(int n)
69{ 71{
70 return likely(n >= 0 && n < KVM_MAX_VCPUS); 72 return likely(n >= 0 && n < KVM_MAX_VCPUS);
@@ -1301,6 +1303,18 @@ static int kvm_cpu_hotplug(struct notifier_block *notifier, unsigned long val,
1301 return NOTIFY_OK; 1303 return NOTIFY_OK;
1302} 1304}
1303 1305
1306
1307asmlinkage void kvm_handle_fault_on_reboot(void)
1308{
1309 if (kvm_rebooting)
1310 /* spin while reset goes on */
1311 while (true)
1312 ;
1313 /* Fault while not rebooting. We want the trace. */
1314 BUG();
1315}
1316EXPORT_SYMBOL_GPL(kvm_handle_fault_on_reboot);
1317
1304static int kvm_reboot(struct notifier_block *notifier, unsigned long val, 1318static int kvm_reboot(struct notifier_block *notifier, unsigned long val,
1305 void *v) 1319 void *v)
1306{ 1320{
@@ -1310,6 +1324,7 @@ static int kvm_reboot(struct notifier_block *notifier, unsigned long val,
1310 * in vmx root mode. 1324 * in vmx root mode.
1311 */ 1325 */
1312 printk(KERN_INFO "kvm: exiting hardware virtualization\n"); 1326 printk(KERN_INFO "kvm: exiting hardware virtualization\n");
1327 kvm_rebooting = true;
1313 on_each_cpu(hardware_disable, NULL, 1); 1328 on_each_cpu(hardware_disable, NULL, 1);
1314 } 1329 }
1315 return NOTIFY_OK; 1330 return NOTIFY_OK;