Skip to contentSkip to conversation

intel_txt: KVM shutdown fix

RFC PATCH Superseded Joseph Cihula 2 participants 2 messages May 8, 2009 KVM

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

RFC PATCH v3 1/2 intel_txt: KVM shutdown fix

Fix KVM to disable itself under all shutdown conditions. In additional to being good practice, Intel(R) TXT requires VMX to be disabled on all CPUs in order for TXT to be disabled.

---
 kvm_main.c |   18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)
virt/kvm/kvm_main.c +9 -9
@@ -2112,15 +2112,15 @@ EXPORT_SYMBOL_GPL(kvm_handle_fault_on_re
 static int kvm_reboot(struct notifier_block *notifier, unsigned long val,
 		      void *v)
 {
-	if (val == SYS_RESTART) {
-		/*
-		 * Some (well, at least mine) BIOSes hang on reboot if
-		 * in vmx root mode.
-		 */
-		printk(KERN_INFO "kvm: exiting hardware virtualization\n");
-		kvm_rebooting = true;
-		on_each_cpu(hardware_disable, NULL, 1);
-	}
+	/*
+	 * Some (well, at least mine) BIOSes hang on reboot if
+	 * in vmx root mode.
+	 *
+	 * And Intel TXT required VMX off for all cpu when system shutdown.
+	 */
+	printk(KERN_INFO "kvm: exiting hardware virtualization\n");
+	kvm_rebooting = true;
+	on_each_cpu(hardware_disable, NULL, 1);
 	return NOTIFY_OK;
 }
 
#1 lore raw
Quoted 2 lines · Joseph Cihula

Fix KVM to disable itself under all shutdown conditions. In additional to being good practice, Intel(R) TXT requires VMX to be disabled on all CPUs in order for TXT to be disabled.

This is already in kvm.git, as f878b14017f.

Signature · 1 line
Do not meddle in the internals of kernels, for they are subtle and quick to panic.