From patchwork Wed Sep 13 17:59:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 9951809 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 F2611603F4 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 E550F28C1C for ; Wed, 13 Sep 2017 18:02:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DA0FA28C32; Wed, 13 Sep 2017 18:02:38 +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 7858F28C27 for ; Wed, 13 Sep 2017 18:02:38 +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-0007xV-Rv; Wed, 13 Sep 2017 18:00:18 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dsBxS-0007vb-CP for xen-devel@lists.xen.org; Wed, 13 Sep 2017 18:00:18 +0000 Received: from [85.158.139.211] by server-4.bemta-5.messagelabs.com id 88/F3-09852-13279B95; Wed, 13 Sep 2017 18:00:17 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrMLMWRWlGSWpSXmKPExsVysyfVTdegaGe kwazrNhZLPi5mcWD0OLr7N1MAYxRrZl5SfkUCa8ajk5eYClbzVBy/tYKxgXEiZxcjF4eQwGZG iXsHL7BDOKcZJXZ92cbcxcjJwSagKXHn8ycmEFtEQFri2ufLjCBFzAKLGSU+7+8FKxIWcJE4M qEPzGYRUJU492MOI4jNK2AlcfjrVDBbQkBeYlfbRVYQmxMoPvPrAqChHEDbLCVO90RNYORewM iwilGjOLWoLLVI18hAL6koMz2jJDcxM0fX0MBULze1uDgxPTUnMalYLzk/dxMj0MP1DAyMOxg bZ/sdYpTkYFIS5d2ruzNSiC8pP6UyI7E4I76oNCe1+BCjDAeHkgSvRCFQTrAoNT21Ii0zBxhq MGkJDh4lEV5tkDRvcUFibnFmOkTqFKMuR8fNu3+YhFjy8vNSpcR5Y0CKBECKMkrz4EbAwv4So 6yUMC8jAwODEE9BalFuZgmq/CtGcQ5GJWFePZApPJl5JXCbXgEdwQR0xJnTO0COKElESEk1MA otUzFQyNqWc6faTLNg77G3YnfXRxn1qW92bJ3gvH37ir2binlnu7wy1HqlpfFk6YYlW9zktut PenCSJf9Fi+Kzqa4zNvpGvl+x2mzixANL0p90n130fv39BvHu/TWMVnsYvQwN2x1e1P1+yPx3 /tolzoIO+x5W2X9/lcEZEfRPo+/m9hNmXzyUWIozEg21mIuKEwGRz3wIdgIAAA== X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-8.tower-206.messagelabs.com!1505325616!111266319!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 1917 invoked from network); 13 Sep 2017 18:00:16 -0000 Received: from usa-sjc-mx-foss1.foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-8.tower-206.messagelabs.com with SMTP; 13 Sep 2017 18:00:16 -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 33EF1169F; Wed, 13 Sep 2017 11:00:16 -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 227833F483; Wed, 13 Sep 2017 11:00:14 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Wed, 13 Sep 2017 18:59:49 +0100 Message-Id: <20170913175953.16942-12-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 11/15] xen/x86: p2m-pod: Clean-up p2m_pod_zero_check 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, 6 insertions(+), 4 deletions(-) diff --git a/xen/arch/x86/mm/p2m-pod.c b/xen/arch/x86/mm/p2m-pod.c index 176d06cb42..611a087855 100644 --- a/xen/arch/x86/mm/p2m-pod.c +++ b/xen/arch/x86/mm/p2m-pod.c @@ -861,17 +861,19 @@ p2m_pod_zero_check(struct p2m_domain *p2m, unsigned long *gfns, int count) for ( i = 0; i < count; i++ ) { p2m_access_t a; + struct page_info *pg; mfns[i] = p2m->get_entry(p2m, _gfn(gfns[i]), types + i, &a, 0, NULL, NULL); + pg = mfn_to_page(mfns[i]); + /* * If this is ram, and not a pagetable or from the xen heap, and * probably not mapped elsewhere, map it; otherwise, skip. */ - if ( p2m_is_ram(types[i]) - && ( (mfn_to_page(mfns[i])->count_info & PGC_allocated) != 0 ) - && ( (mfn_to_page(mfns[i])->count_info & (PGC_page_table|PGC_xen_heap)) == 0 ) - && ( (mfn_to_page(mfns[i])->count_info & PGC_count_mask) <= max_ref ) ) + if ( p2m_is_ram(types[i]) && (pg->count_info & PGC_allocated) && + ((pg->count_info & (PGC_page_table | PGC_xen_heap)) == 0) && + ((pg->count_info & (PGC_count_mask)) <= max_ref) ) map[i] = map_domain_page(mfns[i]); else map[i] = NULL;