Fwd: [PATCH 4/4] vfio/pci: Allow MMIO regions to be exported through dma-buf
Jason Gunthorpe
jgg at nvidia.com
Fri Aug 26 18:10:32 UTC 2022
On Sun, Aug 21, 2022 at 04:51:34PM +0300, Oded Gabbay wrote:
> > +static void vfio_pci_dma_buf_unmap(struct dma_buf_attachment *attachment,
> > + struct sg_table *sgt,
> > + enum dma_data_direction dir)
> > +{
> > + struct vfio_pci_dma_buf *priv = attachment->dmabuf->priv;
> > +
> > + dma_unmap_resource(attachment->dev, sg_dma_address(sgt->sgl),
> > + priv->dmabuf->size, dir, DMA_ATTR_SKIP_CPU_SYNC);
> > + sg_free_table(sgt);
> Before calling sg_free_table(), you need to restore the orig_nents as
> it is used in that function to free the allocated memory of the sgt.
Oops, right, thanks good catch
Jason
More information about the dri-devel
mailing list