From patchwork Wed Dec 14 10:11:43 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Haozhong Zhang X-Patchwork-Id: 9473971 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 8AD6160571 for ; Wed, 14 Dec 2016 10:15:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 775A3286E7 for ; Wed, 14 Dec 2016 10:15:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6AC402870D; Wed, 14 Dec 2016 10:15:03 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 278ED286E7 for ; Wed, 14 Dec 2016 10:15:03 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cH6Xp-000886-6j; Wed, 14 Dec 2016 10:12:17 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cH6Xo-00087j-Ep for xen-devel@lists.xen.org; Wed, 14 Dec 2016 10:12:16 +0000 Received: from [193.109.254.147] by server-5.bemta-6.messagelabs.com id 14/9D-11476-FFA11585; Wed, 14 Dec 2016 10:12:15 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrFLMWRWlGSWpSXmKPExsVywNwkVve/VGC Ewd+VEhZLPi5mcWD0OLr7N1MAYxRrZl5SfkUCa8alXSeYCy5zVMw88o2pgfExWxcjJ4eQQKXE u1tvWUFsCQFeiSPLZkDZfhI3Tu1k6WLkAqrpZZR4O7GbBSTBJqAvseLxQbAiEQFpiWufLzOCF DEL/GCU2Nu9hKmLkYNDWCBK4vFvZ5AaFgFVic4JrYwgNq+ArcS/O3PZIRbIS1y4egpsJqeAnc S2HSvZIQ6ylZjTPpFtAiPvAkaGVYwaxalFZalFukaWeklFmekZJbmJmTm6hgZmermpxcWJ6ak 5iUnFesn5uZsYgeHAAAQ7GA8sCjzEKMnBpCTKy3U1IEKILyk/pTIjsTgjvqg0J7X4EKMGB4fA lXNzpzNJseTl56UqSfCaSQZGCAkWpaanVqRl5gADFqZUgoNHSYRXXRwozVtckJhbnJkOkTrFq CglzpsD0icAksgozYNrg0XJJUZZKWFeRqCjhHgKUotyM0tQ5V8xinMwKgnzxoNM4cnMK4Gb/g poMRPQYtEl/iCLSxIRUlINjDteMX2cXMd7sppN6cPXbzvPPeFIVb06zdHA3S90wV+V0tV6kYd uu3sdmaySmDNvXmb/gSdW7BUahXe+m7cvSdsfz1slnpSQELTiUZEK815Dw+NJjWL/pUt/W//s vZ9v7VXjYt93LT/CxlIqPI+H2SnDi+/fd6bDnvoRJUF8LpnHXT9ufGWjxFKckWioxVxUnAgAP 0ljLI0CAAA= X-Env-Sender: haozhong.zhang@intel.com X-Msg-Ref: server-2.tower-27.messagelabs.com!1481710332!24842777!2 X-Originating-IP: [192.55.52.93] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogMTkyLjU1LjUyLjkzID0+IDMyNDY2NQ==\n X-StarScan-Received: X-StarScan-Version: 9.1.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 32318 invoked from network); 14 Dec 2016 10:12:15 -0000 Received: from mga11.intel.com (HELO mga11.intel.com) (192.55.52.93) by server-2.tower-27.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 14 Dec 2016 10:12:15 -0000 Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga102.fm.intel.com with ESMTP; 14 Dec 2016 02:12:14 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,346,1477983600"; d="scan'208";a="42364896" Received: from hz-desktop.sh.intel.com (HELO localhost) ([10.239.159.148]) by fmsmga005.fm.intel.com with ESMTP; 14 Dec 2016 02:12:12 -0800 From: Haozhong Zhang To: xen-devel@lists.xen.org Date: Wed, 14 Dec 2016 18:11:43 +0800 Message-Id: <20161214101145.11171-3-haozhong.zhang@intel.com> X-Mailer: git-send-email 2.10.1 In-Reply-To: <20161214101145.11171-1-haozhong.zhang@intel.com> References: <20161214101145.11171-1-haozhong.zhang@intel.com> Cc: Haozhong Zhang , Kevin Tian , Jun Nakajima , Andrew Cooper , Jan Beulich Subject: [Xen-devel] [PATCH v2 2/4] vvmx: return VMfail to L1 if L1 vmxon is executed in VMX operation X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP According to Intel SDM, section "VMXON - Enter VMX Operation", a VMfail should be returned to L1 hypervisor if L1 vmxon is executed in VMX operation, rather than just print a warning message. Signed-off-by: Haozhong Zhang Reviewed-by: Andrew Cooper Acked-by: Kevin Tian --- xen/arch/x86/hvm/vmx/vvmx.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/xen/arch/x86/hvm/vmx/vvmx.c b/xen/arch/x86/hvm/vmx/vvmx.c index eae8150..e765b60 100644 --- a/xen/arch/x86/hvm/vmx/vvmx.c +++ b/xen/arch/x86/hvm/vmx/vvmx.c @@ -1390,9 +1390,12 @@ int nvmx_handle_vmxon(struct cpu_user_regs *regs) return rc; if ( nvmx_vcpu_in_vmx(v) ) - gdprintk(XENLOG_WARNING, - "vmxon again: orig %"PRIpaddr" new %lx\n", - nvmx->vmxon_region_pa, gpa); + { + vmreturn(regs, + nvcpu->nv_vvmcxaddr != VMCX_EADDR ? + VMFAIL_VALID : VMFAIL_INVALID); + return X86EMUL_OKAY; + } nvmx->vmxon_region_pa = gpa;