From 856480eef0a25dde339cce6d1889efdc836c6be8 Mon Sep 17 00:00:00 2001 From: Anshul Dalal Date: Fri, 17 Oct 2025 18:45:29 +0530 Subject: arm: armv8: mmu: add mmu_unmap_reserved_mem For armv8, U-Boot uses a static map defined as 'mem_map' for configuring the MMU's page tables, done by mmu_setup. Though this works well for simpler platforms, it makes creating runtime carveouts by modifying the static array at runtime exceedingly complex like in mach-snapdragon/board.c. Creation of such carveouts are much better handled by APIs such as mmu_change_region_attr once the page tables are configured. Usually such carveouts are configured via the device-tree's reserved-memory node which provides the address and size for the carveout. Therefore this patch adds mmu_unmap_reserved_mem which acts as a wrapper over mmu_change_region_attr, helping unmap a reserved-memory region. Reviewed-by: Ilias Apalodimas Signed-off-by: Anshul Dalal Tested-by: Wadim Egorov --- arch/arm/include/asm/armv8/mmu.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'arch/arm/include') diff --git a/arch/arm/include/asm/armv8/mmu.h b/arch/arm/include/asm/armv8/mmu.h index 6e7a3366844..8aa5f9721c4 100644 --- a/arch/arm/include/asm/armv8/mmu.h +++ b/arch/arm/include/asm/armv8/mmu.h @@ -207,6 +207,15 @@ void setup_pgtables(void); */ int mem_map_from_dram_banks(unsigned int index, unsigned int len, u64 attrs); +/** + * mmu_unmap_reserved_mem() - Unmaps a reserved-memory node as PTE_TYPE_FAULT + * once MMU is configured by mmu_setup. + * + * @name: The name of the node under "/reserved-memory/" path + * @check_nomap: Check if the node is marked "no-map" before unmapping it + */ +int mmu_unmap_reserved_mem(const char *name, bool check_nomap); + u64 get_tcr(u64 *pips, u64 *pva_bits); /** -- cgit v1.2.3