Lines Matching refs:sgt
49 static unsigned long vb2_dc_get_contiguous_size(struct sg_table *sgt)
52 dma_addr_t expected = sg_dma_address(sgt->sgl);
56 for_each_sgtable_dma_sg(sgt, s, i) {
96 struct sg_table *sgt = buf->dma_sgt;
98 if (!sgt)
101 dma_sync_sgtable_for_device(buf->dev, sgt, buf->dma_dir);
107 struct sg_table *sgt = buf->dma_sgt;
109 if (!sgt)
112 dma_sync_sgtable_for_cpu(buf->dev, sgt, buf->dma_dir);
211 struct sg_table sgt;
221 struct sg_table *sgt;
229 sgt = &attach->sgt;
233 ret = sg_alloc_table(sgt, buf->sgt_base->orig_nents, GFP_KERNEL);
240 wr = sgt->sgl;
241 for (i = 0; i < sgt->orig_nents; ++i) {
257 struct sg_table *sgt;
262 sgt = &attach->sgt;
272 dma_unmap_sgtable(db_attach->dev, sgt, attach->dma_dir,
274 sg_free_table(sgt);
285 struct sg_table *sgt;
289 sgt = &attach->sgt;
293 return sgt;
298 dma_unmap_sgtable(db_attach->dev, sgt, attach->dma_dir,
307 if (dma_map_sgtable(db_attach->dev, sgt, dma_dir,
318 return sgt;
322 struct sg_table *sgt, enum dma_data_direction dma_dir)
375 struct sg_table *sgt;
377 sgt = kmalloc(sizeof(*sgt), GFP_KERNEL);
378 if (!sgt) {
383 ret = dma_get_sgtable_attrs(buf->dev, sgt, buf->cookie, buf->dma_addr,
387 kfree(sgt);
391 return sgt;
428 struct sg_table *sgt = buf->dma_sgt;
432 if (sgt) {
437 dma_unmap_sgtable(buf->dev, sgt, buf->dma_dir,
440 /* sgt should exist only if vector contains pages... */
446 sg_free_table(sgt);
447 kfree(sgt);
464 struct sg_table *sgt;
517 sgt = kzalloc(sizeof(*sgt), GFP_KERNEL);
518 if (!sgt) {
524 ret = sg_alloc_table_from_pages(sgt, frame_vector_pages(vec), n_pages,
535 if (dma_map_sgtable(buf->dev, sgt, buf->dma_dir,
542 contig_size = vb2_dc_get_contiguous_size(sgt);
550 buf->dma_addr = sg_dma_address(sgt->sgl);
551 buf->dma_sgt = sgt;
558 dma_unmap_sgtable(buf->dev, sgt, buf->dma_dir, DMA_ATTR_SKIP_CPU_SYNC);
561 sg_free_table(sgt);
564 kfree(sgt);
582 struct sg_table *sgt;
596 sgt = dma_buf_map_attachment(buf->db_attach, buf->dma_dir);
597 if (IS_ERR(sgt)) {
603 contig_size = vb2_dc_get_contiguous_size(sgt);
607 dma_buf_unmap_attachment(buf->db_attach, sgt, buf->dma_dir);
611 buf->dma_addr = sg_dma_address(sgt->sgl);
612 buf->dma_sgt = sgt;
621 struct sg_table *sgt = buf->dma_sgt;
628 if (WARN_ON(!sgt)) {
637 dma_buf_unmap_attachment(buf->db_attach, sgt, buf->dma_dir);