summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/common/linux/dmabuf.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/nvgpu/common/linux/dmabuf.c')
-rw-r--r--drivers/gpu/nvgpu/common/linux/dmabuf.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/dmabuf.c b/drivers/gpu/nvgpu/common/linux/dmabuf.c
index 580dfcae..129739f0 100644
--- a/drivers/gpu/nvgpu/common/linux/dmabuf.c
+++ b/drivers/gpu/nvgpu/common/linux/dmabuf.c
@@ -83,7 +83,8 @@ enum nvgpu_aperture gk20a_dmabuf_aperture(struct gk20a *g,
83 } 83 }
84} 84}
85 85
86struct sg_table *gk20a_mm_pin(struct device *dev, struct dma_buf *dmabuf) 86struct sg_table *gk20a_mm_pin(struct device *dev, struct dma_buf *dmabuf,
87 struct dma_buf_attachment **attachment)
87{ 88{
88 struct gk20a_dmabuf_priv *priv; 89 struct gk20a_dmabuf_priv *priv;
89 90
@@ -111,10 +112,12 @@ struct sg_table *gk20a_mm_pin(struct device *dev, struct dma_buf *dmabuf)
111 112
112 priv->pin_count++; 113 priv->pin_count++;
113 nvgpu_mutex_release(&priv->lock); 114 nvgpu_mutex_release(&priv->lock);
115 *attachment = priv->attach;
114 return priv->sgt; 116 return priv->sgt;
115} 117}
116 118
117void gk20a_mm_unpin(struct device *dev, struct dma_buf *dmabuf, 119void gk20a_mm_unpin(struct device *dev, struct dma_buf *dmabuf,
120 struct dma_buf_attachment *attachment,
118 struct sg_table *sgt) 121 struct sg_table *sgt)
119{ 122{
120 struct gk20a_dmabuf_priv *priv = dma_buf_get_drvdata(dmabuf, dev); 123 struct gk20a_dmabuf_priv *priv = dma_buf_get_drvdata(dmabuf, dev);
@@ -125,6 +128,7 @@ void gk20a_mm_unpin(struct device *dev, struct dma_buf *dmabuf,
125 128
126 nvgpu_mutex_acquire(&priv->lock); 129 nvgpu_mutex_acquire(&priv->lock);
127 WARN_ON(priv->sgt != sgt); 130 WARN_ON(priv->sgt != sgt);
131 WARN_ON(priv->attach != attachment);
128 priv->pin_count--; 132 priv->pin_count--;
129 WARN_ON(priv->pin_count < 0); 133 WARN_ON(priv->pin_count < 0);
130 dma_addr = sg_dma_address(priv->sgt->sgl); 134 dma_addr = sg_dma_address(priv->sgt->sgl);