[PATCH v6 21/30] arm64: set_memory: Implement arch_has_pte_only_direct_map()

Kevin Brodsky
2026-02-27T17:57:25Z

Implement the new arch helper, which is equivalent to
force_pte_mapping().

Signed-off-by: Kevin Brodsky <kevin.brodsky@arm.com>
---
arch/arm64/include/asm/set_memory.h | 3 +++
arch/arm64/mm/mmu.c | 5 +++++
2 files changed, 8 insertions(+)

diff --git a/arch/arm64/include/asm/set_memory.h b/arch/arm64/include/asm/set_memory.h
index b6cd6de34abf..2bf6e0b917e6 100644
--- a/arch/arm64/include/asm/set_memory.h
+++ b/arch/arm64/include/asm/set_memory.h
@@ -9,6 +9,9 @@
bool can_set_direct_map(void);
#define can_set_direct_map can_set_direct_map

+bool arch_has_pte_only_direct_map(void);
+#define arch_has_pte_only_direct_map arch_has_pte_only_direct_map
+
int set_memory_valid(unsigned long addr, int numpages, int enable);

int set_direct_map_invalid_noflush(struct page *page);
diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c
index 09ca62f77a84..a8e982ac5079 100644
--- a/arch/arm64/mm/mmu.c
+++ b/arch/arm64/mm/mmu.c
@@ -1181,6 +1181,11 @@ static void __init map_mem(pgd_t *pgdp)
arm64_kfence_map_pool(early_kfence_pool, pgdp);
}

+bool arch_has_pte_only_direct_map(void)
+{
+ return force_pte_mapping();
+}
+
void mark_rodata_ro(void)
{
unsigned long section_size;
--
2.51.2