@@ -1390,7 +1390,7 @@ DEFINE_SIMPLE_ATTRIBUTE(debug_shrink_fops,
debug_shrink_get,
void ion_device_add_heap(struct ion_device *dev, struct ion_heap *heap)
{
if (!heap->ops->allocate || !heap->ops->free || !heap->ops->map_dma ||
- !heap->ops->unmap_dma)
+ !heap->ops->unmap_dma || !heap->ops->unmap_kernel)
pr_err("%s: can not add heap with invalid ops struct.\n",
__func__);
@@ -170,6 +170,12 @@ void *ion_cma_map_kernel(struct ion_heap *heap,
struct ion_buffer *buffer)
return info->cpu_addr;
}
+void ion_cma_unmap_kernel(struct ion_heap *heap, struct ion_buffer *buffer)
+{
+ /* do nothing because we keep the mapping*/
+ return;
+}
+
static struct ion_heap_ops ion_cma_ops = {
.allocate = ion_cma_allocate,
After calling dma_alloc_coherent memory is mapped in kernel space. CMA heap doesn't map/unmap so only create a function to avoid segfault when ion call it without check it. Add a check at heap creation to be sure that unmap_kernel ops is implemented. Signed-off-by: Benjamin Gaignard <benjamin.gaignard@linaro.org> --- drivers/gpu/ion/ion.c | 2 +- drivers/gpu/ion/ion_cma_heap.c | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) .free = ion_cma_free, @@ -178,6 +184,7 @@ static struct ion_heap_ops ion_cma_ops = { .phys = ion_cma_phys, .map_user = ion_cma_mmap, .map_kernel = ion_cma_map_kernel, + .unmap_kernel = ion_cma_unmap_kernel, }; struct ion_heap *ion_cma_heap_create(struct ion_platform_heap *data)