From mboxrd@z Thu Jan 1 00:00:00 1970 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 0C1F5C07CB1 for ; Wed, 29 Nov 2023 11:23:11 +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:Cc:To:From:Subject:Message-ID: References:Mime-Version:In-Reply-To:Date:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=Zh3ZlPfdLUiYGOgrvtpdST6lBpEGivoCEr6Q1sj/Usk=; b=V5q6CCGYMMZXxj0OC6HL2dHOzw zm1t+digcX2jn0jSo9rnRXiSouJNbUT6qXE/tx//p3A4dLGqy1zF5HCUDRgYqib/iSkX8wixp33ZH O52paVonpZUQHarZxYZAPHN83fS2v1vbaGNb5Rywnw6roWHmG1BTrZNjLilA3NZoHOHa1A43BuelS NMPponOzzMqxrLkocsOo0tsksMeCxY2jV6yKLapuFTqQU9wykBkT8zQfpWMnP5OdmU6uBvWIamhMw 849UIoQORpm2x4KfR0Up6gA9o+4FcfyLk4v7wNFdwCuBpGUWvPsmoCKNiIDy6Jw/9o1rADca8WPdq skZVbybg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r8IeV-008385-1R; Wed, 29 Nov 2023 11:22:47 +0000 Received: from mail-yb1-xb49.google.com ([2607:f8b0:4864:20::b49]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r8Iag-0080Fd-2M for linux-arm-kernel@lists.infradead.org; Wed, 29 Nov 2023 11:19:07 +0000 Received: by mail-yb1-xb49.google.com with SMTP id 3f1490d57ef6-db512266d27so1876274276.3 for ; Wed, 29 Nov 2023 03:18:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1701256729; x=1701861529; darn=lists.infradead.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=VSmNfbZ5siMSXuXN66KGyPWiwJjabBTLch2xfCGdM4g=; b=SBUlATZoA+7OXcgeUBHOPjaprUYTxQ3j5DWp+2p8Pw5FnMpMxpl/I/D8FoCOBpqOND ozrSCqmMO1oSm78cLIyQkGmuMVuxCIWq99Uy98VEHkaLTlVFjQ3PDYYIu/VAoCNosj4O QBPqIOT194Ii+3VZFvFz5xD6HTe2ESKJmMMXn7GBtXsm2daOheQiuB11kipVcT749FS3 92pz/hIcY/KCkfFk3rtcgy3zPFffGlU5RyhRvw6VneFQZ6OUI3PQTDQkvy4GsL8R2Yt2 kQxvSE2v5ZlIXCM+3oj94U1Uf+jb91WnuCSE8QBBt0ZSoAI0AVOpy6WSa/aomdShZv40 +WWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701256729; x=1701861529; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=VSmNfbZ5siMSXuXN66KGyPWiwJjabBTLch2xfCGdM4g=; b=rE3zi8CVG0+JC3bmbtnXSfOxbmaQCrzHotf9WlXkuLUcijT7PkoTDle0CdsJkxXujq lpQLa5HOpEfvJg3Hvaq/5Cnzs0G/B1mZP6cfmlTo6PO+gMiQhSLeYpMzwG9R1ggAG9Ii II+Z9TMjZKra2z56MlkO12zcR5UVlRaMd2cLM+f5UHRIhDalt2erefGvm3aBwE7HAnD3 c8pdZ3RHcziBwEbZ810TH0bdRz+IkOYybXYXNO+Plwd9TF/A9UstAzmtCmIu67rQ1t/L F04Fxh2+9mLaiz8TCzf/U8tc+cH5ops6Ax8AFgbxH67bZPqVunX7F0ty/9gUsEdv8faR WwIQ== X-Gm-Message-State: AOJu0YxbygYj4Vl3YmGbLnzzIuR3IXxoV3KGjRTWsKXrLEXeiFrpUfIO NysAdqvFqPylY+fIF0e9kaGq50JR9xO0ztXO9r/AK3HJhXj989Ey6P65rS7kb7mTuPo/0AjUtt0 IuQMY+GfisQGxVo9wRhynFtjwwTtnGrTq6xThZ4f0ZEK/+0JUvnNTJCRLf8nkfdib1OzhoT/LMM I= X-Google-Smtp-Source: AGHT+IFJbvSUnc9Nizup1o96Lt7Jg5/CTa1PXgEhFmzMZBltPWmvNfqIAaYf5ZSAaaD6moZurOJW9nyh X-Received: from palermo.c.googlers.com ([fda3:e722:ac3:cc00:28:9cb1:c0a8:118a]) (user=ardb job=sendgmr) by 2002:a25:d157:0:b0:daf:be4f:489d with SMTP id i84-20020a25d157000000b00dafbe4f489dmr509118ybg.1.1701256729139; Wed, 29 Nov 2023 03:18:49 -0800 (PST) Date: Wed, 29 Nov 2023 12:16:37 +0100 In-Reply-To: <20231129111555.3594833-43-ardb@google.com> Mime-Version: 1.0 References: <20231129111555.3594833-43-ardb@google.com> X-Developer-Key: i=ardb@kernel.org; a=openpgp; fpr=F43D03328115A198C90016883D200E9CA6329909 X-Developer-Signature: v=1; a=openpgp-sha256; l=3834; i=ardb@kernel.org; h=from:subject; bh=W4xXvjRt6dzsZGIOOmr6cHi9NBW8AYaP5zRZNtx7ctc=; b=owGbwMvMwCFmkMcZplerG8N4Wi2JITVddmbFrWTHIrGOE7fO8M4/euqF19QZl8+o8CVa9J28/ ytQS7Kvo5SFQYyDQVZMkUVg9t93O09PlKp1niULM4eVCWQIAxenAEyk8Tkjw8WrmU4RN9uUFQ1W qG/xyzKfa+T3wj138zTev6lPftwync/I8Je10Lx4iUrhl57vO9uKI9h9zI/9ESr8Ov9AL8Ns66r rjAA= X-Mailer: git-send-email 2.43.0.rc1.413.gea7ed67945-goog Message-ID: <20231129111555.3594833-84-ardb@google.com> Subject: [PATCH v6 41/41] arm64: Revert "mm: provide idmap pointer to cpu_replace_ttbr1()" From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org Cc: Ard Biesheuvel , Catalin Marinas , Will Deacon , Marc Zyngier , Mark Rutland , Ryan Roberts , Anshuman Khandual , Kees Cook X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231129_031850_812168_2C31F0D7 X-CRM114-Status: GOOD ( 15.03 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Ard Biesheuvel This reverts commit 1682c45b920643c, which is no longer needed now that we create the permanent kernel mapping directly during early boot. This is a RINO (revert in name only) given that some of the code has moved around, but the changes are straight-forward. Signed-off-by: Ard Biesheuvel --- arch/arm64/include/asm/mmu_context.h | 17 ++++++----------- arch/arm64/mm/kasan_init.c | 4 ++-- arch/arm64/mm/mmu.c | 4 ++-- 3 files changed, 10 insertions(+), 15 deletions(-) diff --git a/arch/arm64/include/asm/mmu_context.h b/arch/arm64/include/asm/mmu_context.h index a8a89a0f2867..c768d16b81a4 100644 --- a/arch/arm64/include/asm/mmu_context.h +++ b/arch/arm64/include/asm/mmu_context.h @@ -108,18 +108,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); } /* @@ -146,21 +141,21 @@ static inline void cpu_install_ttbr0(phys_addr_t ttbr0, unsigned long t0sz) isb(); } -void __cpu_replace_ttbr1(pgd_t *pgdp, pgd_t *idmap, bool cnp); +void __cpu_replace_ttbr1(pgd_t *pgdp, bool cnp); static inline void cpu_enable_swapper_cnp(void) { - __cpu_replace_ttbr1(lm_alias(swapper_pg_dir), idmap_pg_dir, true); + __cpu_replace_ttbr1(lm_alias(swapper_pg_dir), true); } -static inline void cpu_replace_ttbr1(pgd_t *pgdp, pgd_t *idmap) +static inline void cpu_replace_ttbr1(pgd_t *pgdp) { /* * Only for early TTBR1 replacement before cpucaps are finalized and * before we've decided whether to use CNP. */ WARN_ON(system_capabilities_finalized()); - __cpu_replace_ttbr1(pgdp, idmap, false); + __cpu_replace_ttbr1(pgdp, false); } /* diff --git a/arch/arm64/mm/kasan_init.c b/arch/arm64/mm/kasan_init.c index dd91f5942fd2..2ea0de4a8486 100644 --- a/arch/arm64/mm/kasan_init.c +++ b/arch/arm64/mm/kasan_init.c @@ -220,7 +220,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); @@ -256,7 +256,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) diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c index 07da61c1d7c6..88c6a54b76ac 100644 --- a/arch/arm64/mm/mmu.c +++ b/arch/arm64/mm/mmu.c @@ -1442,7 +1442,7 @@ void ptep_modify_prot_commit(struct vm_area_struct *vma, unsigned long addr, pte * Atomically replaces the active TTBR1_EL1 PGD with a new VA-compatible PGD, * avoiding the possibility of conflicting TLB entries being allocated. */ -void __cpu_replace_ttbr1(pgd_t *pgdp, pgd_t *idmap, bool cnp) +void __cpu_replace_ttbr1(pgd_t *pgdp, bool cnp) { typedef void (ttbr_replace_func)(phys_addr_t); extern ttbr_replace_func idmap_cpu_replace_ttbr1; @@ -1457,7 +1457,7 @@ void __cpu_replace_ttbr1(pgd_t *pgdp, pgd_t *idmap, bool cnp) replace_phys = (void *)__pa_symbol(idmap_cpu_replace_ttbr1); - __cpu_install_idmap(idmap); + cpu_install_idmap(); /* * We really don't want to take *any* exceptions while TTBR1 is -- 2.43.0.rc1.413.gea7ed67945-goog _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel