From patchwork Fri Jun 22 23:35:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liran Alon X-Patchwork-Id: 10483309 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 2A7A3602CB for ; Fri, 22 Jun 2018 23:36:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1885428FAF for ; Fri, 22 Jun 2018 23:36:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0D33829065; Fri, 22 Jun 2018 23:36:27 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 95F8528FAF for ; Fri, 22 Jun 2018 23:36:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934329AbeFVXgZ (ORCPT ); Fri, 22 Jun 2018 19:36:25 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:34556 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934285AbeFVXgT (ORCPT ); Fri, 22 Jun 2018 19:36:19 -0400 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w5MNYEAb117183; Fri, 22 Jun 2018 23:36:06 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=corp-2017-10-26; bh=taMVLiorEusAjVBSpBgrJI8DygwFu48EyvIeCcbz+Fw=; b=dUaebt26oNgiaV4cSpdJKTX4VtOnjEXSRkTJpFflMoOoVMzJaq3nPNP1/xDgAfltrmZH BUv/5wZNhPMNZFpzK61JTUYPo+xSTBObYcuYvMOcfD9oDvCA5PgzBDe9ztNe48KZ0ZzY l+JvSN9hFYqVLloraOYBwAHQlUUWHcsZu2cJy27eBy8ONAw16S+9h3axapNVYiwQFwbV NguUiIxIghAECOpc/hxzxD8sKtdJyNeP80vHM5RvsaUI11sdj+Y4v2EOUvsAcK/MCatT R0XQkVMZTKZ7Knm4HrLXaIJD/vbEvN3Bq95T7CWrxC5ToNr+eQ2+ahl8sFToGfW+Mx5p NQ== Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by userp2120.oracle.com with ESMTP id 2jrp8huqfg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 22 Jun 2018 23:36:06 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w5MNa6ic015829 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 22 Jun 2018 23:36:06 GMT Received: from abhmp0008.oracle.com (abhmp0008.oracle.com [141.146.116.14]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w5MNa5qH018550; Fri, 22 Jun 2018 23:36:06 GMT Received: from liran-pc.mynet (/79.183.72.72) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 22 Jun 2018 16:36:05 -0700 From: Liran Alon To: pbonzini@redhat.com, rkrcmar@redhat.com, kvm@vger.kernel.org Cc: jmattson@google.com, idan.brown@oracle.com, Liran Alon Subject: [PATCH 16/22] KVM: nVMX: Add VMCS field type enumeration Date: Sat, 23 Jun 2018 02:35:16 +0300 Message-Id: <1529710522-28315-17-git-send-email-liran.alon@oracle.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1529710522-28315-1-git-send-email-liran.alon@oracle.com> References: <1529710522-28315-1-git-send-email-liran.alon@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8932 signatures=668703 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=630 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1806210000 definitions=main-1806220260 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP No functionality change. Signed-off-by: Liran Alon Signed-off-by: Jim Mattson --- arch/x86/kvm/vmx.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 3327bd7fe81f..162e9517faa8 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -4510,9 +4510,21 @@ static inline int vmcs_field_width(unsigned long field) return (field >> 13) & 0x3 ; } +enum vmcs_field_type { + VMCS_FIELD_TYPE_CONTROL = 0, + VMCS_FIELD_TYPE_READ_ONLY_DATA = 1, + VMCS_FIELD_TYPE_GUEST = 2, + VMCS_FIELD_TYPE_HOST = 3 +}; + +static inline int vmcs_field_type(unsigned long field) +{ + return (field >> 10) & 0x3; +} + static inline int vmcs_field_readonly(unsigned long field) { - return (((field >> 10) & 0x3) == 1); + return (vmcs_field_type(field) == VMCS_FIELD_TYPE_READ_ONLY_DATA); } static void init_vmcs_shadow_fields(void)