From patchwork Wed Sep 13 17:59:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 9951805 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 0E8E36038F for ; Wed, 13 Sep 2017 18:02:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0157B28C27 for ; Wed, 13 Sep 2017 18:02:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EA60428C1C; Wed, 13 Sep 2017 18:02:37 +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 9DC9A28C1C for ; Wed, 13 Sep 2017 18:02:37 +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 1dsBxS-0007wG-EY; Wed, 13 Sep 2017 18:00:18 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dsBxQ-0007uV-Ke for xen-devel@lists.xen.org; Wed, 13 Sep 2017 18:00:16 +0000 Received: from [85.158.143.35] by server-10.bemta-6.messagelabs.com id 83/44-03642-03279B95; Wed, 13 Sep 2017 18:00:16 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrMLMWRWlGSWpSXmKPExsVysyfVTVe/aGe kwbu3yhZLPi5mcWD0OLr7N1MAYxRrZl5SfkUCa8br2zdZC15xV0yeupCtgXEfZxcjF4eQwGZG iUU7pjFCOKcZJVZMeMvSxcjJwSagKXHn8ycmEFtEQFri2ufLYEXMAosZJT7v72UGSQgL+Eocf 3eNDcRmEVCVaHy1C8zmFbCS+H7rD1izhIC8xK62i6wgNidQfObXBUBxDqBtlhKne6ImMHIvYG RYxahRnFpUllqka2iil1SUmZ5RkpuYmaNraGCml5taXJyYnpqTmFSsl5yfu4kR6GEGINjBeH1 jwCFGSQ4mJVHevbo7I4X4kvJTKjMSizPii0pzUosPMcpwcChJ8EoUAuUEi1LTUyvSMnOAoQaT luDgURLhfVsAlOYtLkjMLc5Mh0idYtTl6Lh59w+TEEtefl6qlDhvDMgMAZCijNI8uBGwsL/EK CslzMsIdJQQT0FqUW5mCar8K0ZxDkYlYV49kCk8mXklcJteAR3BBHTEmdM7QI4oSURISTUwrv SXn5g5XSp4gXTSx6t+8SdDfijbi23uuGt35828RBMfFea5vFzeakXZcSqaS3qcuO5cujbzylK XZVJH/+2Zbuj23tltyfGKJ5tav28zYDQqD/oqePNC+AqpTwJMk3zjGqfNOPlmUuu/E9vvn1ty y1E7vCDH7XO7t+39u91ZDx5NsHJ/eE6/VImlOCPRUIu5qDgRAMdnaVd2AgAA X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-6.tower-21.messagelabs.com!1505325615!59645702!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 23765 invoked from network); 13 Sep 2017 18:00:15 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-6.tower-21.messagelabs.com with SMTP; 13 Sep 2017 18:00:15 -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 DA9E71435; Wed, 13 Sep 2017 11:00:14 -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 C91F03F483; Wed, 13 Sep 2017 11:00:13 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Wed, 13 Sep 2017 18:59:48 +0100 Message-Id: <20170913175953.16942-11-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 10/15] 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 --- Cc: George Dunlap Cc: Jan Beulich Cc: Andrew Cooper --- 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 ) {