Joerg Roedel wrote:
On Mon, Oct 20, 2008 at 07:04:50PM +0200, Alexander Graf wrote:
Normally setting the SVME bit in EFER is not allowed, as we did
not support SVM. Not since we do, we should also allow enabling
SVM mode.

v2 comes as last patch, so we don't enable half-ready code
v4 introduces a module option to enable SVM

Signed-off-by: Alexander Graf <[EMAIL PROTECTED]>
---
 arch/x86/kvm/svm.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index 4582699..1e63860 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -68,6 +68,9 @@ static int npt = 1;
module_param(npt, int, S_IRUGO); +static int nested = 0;
+module_param(nested, int, S_IRUGO);
+
 static void kvm_reput_irq(struct vcpu_svm *svm);
 static void svm_flush_tlb(struct kvm_vcpu *vcpu);
@@ -457,6 +460,9 @@ static __init int svm_hardware_setup(void)
        if (boot_cpu_has(X86_FEATURE_NX))
                kvm_enable_efer_bits(EFER_NX);
+ if (nested)
+               kvm_enable_efer_bits(MSR_EFER_SVME_MASK);
+
        for_each_online_cpu(cpu) {
                r = svm_cpu_init(cpu);
                if (r)


What I think is missing here is some kind of userspace interface. If we
do it this way (with a kernel parameter) we should expose to userspace
if nested svm is enabled. This way userspace knows whether it has to set
the SVM CPUID bit or not.

Right.  There's the KVM_GET_SUPPORTED_CPUID thing that can be used for this.

--
error compiling committee.c: too many arguments to function

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to