From patchwork Mon Feb 13 14:21:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Dyasli X-Patchwork-Id: 9569831 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 E0F3D60572 for ; Mon, 13 Feb 2017 14:23:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CE0A7201F5 for ; Mon, 13 Feb 2017 14:23:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BFA8426E56; Mon, 13 Feb 2017 14:23:35 +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 739C3201F5 for ; Mon, 13 Feb 2017 14:23:35 +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 1cdHVM-00078S-Ql; Mon, 13 Feb 2017 14:21:24 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cdHVL-00077U-FP for xen-devel@lists.xen.org; Mon, 13 Feb 2017 14:21:23 +0000 Received: from [193.109.254.147] by server-10.bemta-6.messagelabs.com id F6/9D-13192-2E0C1A85; Mon, 13 Feb 2017 14:21:22 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmplkeJIrShJLcpLzFFi42JxWrohUvfhgYU RBl3z+SyWfFzM4sDocXT3b6YAxijWzLyk/IoE1owp85YzFcwVrrh0YDtrA+Mm/i5GTg4JAX+J rmln2UFsNgE9iY2zXzGB2CICshKru+YAxbk4mAWOMEpMXXUErEhYwFpizplJrCA2i4CqxKQFb YwgNq+ArcStXS9ZIIbKSVza9oW5i5GDg1PATuLwpESQsBBQybxbt1khbFWJ1y92sUC0CkqcnP kEzGYWkJA4+OIF8wRG3llIUrOQpBYwMq1i1ChOLSpLLdI1NtBLKspMzyjJTczM0TU0MNPLTS0 uTkxPzUlMKtZLzs/dxAgMHgYg2MH4d23gIUZJDiYlUd7YTQsjhPiS8lMqMxKLM+KLSnNSiw8x ynBwKEnwHt0PlBMsSk1PrUjLzAGGMUxagoNHSYQ3HSTNW1yQmFucmQ6ROsWoKCXOmwOSEABJZ JTmwbXBYucSo6yUMC8j0CFCPAWpRbmZJajyrxjFORiVhHkfgUzhycwrgZv+CmgxE9Bi1jiwxS WJCCmpBkZ7ASO1R75dW1VWuL/cyCPWyLIpVsHQzvPK75qlnR4+KT8MdH0jz3h2nCkTuMux4uG bHayypUfr5nM3ZXkFhLrOczSYKOYZc/jMwRguqZ70hsJ/seXRYmc3GNzct+Hq6qlRpicZXH6m HOdInmDyWfXSqeXCzgs6Ty5fFaDMuurqTOUq7ydftyqxFGckGmoxFxUnAgDPc2m+mAIAAA== X-Env-Sender: prvs=210fafdd7=sergey.dyasli@citrix.com X-Msg-Ref: server-16.tower-27.messagelabs.com!1486995679!86482422!1 X-Originating-IP: [66.165.176.89] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni44OSA9PiAyMDMwMDc=\n, received_headers: No Received headers X-StarScan-Received: X-StarScan-Version: 9.2.3; banners=-,-,- X-VirusChecked: Checked Received: (qmail 49700 invoked from network); 13 Feb 2017 14:21:20 -0000 Received: from smtp.citrix.com (HELO SMTP.CITRIX.COM) (66.165.176.89) by server-16.tower-27.messagelabs.com with RC4-SHA encrypted SMTP; 13 Feb 2017 14:21:20 -0000 X-IronPort-AV: E=Sophos;i="5.35,156,1484006400"; d="scan'208";a="406558634" From: Sergey Dyasli To: Date: Mon, 13 Feb 2017 14:21:08 +0000 Message-ID: <20170213142110.26467-2-sergey.dyasli@citrix.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170213142110.26467-1-sergey.dyasli@citrix.com> References: <20170213142110.26467-1-sergey.dyasli@citrix.com> MIME-Version: 1.0 Cc: Andrew Cooper , Kevin Tian , Jan Beulich , Jun Nakajima , Sergey Dyasli Subject: [Xen-devel] [PATCH v4 1/3] x86/vmx: introduce VMX_INSN_SUCCEED 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: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP The new value corresponds to VMsucceed status of VMX instructions. This will replace usage of literal zeroes in related functions. Update vmfail(), vmread_safe() and vmwrite_safe(). Signed-off-by: Sergey Dyasli Reviewed-by: Jan Beulich Acked-by: Kevin Tian --- xen/arch/x86/hvm/vmx/vvmx.c | 3 +++ xen/include/asm-x86/hvm/vmx/vmcs.h | 1 + xen/include/asm-x86/hvm/vmx/vmx.h | 4 ++-- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/xen/arch/x86/hvm/vmx/vvmx.c b/xen/arch/x86/hvm/vmx/vvmx.c index 9c61b5b..7172621 100644 --- a/xen/arch/x86/hvm/vmx/vvmx.c +++ b/xen/arch/x86/hvm/vmx/vvmx.c @@ -483,6 +483,9 @@ static void vmfail_invalid(struct cpu_user_regs *regs) static void vmfail(struct cpu_user_regs *regs, enum vmx_insn_errno errno) { + if ( errno == VMX_INSN_SUCCEED ) + return; + if ( vcpu_nestedhvm(current).nv_vvmcxaddr != INVALID_PADDR && errno != VMX_INSN_FAIL_INVALID ) vmfail_valid(regs, errno); diff --git a/xen/include/asm-x86/hvm/vmx/vmcs.h b/xen/include/asm-x86/hvm/vmx/vmcs.h index 3eb11e7..005e7e1 100644 --- a/xen/include/asm-x86/hvm/vmx/vmcs.h +++ b/xen/include/asm-x86/hvm/vmx/vmcs.h @@ -514,6 +514,7 @@ enum vmcs_field { /* VM Instruction error numbers */ enum vmx_insn_errno { + VMX_INSN_SUCCEED = 0, VMX_INSN_VMCLEAR_INVALID_PHYADDR = 2, VMX_INSN_VMLAUNCH_NONCLEAR_VMCS = 4, VMX_INSN_VMRESUME_NONLAUNCHED_VMCS = 5, diff --git a/xen/include/asm-x86/hvm/vmx/vmx.h b/xen/include/asm-x86/hvm/vmx/vmx.h index f4183d9..17e6342 100644 --- a/xen/include/asm-x86/hvm/vmx/vmx.h +++ b/xen/include/asm-x86/hvm/vmx/vmx.h @@ -404,7 +404,7 @@ static always_inline void __vmwrite(unsigned long field, unsigned long value) static inline enum vmx_insn_errno vmread_safe(unsigned long field, unsigned long *value) { - unsigned long ret = 0; + unsigned long ret = VMX_INSN_SUCCEED; bool fail_invalid, fail_valid; asm volatile ( GAS_VMX_OP("vmread %[field], %[value]\n\t", @@ -427,7 +427,7 @@ static inline enum vmx_insn_errno vmread_safe(unsigned long field, static inline enum vmx_insn_errno vmwrite_safe(unsigned long field, unsigned long value) { - unsigned long ret = 0; + unsigned long ret = VMX_INSN_SUCCEED; bool fail_invalid, fail_valid; asm volatile ( GAS_VMX_OP("vmwrite %[value], %[field]\n\t",