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 2F5CFC54764 for ; Mon, 19 Feb 2024 10:48:51 +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:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=a2S+xOtAcf1THRFMn1xZM5NHSDULx5uEZAVa8xBD+ZE=; b=c6k3qVfe3PzO3r HzQsR2J8RPpInv75am7+/ZMgTpc8SxHx2o6becG4Qn7kOrqxOBtqd3V4I/JvnG+XkONOGRKNqXOnq NQu9aeXvjRPuNd+stHnG9nxsGn6HziDZLRe2oDTSfp4SsexcW2A6vo1lOlXecEhoDimzj9j/4pLz5 6fzlql7cGDS+MgTB6kmdbyXMOZqkyvVBboxhW6SVnigDbbf0IDh1vogcwPsh3Qi27jy07arHBI47e xPyyNVmf+zQG452EQJJzpnVNd9oeTCvy2YFMflsjalDlaoiy/znrjgIBi++dCmKJkqZMrKr1/cz/A vKMia5btOENV1WnG9JlQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rc1CS-0000000A60c-1LyG; Mon, 19 Feb 2024 10:48:40 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rc1CP-0000000A605-2DuG for linux-arm-kernel@lists.infradead.org; Mon, 19 Feb 2024 10:48:38 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 475EFFEC; Mon, 19 Feb 2024 02:49:14 -0800 (PST) Received: from FVFF77S0Q05N (unknown [10.57.66.18]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 6DBDA3F762; Mon, 19 Feb 2024 02:48:33 -0800 (PST) Date: Mon, 19 Feb 2024 10:48:26 +0000 From: Mark Rutland To: skseofh@gmail.com Cc: catalin.marinas@arm.com, will@kernel.org, ryan.roberts@arm.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] arm64: add early fixmap initialization flag Message-ID: References: <20240217140326.2367186-1-skseofh@gmail.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20240217140326.2367186-1-skseofh@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240219_024837_639250_DF81A2E3 X-CRM114-Status: GOOD ( 19.10 ) 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 On Sat, Feb 17, 2024 at 11:03:26PM +0900, skseofh@gmail.com wrote: > From: Daero Lee > > early_fixmap_init may be called multiple times. Since there is no > change in the page table after early fixmap initialization, an > initialization flag was added. Why is that better? We call early_fixmap_init() in two places: * early_fdt_map() * setup_arch() ... and to get to setup_arch() we *must* have gone through early_fdt_map(), since __primary_switched() calls that before going to setup_arch(). So AFAICT we can remove the second call to early_fixmap_init() in setup_arch(), and rely on the earlier one in early_fdt_map(). Mark. > > Signed-off-by: Daero Lee > --- > arch/arm64/mm/fixmap.c | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/arch/arm64/mm/fixmap.c b/arch/arm64/mm/fixmap.c > index c0a3301203bd..fbdd5f30f3a1 100644 > --- a/arch/arm64/mm/fixmap.c > +++ b/arch/arm64/mm/fixmap.c > @@ -32,6 +32,8 @@ static pte_t bm_pte[NR_BM_PTE_TABLES][PTRS_PER_PTE] __page_aligned_bss; > static pmd_t bm_pmd[PTRS_PER_PMD] __page_aligned_bss __maybe_unused; > static pud_t bm_pud[PTRS_PER_PUD] __page_aligned_bss __maybe_unused; > > +static int early_fixmap_initialized __initdata; > + > static inline pte_t *fixmap_pte(unsigned long addr) > { > return &bm_pte[BM_PTE_TABLE_IDX(addr)][pte_index(addr)]; > @@ -100,10 +102,15 @@ void __init early_fixmap_init(void) > unsigned long addr = FIXADDR_TOT_START; > unsigned long end = FIXADDR_TOP; > > + if (early_fixmap_initialized) > + return; > + > pgd_t *pgdp = pgd_offset_k(addr); > p4d_t *p4dp = p4d_offset(pgdp, addr); > > early_fixmap_init_pud(p4dp, addr, end); > + > + early_fixmap_initialized = 1; > } > > /* > -- > 2.25.1 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel