From patchwork Wed Sep 13 17:59:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 112467 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp1226666qgf; Wed, 13 Sep 2017 11:02:27 -0700 (PDT) X-Google-Smtp-Source: AOwi7QApD/rc6E7ArFUJL0FIg/zP+bhRS6wWcjCn8dj5bGN+gyZi2uGncA2A/EbcnNtyd2uj4vKS X-Received: by 10.36.29.199 with SMTP id 190mr5737211itj.78.1505325746979; Wed, 13 Sep 2017 11:02:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505325746; cv=none; d=google.com; s=arc-20160816; b=wS3rj6y6yeZhmpAL7RGYqWbpwH7h9QfRuZqub5nN/hjh+JDHby+3MqLvQVzA9NmgYN tqpQoGUNiv2+vaFPniCYG1e+h6fPqvuw/Emy9Z9q+2YbZSOEC80LCKZNu7cZ8nuLgDOy xp6avn4bwTmWMj4ERWTlvvAyGpbNNBWxIv3dLMEGQUPHUq5hxg/PjknInZfbWwz5eZrZ HkMG3CB1MPVLDcZ5/NF6oUPT6aCi82h/u4KG9l2Wpwm8hoYnYJk+fIJGsJktY5USuOnY DmaZ/uzuj9PyFW+HUpNDznfxKUfn8h47IRVt7F5XbceJV2+lmuumNfXa4NZGpVe6Zs2B AlMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:cc:references:in-reply-to:message-id:date:to :from:arc-authentication-results; bh=1m7QtIW/P0a+2BGWL3YTve7VgCEjsUa71IJ/pBuP/1s=; b=qDmI7TA9pyMjhe0H95FjBUThNCS/mV4s5iSKfqckReJHEk+s9KxoxDyN1K8Vq1YKIJ 0vV36EHMxDunQAhKFpY+Ctj0+OP3tFoDK5Zyp1NRdi++KNQUPvECrKBj3Y4dsbL1Nbhz a/olcU+YE1gwz099jRy5iq56aAaOxSZZlKW7pXMWl7xg7SQUK/lYKLFC4+WmuDDKToDp DvkBcwWj5YuBhRJeohzFvVIYAJ1vOGT8HUicUKeAio2kWxwgEZetj9ydvMjraWMq780E sp2uJ/swoPHc4H0FFp4EwA0mRPB9s2HoLbE7lPkHTH464sxGHifkKAk4wnTkBB8smCc4 qXNg== ARC-Authentication-Results: i=1; mx.google.com; spf=neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) smtp.mailfrom=xen-devel-bounces@lists.xen.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id m202si2676202iom.191.2017.09.13.11.02.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Sep 2017 11:02:26 -0700 (PDT) Received-SPF: neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) client-ip=192.237.175.120; Authentication-Results: mx.google.com; spf=neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) smtp.mailfrom=xen-devel-bounces@lists.xen.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dsBxW-00083z-Am; Wed, 13 Sep 2017 18:00:22 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dsBxV-00081U-BV for xen-devel@lists.xen.org; Wed, 13 Sep 2017 18:00:21 +0000 Received: from [85.158.137.68] by server-5.bemta-3.messagelabs.com id 58/06-02226-43279B95; Wed, 13 Sep 2017 18:00:20 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrMLMWRWlGSWpSXmKPExsVysyfVTde4aGe kwaRrphZLPi5mcWD0OLr7N1MAYxRrZl5SfkUCa8aKq9NYCz6oVrxe/4O5gfGvVBcjF4eQwGZG iR3dFxkhnNOMEjtPbGLuYuTkYBPQlLjz+RMTiC0iIC1x7fNlsCJmgcWMEp/394IVCQuESPybu pkRxGYRUJXYsfw4O4jNK2Al8Xj1LbBmCQF5iV1tF1lBbE6g+MyvC4DiHEDbLCVO90RNYORewM iwilGjOLWoLLVI19BUL6koMz2jJDcxM0fX0MBYLze1uDgxPTUnMalYLzk/dxMj0MMMQLCDcc1 2z0OMkhxMSqK8e3V3RgrxJeWnVGYkFmfEF5XmpBYfYpTh4FCS4J1dAJQTLEpNT61Iy8wBhhpM WoKDR0mE9y1Imre4IDG3ODMdInWKUZej4+bdP0xCLHn5ealS4rzrQYoEQIoySvPgRsDC/hKjr JQwLyPQUUI8BalFuZklqPKvGMU5GJWEedMKgabwZOaVwG16BXQEE9ARZ07vADmiJBEhJdXA2C l/7OC5Akanh7wMT4r/iM0J//jfNqm3TPmVqtANnU61i8VT+wo2Z1ayb1+zS8IzWD0kSvN6olt EX91LlThLj13ax9RfsZ45uGfdm53znrpoP/95+OCJN+Znr00XY5N70pcrdM9PTk9NQYV5zd66 Tafu97ZvCFw0pbfJb4mEr9M5y63PHdk1lFiKMxINtZiLihMB0vMLgnYCAAA= X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-3.tower-31.messagelabs.com!1505325619!114657001!1 X-Originating-IP: [217.140.101.70] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 57962 invoked from network); 13 Sep 2017 18:00:19 -0000 Received: from usa-sjc-mx-foss1.foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-3.tower-31.messagelabs.com with SMTP; 13 Sep 2017 18:00:19 -0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id D081A1435; Wed, 13 Sep 2017 11:00:18 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.206.53]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id BD9253F483; Wed, 13 Sep 2017 11:00:17 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Wed, 13 Sep 2017 18:59:51 +0100 Message-Id: <20170913175953.16942-14-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170913175953.16942-1-julien.grall@arm.com> References: <20170913175953.16942-1-julien.grall@arm.com> Cc: George Dunlap , Andrew Cooper , Julien Grall , Jan Beulich Subject: [Xen-devel] [PATCH 13/15] xen/x86: p2m-pod: Use typesafe gfn in p2m_pod_demand_populate 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" Signed-off-by: Julien Grall --- Cc: George Dunlap Cc: Jan Beulich Cc: Andrew Cooper --- xen/arch/x86/mm/p2m-ept.c | 4 ++-- xen/arch/x86/mm/p2m-pod.c | 12 ++++++------ xen/arch/x86/mm/p2m-pt.c | 6 +++--- xen/include/asm-x86/p2m.h | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/xen/arch/x86/mm/p2m-ept.c b/xen/arch/x86/mm/p2m-ept.c index dff214cf7b..36627f1ce0 100644 --- a/xen/arch/x86/mm/p2m-ept.c +++ b/xen/arch/x86/mm/p2m-ept.c @@ -965,7 +965,7 @@ static mfn_t ept_get_entry(struct p2m_domain *p2m, index = gfn_remainder >> ( i * EPT_TABLE_ORDER); ept_entry = table + index; - if ( !p2m_pod_demand_populate(p2m, gfn, i * EPT_TABLE_ORDER, q) ) + if ( !p2m_pod_demand_populate(p2m, gfn_t, i * EPT_TABLE_ORDER, q) ) goto retry; else goto out; @@ -987,7 +987,7 @@ static mfn_t ept_get_entry(struct p2m_domain *p2m, ASSERT(i == 0); - if ( p2m_pod_demand_populate(p2m, gfn, + if ( p2m_pod_demand_populate(p2m, gfn_t, PAGE_ORDER_4K, q) ) goto out; } diff --git a/xen/arch/x86/mm/p2m-pod.c b/xen/arch/x86/mm/p2m-pod.c index 0dd0f0a083..5c79444d7b 100644 --- a/xen/arch/x86/mm/p2m-pod.c +++ b/xen/arch/x86/mm/p2m-pod.c @@ -1076,13 +1076,13 @@ static void pod_eager_record(struct p2m_domain *p2m, gfn_t gfn, } int -p2m_pod_demand_populate(struct p2m_domain *p2m, unsigned long gfn, +p2m_pod_demand_populate(struct p2m_domain *p2m, gfn_t gfn, unsigned int order, p2m_query_t q) { struct domain *d = p2m->domain; struct page_info *p = NULL; /* Compiler warnings */ - gfn_t gfn_aligned = _gfn((gfn >> order) << order); + gfn_t gfn_aligned = _gfn((gfn_x(gfn) >> order) << order); mfn_t mfn; unsigned long i; @@ -1135,8 +1135,8 @@ p2m_pod_demand_populate(struct p2m_domain *p2m, unsigned long gfn, goto out_of_memory; /* Keep track of the highest gfn demand-populated by a guest fault */ - if ( gfn > p2m->pod.max_guest ) - p2m->pod.max_guest = gfn; + if ( gfn_x(gfn) > p2m->pod.max_guest ) + p2m->pod.max_guest = gfn_x(gfn); /* * Get a page f/ the cache. A NULL return value indicates that the @@ -1170,7 +1170,7 @@ p2m_pod_demand_populate(struct p2m_domain *p2m, unsigned long gfn, int d:16,order:16; } t; - t.gfn = gfn; + t.gfn = gfn_x(gfn); t.mfn = mfn_x(mfn); t.d = d->domain_id; t.order = order; @@ -1210,7 +1210,7 @@ remap_and_retry: int d:16; } t; - t.gfn = gfn; + t.gfn = gfn_x(gfn); t.d = d->domain_id; __trace_var(TRC_MEM_POD_SUPERPAGE_SPLINTER, 0, sizeof(t), &t); diff --git a/xen/arch/x86/mm/p2m-pt.c b/xen/arch/x86/mm/p2m-pt.c index 57878b1886..3dd4bef66e 100644 --- a/xen/arch/x86/mm/p2m-pt.c +++ b/xen/arch/x86/mm/p2m-pt.c @@ -802,7 +802,7 @@ pod_retry_l3: { if ( q & P2M_ALLOC ) { - if ( !p2m_pod_demand_populate(p2m, gfn, PAGE_ORDER_1G, q) ) + if ( !p2m_pod_demand_populate(p2m, gfn_t, PAGE_ORDER_1G, q) ) goto pod_retry_l3; gdprintk(XENLOG_ERR, "%s: Allocate 1GB failed!\n", __func__); } @@ -844,7 +844,7 @@ pod_retry_l2: if ( p2m_flags_to_type(flags) == p2m_populate_on_demand ) { if ( q & P2M_ALLOC ) { - if ( !p2m_pod_demand_populate(p2m, gfn, PAGE_ORDER_2M, q) ) + if ( !p2m_pod_demand_populate(p2m, gfn_t, PAGE_ORDER_2M, q) ) goto pod_retry_l2; } else *t = p2m_populate_on_demand; @@ -883,7 +883,7 @@ pod_retry_l1: if ( l1t == p2m_populate_on_demand ) { if ( q & P2M_ALLOC ) { - if ( !p2m_pod_demand_populate(p2m, gfn, PAGE_ORDER_4K, q) ) + if ( !p2m_pod_demand_populate(p2m, gfn_t, PAGE_ORDER_4K, q) ) goto pod_retry_l1; } else *t = p2m_populate_on_demand; diff --git a/xen/include/asm-x86/p2m.h b/xen/include/asm-x86/p2m.h index 07ca02a173..1ae9216404 100644 --- a/xen/include/asm-x86/p2m.h +++ b/xen/include/asm-x86/p2m.h @@ -720,7 +720,7 @@ extern void audit_p2m(struct domain *d, /* Called by p2m code when demand-populating a PoD page */ int -p2m_pod_demand_populate(struct p2m_domain *p2m, unsigned long gfn, +p2m_pod_demand_populate(struct p2m_domain *p2m, gfn_t gfn, unsigned int order, p2m_query_t q);