From patchwork Sun Jun 13 12:23:04 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nadav Har'El X-Patchwork-Id: 105780 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o5DCNFo5026311 for ; Sun, 13 Jun 2010 12:23:15 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752002Ab0FMMXM (ORCPT ); Sun, 13 Jun 2010 08:23:12 -0400 Received: from mtagate5.uk.ibm.com ([194.196.100.165]:39485 "EHLO mtagate5.uk.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751891Ab0FMMXK (ORCPT ); Sun, 13 Jun 2010 08:23:10 -0400 Received: from d06nrmr1407.portsmouth.uk.ibm.com (d06nrmr1407.portsmouth.uk.ibm.com [9.149.38.185]) by mtagate5.uk.ibm.com (8.13.1/8.13.1) with ESMTP id o5DCN757020449 for ; Sun, 13 Jun 2010 12:23:07 GMT Received: from d06av02.portsmouth.uk.ibm.com (d06av02.portsmouth.uk.ibm.com [9.149.37.228]) by d06nrmr1407.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id o5DCN7ZG483544 for ; Sun, 13 Jun 2010 13:23:07 +0100 Received: from d06av02.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av02.portsmouth.uk.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id o5DCN6w5032106 for ; Sun, 13 Jun 2010 13:23:06 +0100 Received: from rice.haifa.ibm.com (rice.haifa.ibm.com [9.148.8.205]) by d06av02.portsmouth.uk.ibm.com (8.12.11.20060308/8.12.11) with ESMTP id o5DCN577032101 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 13 Jun 2010 13:23:06 +0100 Received: from rice.haifa.ibm.com (lnx-nyh.haifa.ibm.com [127.0.0.1]) by rice.haifa.ibm.com (8.14.4/8.14.4) with ESMTP id o5DCN5Hk012874; Sun, 13 Jun 2010 15:23:05 +0300 Received: (from nyh@localhost) by rice.haifa.ibm.com (8.14.4/8.14.4/Submit) id o5DCN4qC012872; Sun, 13 Jun 2010 15:23:04 +0300 Date: Sun, 13 Jun 2010 15:23:04 +0300 Message-Id: <201006131223.o5DCN4qC012872@rice.haifa.ibm.com> X-Authentication-Warning: rice.haifa.ibm.com: nyh set sender to "Nadav Har'El" using -f Cc: kvm@vger.kernel.org To: avi@redhat.com From: "Nadav Har'El" References: <1276431753-nyh@il.ibm.com> Subject: [PATCH 1/24] Move nested option from svm.c to x86.c Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Sun, 13 Jun 2010 12:23:15 +0000 (UTC) --- .before/arch/x86/kvm/svm.c 2010-06-13 15:01:28.000000000 +0300 +++ .after/arch/x86/kvm/svm.c 2010-06-13 15:01:28.000000000 +0300 @@ -158,9 +158,6 @@ static int npt = 1; module_param(npt, int, S_IRUGO); -static int nested = 1; -module_param(nested, int, S_IRUGO); - static void svm_flush_tlb(struct kvm_vcpu *vcpu); static void svm_complete_interrupts(struct vcpu_svm *svm); --- .before/arch/x86/kvm/x86.c 2010-06-13 15:01:28.000000000 +0300 +++ .after/arch/x86/kvm/x86.c 2010-06-13 15:01:28.000000000 +0300 @@ -95,6 +95,17 @@ EXPORT_SYMBOL_GPL(kvm_x86_ops); int ignore_msrs = 0; module_param_named(ignore_msrs, ignore_msrs, bool, S_IRUGO | S_IWUSR); +/* If nested=1, nested virtualization is supported. I.e., the guest may use + * VMX or SVM (as appropriate) and be a hypervisor for its own guests. + * If nested=0, nested virtualization is not supported. + * When nested starts as 2 (which is the default), it is later modified by the + * specific module used (VMX or SVM). Currently, nested will be left enabled + * on SVM, but reset to 0 on VMX. + */ +int nested = 2; +EXPORT_SYMBOL_GPL(nested); +module_param(nested, int, S_IRUGO); + #define KVM_NR_SHARED_MSRS 16 struct kvm_shared_msrs_global { --- .before/arch/x86/kvm/x86.h 2010-06-13 15:01:28.000000000 +0300 +++ .after/arch/x86/kvm/x86.h 2010-06-13 15:01:28.000000000 +0300 @@ -75,4 +75,6 @@ static inline struct kvm_mem_aliases *kv void kvm_before_handle_nmi(struct kvm_vcpu *vcpu); void kvm_after_handle_nmi(struct kvm_vcpu *vcpu); +extern int nested; + #endif --- .before/arch/x86/kvm/vmx.c 2010-06-13 15:01:28.000000000 +0300 +++ .after/arch/x86/kvm/vmx.c 2010-06-13 15:01:28.000000000 +0300 @@ -4310,6 +4310,12 @@ static int __init vmx_init(void) { int r, i; + /* By default (when nested==2), turn off nested support. This check + * should be removed when nested VMX is considered mature enough. + */ + if (nested != 1) + nested = 0; + rdmsrl_safe(MSR_EFER, &host_efer); for (i = 0; i < NR_VMX_MSR; ++i)