diff --git a/drivers/base/dma-contiguous.c b/drivers/base/dma-contiguous.c index b71e50bbfc78be8e368a28c4c7cbf3e34bf19674..3baca0e1b37b29b63e9eec0faab69526a6a81b5b 100644 --- a/drivers/base/dma-contiguous.c +++ b/drivers/base/dma-contiguous.c @@ -461,6 +461,13 @@ static int __init cma_init_reserved_areas(void) } core_initcall(cma_init_reserved_areas); +phys_addr_t cma_get_base(struct device *dev) +{ + struct cma *cma = dev_get_cma_area(dev); + + return cma->base_pfn << PAGE_SHIFT; +} + /** * dma_alloc_from_contiguous() - allocate pages from contiguous area * @dev: Pointer to device for which the allocation is performed. diff --git a/include/linux/dma-contiguous.h b/include/linux/dma-contiguous.h index e5ebd7e16ac8bfd791016feadee2b46ac3d466d7..9975eef4cad7971633e45eb0bb7620fecdd4857c 100644 --- a/include/linux/dma-contiguous.h +++ b/include/linux/dma-contiguous.h @@ -65,6 +65,9 @@ struct device; */ #define MAX_CMA_AREAS (1 + CONFIG_CMA_AREAS) + +phys_addr_t cma_get_base(struct device *dev); + extern struct cma *dma_contiguous_def_area; void dma_contiguous_reserve(phys_addr_t addr_limit); @@ -142,6 +145,12 @@ bool dma_release_from_contiguous(struct device *dev, struct page *pages, return false; } + +static inline phys_addr_t cma_get_base(struct device *dev) +{ + return 0; +} + #endif #endif