diff options
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 |