linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] arm64: add early fixmap initialization flag
@ 2024-02-17 14:03 skseofh
  2024-02-19 10:48 ` Mark Rutland
  0 siblings, 1 reply; 6+ messages in thread
From: skseofh @ 2024-02-17 14:03 UTC (permalink / raw)
  To: catalin.marinas, will
  Cc: ryan.roberts, mark.rutland, linux-arm-kernel, linux-kernel,
	Daero Lee

From: Daero Lee <skseofh@gmail.com>

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.

Signed-off-by: Daero Lee <skseofh@gmail.com>
---
 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

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-02-22 11:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-17 14:03 [PATCH] arm64: add early fixmap initialization flag skseofh
2024-02-19 10:48 ` Mark Rutland
2024-02-20  0:29   ` Itaru Kitayama
2024-02-20 11:55     ` Mark Rutland
2024-02-20 23:14       ` Itaru Kitayama
2024-02-22 10:59         ` Mark Rutland

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).