From patchwork Tue Jun 13 16:13:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 105394 Delivered-To: patch@linaro.org Received: by 10.140.91.77 with SMTP id y71csp486442qgd; Tue, 13 Jun 2017 09:15:29 -0700 (PDT) X-Received: by 10.36.74.195 with SMTP id k186mr846655itb.63.1497370528990; Tue, 13 Jun 2017 09:15:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1497370528; cv=none; d=google.com; s=arc-20160816; b=ZNmmGxONF4KYMcpyIyb01gxLmjTYFLUQNakjC7O9JxdCVZUBAD+4VO7YhAJZgRrVh9 U8v0Z3s+UMwyhtw6JHbPzqzUcYhY2RmmpAdSDV9kFLgFnptf0b+MZQmntr8p1SrRu47X rso5lKcTWCWgqs41Mg7+jpYA7ma6b/UYbRvdbY8bUeTXej8N2hkObC7J/5BEXqJxiHdw LGMZok6TX3x/GNUH1Yg2b1it0IFUAfFPg7OzwxcQWZssaiD6gVqkXTYAJ3lJqZQ6VxAm hlgMRyxqLwCCzWZdicv3qEPzUxY89ZFbMNkRQtM052M+Z5F+RUi72uk8uUoQ85kQoKpG 8Cxw== 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=Muh2gAxwrfE8NIaKADxwjOsBoVjeD+Vcd0M1QyBjwv4=; b=kcNyMDuWGIw6tu8f7cqvV3RuDwn302NxKt1HETIGZaVyjYUUpGTser8no/9aZ1wL20 iRh3LvLFz/Gpm4msjv+NWTT6eXXbWkvEkleLBxs73wTZt0npPKflLzxJ8pLU0N2Nh5i8 cYqL95djQhCJVX74A74uj/kNGbX3Xo8iRI0KP5ysnj5oR745jdn4d/jIufVYs1jYpRMF 3rIEbKGphXotaxfuyFuyeYp2Dr4/qEJ5RIPTrF3w35KA8cwqxcw0qCVR67gIHxofUd+S EIcbeaQ01GYyTxCnS3bY4R54kQOqi8ebDNo3vWwoOqbAyEYZXQFLp4/jve8TKlX87cKU ZJBA== 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 v188si399242ioe.165.2017.06.13.09.15.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Jun 2017 09:15:28 -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 1dKoRp-00086T-HR; Tue, 13 Jun 2017 16:13:41 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dKoRo-00080j-CZ for xen-devel@lists.xen.org; Tue, 13 Jun 2017 16:13:40 +0000 Received: from [193.109.254.147] by server-3.bemta-6.messagelabs.com id 55/69-03058-43F00495; Tue, 13 Jun 2017 16:13:40 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrKLMWRWlGSWpSXmKPExsVysyfVTdeY3yH SoGGNjsWSj4tZHBg9ju7+zRTAGMWamZeUX5HAmtF00LLgBmdF5+6FbA2M59m7GLk4hAQ2M0rs OHaIDcI5zSixf9JloAwnB5uApsSdz5+YQGwRAWmJa58vM4LYzAIREk0L9oLFhQVsJW5+38ACY rMIqEpcW/EAqJeDg1fAUmLyDHuQsISAvMSutousIDangJXEpedNYGOEgEqad69nmsDIvYCRYR WjRnFqUVlqka6RiV5SUWZ6RkluYmaOrqGBmV5uanFxYnpqTmJSsV5yfu4mRqB3GYBgB+O+j5G HGCU5mJREeT0F7CKF+JLyUyozEosz4otKc1KLDzHKcHAoSfDa8zlECgkWpaanVqRl5gDDDCYt wcGjJMJ7nwUozVtckJhbnJkOkTrFqCglzvuHFyghAJLIKM2Da4OF9iVGWSlhXkagQ4R4ClKLc jNLUOVfMYpzMCoJ87bwAE3hycwrgZv+CmgxE9Di61dsQBaXJCKkpBoYGc05D04oebQrcMnyN7 vWHLPzV+Te3lccqSMivmIb85LOhGLOr4nXXGQuH41kYq558kTbc9OyTBl2a4vAN1NnnTLra4i fsm6h4ZGtGpNSFLdnRLxKODrfT+T5EQ0J1pTkxxp3Oqe+v/1c7Lc4V2HcytV3D4jbGnzirfjC 23/++rvv9aZdbgtmK7EUZyQaajEXFScCAHxV48poAgAA X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-7.tower-27.messagelabs.com!1497370419!102885154!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.19; banners=-,-,- X-VirusChecked: Checked Received: (qmail 54640 invoked from network); 13 Jun 2017 16:13:39 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-7.tower-27.messagelabs.com with SMTP; 13 Jun 2017 16:13:39 -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 081E615B2; Tue, 13 Jun 2017 09:13:39 -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 41FBD3F557; Tue, 13 Jun 2017 09:13:38 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Tue, 13 Jun 2017 17:13:06 +0100 Message-Id: <20170613161323.25196-8-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170613161323.25196-1-julien.grall@arm.com> References: <20170613161323.25196-1-julien.grall@arm.com> Cc: Julien Grall , sstabellini@kernel.org, punit.agrawal@arm.com Subject: [Xen-devel] [PATCH 07/24] xen/arm: mm: Clean-up mfn_to_xen_entry 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" The physical address is computed from the machine frame number, so checking if the physical address is page aligned is pointless. Furthermore, directly assigned the MFN to the corresponding field in the entry rather than converting to a physical address and orring the value. It will avoid to rely on the field position and make the code clearer. Signed-off-by: Julien Grall Reviewed-by: Stefano Stabellini --- xen/arch/arm/mm.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c index 6f63e4315a..d164ed2eda 100644 --- a/xen/arch/arm/mm.c +++ b/xen/arch/arm/mm.c @@ -261,7 +261,6 @@ void dump_hyp_walk(vaddr_t addr) */ static inline lpae_t mfn_to_xen_entry(unsigned long mfn, unsigned attr) { - paddr_t pa = ((paddr_t) mfn) << PAGE_SHIFT; lpae_t e = (lpae_t) { .pt = { .valid = 1, /* Mappings are present */ @@ -316,11 +315,9 @@ static inline lpae_t mfn_to_xen_entry(unsigned long mfn, unsigned attr) break; } - ASSERT(!(pa & ~PAGE_MASK)); - ASSERT(!(pa & ~PADDR_MASK)); + ASSERT(!(pfn_to_paddr(mfn) & ~PADDR_MASK)); - /* XXX shifts */ - e.bits |= pa; + e.pt.base = mfn; return e; }