Lines Matching refs:sgt
35 static dma_addr_t tegra_bo_pin(struct host1x_bo *bo, struct sg_table **sgt) in tegra_bo_pin() argument
42 static void tegra_bo_unpin(struct host1x_bo *bo, struct sg_table *sgt) in tegra_bo_unpin() argument
111 err = iommu_map_sg(tegra->domain, bo->paddr, bo->sgt->sgl, in tegra_bo_iommu_map()
112 bo->sgt->nents, prot); in tegra_bo_iommu_map()
175 sg_free_table(bo->sgt); in tegra_bo_free()
176 kfree(bo->sgt); in tegra_bo_free()
193 bo->sgt = drm_prime_pages_to_sg(bo->pages, bo->num_pages); in tegra_bo_get_pages()
194 if (IS_ERR(bo->sgt)) in tegra_bo_get_pages()
204 for_each_sg(bo->sgt->sgl, s, bo->sgt->nents, i) in tegra_bo_get_pages()
207 dma_sync_sg_for_device(drm->dev, bo->sgt->sgl, bo->sgt->nents, in tegra_bo_get_pages()
214 return PTR_ERR(bo->sgt); in tegra_bo_get_pages()
320 bo->sgt = dma_buf_map_attachment(attach, DMA_TO_DEVICE); in tegra_bo_import()
321 if (!bo->sgt) { in tegra_bo_import()
326 if (IS_ERR(bo->sgt)) { in tegra_bo_import()
327 err = PTR_ERR(bo->sgt); in tegra_bo_import()
336 if (bo->sgt->nents > 1) { in tegra_bo_import()
341 bo->paddr = sg_dma_address(bo->sgt->sgl); in tegra_bo_import()
349 if (!IS_ERR_OR_NULL(bo->sgt)) in tegra_bo_import()
350 dma_buf_unmap_attachment(attach, bo->sgt, DMA_TO_DEVICE); in tegra_bo_import()
369 dma_buf_unmap_attachment(gem->import_attach, bo->sgt, in tegra_bo_free_object()
500 struct sg_table *sgt; in tegra_gem_prime_map_dma_buf() local
502 sgt = kmalloc(sizeof(*sgt), GFP_KERNEL); in tegra_gem_prime_map_dma_buf()
503 if (!sgt) in tegra_gem_prime_map_dma_buf()
510 if (sg_alloc_table(sgt, bo->num_pages, GFP_KERNEL)) in tegra_gem_prime_map_dma_buf()
513 for_each_sg(sgt->sgl, sg, bo->num_pages, i) in tegra_gem_prime_map_dma_buf()
516 if (dma_map_sg(attach->dev, sgt->sgl, sgt->nents, dir) == 0) in tegra_gem_prime_map_dma_buf()
519 if (sg_alloc_table(sgt, 1, GFP_KERNEL)) in tegra_gem_prime_map_dma_buf()
522 sg_dma_address(sgt->sgl) = bo->paddr; in tegra_gem_prime_map_dma_buf()
523 sg_dma_len(sgt->sgl) = gem->size; in tegra_gem_prime_map_dma_buf()
526 return sgt; in tegra_gem_prime_map_dma_buf()
529 sg_free_table(sgt); in tegra_gem_prime_map_dma_buf()
530 kfree(sgt); in tegra_gem_prime_map_dma_buf()
535 struct sg_table *sgt, in tegra_gem_prime_unmap_dma_buf() argument
542 dma_unmap_sg(attach->dev, sgt->sgl, sgt->nents, dir); in tegra_gem_prime_unmap_dma_buf()
544 sg_free_table(sgt); in tegra_gem_prime_unmap_dma_buf()
545 kfree(sgt); in tegra_gem_prime_unmap_dma_buf()