From patchwork Fri Nov 11 17:11:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 13040651 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0A643C4332F for ; Fri, 11 Nov 2022 17:36:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ht87nAj579IATkGWpITlSG275pZZvgN42ioGrCcB7KY=; b=bBt51sM/YChFxg 0U3Qi1i3pK6YZINFuAI32LtgpR77S3/rT7DzT6gF594wnlMAUUoiczsDQkPk6L4SyAw2EdbrY+zAz N+Aqy/kPsmLp7V7uttGKwfrkrN0AJpmgdY2KrUti733a6ttrpk3SgO+CJoFxjcIpRwUYSU+mGNlTm fnyLqe7qzIxdYilRVam2XyzpwaHB80qV8y0LAjWk+RwKT5uOBL+Ydivf8Z2cUltptbihDfJo9ZirJ 1ECkDpNyBgdI/AVz9SbIOliobSqCSm1MjOSM9Er0xqNzOlCdvNmhUZFPKO7nYRwxPAh6ezpxvnSyk JZ6zxXY1IhIACFD2juDw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1otXwO-00HJst-Lj; Fri, 11 Nov 2022 17:35:44 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1otXaq-00H87l-Jq for linux-arm-kernel@lists.infradead.org; Fri, 11 Nov 2022 17:13:33 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 215F96206C; Fri, 11 Nov 2022 17:13:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A7B8AC433D7; Fri, 11 Nov 2022 17:13:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668186807; bh=Blw0gWbIE9SQyI0x/IqXVoZWk0/G+DQ7lMnPJtMO5CU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tbo160W/a0FkhIi2ol65NsvnXqtrCG8NK+sf+sM2NWx2ODEjwQV7CulYfxT91I8FZ 0pCns2mUY4hUJtdRkx9OuHKhY5+fZTRX+gTZCmaLI+LUwX7jykPXKen1OBSC9y+TUz tIjldDKuWd5sZhJX6iJWV63E7uuRiwqwOoTQzsz5LLD1jW0AsD/vPGTdm+RX0r5VhF ZQiMwk5TUk78dlzJ4A3/ek6lPFT7kJKinnSqmsj1fEhB0zHzumZze3PMDWq6P3v7zA 8D4Pq6ZkFtrceDsXToVStAw7zCjg8ls+LpXAOe/86TRaNLCkgEm7pmRB6GzHWHCU5W Z8JtOh9SWrcvw== From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org Cc: Ard Biesheuvel , Marc Zyngier , Will Deacon , Mark Rutland , Kees Cook , Catalin Marinas , Mark Brown , Anshuman Khandual Subject: [PATCH v7 30/33] arm64: Revert "mm: provide idmap pointer to cpu_replace_ttbr1()" Date: Fri, 11 Nov 2022 18:11:58 +0100 Message-Id: <20221111171201.2088501-31-ardb@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221111171201.2088501-1-ardb@kernel.org> References: <20221111171201.2088501-1-ardb@kernel.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=3745; i=ardb@kernel.org; h=from:subject; bh=Blw0gWbIE9SQyI0x/IqXVoZWk0/G+DQ7lMnPJtMO5CU=; b=owEB7QES/pANAwAKAcNPIjmS2Y8kAcsmYgBjboJbrVxEICZi45aN/PsF2NeeRgT9Nej7GSyBdWSi kyjsiXqJAbMEAAEKAB0WIQT72WJ8QGnJQhU3VynDTyI5ktmPJAUCY26CWwAKCRDDTyI5ktmPJP5PDA CvD7JYCGlCtDgrzHJtIh45Q2d7srN7b5ZGB00wROioNlfiLHpisXl26ee1KORht7rtpRd7TTo+iz5i D8xsB++WVMpE3NnO5pzCvLieTPdt4x/X7KqjPfgL33mFohby6Tp9REUMNxHL3aGi6nHIXNBwHHyy71 RobWdsA1n0wPgNd3AMBoYkODsR2hw1eVRQ6pqWkV/M2CEGxIzNt3Mp90Za9Lg0thtBYwz4GwVuXYvD WG5uzA9p97MIqvl8f2mRHGAg5dsz7AfSzShPURqM4iiT+JRl3dqre4v72xPYAZpDGp02ZYYLMdhCEn apglLwUDFIJzld4MV3uK5mAyN/vsm58dPy+UToEDqPC3l5LGJ4/EL4S+Ct40XlY8KDpsrB+tlHB7US Z4o3fgT9zZOj0sDAXniLiF7cLlNWPaSKfPFGV+eEr29PyZtbIeCN3xI0HPchPdO8vY86WsuWZJKyK+ mWHD8KW8uFbHDy/7YyQ1kHLej1R+9JZaW5NGCcb0yvLpI= X-Developer-Key: i=ardb@kernel.org; a=openpgp; fpr=F43D03328115A198C90016883D200E9CA6329909 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221111_091328_794770_31B2D5AC X-CRM114-Status: GOOD ( 15.08 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This reverts commit 1682c45b920643c, which is no longer needed now that we create the permanent kernel mapping directly during early boot. Signed-off-by: Ard Biesheuvel --- arch/arm64/include/asm/mmu_context.h | 13 ++++--------- arch/arm64/kernel/cpufeature.c | 2 +- arch/arm64/kernel/suspend.c | 2 +- arch/arm64/mm/kasan_init.c | 4 ++-- 4 files changed, 8 insertions(+), 13 deletions(-) diff --git a/arch/arm64/include/asm/mmu_context.h b/arch/arm64/include/asm/mmu_context.h index d3f8b5df0c1fe315..3c80c34f14e152d9 100644 --- a/arch/arm64/include/asm/mmu_context.h +++ b/arch/arm64/include/asm/mmu_context.h @@ -105,18 +105,13 @@ static inline void cpu_uninstall_idmap(void) cpu_switch_mm(mm->pgd, mm); } -static inline void __cpu_install_idmap(pgd_t *idmap) +static inline void cpu_install_idmap(void) { cpu_set_reserved_ttbr0(); local_flush_tlb_all(); cpu_set_idmap_tcr_t0sz(); - cpu_switch_mm(lm_alias(idmap), &init_mm); -} - -static inline void cpu_install_idmap(void) -{ - __cpu_install_idmap(idmap_pg_dir); + cpu_switch_mm(lm_alias(idmap_pg_dir), &init_mm); } /* @@ -147,7 +142,7 @@ static inline void cpu_install_ttbr0(phys_addr_t ttbr0, unsigned long t0sz) * 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 *pgdp, pgd_t *idmap) +static inline void cpu_replace_ttbr1(pgd_t *pgdp) { typedef void (ttbr_replace_func)(phys_addr_t); extern ttbr_replace_func idmap_cpu_replace_ttbr1; @@ -170,7 +165,7 @@ static inline void cpu_replace_ttbr1(pgd_t *pgdp, pgd_t *idmap) replace_phys = (void *)__pa_symbol(idmap_cpu_replace_ttbr1); - __cpu_install_idmap(idmap); + cpu_install_idmap(); replace_phys(ttbr1); cpu_uninstall_idmap(); } diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c index 08ab04dc9393652a..eca9df123a8b354b 100644 --- a/arch/arm64/kernel/cpufeature.c +++ b/arch/arm64/kernel/cpufeature.c @@ -3348,7 +3348,7 @@ subsys_initcall_sync(init_32bit_el0_mask); static void __maybe_unused cpu_enable_cnp(struct arm64_cpu_capabilities const *cap) { - cpu_replace_ttbr1(lm_alias(swapper_pg_dir), idmap_pg_dir); + cpu_replace_ttbr1(lm_alias(swapper_pg_dir)); } /* diff --git a/arch/arm64/kernel/suspend.c b/arch/arm64/kernel/suspend.c index 8b02d310838f9240..033cd080af680c2e 100644 --- a/arch/arm64/kernel/suspend.c +++ b/arch/arm64/kernel/suspend.c @@ -54,7 +54,7 @@ void notrace __cpu_suspend_exit(void) /* Restore CnP bit in TTBR1_EL1 */ if (system_supports_cnp()) - cpu_replace_ttbr1(lm_alias(swapper_pg_dir), idmap_pg_dir); + cpu_replace_ttbr1(lm_alias(swapper_pg_dir)); /* * PSTATE was not saved over suspend/resume, re-enable any detected diff --git a/arch/arm64/mm/kasan_init.c b/arch/arm64/mm/kasan_init.c index df98f496539f0e39..7e32f21fb8e1e227 100644 --- a/arch/arm64/mm/kasan_init.c +++ b/arch/arm64/mm/kasan_init.c @@ -221,7 +221,7 @@ static void __init kasan_init_shadow(void) */ memcpy(tmp_pg_dir, swapper_pg_dir, sizeof(tmp_pg_dir)); dsb(ishst); - cpu_replace_ttbr1(lm_alias(tmp_pg_dir), idmap_pg_dir); + cpu_replace_ttbr1(lm_alias(tmp_pg_dir)); clear_pgds(KASAN_SHADOW_START, KASAN_SHADOW_END); @@ -265,7 +265,7 @@ static void __init kasan_init_shadow(void) PAGE_KERNEL_RO)); memset(kasan_early_shadow_page, KASAN_SHADOW_INIT, PAGE_SIZE); - cpu_replace_ttbr1(lm_alias(swapper_pg_dir), idmap_pg_dir); + cpu_replace_ttbr1(lm_alias(swapper_pg_dir)); } static void __init kasan_init_depth(void)