From patchwork Mon Oct 2 12:59:36 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 114608 Delivered-To: patch@linaro.org Received: by 10.140.22.163 with SMTP id 32csp653905qgn; Mon, 2 Oct 2017 06:02:11 -0700 (PDT) X-Google-Smtp-Source: AOwi7QDea78kf9jBhrXdxzCIgPtGNKwGnFYXDt4W1zmk6HZCymL4OToq02JAxc/0xCR16cmCUfSh X-Received: by 10.36.82.145 with SMTP id d139mr19223257itb.86.1506949331491; Mon, 02 Oct 2017 06:02:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506949331; cv=none; d=google.com; s=arc-20160816; b=o8A4cbkyddX0Y7qJMm67cUICeGJiDY6CfeCf9Lb6TCXlT60OUlRgC3y7cO5X92btst Va6mCNh8AerjUnNCljkk8rB/hdDR8089wOEW5yS/mGswLQBlPfHZgS+oxwto27riQxT+ +R/NYyQA+KzlZLYdwFuuld362lAgBxHSxdwL03H5L/jI+ImebhtqmLsS91IYIv0TUlQS X0tXpYlmLGK79lMzfi2vqF0F0k1sVYEtUCcq3a8v4PODjxzTjTe5s4Ibgnh6POkEZAxe vVDEc2cU6REtZqXXfCYQQU7d/IIQnyCvoda1rbMwYMm0srOVNanVrt1BiQxX1aOOICBl RSlA== 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=gW3ZSWs9cgXQnq+hszEs9NseU/7DXrSzFCQ5cGx+C0w=; b=qSGNT6G02y0hRo8TeaIEAHl0l+4hAGyV+Qrhf7E591KYfqJEd++iL/CpDODiNMV32Z fQCHz5Q0JyKId7SJR+fM89IBNr0ZTbHXnmO+SWNjFme+r+woxjjodFt9uz0jQwBbUHJj IC8eZxdQFiaOsS/rBwSGVn3FHuQCavL/Vg6euy04r6gJVW7w9+J+wIvyMrUrB5kOtiK3 Z1wu8I+VIPIgeffXE1Mxm18VyREfMu35/pkKHRUbAFCU4AlhdPqZNIA06WmzLAdUwZYn 4Fg6ZdHHnJdKU4EKGBrEeIVgikFWrTv6tiQh8W0XzxYSnb4Ki9kC2tSIXVPRqr/f2Db2 xh5Q== 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 u127si8632205itg.154.2017.10.02.06.02.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 02 Oct 2017 06:02:11 -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 1dz0KP-0004DN-1D; Mon, 02 Oct 2017 13:00:09 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dz0KN-0004Bg-Gc for xen-devel@lists.xen.org; Mon, 02 Oct 2017 13:00:07 +0000 Received: from [85.158.137.68] by server-7.bemta-3.messagelabs.com id 1D/E9-02224-65832D95; Mon, 02 Oct 2017 13:00:06 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrELMWRWlGSWpSXmKPExsVysyfVTTfE4lK kwZaznBZLPi5mcWD0OLr7N1MAYxRrZl5SfkUCa8apLwuZCjbyVvw+3szUwHiVq4uRk0NIYDOj xMdTqV2MXED2aUaJe30T2EASbAKaEnc+f2ICsUUEpCWufb7MCFLELLCYUeLz/l5mkISwQIDE5 +e/wIpYBFQlWnYuAovzClhJTFy0gB3ElhCQl9jVdpEVxOYEir8//pEVYrOlxPHuSUwTGLkXMD KsYlQvTi0qSy3SNdJLKspMzyjJTczM0TU0MNbLTS0uTkxPzUlMKtZLzs/dxAj0bz0DA+MOxlP NzocYJTmYlER5mQ0vRQrxJeWnVGYkFmfEF5XmpBYfYpTh4FCS4E0xB8oJFqWmp1akZeYAAw0m LcHBoyTCawqS5i0uSMwtzkyHSJ1i1OXouHn3D5MQS15+XqqUOO9/M6AiAZCijNI8uBGwoL/EK CslzMvIwMAgxFOQWpSbWYIq/4pRnINRSZjXBWQVT2ZeCdymV0BHMAEdMafrAsgRJYkIKakGRk +5W65ygm0f1wXP4Nv0LSk6PZSztHpTmeZ3/awjxStT2uWU4jct+N9ZOOnOB6tIm46nFhcmbpf aFuTemHIpxP9Q3ePHys0bFtQkTVv2Pyam/rZfEG/ZTtezX75odF2XfST/bO+5z5+2Kk3Ofzhl 1XlRHbOn/NZ8S860+B1+KCee9euaGdMWMyWW4oxEQy3mouJEAD6bVmV1AgAA X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-7.tower-31.messagelabs.com!1506949203!109946467!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 22028 invoked from network); 2 Oct 2017 13:00:03 -0000 Received: from usa-sjc-mx-foss1.foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-7.tower-31.messagelabs.com with SMTP; 2 Oct 2017 13:00:03 -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 6444D165D; Mon, 2 Oct 2017 06:00:03 -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 552263F53D; Mon, 2 Oct 2017 06:00:02 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Mon, 2 Oct 2017 13:59:36 +0100 Message-Id: <20171002125941.11274-11-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171002125941.11274-1-julien.grall@arm.com> References: <20171002125941.11274-1-julien.grall@arm.com> Cc: George Dunlap , Andrew Cooper , Julien Grall , Jan Beulich Subject: [Xen-devel] [PATCH v3 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" Signed-off-by: Julien Grall Acked-by: Andrew Cooper Reviewed-by: Wei Liu Reviewed-by: George Dunlap --- Cc: George Dunlap Cc: Jan Beulich Cc: Andrew Cooper Changes in v3: - Add Wei's reviewed-by 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 ) {