From 6fcef5e7806e3dc6e81d08e39c6536eb3efe9d97 Mon Sep 17 00:00:00 2001 From: Jeremy Gebben Date: Fri, 23 Mar 2012 10:25:23 -0600 Subject: [PATCH] gpu: ion: set dma_address for contiguous heaps in ion_map_dma() Ion carveout and content protect heap buffers do not have a struct page associated with them. Thus sg_phys() will not work reliably on these buffers, so set dma_address on their scatterlists. CRs-Fixed: 345257 Change-Id: Ifdad5ce497de170f47b4ee2f7a93563a5cbe1a96 Signed-off-by: Jeremy Gebben --- drivers/gpu/ion/ion_carveout_heap.c | 9 ++++----- drivers/gpu/ion/ion_cp_heap.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/ion/ion_carveout_heap.c b/drivers/gpu/ion/ion_carveout_heap.c index 82287a9698d..3bb09bc8d19 100644 --- a/drivers/gpu/ion/ion_carveout_heap.c +++ b/drivers/gpu/ion/ion_carveout_heap.c @@ -111,10 +111,6 @@ struct sg_table *ion_carveout_heap_map_dma(struct ion_heap *heap, { struct sg_table *table; int ret; - struct page *page = phys_to_page(buffer->priv_phys); - - if (page == NULL) - return NULL; table = kzalloc(sizeof(struct sg_table), GFP_KERNEL); if (!table) @@ -123,7 +119,10 @@ struct sg_table *ion_carveout_heap_map_dma(struct ion_heap *heap, ret = sg_alloc_table(table, 1, GFP_KERNEL); if (ret) goto err0; - sg_set_page(sglist, page, buffer->size, 0); + + table->sgl->length = buffer->size; + table->sgl->offset = 0; + table->sgl->dma_address = buffer->priv_phys; return table; diff --git a/drivers/gpu/ion/ion_cp_heap.c b/drivers/gpu/ion/ion_cp_heap.c index fe489788956..a1fbdd97549 100644 --- a/drivers/gpu/ion/ion_cp_heap.c +++ b/drivers/gpu/ion/ion_cp_heap.c @@ -303,10 +303,6 @@ struct sg_table *ion_cp_heap_create_sg_table(struct ion_buffer *buffer) { struct sg_table *table; int ret; - struct page *page = phys_to_page(buffer->priv_phys); - - if (page == NULL) - return NULL; table = kzalloc(sizeof(struct sg_table), GFP_KERNEL); if (!table) @@ -315,7 +311,10 @@ struct sg_table *ion_cp_heap_create_sg_table(struct ion_buffer *buffer) ret = sg_alloc_table(table, 1, GFP_KERNEL); if (ret) goto err0; - sg_set_page(sglist, page, buffer->size, 0); + + table->sgl->length = buffer->size; + table->sgl->offset = 0; + table->sgl->dma_address = buffer->priv_phys; return table; err0: