Lines Matching refs:sgt

53 static unsigned long vb2_dc_get_contiguous_size(struct sg_table *sgt)
56 dma_addr_t expected = sg_dma_address(sgt->sgl);
60 for_each_sgtable_dma_sg(sgt, s, i) {
126 struct sg_table *sgt = buf->dma_sgt;
140 dma_sync_sgtable_for_device(buf->dev, sgt, buf->dma_dir);
146 struct sg_table *sgt = buf->dma_sgt;
160 dma_sync_sgtable_for_cpu(buf->dev, sgt, buf->dma_dir);
313 struct sg_table sgt;
323 struct sg_table *sgt;
331 sgt = &attach->sgt;
335 ret = sg_alloc_table(sgt, buf->sgt_base->orig_nents, GFP_KERNEL);
342 wr = sgt->sgl;
343 for (i = 0; i < sgt->orig_nents; ++i) {
359 struct sg_table *sgt;
364 sgt = &attach->sgt;
374 dma_unmap_sgtable(db_attach->dev, sgt, attach->dma_dir,
376 sg_free_table(sgt);
385 struct sg_table *sgt;
387 sgt = &attach->sgt;
390 return sgt;
394 dma_unmap_sgtable(db_attach->dev, sgt, attach->dma_dir,
403 if (dma_map_sgtable(db_attach->dev, sgt, dma_dir,
411 return sgt;
415 struct sg_table *sgt, enum dma_data_direction dma_dir)
476 struct sg_table *sgt;
481 sgt = kmalloc(sizeof(*sgt), GFP_KERNEL);
482 if (!sgt) {
487 ret = dma_get_sgtable_attrs(buf->dev, sgt, buf->cookie, buf->dma_addr,
491 kfree(sgt);
495 return sgt;
534 struct sg_table *sgt = buf->dma_sgt;
538 if (sgt) {
543 dma_unmap_sgtable(buf->dev, sgt, buf->dma_dir,
546 /* sgt should exist only if vector contains pages... */
552 sg_free_table(sgt);
553 kfree(sgt);
570 struct sg_table *sgt;
625 sgt = kzalloc(sizeof(*sgt), GFP_KERNEL);
626 if (!sgt) {
632 ret = sg_alloc_table_from_pages(sgt, frame_vector_pages(vec), n_pages,
643 if (dma_map_sgtable(buf->dev, sgt, buf->dma_dir,
650 contig_size = vb2_dc_get_contiguous_size(sgt);
658 buf->dma_addr = sg_dma_address(sgt->sgl);
659 buf->dma_sgt = sgt;
668 dma_unmap_sgtable(buf->dev, sgt, buf->dma_dir, DMA_ATTR_SKIP_CPU_SYNC);
671 sg_free_table(sgt);
674 kfree(sgt);
692 struct sg_table *sgt;
706 sgt = dma_buf_map_attachment_unlocked(buf->db_attach, buf->dma_dir);
707 if (IS_ERR(sgt)) {
713 contig_size = vb2_dc_get_contiguous_size(sgt);
717 dma_buf_unmap_attachment_unlocked(buf->db_attach, sgt,
722 buf->dma_addr = sg_dma_address(sgt->sgl);
723 buf->dma_sgt = sgt;
732 struct sg_table *sgt = buf->dma_sgt;
740 if (WARN_ON(!sgt)) {
749 dma_buf_unmap_attachment_unlocked(buf->db_attach, sgt, buf->dma_dir);