diff options
author | Catalin Marinas <catalin.marinas@arm.com> | 2014-02-27 07:09:22 -0500 |
---|---|---|
committer | Catalin Marinas <catalin.marinas@arm.com> | 2014-02-27 07:09:22 -0500 |
commit | 19e7640d1f2302c20df2733e3e3df49acb17189e (patch) | |
tree | 2fcf864c556e32cc562f51efbd92ad8d96c8389b /arch/arm64/mm | |
parent | 16fb1a9bec6126162560f159df449e4781560807 (diff) |
arm64: Replace ZONE_DMA32 with ZONE_DMA
On arm64 we do not have two DMA zones, so it does not make sense to
implement ZONE_DMA32. This patch changes ZONE_DMA32 with ZONE_DMA, the
latter covering 32-bit dma address space to honour GFP_DMA allocations.
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Diffstat (limited to 'arch/arm64/mm')
-rw-r--r-- | arch/arm64/mm/dma-mapping.c | 4 | ||||
-rw-r--r-- | arch/arm64/mm/init.c | 31 |
2 files changed, 18 insertions, 17 deletions
diff --git a/arch/arm64/mm/dma-mapping.c b/arch/arm64/mm/dma-mapping.c index 985fc075c0f3..26b2512c1fcd 100644 --- a/arch/arm64/mm/dma-mapping.c +++ b/arch/arm64/mm/dma-mapping.c | |||
@@ -39,9 +39,9 @@ static void *__dma_alloc_coherent(struct device *dev, size_t size, | |||
39 | return NULL; | 39 | return NULL; |
40 | } | 40 | } |
41 | 41 | ||
42 | if (IS_ENABLED(CONFIG_ZONE_DMA32) && | 42 | if (IS_ENABLED(CONFIG_ZONE_DMA) && |
43 | dev->coherent_dma_mask <= DMA_BIT_MASK(32)) | 43 | dev->coherent_dma_mask <= DMA_BIT_MASK(32)) |
44 | flags |= GFP_DMA32; | 44 | flags |= GFP_DMA; |
45 | if (IS_ENABLED(CONFIG_DMA_CMA)) { | 45 | if (IS_ENABLED(CONFIG_DMA_CMA)) { |
46 | struct page *page; | 46 | struct page *page; |
47 | 47 | ||
diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c index d0b4c2efda90..a61a4d560d12 100644 --- a/arch/arm64/mm/init.c +++ b/arch/arm64/mm/init.c | |||
@@ -30,6 +30,7 @@ | |||
30 | #include <linux/memblock.h> | 30 | #include <linux/memblock.h> |
31 | #include <linux/sort.h> | 31 | #include <linux/sort.h> |
32 | #include <linux/of_fdt.h> | 32 | #include <linux/of_fdt.h> |
33 | #include <linux/dma-mapping.h> | ||
33 | #include <linux/dma-contiguous.h> | 34 | #include <linux/dma-contiguous.h> |
34 | 35 | ||
35 | #include <asm/sections.h> | 36 | #include <asm/sections.h> |
@@ -59,22 +60,22 @@ static int __init early_initrd(char *p) | |||
59 | early_param("initrd", early_initrd); | 60 | early_param("initrd", early_initrd); |
60 | #endif | 61 | #endif |
61 | 62 | ||
62 | #define MAX_DMA32_PFN ((4UL * 1024 * 1024 * 1024) >> PAGE_SHIFT) | ||
63 | |||
64 | static void __init zone_sizes_init(unsigned long min, unsigned long max) | 63 | static void __init zone_sizes_init(unsigned long min, unsigned long max) |
65 | { | 64 | { |
66 | struct memblock_region *reg; | 65 | struct memblock_region *reg; |
67 | unsigned long zone_size[MAX_NR_ZONES], zhole_size[MAX_NR_ZONES]; | 66 | unsigned long zone_size[MAX_NR_ZONES], zhole_size[MAX_NR_ZONES]; |
68 | unsigned long max_dma32 = min; | 67 | unsigned long max_dma = min; |
69 | 68 | ||
70 | memset(zone_size, 0, sizeof(zone_size)); | 69 | memset(zone_size, 0, sizeof(zone_size)); |
71 | 70 | ||
72 | #ifdef CONFIG_ZONE_DMA32 | ||
73 | /* 4GB maximum for 32-bit only capable devices */ | 71 | /* 4GB maximum for 32-bit only capable devices */ |
74 | max_dma32 = max(min, min(max, MAX_DMA32_PFN)); | 72 | if (IS_ENABLED(CONFIG_ZONE_DMA)) { |
75 | zone_size[ZONE_DMA32] = max_dma32 - min; | 73 | unsigned long max_dma_phys = |
76 | #endif | 74 | (unsigned long)dma_to_phys(NULL, DMA_BIT_MASK(32) + 1); |
77 | zone_size[ZONE_NORMAL] = max - max_dma32; | 75 | max_dma = max(min, min(max, max_dma_phys >> PAGE_SHIFT)); |
76 | zone_size[ZONE_DMA] = max_dma - min; | ||
77 | } | ||
78 | zone_size[ZONE_NORMAL] = max - max_dma; | ||
78 | 79 | ||
79 | memcpy(zhole_size, zone_size, sizeof(zhole_size)); | 80 | memcpy(zhole_size, zone_size, sizeof(zhole_size)); |
80 | 81 | ||
@@ -84,15 +85,15 @@ static void __init zone_sizes_init(unsigned long min, unsigned long max) | |||
84 | 85 | ||
85 | if (start >= max) | 86 | if (start >= max) |
86 | continue; | 87 | continue; |
87 | #ifdef CONFIG_ZONE_DMA32 | 88 | |
88 | if (start < max_dma32) { | 89 | if (IS_ENABLED(CONFIG_ZONE_DMA) && start < max_dma) { |
89 | unsigned long dma_end = min(end, max_dma32); | 90 | unsigned long dma_end = min(end, max_dma); |
90 | zhole_size[ZONE_DMA32] -= dma_end - start; | 91 | zhole_size[ZONE_DMA] -= dma_end - start; |
91 | } | 92 | } |
92 | #endif | 93 | |
93 | if (end > max_dma32) { | 94 | if (end > max_dma) { |
94 | unsigned long normal_end = min(end, max); | 95 | unsigned long normal_end = min(end, max); |
95 | unsigned long normal_start = max(start, max_dma32); | 96 | unsigned long normal_start = max(start, max_dma); |
96 | zhole_size[ZONE_NORMAL] -= normal_end - normal_start; | 97 | zhole_size[ZONE_NORMAL] -= normal_end - normal_start; |
97 | } | 98 | } |
98 | } | 99 | } |