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: 113246 Delivered-To: patch@linaro.org Received: by 10.80.163.150 with SMTP id s22csp1845988edb; Thu, 21 Sep 2017 05:42:55 -0700 (PDT) X-Google-Smtp-Source: AOwi7QB4Nbrs/DmZXonlKhBXHFPoV5vRu8dH8qUuDAYD6FPIaQ8CUy3kQ3gfg/q2hQ6i1aJWrV0r X-Received: by 10.107.180.216 with SMTP id d207mr3076008iof.275.1505997774901; Thu, 21 Sep 2017 05:42:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505997774; cv=none; d=google.com; s=arc-20160816; b=Y7sHIjINgwsE0bmZnlPkcmQLxtm9AcombPvdPv67SD+qNulnkKXfF0VcG+cm5mqMaz ilkgBjvU1fSEYS5zKaK/nFIGWh2VxjNQQr+romg4FCNTPn5I2S3pqYREG3hRubT7N2PH Kbl+30UnXdNll1gJFaFkJT2TiXKg6Abx9zlpR+OAaiDE0v9V2s6Bc2psWq6yHPM49Nyc 3SrPhOhNJSzLHBT1BrG/siRIMp5I3os0mHwPeLsIlD43qu+mlH1PSuJW4mCVwCJiLOti 7yYiFyg9p9BsaGjoeSanaScIMM2xBGZ/AeG7tXaYMokZVdDf8LeSLlR4P5bpopJIbmv2 sdzQ== 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=FlCsDt1Agggaj7lc5Uhj/Rjmxjm9HsXCZ1JlKGnGkYY=; b=iiQQGCCQvvyJfkpEvoq/EMZ7FU7CehxfP1fDRTBalRp4Kq0Bq3DJ2o/5hms9iX7kXz 02ol3oeyFen2BGk3Rs2rxIlva8BgXZqXkKcBIaYQ0FcHAlpRQls9HC9vFMwK7EcGYchf FdPrFOMRio95NtT0E1jqkBcjlLM1IDo5tqe2EeJ6xD3DOHdZYt30voc+4RCYbBAkVhPC kVcQftwePbC1iOGYtVDrnnWgc+IhkrmTIhvnrODlaCs3W/nOe3uuBzPlkt9qNSl+Y3b/ 7zYDRUKDHMIHNcbIIFG6cxvALsC+rx7UUTo04XSlZDtxpO9lzxqdj4at3rPCQWHFDO5U yetQ== 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 q65si1398513itg.158.2017.09.21.05.42.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 21 Sep 2017 05:42:54 -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 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" 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 ) {