From patchwork Thu Sep 21 12:40:29 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 9963837 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 02D2C6056A for ; Thu, 21 Sep 2017 12:43:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EBAC2294C5 for ; Thu, 21 Sep 2017 12:43:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E0642294C8; Thu, 21 Sep 2017 12:43:16 +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 BDEE7294C5 for ; Thu, 21 Sep 2017 12:43:15 +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 1dv0mq-0001NJ-Aa; Thu, 21 Sep 2017 12:41:00 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dv0mp-0001Kf-0t for xen-devel@lists.xen.org; Thu, 21 Sep 2017 12:40:59 +0000 Received: from [85.158.137.68] by server-11.bemta-3.messagelabs.com id 2F/6A-01812-A53B3C95; Thu, 21 Sep 2017 12:40:58 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrCLMWRWlGSWpSXmKPExsVysyfVTTdy8+F Ig73LdS2WfFzM4sDocXT3b6YAxijWzLyk/IoE1oy9rQtYCy7xVHTt2MPawNjH1cXIxSEksJlR 4s/rLjYI5zSjxKNZdxm7GDk52AQ0Je58/sQEYosISEtc+3yZEaSIWWAxo8Tn/b3MIAlhgQCJf XP+gtksAqoS7y98BmvgFbCUaNv4hR3ElhCQl9jVdpEVxOYEiR/+BmYLCVhI/JpwgnUCI/cCRo ZVjBrFqUVlqUW6RgZ6SUWZ6RkluYmZObqGBsZ6uanFxYnpqTmJScV6yfm5mxiBPq5nYGDcwdh 8wu8QoyQHk5Io7wbFw5FCfEn5KZUZicUZ8UWlOanFhxhlODiUJHh1lIFygkWp6akVaZk5wGCD SUtw8CiJ8AaApHmLCxJzizPTIVKnGHU5Om7e/cMkxJKXn5cqJc77WwmoSACkKKM0D24ELPAvM cpKCfMyMjAwCPEUpBblZpagyr9iFOdgVBLmFQVZxZOZVwK36RXQEUxAR2RvOAByREkiQkqqgX Fz2CEhs0tuTLdCVpyblsgRfvVX64LHXkmRHhMFnP4vCZiQpXLwV23spqO2pr/tT8w/fE2JzSX 8sOYej0eBy1kOr57Leon1VAO7rvWW4GT+Q0t0Fi7SObrE7tbDmxUG3BvX5Eu+2dyj+NLNsekB 26ttSm5P3lSZys+V8/yRl/tX62IC25xjbB1KLMUZiYZazEXFiQCeYIaodwIAAA== X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-3.tower-31.messagelabs.com!1505997657!115886870!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 51393 invoked from network); 21 Sep 2017 12:40:57 -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; 21 Sep 2017 12:40:57 -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 00D401529; Thu, 21 Sep 2017 05:40:57 -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 E5C4E3F58C; Thu, 21 Sep 2017 05:40:55 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Thu, 21 Sep 2017 13:40:29 +0100 Message-Id: <20170921124035.2410-11-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170921124035.2410-1-julien.grall@arm.com> References: <20170921124035.2410-1-julien.grall@arm.com> Cc: George Dunlap , Andrew Cooper , Julien Grall , Jan Beulich Subject: [Xen-devel] [PATCH v2 10/16] xen/x86: p2m-pod: Use typesafe GFN in pod_eager_record 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 Signed-off-by: Julien Grall Acked-by: Andrew Cooper Reviewed-by: Wei Liu --- Cc: George Dunlap Cc: Jan Beulich Cc: Andrew Cooper Changes in v2: - Add Andrew's acked-by --- xen/arch/x86/mm/p2m-pod.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/xen/arch/x86/mm/p2m-pod.c b/xen/arch/x86/mm/p2m-pod.c index b8a51cf12a..176d06cb42 100644 --- a/xen/arch/x86/mm/p2m-pod.c +++ b/xen/arch/x86/mm/p2m-pod.c @@ -1062,15 +1062,15 @@ static void pod_eager_reclaim(struct p2m_domain *p2m) } while ( (p2m->pod.count == 0) && (i < ARRAY_SIZE(mrp->list)) ); } -static void pod_eager_record(struct p2m_domain *p2m, - unsigned long gfn, unsigned int order) +static void pod_eager_record(struct p2m_domain *p2m, gfn_t gfn, + unsigned int order) { struct pod_mrp_list *mrp = &p2m->pod.mrp; - ASSERT(gfn != gfn_x(INVALID_GFN)); + ASSERT(!gfn_eq(gfn, INVALID_GFN)); mrp->list[mrp->idx++] = - gfn | (order == PAGE_ORDER_2M ? POD_LAST_SUPERPAGE : 0); + gfn_x(gfn) | (order == PAGE_ORDER_2M ? POD_LAST_SUPERPAGE : 0); mrp->idx %= ARRAY_SIZE(mrp->list); } @@ -1160,7 +1160,7 @@ p2m_pod_demand_populate(struct p2m_domain *p2m, unsigned long gfn, p2m->pod.entry_count -= (1UL << order); BUG_ON(p2m->pod.entry_count < 0); - pod_eager_record(p2m, gfn_x(gfn_aligned), order); + pod_eager_record(p2m, gfn_aligned, order); if ( tb_init_done ) {