diff options
author | Ahmad Fatoum <a.fatoum@pengutronix.de> | 2023-05-22 07:28:28 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2023-05-23 09:26:09 +0200 |
commit | 4ad24201d89a4497c156ba4982ab24d7f4bcf4b4 (patch) | |
tree | 30c398a734ba06119b6a0cca012bf629a88d8800 /arch/arm/cpu | |
parent | 5fa20435c4f8708de824a45a0c17e30167a501ce (diff) | |
download | barebox-4ad24201d89a4497c156ba4982ab24d7f4bcf4b4.tar.gz barebox-4ad24201d89a4497c156ba4982ab24d7f4bcf4b4.tar.xz |
ARM: mmu64: support non-1:1 mappings in arch_remap_range
This provides an alternative to ARM32's map_io_sections with the added
benefit of supporting 4K granularity.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20230522052835.1039143-5-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm/cpu')
-rw-r--r-- | arch/arm/cpu/mmu_64.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/arch/arm/cpu/mmu_64.c b/arch/arm/cpu/mmu_64.c index a16347ca6e..cdc4825422 100644 --- a/arch/arm/cpu/mmu_64.c +++ b/arch/arm/cpu/mmu_64.c @@ -138,7 +138,8 @@ static void create_sections(uint64_t virt, uint64_t phys, uint64_t size, pte = table + idx; - if (size >= block_size && IS_ALIGNED(addr, block_size)) { + if (size >= block_size && IS_ALIGNED(addr, block_size) && + IS_ALIGNED(phys, block_size)) { type = (level == 3) ? PTE_TYPE_PAGE : PTE_TYPE_BLOCK; *pte = phys | attr | type; @@ -162,9 +163,6 @@ int arch_remap_range(void *virt_addr, phys_addr_t phys_addr, size_t size, unsign { unsigned long attrs; - if (phys_addr != virt_to_phys(virt_addr)) - return -ENOSYS; - switch (flags) { case MAP_CACHED: attrs = CACHED_MEM; @@ -179,7 +177,7 @@ int arch_remap_range(void *virt_addr, phys_addr_t phys_addr, size_t size, unsign return -EINVAL; } - create_sections((uint64_t)virt_addr, (uint64_t)virt_addr, (uint64_t)size, attrs); + create_sections((uint64_t)virt_addr, phys_addr, (uint64_t)size, attrs); return 0; } |