Added the dma_contiguous_stats() to get CMA
stats such as base and size from the given dev
bug
1279160
Change-Id: I066e35e7fda140f8613a3d4364464587d3bd251d
Signed-off-by: Vandana Salve <vsalve@nvidia.com>
Reviewed-on: http://git-master/r/328412
GVS: Gerrit_Virtual_Submit
Reviewed-by: Krishna Reddy <vdumpa@nvidia.com>
Tested-by: Krishna Reddy <vdumpa@nvidia.com>
return true;
}
+
+int dma_get_contiguous_stats(struct device *dev,
+ struct dma_contiguous_stats *stats)
+{
+ struct cma *cma = NULL;
+
+ if ((!dev) || !stats)
+ return -EINVAL;
+
+ if (dev->cma_area)
+ cma = dev->cma_area;
+
+ if (!cma)
+ return -EINVAL;
+
+ stats->size = (cma->count) << PAGE_SHIFT;
+ stats->base = (cma->base_pfn) << PAGE_SHIFT;
+
+ return 0;
+}
#ifdef CONFIG_CMA
+struct dma_contiguous_stats {
+ phys_addr_t base;
+ size_t size;
+};
+
/*
* There is always at least global CMA area and a few optional device
* private areas configured in kernel .config.
unsigned int order);
bool dma_release_from_contiguous(struct device *dev, struct page *pages,
int count);
+int dma_get_contiguous_stats(struct device *dev,
+ struct dma_contiguous_stats *stats);
#else
return false;
}
+static inline
+int dma_get_contiguous_stats(struct device *dev,
+ struct dma_contiguous_stats *stats)
+{
+ return -ENOSYS;
+}
#endif
#endif