summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/common/linux/dma.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/nvgpu/common/linux/dma.c')
-rw-r--r--drivers/gpu/nvgpu/common/linux/dma.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/dma.c b/drivers/gpu/nvgpu/common/linux/dma.c
index abcf36f1..eb2d0ac4 100644
--- a/drivers/gpu/nvgpu/common/linux/dma.c
+++ b/drivers/gpu/nvgpu/common/linux/dma.c
@@ -335,6 +335,7 @@ static void nvgpu_dma_free_sys(struct gk20a *g, struct nvgpu_mem *mem)
335 struct device *d = dev_from_gk20a(g); 335 struct device *d = dev_from_gk20a(g);
336 336
337 if (!(mem->mem_flags & NVGPU_MEM_FLAG_SHADOW_COPY) && 337 if (!(mem->mem_flags & NVGPU_MEM_FLAG_SHADOW_COPY) &&
338 !(mem->mem_flags & __NVGPU_MEM_FLAG_NO_DMA) &&
338 (mem->cpu_va || mem->priv.pages)) { 339 (mem->cpu_va || mem->priv.pages)) {
339 if (mem->priv.flags) { 340 if (mem->priv.flags) {
340 DEFINE_DMA_ATTRS(dma_attrs); 341 DEFINE_DMA_ATTRS(dma_attrs);
@@ -358,6 +359,13 @@ static void nvgpu_dma_free_sys(struct gk20a *g, struct nvgpu_mem *mem)
358 mem->priv.pages = NULL; 359 mem->priv.pages = NULL;
359 } 360 }
360 361
362 /*
363 * When this flag is set we expect that pages is still populated but not
364 * by the DMA API.
365 */
366 if (mem->mem_flags & __NVGPU_MEM_FLAG_NO_DMA)
367 nvgpu_kfree(g, mem->priv.pages);
368
361 if (mem->priv.sgt) 369 if (mem->priv.sgt)
362 nvgpu_free_sgtable(g, &mem->priv.sgt); 370 nvgpu_free_sgtable(g, &mem->priv.sgt);
363 371