From patchwork Fri Dec 18 19:39:55 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Boris Ostrovsky X-Patchwork-Id: 7887541 Return-Path: X-Original-To: patchwork-xen-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 219BEBEEED for ; Fri, 18 Dec 2015 19:42:27 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 520A12050B for ; Fri, 18 Dec 2015 19:42:26 +0000 (UTC) Received: from lists.xen.org (lists.xenproject.org [50.57.142.19]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7905F204E7 for ; Fri, 18 Dec 2015 19:42:25 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aA0s0-0005Tr-Nh; Fri, 18 Dec 2015 19:39:16 +0000 Received: from mail6.bemta4.messagelabs.com ([85.158.143.247]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aA0ry-0005TS-Un for xen-devel@lists.xen.org; Fri, 18 Dec 2015 19:39:15 +0000 Received: from [85.158.143.35] by server-3.bemta-4.messagelabs.com id 3F/34-31122-2E064765; Fri, 18 Dec 2015 19:39:14 +0000 X-Env-Sender: boris.ostrovsky@oracle.com X-Msg-Ref: server-13.tower-21.messagelabs.com!1450467552!4541522!1 X-Originating-IP: [156.151.31.81] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogMTU2LjE1MS4zMS44MSA9PiAyODgzMzk=\n X-StarScan-Received: X-StarScan-Version: 7.35.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 44245 invoked from network); 18 Dec 2015 19:39:13 -0000 Received: from userp1040.oracle.com (HELO userp1040.oracle.com) (156.151.31.81) by server-13.tower-21.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 18 Dec 2015 19:39:13 -0000 Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id tBIJd3sk031436 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 18 Dec 2015 19:39:04 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserv0021.oracle.com (8.13.8/8.13.8) with ESMTP id tBIJd3S4029510 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Fri, 18 Dec 2015 19:39:03 GMT Received: from abhmp0015.oracle.com (abhmp0015.oracle.com [141.146.116.21]) by userv0121.oracle.com (8.13.8/8.13.8) with ESMTP id tBIJd2d9014006; Fri, 18 Dec 2015 19:39:02 GMT Received: from ovs104.us.oracle.com (/10.149.76.204) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 18 Dec 2015 11:39:01 -0800 From: Boris Ostrovsky To: jbeulich@suse.com, andrew.cooper3@citrix.com, keir@xen.org Date: Fri, 18 Dec 2015 14:39:55 -0500 Message-Id: <1450467596-3649-2-git-send-email-boris.ostrovsky@oracle.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1450467596-3649-1-git-send-email-boris.ostrovsky@oracle.com> References: <1450467596-3649-1-git-send-email-boris.ostrovsky@oracle.com> X-Source-IP: aserv0021.oracle.com [141.146.126.233] Cc: kevin.tian@intel.com, jun.nakajima@intel.com, xen-devel@lists.xen.org, Aravind.Gopalakrishnan@amd.com, suravee.suthikulpanit@amd.com, Boris Ostrovsky Subject: [Xen-devel] [PATCH v3 1/2] x86/mm: Add information about faulted page's presence to npfec structure X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This is provided explicitly in SVM and implicitly in VMX (when neither of the three EPT_EFFECTIVE_* bits is set). Signed-off-by: Boris Ostrovsky Reviewed-by: Jan Beulich Cc: kevin.tian@intel.com Cc: jun.nakajima@intel.com Cc: suravee.suthikulpanit@amd.com Cc: Aravind.Gopalakrishnan@amd.com Acked-by: Kevin Tian --- xen/arch/x86/hvm/svm/svm.c | 3 ++- xen/arch/x86/hvm/vmx/vmx.c | 5 ++++- xen/include/xen/mm.h | 1 + 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c index 0078100..a66d854 100644 --- a/xen/arch/x86/hvm/svm/svm.c +++ b/xen/arch/x86/hvm/svm/svm.c @@ -1491,7 +1491,8 @@ static void svm_do_nested_pgfault(struct vcpu *v, struct npfec npfec = { .read_access = !(pfec & PFEC_insn_fetch), .write_access = !!(pfec & PFEC_write_access), - .insn_fetch = !!(pfec & PFEC_insn_fetch) + .insn_fetch = !!(pfec & PFEC_insn_fetch), + .present = !!(pfec & PFEC_page_present), }; /* These bits are mutually exclusive */ diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c index 2922673..7ea1882 100644 --- a/xen/arch/x86/hvm/vmx/vmx.c +++ b/xen/arch/x86/hvm/vmx/vmx.c @@ -2746,7 +2746,10 @@ static void ept_handle_violation(unsigned long qualification, paddr_t gpa) .read_access = !!(qualification & EPT_READ_VIOLATION) || !!(qualification & EPT_WRITE_VIOLATION), .write_access = !!(qualification & EPT_WRITE_VIOLATION), - .insn_fetch = !!(qualification & EPT_EXEC_VIOLATION) + .insn_fetch = !!(qualification & EPT_EXEC_VIOLATION), + .present = !!(qualification & (EPT_EFFECTIVE_READ | + EPT_EFFECTIVE_WRITE | + EPT_EFFECTIVE_EXEC)) }; if ( tb_init_done ) diff --git a/xen/include/xen/mm.h b/xen/include/xen/mm.h index 5d4b64b..a795dd6 100644 --- a/xen/include/xen/mm.h +++ b/xen/include/xen/mm.h @@ -159,6 +159,7 @@ struct npfec { unsigned int read_access:1; unsigned int write_access:1; unsigned int insn_fetch:1; + unsigned int present:1; unsigned int gla_valid:1; unsigned int kind:2; /* npfec_kind_t */ };