mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-24 02:22:34 +03:00
gpu: nvgpu: Add tracking of dma_buf_attachment
VM and CDE code assumes that dma_buf_attachment is stored as a pointer in the private dma_buf_drvdata, so it is not tracked. In Linux trees without dma_buf_*_drvdata() support this is not true, so change the code to explicitly track dma_buf_attachment. JIRA NVGPU-4 Change-Id: I692f05a19a6469195d5444a7e5ff6e92f77ae272 Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1648004 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
committed by
mobile promotions
parent
8ca1a765ee
commit
9e283f9f40
@@ -83,7 +83,8 @@ enum nvgpu_aperture gk20a_dmabuf_aperture(struct gk20a *g,
|
||||
}
|
||||
}
|
||||
|
||||
struct sg_table *gk20a_mm_pin(struct device *dev, struct dma_buf *dmabuf)
|
||||
struct sg_table *gk20a_mm_pin(struct device *dev, struct dma_buf *dmabuf,
|
||||
struct dma_buf_attachment **attachment)
|
||||
{
|
||||
struct gk20a_dmabuf_priv *priv;
|
||||
|
||||
@@ -111,10 +112,12 @@ struct sg_table *gk20a_mm_pin(struct device *dev, struct dma_buf *dmabuf)
|
||||
|
||||
priv->pin_count++;
|
||||
nvgpu_mutex_release(&priv->lock);
|
||||
*attachment = priv->attach;
|
||||
return priv->sgt;
|
||||
}
|
||||
|
||||
void gk20a_mm_unpin(struct device *dev, struct dma_buf *dmabuf,
|
||||
struct dma_buf_attachment *attachment,
|
||||
struct sg_table *sgt)
|
||||
{
|
||||
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,
|
||||
|
||||
nvgpu_mutex_acquire(&priv->lock);
|
||||
WARN_ON(priv->sgt != sgt);
|
||||
WARN_ON(priv->attach != attachment);
|
||||
priv->pin_count--;
|
||||
WARN_ON(priv->pin_count < 0);
|
||||
dma_addr = sg_dma_address(priv->sgt->sgl);
|
||||
|
||||
Reference in New Issue
Block a user