Commit 19e7640d authored by Catalin Marinas's avatar Catalin Marinas

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: default avatarCatalin Marinas <catalin.marinas@arm.com>
parent 16fb1a9b
...@@ -86,7 +86,7 @@ config GENERIC_CSUM ...@@ -86,7 +86,7 @@ config GENERIC_CSUM
config GENERIC_CALIBRATE_DELAY config GENERIC_CALIBRATE_DELAY
def_bool y def_bool y
config ZONE_DMA32 config ZONE_DMA
def_bool y def_bool y
config ARCH_DMA_ADDR_T_64BIT config ARCH_DMA_ADDR_T_64BIT
......
...@@ -39,9 +39,9 @@ static void *__dma_alloc_coherent(struct device *dev, size_t size, ...@@ -39,9 +39,9 @@ static void *__dma_alloc_coherent(struct device *dev, size_t size,
return NULL; return NULL;
} }
if (IS_ENABLED(CONFIG_ZONE_DMA32) && if (IS_ENABLED(CONFIG_ZONE_DMA) &&
dev->coherent_dma_mask <= DMA_BIT_MASK(32)) dev->coherent_dma_mask <= DMA_BIT_MASK(32))
flags |= GFP_DMA32; flags |= GFP_DMA;
if (IS_ENABLED(CONFIG_DMA_CMA)) { if (IS_ENABLED(CONFIG_DMA_CMA)) {
struct page *page; struct page *page;
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#include <linux/memblock.h> #include <linux/memblock.h>
#include <linux/sort.h> #include <linux/sort.h>
#include <linux/of_fdt.h> #include <linux/of_fdt.h>
#include <linux/dma-mapping.h>
#include <linux/dma-contiguous.h> #include <linux/dma-contiguous.h>
#include <asm/sections.h> #include <asm/sections.h>
...@@ -59,22 +60,22 @@ static int __init early_initrd(char *p) ...@@ -59,22 +60,22 @@ static int __init early_initrd(char *p)
early_param("initrd", early_initrd); early_param("initrd", early_initrd);
#endif #endif
#define MAX_DMA32_PFN ((4UL * 1024 * 1024 * 1024) >> PAGE_SHIFT)
static void __init zone_sizes_init(unsigned long min, unsigned long max) static void __init zone_sizes_init(unsigned long min, unsigned long max)
{ {
struct memblock_region *reg; struct memblock_region *reg;
unsigned long zone_size[MAX_NR_ZONES], zhole_size[MAX_NR_ZONES]; unsigned long zone_size[MAX_NR_ZONES], zhole_size[MAX_NR_ZONES];
unsigned long max_dma32 = min; unsigned long max_dma = min;
memset(zone_size, 0, sizeof(zone_size)); memset(zone_size, 0, sizeof(zone_size));
#ifdef CONFIG_ZONE_DMA32
/* 4GB maximum for 32-bit only capable devices */ /* 4GB maximum for 32-bit only capable devices */
max_dma32 = max(min, min(max, MAX_DMA32_PFN)); if (IS_ENABLED(CONFIG_ZONE_DMA)) {
zone_size[ZONE_DMA32] = max_dma32 - min; unsigned long max_dma_phys =
#endif (unsigned long)dma_to_phys(NULL, DMA_BIT_MASK(32) + 1);
zone_size[ZONE_NORMAL] = max - max_dma32; max_dma = max(min, min(max, max_dma_phys >> PAGE_SHIFT));
zone_size[ZONE_DMA] = max_dma - min;
}
zone_size[ZONE_NORMAL] = max - max_dma;
memcpy(zhole_size, zone_size, sizeof(zhole_size)); memcpy(zhole_size, zone_size, sizeof(zhole_size));
...@@ -84,15 +85,15 @@ static void __init zone_sizes_init(unsigned long min, unsigned long max) ...@@ -84,15 +85,15 @@ static void __init zone_sizes_init(unsigned long min, unsigned long max)
if (start >= max) if (start >= max)
continue; continue;
#ifdef CONFIG_ZONE_DMA32
if (start < max_dma32) { if (IS_ENABLED(CONFIG_ZONE_DMA) && start < max_dma) {
unsigned long dma_end = min(end, max_dma32); unsigned long dma_end = min(end, max_dma);
zhole_size[ZONE_DMA32] -= dma_end - start; zhole_size[ZONE_DMA] -= dma_end - start;
} }
#endif
if (end > max_dma32) { if (end > max_dma) {
unsigned long normal_end = min(end, max); unsigned long normal_end = min(end, max);
unsigned long normal_start = max(start, max_dma32); unsigned long normal_start = max(start, max_dma);
zhole_size[ZONE_NORMAL] -= normal_end - normal_start; zhole_size[ZONE_NORMAL] -= normal_end - normal_start;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment