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 3B632C61DF4 for ; Fri, 24 Nov 2023 10:23:47 +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=MyhLB6x4VjGqvbyeWJjUj0EBvWrfFBxyvCQgVOiiemw=; b=2UgYQ8TU2O/u06jo2B9K7v9vvK XY1OoW5S/YDOgg9kmSU0naUa0LrKnoFvLf58GfXQ/0lxtWlB0FTOmZqNRPDuqmHchTvJYN/XVND62 AzeQPj/P1Meypa+QsXVztbxX4e9Nlf1a+t+isWbr4iX7MZkY3tZVd4rFup5kHwqdgStgNOCMUIKsc dI6SYm4E1bYrNE1nh0iRinWmjyzL7b5GhEmKIsYeoT4ehwH4PG3Y521M8ENK+vxEGEcKesB9MyfpZ c1+x34xY9d2Ljf7hE0WvbHJatQTfomcFOAzdjBFCWJGhPxOLrnhnbxl8067h/i71McmVVjp9muAUW WLiNs9oQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r6TL3-006pvM-1j; Fri, 24 Nov 2023 10:23:09 +0000 Received: from mail-wm1-x349.google.com ([2a00:1450:4864:20::349]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r6TJg-006pMB-1t for linux-arm-kernel@lists.infradead.org; Fri, 24 Nov 2023 10:21:57 +0000 Received: by mail-wm1-x349.google.com with SMTP id 5b1f17b1804b1-40b346a11d9so9864455e9.3 for ; Fri, 24 Nov 2023 02:21:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1700821302; x=1701426102; 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=imcZ68l5aw0m3ocVj6+r1KqdZudjnVqQB3yjRHbNBSQ=; b=JnhW/nRuVV+NZHVf1t70isbxryKw0n5ez3e9eJD5SE9JK0CO8rR9mViVv3h0rpU4am Oi+8lai2D9UEIOrVOw+KIzs8puBUKgwliTS5qM9QmZICw+Qb15rQZR0fcuSrgS4n4XCI 8T1b3cTIRckPZwYtFx2Ylz0OI1dlDT+0TZ5Qp9tXxXPM84xjiRK+50Bw+ROkiD93qf+s bdmWF3jvIodf28I3TCFsCXjCBLzCMCxPfd23hxckE6Lz1JSenGpR3Xd6KDIknjkW68NA N/ikCHpxJrfN160//PRARFoBL59S9mSRl9vCatW9xH90rzP50o3l66hH+l51TgNNx71J EmCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700821302; x=1701426102; 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=imcZ68l5aw0m3ocVj6+r1KqdZudjnVqQB3yjRHbNBSQ=; b=s2FMzwa8QKO+2jjItBmYGoKhFn8Ecct8L+EuCbgbx55I2BTg8fUBxYCW2CoAjZI/KQ 0Rf/Tblmb8lpXENZLUqj0KIcIy2syzxCOE+6mDhUGneh8iUx1IGfK5i6gak8fsIOnJRd RzhV7zFDjHzbeSaoIbm+3JCA/GadTb+vNZGhTrHUS40rYpKv/Ea1iRMXK4RHgQplZqNk K3pGsloVfohaCnFXSdfwksyWNReL4qTUfhRnT8kKK1PDkwITYgLI5gRi0eyE4EvrsZPj jHTKjWJy9x16t6FDQSlr53X1PokobTnRnTEIQWAisqMPPgcq7fAGuXu0Q7Vtd+qzAF2D Txzg== X-Gm-Message-State: AOJu0YyJmP5zzVPZKTm6Gyh7/ajvqYU9v1shYMJf0iBX5KsvehbkWrfi 2Z4J+k21ovUMh2/xk2zvWdRcbB5F8PW7eR0a2BssB41MMcmMIBVKbwvvMzfDnPGk2S2o2gZHDdV 9PhT0lgitQTL8EAJg02DtDkek2sEVs0d5kWZb9+IwhpIxaSoA4uYHE3ffjrAdQBL5Hn/+r9hzKh g= X-Google-Smtp-Source: AGHT+IHUcIxlRO7ozBJcvDqw1GTNIJ7QqfNwE4kpvZJ5Ktcgo1rsNOvGidMQOzQ0HkcnQnP+YTepW7bh X-Received: from palermo.c.googlers.com ([fda3:e722:ac3:cc00:28:9cb1:c0a8:118a]) (user=ardb job=sendgmr) by 2002:a05:600c:4686:b0:402:f504:f2e9 with SMTP id p6-20020a05600c468600b00402f504f2e9mr44988wmo.0.1700821302424; Fri, 24 Nov 2023 02:21:42 -0800 (PST) Date: Fri, 24 Nov 2023 11:19:19 +0100 In-Reply-To: <20231124101840.944737-41-ardb@google.com> Mime-Version: 1.0 References: <20231124101840.944737-41-ardb@google.com> X-Developer-Key: i=ardb@kernel.org; a=openpgp; fpr=F43D03328115A198C90016883D200E9CA6329909 X-Developer-Signature: v=1; a=openpgp-sha256; l=3478; i=ardb@kernel.org; h=from:subject; bh=qmsYzXP4m98BND8lXwIz1d4eg3pbd5m604LF8G46VZQ=; b=owGbwMvMwCFmkMcZplerG8N4Wi2JITWhYovv5elREQZcK1YvNa7XWVL9ZZLSvoMd8Xl7Zyda3 XSueXWko5SFQYyDQVZMkUVg9t93O09PlKp1niULM4eVCWQIAxenAEwk/BDDX5mbrh4aJWszjL4J 6fLp+q7m+/dIdkbLNROH/26CbW+rChkZTq7gyjhRntj26ESo6QJRhowrkvXv8i/Z2JhyTI1Z+qm KGQA= X-Mailer: git-send-email 2.43.0.rc1.413.gea7ed67945-goog Message-ID: <20231124101840.944737-80-ardb@google.com> Subject: [PATCH v5 39/39] 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-20231124_022144_653575_270FB9B4 X-CRM114-Status: GOOD ( 14.20 ) 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 not a clean revert but the changes are straight-forward. Signed-off-by: Ard Biesheuvel --- arch/arm64/include/asm/mmu_context.h | 19 +++++++------------ arch/arm64/mm/kasan_init.c | 4 ++-- 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/arch/arm64/include/asm/mmu_context.h b/arch/arm64/include/asm/mmu_context.h index 3c487948b94e..d740e2ddd272 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); } /* @@ -150,7 +145,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, bool cnp) +static inline 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; @@ -165,7 +160,7 @@ static inline 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 @@ -180,17 +175,17 @@ static inline void __cpu_replace_ttbr1(pgd_t *pgdp, pgd_t *idmap, 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) -- 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