From patchwork Mon Feb 22 20:54:27 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 62630 Delivered-To: patch@linaro.org Received: by 10.112.43.199 with SMTP id y7csp1471474lbl; Mon, 22 Feb 2016 12:58:12 -0800 (PST) X-Received: by 10.98.13.68 with SMTP id v65mr40831999pfi.150.1456174692545; Mon, 22 Feb 2016 12:58:12 -0800 (PST) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id v13si41812726pas.199.2016.02.22.12.58.12 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 22 Feb 2016 12:58:12 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) client-ip=2001:1868:205::9; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) smtp.mailfrom=linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org; dkim=neutral (body hash did not verify) header.i=@linaro.org Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1aXxXd-0005lu-2r; Mon, 22 Feb 2016 20:57:13 +0000 Received: from mail-wm0-x232.google.com ([2a00:1450:400c:c09::232]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aXxW3-0003ym-Da for linux-arm-kernel@lists.infradead.org; Mon, 22 Feb 2016 20:55:36 +0000 Received: by mail-wm0-x232.google.com with SMTP id c200so191069222wme.0 for ; Mon, 22 Feb 2016 12:55:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Z7i54hmBQu2DMDMW9Aja283VWwgtQ46EGxdyhbevJtM=; b=FnqupF11MC2NdBJ+lMNH0rFoF1YrBa4pLNy6TNV89DE7N66T4YzreLck+cin267FNX 2PopDTqzwDY3M5fQmgTQ1yMTzGp2rPUkki05v92Eq7gAen3SIV/E9AyY2Iyac9Qkgv/N 94uzwRHL9RiPal6ceJ2lSRu1lz7S+XcLiOyZM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Z7i54hmBQu2DMDMW9Aja283VWwgtQ46EGxdyhbevJtM=; b=dqYWNcZntuge4fialI7+UrfUmDZHtc43uka6KeceDG9t+70hQdRVNi1s5zq9ZSvpjx 5b1I/mBNRbJ52XsUJP4slFdLKmGI8JF4pCEYUCAGYe7SeNlosvGnb+fnzsdnYsSZX1ui zt2XB1+Dc7MnKCrsT+hyEfp1JUEla5kdxtXYEBwk0q7n8114tBOffZi2yd8maLVh+ecq BrHJyEV3CCFJrTLbNldgXhvR2guz/hxqZ1Y2Zl+YGn9b0LQqWRwZB4d9idrX8qWlxYKQ uuMTAcQIpazCYXzr1VFk5bfPoQPRYTyOVlGyKrcZzLzo1fAa6oVEgmQ6uS3dBi1lH+SV uQaA== X-Gm-Message-State: AG10YOQxzsWttyhmmuf1o7s0vcdEM0WkWlWmdbUUdm4xTWR0kDRQzMgjD5lSBGqhW86e7XGT X-Received: by 10.28.186.10 with SMTP id k10mr13476839wmf.99.1456174513763; Mon, 22 Feb 2016 12:55:13 -0800 (PST) Received: from localhost.localdomain ([195.55.142.58]) by smtp.gmail.com with ESMTPSA id k8sm15012530wjr.38.2016.02.22.12.54.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 22 Feb 2016 12:55:13 -0800 (PST) From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org, will.deacon@arm.com, catalin.marinas@arm.com, mark.rutland@arm.com Subject: [RFC PATCH 05/10] arm64: mm: avoid __pa translations in early_fixmap_init Date: Mon, 22 Feb 2016 21:54:27 +0100 Message-Id: <1456174472-30028-6-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1456174472-30028-1-git-send-email-ard.biesheuvel@linaro.org> References: <1456174472-30028-1-git-send-email-ard.biesheuvel@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160222_125535_663576_9B2813D6 X-CRM114-Status: GOOD ( 12.26 ) X-Spam-Score: -2.7 (--) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-2.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [2a00:1450:400c:c09:0:0:0:232 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ard Biesheuvel MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org Avoid using __pa() translations while populating the fixmap page tables, by using __pa_symbol to take the physical addresses of bm_pud, bm_pmd and bm_pte, and move to __pgd_populate/__pmd_populate/__pte_populate, which takes physical addresses directly. Since the former two are now called unconditionally, remove the BUILD_BUG()'s that prevent their use in case their page table level is folded away. Signed-off-by: Ard Biesheuvel --- arch/arm64/include/asm/pgalloc.h | 2 -- arch/arm64/mm/mmu.c | 8 ++++---- 2 files changed, 4 insertions(+), 6 deletions(-) -- 2.5.0 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel diff --git a/arch/arm64/include/asm/pgalloc.h b/arch/arm64/include/asm/pgalloc.h index ff98585d085a..bc01d2b65225 100644 --- a/arch/arm64/include/asm/pgalloc.h +++ b/arch/arm64/include/asm/pgalloc.h @@ -54,7 +54,6 @@ static inline void pud_populate(struct mm_struct *mm, pud_t *pud, pmd_t *pmd) #else static inline void __pud_populate(pud_t *pud, phys_addr_t pmd, pudval_t prot) { - BUILD_BUG(); } #endif /* CONFIG_PGTABLE_LEVELS > 2 */ @@ -83,7 +82,6 @@ static inline void pgd_populate(struct mm_struct *mm, pgd_t *pgd, pud_t *pud) #else static inline void __pgd_populate(pgd_t *pgdp, phys_addr_t pud, pgdval_t prot) { - BUILD_BUG(); } #endif /* CONFIG_PGTABLE_LEVELS > 3 */ diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c index fbba941a6e87..e7340defa085 100644 --- a/arch/arm64/mm/mmu.c +++ b/arch/arm64/mm/mmu.c @@ -679,7 +679,7 @@ void __init early_fixmap_init(void) pgd = pgd_offset_k(addr); if (CONFIG_PGTABLE_LEVELS > 3 && - !(pgd_none(*pgd) || pgd_page_paddr(*pgd) == __pa(bm_pud))) { + !(pgd_none(*pgd) || pgd_page_paddr(*pgd) == __pa_symbol(bm_pud))) { /* * We only end up here if the kernel mapping and the fixmap * share the top level pgd entry, which should only happen on @@ -688,12 +688,12 @@ void __init early_fixmap_init(void) BUG_ON(!IS_ENABLED(CONFIG_ARM64_16K_PAGES)); pud = pud_offset_kimg(pgd, addr); } else { - pgd_populate(&init_mm, pgd, bm_pud); + __pgd_populate(pgd, __pa_symbol(bm_pud), PUD_TYPE_TABLE); pud = fixmap_pud(addr); } - pud_populate(&init_mm, pud, bm_pmd); + __pud_populate(pud, __pa_symbol(bm_pmd), PUD_TYPE_TABLE); pmd = fixmap_pmd(addr); - pmd_populate_kernel(&init_mm, pmd, bm_pte); + __pmd_populate(pmd, __pa_symbol(bm_pte), PMD_TYPE_TABLE); /* * The boot-ioremap range spans multiple pmds, for which