From patchwork Mon Feb 22 20:54:25 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 62629 Delivered-To: patch@linaro.org Received: by 10.112.43.199 with SMTP id y7csp1471252lbl; Mon, 22 Feb 2016 12:57:41 -0800 (PST) X-Received: by 10.98.10.149 with SMTP id 21mr41290056pfk.75.1456174661382; Mon, 22 Feb 2016 12:57:41 -0800 (PST) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id p81si41966232pfa.102.2016.02.22.12.57.41 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 22 Feb 2016 12:57:41 -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 1aXxWV-0004zS-ST; Mon, 22 Feb 2016 20:56:03 +0000 Received: from mail-wm0-x233.google.com ([2a00:1450:400c:c09::233]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aXxVl-0003Gt-Pv for linux-arm-kernel@lists.infradead.org; Mon, 22 Feb 2016 20:55:18 +0000 Received: by mail-wm0-x233.google.com with SMTP id g62so182008994wme.0 for ; Mon, 22 Feb 2016 12:54:57 -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=bqOKKNyonZSjpGPr8m/Uxh/dKd7VUyms8mUPaGTDwxc=; b=IV6jcx5BoyFVFahaniKdwpcjwn3bSZJK43F3yqRR5JO9fsiVkBwWpnJsLiTvoEwce9 zX8wIzP7lPjUItHLAax246eZkjI80apYnfTgaBIAIURNEbjG8JwUEI16GoZHbdsNWGy/ Txo5VjJfVYqgfNixuJvS/P2gK3jtPsLFKndI8= 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=bqOKKNyonZSjpGPr8m/Uxh/dKd7VUyms8mUPaGTDwxc=; b=e0Zv5hc4b6Rnxo66TB37QdgJl8puCnQqIKK82QFsQkbEfWKvhqLecML79Jy3T0dkI0 vM4CvTn5Yur7ooCr/xCasKW+iR/zOo73cYbfywFC6DspUwhgdYmKbOfNzHVptqcGyd/T 8q8PKLSGcbpyF2ukRN4DyVZTcy35YEx6vOOYoRvlXHlNNwdYgd62dctq8HVYHYGzpH08 vQE7vbCZxqB3jxxhhQ2Yvt533u1a3KgbE1q/ZO4o6LMlSA0K/E7Izk2Gyuf1yHOmk5t7 EeerNiWNYiGF/kG+mM+2dqOJK672joG/Gw6dLpAySfUmS8oFMcx+E35sRw8ZZFkLAqLE cP6w== X-Gm-Message-State: AG10YOSmvEjuFbxUwFroQbSrIXxY0zXlM5iwMxsctGTDxkAF/C/me9yjBJkk90VaCImCQENv X-Received: by 10.194.185.199 with SMTP id fe7mr29666249wjc.50.1456174496059; Mon, 22 Feb 2016 12:54:56 -0800 (PST) Received: from localhost.localdomain ([195.55.142.58]) by smtp.gmail.com with ESMTPSA id k8sm15012530wjr.38.2016.02.22.12.54.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 22 Feb 2016 12:54:55 -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 03/10] arm64: mm: avoid __pa translations in cpu_replace_ttbr1 Date: Mon, 22 Feb 2016 21:54:25 +0100 Message-Id: <1456174472-30028-4-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_125518_117330_16A70C05 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:233 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 the use of generic __pa() translations in cpu_replace_ttbr1(), by changing its argument to a physical pgd[] address, and using __pa_symbol() on the reference to swapper_pg_dir. Signed-off-by: Ard Biesheuvel --- arch/arm64/include/asm/mmu_context.h | 6 ++---- arch/arm64/mm/mmu.c | 4 ++-- 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/mmu_context.h b/arch/arm64/include/asm/mmu_context.h index a00f7cf35bbd..40fc56f3ed52 100644 --- a/arch/arm64/include/asm/mmu_context.h +++ b/arch/arm64/include/asm/mmu_context.h @@ -130,15 +130,13 @@ static inline void cpu_install_idmap(void) * Atomically replaces the active TTBR1_EL1 PGD with a new VA-compatible PGD, * avoiding the possibility of conflicting TLB entries being allocated. */ -static inline void cpu_replace_ttbr1(pgd_t *pgd) +static inline void cpu_replace_ttbr1(phys_addr_t pgd_phys) { typedef void (ttbr_replace_func)(phys_addr_t); extern ttbr_replace_func idmap_cpu_replace_ttbr1; ttbr_replace_func *replace_phys; - phys_addr_t pgd_phys = virt_to_phys(pgd); - - replace_phys = (void *)virt_to_phys(idmap_cpu_replace_ttbr1); + replace_phys = (void *)__pa_symbol(idmap_cpu_replace_ttbr1); cpu_install_idmap(); replace_phys(pgd_phys); diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c index 00d166465ff4..fbba941a6e87 100644 --- a/arch/arm64/mm/mmu.c +++ b/arch/arm64/mm/mmu.c @@ -546,9 +546,9 @@ void __init paging_init(void) * * To do this we need to go via a temporary pgd. */ - cpu_replace_ttbr1(__va(pgd_phys)); + cpu_replace_ttbr1(pgd_phys); memcpy(swapper_pg_dir, pgd, PAGE_SIZE); - cpu_replace_ttbr1(swapper_pg_dir); + cpu_replace_ttbr1(__pa_symbol(swapper_pg_dir)); pgd_clear_fixmap(); memblock_free(pgd_phys, PAGE_SIZE);