All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] vmx,svm: Add module parameter to ignore the 'in use' check
@ 2011-07-04 23:09 Sasha Levin
  2011-07-04 23:09 ` [PATCH 2/2] vmx,svm: Print errors if SVM or VMX were already set Sasha Levin
  2011-07-05  8:09 ` [PATCH 1/2] vmx,svm: Add module parameter to ignore the 'in use' check Avi Kivity
  0 siblings, 2 replies; 14+ messages in thread
From: Sasha Levin @ 2011-07-04 23:09 UTC (permalink / raw)
  To: kvm; +Cc: Sasha Levin, Avi Kivity, Marcelo Tosatti

Add a module parameter 'check_inuse' to allow disabling the check of whether
virtualization has already been enabled on the given cpu.

This is needed to deal with broken BIOS which set the SVM/VMX bit by default.

Cc: Avi Kivity <avi@redhat.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Suggested-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
---
 arch/x86/kvm/svm.c |    5 ++++-
 arch/x86/kvm/vmx.c |    5 ++++-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index 475d1c9..5ca76e3 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -183,6 +183,9 @@ module_param(npt, int, S_IRUGO);
 static int nested = 1;
 module_param(nested, int, S_IRUGO);
 
+static bool check_inuse = 1;
+module_param(check_inuse, bool, S_IRUGO);
+
 static void svm_flush_tlb(struct kvm_vcpu *vcpu);
 static void svm_complete_interrupts(struct vcpu_svm *svm);
 
@@ -587,7 +590,7 @@ static int svm_hardware_enable(void *garbage)
 	int me = raw_smp_processor_id();
 
 	rdmsrl(MSR_EFER, efer);
-	if (efer & EFER_SVME)
+	if (check_inuse && (efer & EFER_SVME))
 		return -EBUSY;
 
 	if (!has_svm()) {
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index f5b49c7..3046b07 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -74,6 +74,9 @@ module_param(vmm_exclusive, bool, S_IRUGO);
 static int __read_mostly yield_on_hlt = 1;
 module_param(yield_on_hlt, bool, S_IRUGO);
 
+static bool check_inuse = 1;
+module_param(check_inuse, bool, S_IRUGO);
+
 /*
  * If nested=1, nested virtualization is supported, i.e., guests may use
  * VMX and be a hypervisor for its own guests. If nested=0, guests may not
@@ -2230,7 +2233,7 @@ static int hardware_enable(void *garbage)
 	u64 phys_addr = __pa(per_cpu(vmxarea, cpu));
 	u64 old, test_bits;
 
-	if (read_cr4() & X86_CR4_VMXE)
+	if (check_inuse && (read_cr4() & X86_CR4_VMXE))
 		return -EBUSY;
 
 	INIT_LIST_HEAD(&per_cpu(loaded_vmcss_on_cpu, cpu));
-- 
1.7.6


^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2011-07-05 11:14 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-04 23:09 [PATCH 1/2] vmx,svm: Add module parameter to ignore the 'in use' check Sasha Levin
2011-07-04 23:09 ` [PATCH 2/2] vmx,svm: Print errors if SVM or VMX were already set Sasha Levin
2011-07-05  0:42   ` Alexander Graf
2011-07-05  6:16     ` Tian, Kevin
2011-07-05  6:14   ` Tian, Kevin
2011-07-05  8:09 ` [PATCH 1/2] vmx,svm: Add module parameter to ignore the 'in use' check Avi Kivity
2011-07-05  8:14   ` Sasha Levin
2011-07-05  9:11     ` Joerg Roedel
2011-07-05  9:32       ` Sasha Levin
2011-07-05  9:37         ` Avi Kivity
2011-07-05  9:56           ` Sasha Levin
2011-07-05 10:37             ` Avi Kivity
2011-07-05 11:07               ` Sasha Levin
2011-07-05 11:14                 ` Avi Kivity

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.