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 E0D6CC48BF8 for ; Tue, 20 Feb 2024 00:29:48 +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=s+GgEaDPc6FVJmtxWPJHhht9YZCDEnhj5fN2BUX2bPs=; b=LKAVh3CF3EBkUw wnu6fgp8zzw3B5v57k7DUO2eTwmGM/HP+fcsCdvlky7fz+9/VdO1z963m4GXX2FUBXLIvX82r8Rrz QABJrBRgJWvaP/2iyT1baLFN9shFHztcyWoqoij4WTRTtiz3ntjvwY/6aaQ8R3p10K5ZgrKsnWw/W iRsDdtc1lqsyeAGMwnHg490lGYlFBJRn3g7pWiGWRSf4Dji7cxsk7x2AKN1teN3ADA24KtKwIem/3 nwUfKXKCywGtRUtU4yoRSurt6i2jjY/e+74dU/7fDUFG+wnoS8t/2sKquvG8WUOMvOWnaa+VjYo22 nOeBvR1suycni8jWxbWQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rcE0r-0000000Ce6l-2X4G; Tue, 20 Feb 2024 00:29:33 +0000 Received: from out-177.mta0.migadu.com ([2001:41d0:1004:224b::b1]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rcE0o-0000000Ce62-37v7 for linux-arm-kernel@lists.infradead.org; Tue, 20 Feb 2024 00:29:32 +0000 Date: Tue, 20 Feb 2024 09:29:14 +0900 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1708388962; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=rYuTBsJkK+AK+LNE5sjpfw0BQt+vbyg0B6ux0rgRMjs=; b=j8uvtFpwxAr72QZh5GM/HSk2IRsS1PuaeTOYAPj4KqGK3VGUKculE9G0tz2LXcMUTrcNIK kWh8UT4674eYs33gxDvHfs2KSw6MvoglCdl5OqtWFoOBdbt+MdhoQ/mXKuDnPfGV+bwzeL 4ryqHETlIO2kWEwXoxnIQvgJmK1xShs= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Itaru Kitayama To: Mark Rutland Cc: skseofh@gmail.com, 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: X-Migadu-Flow: FLOW_OUT X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240219_162930_954391_ABC0A580 X-CRM114-Status: GOOD ( 25.52 ) 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 Mon, Feb 19, 2024 at 10:48:26AM +0000, Mark Rutland wrote: > 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(). Removing the second call makes the code base a bit harder to understand as the functions related to DT and ACPI setup are not separated cleanly. I prefer calling the early_fixmap_init() in setup_arch() as well. Itaru. > > 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