Commit def5c492 authored by Arve Hjønnevåg's avatar Arve Hjønnevåg Committed by Greg Kroah-Hartman
Browse files

gpu: ion: __dma_page_cpu_to_dev -> arm_dma_ops.sync_single_for_device hack



Signed-off-by: default avatarArve Hjønnevåg <arve@android.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: default avatarJohn Stultz <john.stultz@linaro.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent ea313b5f
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -105,8 +105,9 @@ static void ion_chunk_heap_free(struct ion_buffer *buffer)

	for_each_sg(table->sgl, sg, table->nents, i) {
		if (ion_buffer_cached(buffer))
			__dma_page_cpu_to_dev(sg_page(sg), 0, sg_dma_len(sg),
					      DMA_BIDIRECTIONAL);
			arm_dma_ops.sync_single_for_device(NULL,
				pfn_to_dma(NULL, page_to_pfn(sg_page(sg))),
				sg_dma_len(sg), DMA_BIDIRECTIONAL);
		gen_pool_free(chunk_heap->pool, page_to_phys(sg_page(sg)),
			      sg_dma_len(sg));
	}
@@ -177,8 +178,9 @@ struct ion_heap *ion_chunk_heap_create(struct ion_platform_heap *heap_data)
	}
	free_vm_area(vm_struct);

	__dma_page_cpu_to_dev(phys_to_page(heap_data->base), 0, heap_data->size,
			      DMA_BIDIRECTIONAL);
	arm_dma_ops.sync_single_for_device(NULL,
		pfn_to_dma(NULL, page_to_pfn(phys_to_page(heap_data->base))),
		heap_data->size, DMA_BIDIRECTIONAL);
	gen_pool_add(chunk_heap->pool, chunk_heap->base, heap_data->size, -1);
	chunk_heap->heap.ops = &chunk_heap_ops;
	chunk_heap->heap.type = ION_HEAP_TYPE_CHUNK;
+4 −2
Original line number Diff line number Diff line
@@ -37,7 +37,9 @@ static void *ion_page_pool_alloc_pages(struct ion_page_pool *pool)
	/* this is only being used to flush the page for dma,
	   this api is not really suitable for calling from a driver
	   but no better way to flush a page for dma exist at this time */
	__dma_page_cpu_to_dev(page, 0, PAGE_SIZE << pool->order,
	arm_dma_ops.sync_single_for_device(NULL,
					   pfn_to_dma(NULL, page_to_pfn(page)),
					   PAGE_SIZE << pool->order,
					   DMA_BIDIRECTIONAL);
	return page;
}
+3 −2
Original line number Diff line number Diff line
@@ -78,8 +78,9 @@ static struct page *alloc_buffer_page(struct ion_system_heap *heap,
		page = alloc_pages(gfp_flags, order);
		if (!page)
			return 0;
		__dma_page_cpu_to_dev(page, 0, PAGE_SIZE << order,
				      DMA_BIDIRECTIONAL);
		arm_dma_ops.sync_single_for_device(NULL,
			pfn_to_dma(NULL, page_to_pfn(page)),
			PAGE_SIZE << order, DMA_BIDIRECTIONAL);
	}
	if (!page)
		return 0;