lkml.org 
[lkml]   [2018]   [Jun]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v3 9/9] xen/gntdev: Implement dma-buf import functionality
From
Date


On 06/12/2018 09:42 AM, Oleksandr Andrushchenko wrote:

> int gntdev_dmabuf_imp_release(struct gntdev_dmabuf_priv *priv, u32 fd)
> {
> - return -EINVAL;
> + struct gntdev_dmabuf *gntdev_dmabuf;
> + struct dma_buf_attachment *attach;
> + struct dma_buf *dma_buf;
> +
> + gntdev_dmabuf = dmabuf_imp_find_unlink(priv, fd);
> + if (IS_ERR(gntdev_dmabuf))
> + return PTR_ERR(gntdev_dmabuf);
> +
> + pr_debug("Releasing DMA buffer with fd %d\n", fd);
> +
> + attach = gntdev_dmabuf->u.imp.attach;
> +
> + if (gntdev_dmabuf->u.imp.sgt)
> + dma_buf_unmap_attachment(attach, gntdev_dmabuf->u.imp.sgt,
> + DMA_BIDIRECTIONAL);
> + dma_buf = attach->dmabuf;
> + dma_buf_detach(attach->dmabuf, attach);
> + dma_buf_put(dma_buf);
> +
> + dmabuf_imp_end_foreign_access(gntdev_dmabuf->u.imp.refs,
> + gntdev_dmabuf->nr_pages);



Should you first end foreign access, before doing anything?

-boris


> + dmabuf_imp_free_storage(gntdev_dmabuf);
> + return 0;
> }
>

\
 
 \ /
  Last update: 2018-06-13 05:15    [W:0.186 / U:0.588 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site