Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp1441311rdb; Mon, 19 Feb 2024 16:29:34 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUwSYaMHVPbs32AN0TKxFT3Ty8tRlq6LD8e9b+my3VWdS6Gtv7Bq9qV1dka0i3se/jhHzYA8rV6vmDVnNii6Xg8bQwGROabLry+/uPZEA== X-Google-Smtp-Source: AGHT+IGqybVxhAkGKogyWiZ6FqvLbK013p8LtJw9o1NeR2oKgE0QvHMaliq2ncGOj94rojnIcWt+ X-Received: by 2002:a05:6358:571a:b0:178:6c79:6ccf with SMTP id a26-20020a056358571a00b001786c796ccfmr15539263rwf.17.1708388973863; Mon, 19 Feb 2024 16:29:33 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708388973; cv=pass; d=google.com; s=arc-20160816; b=S5gyGU07223jcyLAQIf8moH+lb9pI/63tATH4BR5LG6zFNMta7Hj2zgNYa/R5LnWdb t0Vz/e1sC+w37F12CaC02fgkQeQOsA3MJ26j7woI3Y89BN1Dipw3d3egVMev2YIUAETZ etASicXsdKWhEd9YCyvdegvv9PyLpcuiOqGbm+POnA8YGX4+C3aq1WLN1ellBe6J3OTy A+F5h+pNodfCEG6KHDo9gQqKpUnScRFE3/RkKFciCVErOhacE1q94Q0FpwIF1Kp0zWD0 iJc/BTe3KWV0w6Af+jX6LS8QTUGZcQ8Tml1PtG+gcepgGYdwJVil5Y2AtioD+kSZJ8eT cAkA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:dkim-signature:date; bh=rYuTBsJkK+AK+LNE5sjpfw0BQt+vbyg0B6ux0rgRMjs=; fh=HN09eeBx8xvVNrlB8q8UuhObBOfDcifu5X/0MOJ/li4=; b=nVpACl0LddC2ZpdD/0oIh0EulETT+je7wYDkSel2h/8ijhD5WgWozDmwDa91Dvrfc8 +QgqikAAf8sqBz63V6nQAh/td8V/dvLV8zPYyrPKSoUiWiGwxrI+3pdVmyhLBE+fFe44 xXLGrpYb4Ov61XeTH40vP9nR8Tsael4a1MTXTrt7K4cxKs8p1WXtGY0lojYWqNQmGAJA 3wu1ZQPphJsosfoC2D0r1tK48T6M43hJu5Y5UZY94azM+buKbbDUkCuyME6Cs/1i465+ bDS71q9efBf6K+xY4mq+N/tgiBEiGv5yvk25L163Kq50pE1iLBoubOPXUaXtwzSuZHcb 2eBg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=j8uvtFpw; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-72149-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-72149-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id jw8-20020a056a00928800b006e0cfe7ad50si5303602pfb.102.2024.02.19.16.29.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Feb 2024 16:29:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-72149-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=j8uvtFpw; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-72149-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-72149-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 89B8E282CE6 for ; Tue, 20 Feb 2024 00:29:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8DFA1187F; Tue, 20 Feb 2024 00:29:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="j8uvtFpw" Received: from out-175.mta0.migadu.com (out-175.mta0.migadu.com [91.218.175.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C828415B1 for ; Tue, 20 Feb 2024 00:29:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.175 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708388966; cv=none; b=EuoVM2lnd0TS1vbo9SbVSRYKgAqskO/JCPD++SNw+Hul/S9SVOjD5BvKKSu9IXvpvHFwuI8yUt513ryz58bp/7OiSWBqZvLvvbIswiyiimi9ab0GzZXB9O8e0Ut+42Yh69M57l51HjPBg6xeP5e1+H6QspmfoE0mpMiMSBfOt+c= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708388966; c=relaxed/simple; bh=183g6vtbcZ2b2MRFPH32KglvjXRItRCSep4zZ+9EpJM=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=b7xD/9RkvoQE1oTlZBJjTLQOhKkYCNXUDt90U4N8cY9+BtwFotv5TbwL3MbyhE/iteh/Nm6EGz+I3PCkEor/KR8o1gsIhCqN+aVB/ItKYsqIqZG7UMSuDCcpkT2SsfESV0CZCllZkMOKtU/c+K6E9DkaoHUGAyWXki76YGgf/HE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=j8uvtFpw; arc=none smtp.client-ip=91.218.175.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev 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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Migadu-Flow: FLOW_OUT 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 > >