diff options
author | Catalin Marinas <catalin.marinas@arm.com> | 2014-06-13 08:41:20 -0400 |
---|---|---|
committer | Catalin Marinas <catalin.marinas@arm.com> | 2014-06-18 07:40:56 -0400 |
commit | 2d5a5612bceda8edd25b29f363c4e2c6cda28bab (patch) | |
tree | 7b26f52f615553aea4e531d2109a3ca6e6ce3417 /arch/arm64/mm | |
parent | 1712ef43af71b0a0498ad370f0829d6b85fa2dca (diff) |
arm64: Limit the CMA buffer to 32-bit if ZONE_DMA
When the CMA buffer is allocated, it is too early to know whether
devices will require ZONE_DMA memory. This patch limits the CMA buffer
to (DMA_BIT_MASK(32) + 1) if CONFIG_ZONE_DMA is enabled.
In addition, it computes the dma_to_phys(DMA_BIT_MASK(32)) before the
increment (no current functional change).
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Diffstat (limited to 'arch/arm64/mm')
-rw-r--r-- | arch/arm64/mm/init.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c index 091d428d64ac..f43db8a69262 100644 --- a/arch/arm64/mm/init.c +++ b/arch/arm64/mm/init.c | |||
@@ -71,7 +71,7 @@ static void __init zone_sizes_init(unsigned long min, unsigned long max) | |||
71 | /* 4GB maximum for 32-bit only capable devices */ | 71 | /* 4GB maximum for 32-bit only capable devices */ |
72 | if (IS_ENABLED(CONFIG_ZONE_DMA)) { | 72 | if (IS_ENABLED(CONFIG_ZONE_DMA)) { |
73 | unsigned long max_dma_phys = | 73 | unsigned long max_dma_phys = |
74 | (unsigned long)dma_to_phys(NULL, DMA_BIT_MASK(32) + 1); | 74 | (unsigned long)(dma_to_phys(NULL, DMA_BIT_MASK(32)) + 1); |
75 | max_dma = max(min, min(max, max_dma_phys >> PAGE_SHIFT)); | 75 | max_dma = max(min, min(max, max_dma_phys >> PAGE_SHIFT)); |
76 | zone_size[ZONE_DMA] = max_dma - min; | 76 | zone_size[ZONE_DMA] = max_dma - min; |
77 | } | 77 | } |
@@ -126,6 +126,8 @@ static void arm64_memory_present(void) | |||
126 | 126 | ||
127 | void __init arm64_memblock_init(void) | 127 | void __init arm64_memblock_init(void) |
128 | { | 128 | { |
129 | phys_addr_t dma_phys_limit = 0; | ||
130 | |||
129 | /* Register the kernel text, kernel data and initrd with memblock */ | 131 | /* Register the kernel text, kernel data and initrd with memblock */ |
130 | memblock_reserve(__pa(_text), _end - _text); | 132 | memblock_reserve(__pa(_text), _end - _text); |
131 | #ifdef CONFIG_BLK_DEV_INITRD | 133 | #ifdef CONFIG_BLK_DEV_INITRD |
@@ -141,7 +143,11 @@ void __init arm64_memblock_init(void) | |||
141 | memblock_reserve(__pa(idmap_pg_dir), IDMAP_DIR_SIZE); | 143 | memblock_reserve(__pa(idmap_pg_dir), IDMAP_DIR_SIZE); |
142 | 144 | ||
143 | early_init_fdt_scan_reserved_mem(); | 145 | early_init_fdt_scan_reserved_mem(); |
144 | dma_contiguous_reserve(0); | 146 | |
147 | /* 4GB maximum for 32-bit only capable devices */ | ||
148 | if (IS_ENABLED(CONFIG_ZONE_DMA)) | ||
149 | dma_phys_limit = dma_to_phys(NULL, DMA_BIT_MASK(32)) + 1; | ||
150 | dma_contiguous_reserve(dma_phys_limit); | ||
145 | 151 | ||
146 | memblock_allow_resize(); | 152 | memblock_allow_resize(); |
147 | memblock_dump_all(); | 153 | memblock_dump_all(); |