diff options
author | Catalin Marinas <catalin.marinas@arm.com> | 2015-02-05 13:01:53 -0500 |
---|---|---|
committer | Catalin Marinas <catalin.marinas@arm.com> | 2015-02-27 13:05:55 -0500 |
commit | a1e50a82256ed2f1312e70c52a84323e2e378f49 (patch) | |
tree | d1a3059412f8323c6644f2fceb7649cba84a093c /arch/arm64/mm/init.c | |
parent | f6242cac10427c546271050b31c891a078e490cd (diff) |
arm64: Increase the swiotlb buffer size 64MB
With commit 3690951fc6d4 (arm64: Use swiotlb late initialisation), the
swiotlb buffer size is limited to MAX_ORDER_NR_PAGES. However, there are
platforms with 32-bit only devices that require bounce buffering via
swiotlb. This patch changes the swiotlb initialisation to an early 64MB
memblock allocation. In order to get the swiotlb buffer correctly
allocated (via memblock_virt_alloc_low_nopanic), this patch also defines
ARCH_LOW_ADDRESS_LIMIT to the maximum physical address capable of 32-bit
DMA.
Reported-by: Kefeng Wang <wangkefeng.wang@huawei.com>
Tested-by: Kefeng Wang <wangkefeng.wang@huawei.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Diffstat (limited to 'arch/arm64/mm/init.c')
-rw-r--r-- | arch/arm64/mm/init.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c index 71145f952070..ae85da6307bb 100644 --- a/arch/arm64/mm/init.c +++ b/arch/arm64/mm/init.c | |||
@@ -33,6 +33,7 @@ | |||
33 | #include <linux/dma-mapping.h> | 33 | #include <linux/dma-mapping.h> |
34 | #include <linux/dma-contiguous.h> | 34 | #include <linux/dma-contiguous.h> |
35 | #include <linux/efi.h> | 35 | #include <linux/efi.h> |
36 | #include <linux/swiotlb.h> | ||
36 | 37 | ||
37 | #include <asm/fixmap.h> | 38 | #include <asm/fixmap.h> |
38 | #include <asm/memory.h> | 39 | #include <asm/memory.h> |
@@ -45,6 +46,7 @@ | |||
45 | #include "mm.h" | 46 | #include "mm.h" |
46 | 47 | ||
47 | phys_addr_t memstart_addr __read_mostly = 0; | 48 | phys_addr_t memstart_addr __read_mostly = 0; |
49 | phys_addr_t arm64_dma_phys_limit __read_mostly; | ||
48 | 50 | ||
49 | #ifdef CONFIG_BLK_DEV_INITRD | 51 | #ifdef CONFIG_BLK_DEV_INITRD |
50 | static int __init early_initrd(char *p) | 52 | static int __init early_initrd(char *p) |
@@ -85,7 +87,7 @@ static void __init zone_sizes_init(unsigned long min, unsigned long max) | |||
85 | 87 | ||
86 | /* 4GB maximum for 32-bit only capable devices */ | 88 | /* 4GB maximum for 32-bit only capable devices */ |
87 | if (IS_ENABLED(CONFIG_ZONE_DMA)) { | 89 | if (IS_ENABLED(CONFIG_ZONE_DMA)) { |
88 | max_dma = PFN_DOWN(max_zone_dma_phys()); | 90 | max_dma = PFN_DOWN(arm64_dma_phys_limit); |
89 | zone_size[ZONE_DMA] = max_dma - min; | 91 | zone_size[ZONE_DMA] = max_dma - min; |
90 | } | 92 | } |
91 | zone_size[ZONE_NORMAL] = max - max_dma; | 93 | zone_size[ZONE_NORMAL] = max - max_dma; |
@@ -156,8 +158,6 @@ early_param("mem", early_mem); | |||
156 | 158 | ||
157 | void __init arm64_memblock_init(void) | 159 | void __init arm64_memblock_init(void) |
158 | { | 160 | { |
159 | phys_addr_t dma_phys_limit = 0; | ||
160 | |||
161 | memblock_enforce_memory_limit(memory_limit); | 161 | memblock_enforce_memory_limit(memory_limit); |
162 | 162 | ||
163 | /* | 163 | /* |
@@ -174,8 +174,10 @@ void __init arm64_memblock_init(void) | |||
174 | 174 | ||
175 | /* 4GB maximum for 32-bit only capable devices */ | 175 | /* 4GB maximum for 32-bit only capable devices */ |
176 | if (IS_ENABLED(CONFIG_ZONE_DMA)) | 176 | if (IS_ENABLED(CONFIG_ZONE_DMA)) |
177 | dma_phys_limit = max_zone_dma_phys(); | 177 | arm64_dma_phys_limit = max_zone_dma_phys(); |
178 | dma_contiguous_reserve(dma_phys_limit); | 178 | else |
179 | arm64_dma_phys_limit = PHYS_MASK + 1; | ||
180 | dma_contiguous_reserve(arm64_dma_phys_limit); | ||
179 | 181 | ||
180 | memblock_allow_resize(); | 182 | memblock_allow_resize(); |
181 | memblock_dump_all(); | 183 | memblock_dump_all(); |
@@ -276,6 +278,8 @@ static void __init free_unused_memmap(void) | |||
276 | */ | 278 | */ |
277 | void __init mem_init(void) | 279 | void __init mem_init(void) |
278 | { | 280 | { |
281 | swiotlb_init(1); | ||
282 | |||
279 | set_max_mapnr(pfn_to_page(max_pfn) - mem_map); | 283 | set_max_mapnr(pfn_to_page(max_pfn) - mem_map); |
280 | 284 | ||
281 | #ifndef CONFIG_SPARSEMEM_VMEMMAP | 285 | #ifndef CONFIG_SPARSEMEM_VMEMMAP |