[PATCH] fixup! ARM64: mmu: fix mmu_early_enable VA->PA mapping
Ahmad Fatoum
a.fatoum at pengutronix.de
Mon Dec 18 04:42:16 PST 2023
Fix warnings and reformat:
- fix whitespaces in accordance with kernel coding style
- mark locally-used function static to fix warning
- remove cast to fix -Wint-conversion warning
- Use C-style comments as used elsewhere
Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
arch/arm/cpu/mmu_64.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/arch/arm/cpu/mmu_64.c b/arch/arm/cpu/mmu_64.c
index e855ae4fa7d4..a392789ab696 100644
--- a/arch/arm/cpu/mmu_64.c
+++ b/arch/arm/cpu/mmu_64.c
@@ -294,12 +294,13 @@ void dma_flush_range(void *ptr, size_t size)
v8_flush_dcache_range(start, end);
}
-void init_range(void *virt_addr, size_t size)
+static void init_range(void *virt_addr, size_t size)
{
uint64_t *ttb = get_ttb();
uint64_t addr = (uint64_t)virt_addr;
- while(size) {
- early_remap_range((void *)addr, L0_XLAT_SIZE, MAP_UNCACHED);
+
+ while (size) {
+ early_remap_range(addr, L0_XLAT_SIZE, MAP_UNCACHED);
split_block(ttb,0);
size -= L0_XLAT_SIZE;
addr += L0_XLAT_SIZE;
@@ -324,9 +325,10 @@ void mmu_early_enable(unsigned long membase, unsigned long memsize)
memset((void *)ttb, 0, GRANULE_SIZE);
- // Assume maximum BITS_PER_PA set to 40 bits.
- // Set 1:1 mapping of VA->PA. So to cover the full 1TB range we need 2 tables.
- init_range(0, 2*L0_XLAT_SIZE);
+ /* Assuming maximum BITS_PER_PA set to 40 bits, set 1:1 mapping
+ * of VA->PA. To cover the full 1TiB range we need 2 tables.
+ */
+ init_range(0, 2 * L0_XLAT_SIZE);
early_remap_range(membase, memsize - OPTEE_SIZE, MAP_CACHED);
early_remap_range(membase + memsize - OPTEE_SIZE, OPTEE_SIZE, MAP_FAULT);
early_remap_range(PAGE_ALIGN_DOWN((uintptr_t)_stext), PAGE_ALIGN(_etext - _stext), MAP_CACHED);
--
2.39.2
More information about the barebox
mailing list