Some architectures have platform specific DMA addressing limitations. This will allow for hardware description code to provide the constraints in a generic manner, so as for arch code to properly setup it's memory zones and DMA mask. Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@xxxxxxx> --- Changes in v2: None include/asm-generic/dma.h | 8 +++++++- mm/page_alloc.c | 3 +++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/include/asm-generic/dma.h b/include/asm-generic/dma.h index 43d0c8af8058..c2f39cdb64f6 100644 --- a/include/asm-generic/dma.h +++ b/include/asm-generic/dma.h @@ -8,7 +8,13 @@ * * Some code relies on seeing MAX_DMA_ADDRESS though. */ -#define MAX_DMA_ADDRESS PAGE_OFFSET +#define MAX_DMA_ADDRESS (PAGE_OFFSET + dma_zone_size) + +/* + * Some architectures may have platform specific DMA addressing constraints. + * Firmware can use this to fine tune the device's DMA memory zone. + */ +extern u64 dma_zone_size __ro_after_init; extern int request_dma(unsigned int dmanr, const char *device_id); extern void free_dma(unsigned int dmanr); diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 272c6de1bf4e..b514afee5451 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -133,6 +133,9 @@ EXPORT_SYMBOL(_totalram_pages); unsigned long totalreserve_pages __read_mostly; unsigned long totalcma_pages __read_mostly; +u64 dma_zone_size __ro_after_init; +EXPORT_SYMBOL(dma_zone_size); + int percpu_pagelist_fraction; gfp_t gfp_allowed_mask __read_mostly = GFP_BOOT_MASK; #ifdef CONFIG_INIT_ON_ALLOC_DEFAULT_ON -- 2.22.0