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 <jgebben@codeaurora.org>
This commit is contained in:
committed by
Stephen Boyd
parent
2c60140ed2
commit
6fcef5e780
@@ -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;
|
||||
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user