[PATCH 01/11] treewide: use remap_range instead of arch_remap_range

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The remapping in arch_remap_range is currently limited to attributes. In
a later commit, we'll start supporting non-1:1 remappings. We'll keep
remap_range as is for 1:1, so as preparation, let's switch all
arch_remap_range users that want 1:1 remappings to remap_range.

Signed-off-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx>
---
 arch/arm/cpu/mmu-common.c |  8 ++++----
 arch/arm/cpu/mmu_32.c     | 10 +++++-----
 arch/arm/cpu/mmu_64.c     | 10 +++++-----
 drivers/hab/habv4.c       |  2 +-
 4 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/arch/arm/cpu/mmu-common.c b/arch/arm/cpu/mmu-common.c
index 02f512c2c6bd..5208db21ec90 100644
--- a/arch/arm/cpu/mmu-common.c
+++ b/arch/arm/cpu/mmu-common.c
@@ -36,7 +36,7 @@ void *dma_alloc_map(size_t size, dma_addr_t *dma_handle, unsigned flags)
 	memset(ret, 0, size);
 	dma_flush_range(ret, size);
 
-	arch_remap_range(ret, size, flags);
+	remap_range(ret, size, flags);
 
 	return ret;
 }
@@ -53,19 +53,19 @@ void *dma_alloc_coherent(size_t size, dma_addr_t *dma_handle)
 void dma_free_coherent(void *mem, dma_addr_t dma_handle, size_t size)
 {
 	size = PAGE_ALIGN(size);
-	arch_remap_range(mem, size, MAP_CACHED);
+	remap_range(mem, size, MAP_CACHED);
 
 	free(mem);
 }
 
 void zero_page_access(void)
 {
-	arch_remap_range(0x0, PAGE_SIZE, MAP_CACHED);
+	remap_range(0x0, PAGE_SIZE, MAP_CACHED);
 }
 
 void zero_page_faulting(void)
 {
-	arch_remap_range(0x0, PAGE_SIZE, MAP_FAULT);
+	remap_range(0x0, PAGE_SIZE, MAP_FAULT);
 }
 
 static int mmu_init(void)
diff --git a/arch/arm/cpu/mmu_32.c b/arch/arm/cpu/mmu_32.c
index 852c5626dedd..e4607d99fd2a 100644
--- a/arch/arm/cpu/mmu_32.c
+++ b/arch/arm/cpu/mmu_32.c
@@ -534,11 +534,11 @@ void __mmu_init(bool mmu_on)
 		pos = bank->start;
 
 		for_each_reserved_region(bank, rsv) {
-			arch_remap_range((void *)pos, rsv->start - pos, MAP_CACHED);
+			remap_range((void *)pos, rsv->start - pos, MAP_CACHED);
 			pos = rsv->end + 1;
 		}
 
-		arch_remap_range((void *)pos, bank->start + bank->size - pos, MAP_CACHED);
+		remap_range((void *)pos, bank->start + bank->size - pos, MAP_CACHED);
 	}
 }
 
@@ -581,9 +581,9 @@ void mmu_early_enable(unsigned long membase, unsigned long memsize)
 	create_flat_mapping();
 
 	/* maps main memory as cachable */
-	arch_remap_range((void *)membase, memsize - OPTEE_SIZE, MAP_CACHED);
-	arch_remap_range((void *)membase + memsize - OPTEE_SIZE, OPTEE_SIZE, MAP_UNCACHED);
-	arch_remap_range((void *)PAGE_ALIGN_DOWN((uintptr_t)_stext), PAGE_ALIGN(_etext - _stext), MAP_CACHED);
+	remap_range((void *)membase, memsize - OPTEE_SIZE, MAP_CACHED);
+	remap_range((void *)membase + memsize - OPTEE_SIZE, OPTEE_SIZE, MAP_UNCACHED);
+	remap_range((void *)PAGE_ALIGN_DOWN((uintptr_t)_stext), PAGE_ALIGN(_etext - _stext), MAP_CACHED);
 
 	__mmu_cache_on();
 }
diff --git a/arch/arm/cpu/mmu_64.c b/arch/arm/cpu/mmu_64.c
index 3f9b52bbdb7b..478222cd991f 100644
--- a/arch/arm/cpu/mmu_64.c
+++ b/arch/arm/cpu/mmu_64.c
@@ -203,11 +203,11 @@ void __mmu_init(bool mmu_on)
 		pos = bank->start;
 
 		for_each_reserved_region(bank, rsv) {
-			arch_remap_range((void *)pos, rsv->start - pos, MAP_CACHED);
+			remap_range((void *)pos, rsv->start - pos, MAP_CACHED);
 			pos = rsv->end + 1;
 		}
 
-		arch_remap_range((void *)pos, bank->start + bank->size - pos, MAP_CACHED);
+		remap_range((void *)pos, bank->start + bank->size - pos, MAP_CACHED);
 	}
 
 	/* Make zero page faulting to catch NULL pointer derefs */
@@ -257,9 +257,9 @@ void mmu_early_enable(unsigned long membase, unsigned long memsize)
 
 	memset((void *)ttb, 0, GRANULE_SIZE);
 
-	arch_remap_range(0, 1UL << (BITS_PER_VA - 1), MAP_UNCACHED);
-	arch_remap_range((void *)membase, memsize - OPTEE_SIZE, MAP_CACHED);
-	arch_remap_range((void *)membase + memsize - OPTEE_SIZE, OPTEE_SIZE, MAP_FAULT);
+	remap_range(0, 1UL << (BITS_PER_VA - 1), MAP_UNCACHED);
+	remap_range((void *)membase, memsize - OPTEE_SIZE, MAP_CACHED);
+	remap_range((void *)membase + memsize - OPTEE_SIZE, OPTEE_SIZE, MAP_FAULT);
 
 	mmu_enable();
 }
diff --git a/drivers/hab/habv4.c b/drivers/hab/habv4.c
index d2494db11486..a8745e8339e5 100644
--- a/drivers/hab/habv4.c
+++ b/drivers/hab/habv4.c
@@ -616,7 +616,7 @@ static int init_imx6_hab_get_status(void)
 		/* can happen in multi-image builds and is not an error */
 		return 0;
 
-	arch_remap_range(0x0, SZ_1M, MAP_CACHED);
+	remap_range(0x0, SZ_1M, MAP_CACHED);
 
 	/*
 	 * Nobody will check the return value if there were HAB errors, but the
-- 
2.39.2





[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux