Skip to content
Snippets Groups Projects
Commit 1ca8d488 authored by Laura Abbott's avatar Laura Abbott Committed by Stephen Boyd
Browse files

cma: Add API to get the start address of a CMA region


When setting CMA up at a fixed region, it is possible for the address
to be shared between multiple subsystems. If the address is placed
dynamically, there is no mechanism to be able to get the start address
of the region. Drivers may wish to do keep track of allocations relative
to the start address so add an API to get the start region of a CMA
address.

Change-Id: If0730c64496c876d3143064d767b22b984c6dc84
Signed-off-by: default avatarLaura Abbott <lauraa@codeaurora.org>
parent f4eeed37
Branches
Tags
No related merge requests found
...@@ -461,6 +461,13 @@ static int __init cma_init_reserved_areas(void) ...@@ -461,6 +461,13 @@ static int __init cma_init_reserved_areas(void)
} }
core_initcall(cma_init_reserved_areas); 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 * dma_alloc_from_contiguous() - allocate pages from contiguous area
* @dev: Pointer to device for which the allocation is performed. * @dev: Pointer to device for which the allocation is performed.
......
...@@ -65,6 +65,9 @@ struct device; ...@@ -65,6 +65,9 @@ struct device;
*/ */
#define MAX_CMA_AREAS (1 + CONFIG_CMA_AREAS) #define MAX_CMA_AREAS (1 + CONFIG_CMA_AREAS)
phys_addr_t cma_get_base(struct device *dev);
extern struct cma *dma_contiguous_def_area; extern struct cma *dma_contiguous_def_area;
void dma_contiguous_reserve(phys_addr_t addr_limit); void dma_contiguous_reserve(phys_addr_t addr_limit);
...@@ -142,6 +145,12 @@ bool dma_release_from_contiguous(struct device *dev, struct page *pages, ...@@ -142,6 +145,12 @@ bool dma_release_from_contiguous(struct device *dev, struct page *pages,
return false; return false;
} }
static inline phys_addr_t cma_get_base(struct device *dev)
{
return 0;
}
#endif #endif
#endif #endif
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment