Loading drivers/gpu/drm/msm/msm_gem.c +30 −14 Original line number Diff line number Diff line Loading @@ -268,6 +268,35 @@ uint64_t msm_gem_mmap_offset(struct drm_gem_object *obj) return offset; } static void put_iova(struct drm_gem_object *obj) { struct drm_device *dev = obj->dev; struct msm_drm_private *priv = obj->dev->dev_private; struct msm_gem_object *msm_obj = to_msm_bo(obj); int id; WARN_ON(!mutex_is_locked(&dev->struct_mutex)); for (id = 0; id < ARRAY_SIZE(msm_obj->domain); id++) { struct msm_mmu *mmu = priv->mmus[id]; if (!mmu || !msm_obj->domain[id].iova) continue; if (obj->import_attach) { if (mmu->funcs->unmap_dma_buf) mmu->funcs->unmap_dma_buf(mmu, msm_obj->sgt, obj->import_attach->dmabuf, DMA_BIDIRECTIONAL); } else mmu->funcs->unmap_sg(mmu, msm_obj->sgt, DMA_BIDIRECTIONAL); msm_obj->domain[id].iova = 0; } } /* should be called under struct_mutex.. although it can be called * from atomic context without struct_mutex to acquire an extra * iova ref if you know one is already held. Loading Loading @@ -517,9 +546,7 @@ void msm_gem_describe_objects(struct list_head *list, struct seq_file *m) void msm_gem_free_object(struct drm_gem_object *obj) { struct drm_device *dev = obj->dev; struct msm_drm_private *priv = obj->dev->dev_private; struct msm_gem_object *msm_obj = to_msm_bo(obj); int id; WARN_ON(!mutex_is_locked(&dev->struct_mutex)); Loading @@ -528,18 +555,7 @@ void msm_gem_free_object(struct drm_gem_object *obj) list_del(&msm_obj->mm_list); for (id = 0; id < ARRAY_SIZE(msm_obj->domain); id++) { struct msm_mmu *mmu = priv->mmus[id]; if (mmu && msm_obj->domain[id].iova) { if (obj->import_attach && mmu->funcs->unmap_dma_buf) { mmu->funcs->unmap_dma_buf(mmu, msm_obj->sgt, obj->import_attach->dmabuf, DMA_BIDIRECTIONAL); } else mmu->funcs->unmap_sg(mmu, msm_obj->sgt, DMA_BIDIRECTIONAL); } } put_iova(obj); if (obj->import_attach) { if (msm_obj->vaddr) Loading drivers/gpu/drm/msm/msm_iommu.c +2 −2 Original line number Diff line number Diff line Loading @@ -44,7 +44,7 @@ static void msm_iommu_detach(struct msm_mmu *mmu, const char **names, int cnt) } static int msm_iommu_map(struct msm_mmu *mmu, uint32_t iova, struct sg_table *sgt, unsigned len, int prot) struct sg_table *sgt, int prot) { struct msm_iommu *iommu = to_msm_iommu(mmu); struct iommu_domain *domain = iommu->domain; Loading Loading @@ -83,7 +83,7 @@ fail: } static int msm_iommu_unmap(struct msm_mmu *mmu, uint32_t iova, struct sg_table *sgt, unsigned len) struct sg_table *sgt) { struct msm_iommu *iommu = to_msm_iommu(mmu); struct iommu_domain *domain = iommu->domain; Loading drivers/gpu/drm/msm/msm_mmu.h +2 −3 Original line number Diff line number Diff line Loading @@ -35,9 +35,8 @@ struct msm_mmu_funcs { int (*attach)(struct msm_mmu *mmu, const char **names, int cnt); void (*detach)(struct msm_mmu *mmu, const char **names, int cnt); int (*map)(struct msm_mmu *mmu, uint32_t iova, struct sg_table *sgt, unsigned len, int prot); int (*unmap)(struct msm_mmu *mmu, uint32_t iova, struct sg_table *sgt, unsigned len); int prot); int (*unmap)(struct msm_mmu *mmu, uint32_t iova, struct sg_table *sgt); int (*map_sg)(struct msm_mmu *mmu, struct sg_table *sgt, enum dma_data_direction dir); void (*unmap_sg)(struct msm_mmu *mmu, struct sg_table *sgt, Loading drivers/gpu/drm/msm/msm_smmu.c +2 −2 Original line number Diff line number Diff line Loading @@ -105,7 +105,7 @@ static void msm_smmu_detach(struct msm_mmu *mmu, const char **names, int cnt) } static int msm_smmu_map(struct msm_mmu *mmu, uint32_t iova, struct sg_table *sgt, unsigned len, int prot) struct sg_table *sgt, int prot) { struct msm_smmu *smmu = to_msm_smmu(mmu); struct msm_smmu_client *client = msm_smmu_to_client(smmu); Loading Loading @@ -173,7 +173,7 @@ static void msm_smmu_unmap_sg(struct msm_mmu *mmu, struct sg_table *sgt, } static int msm_smmu_unmap(struct msm_mmu *mmu, uint32_t iova, struct sg_table *sgt, unsigned len) struct sg_table *sgt) { struct msm_smmu *smmu = to_msm_smmu(mmu); struct msm_smmu_client *client = msm_smmu_to_client(smmu); Loading Loading
drivers/gpu/drm/msm/msm_gem.c +30 −14 Original line number Diff line number Diff line Loading @@ -268,6 +268,35 @@ uint64_t msm_gem_mmap_offset(struct drm_gem_object *obj) return offset; } static void put_iova(struct drm_gem_object *obj) { struct drm_device *dev = obj->dev; struct msm_drm_private *priv = obj->dev->dev_private; struct msm_gem_object *msm_obj = to_msm_bo(obj); int id; WARN_ON(!mutex_is_locked(&dev->struct_mutex)); for (id = 0; id < ARRAY_SIZE(msm_obj->domain); id++) { struct msm_mmu *mmu = priv->mmus[id]; if (!mmu || !msm_obj->domain[id].iova) continue; if (obj->import_attach) { if (mmu->funcs->unmap_dma_buf) mmu->funcs->unmap_dma_buf(mmu, msm_obj->sgt, obj->import_attach->dmabuf, DMA_BIDIRECTIONAL); } else mmu->funcs->unmap_sg(mmu, msm_obj->sgt, DMA_BIDIRECTIONAL); msm_obj->domain[id].iova = 0; } } /* should be called under struct_mutex.. although it can be called * from atomic context without struct_mutex to acquire an extra * iova ref if you know one is already held. Loading Loading @@ -517,9 +546,7 @@ void msm_gem_describe_objects(struct list_head *list, struct seq_file *m) void msm_gem_free_object(struct drm_gem_object *obj) { struct drm_device *dev = obj->dev; struct msm_drm_private *priv = obj->dev->dev_private; struct msm_gem_object *msm_obj = to_msm_bo(obj); int id; WARN_ON(!mutex_is_locked(&dev->struct_mutex)); Loading @@ -528,18 +555,7 @@ void msm_gem_free_object(struct drm_gem_object *obj) list_del(&msm_obj->mm_list); for (id = 0; id < ARRAY_SIZE(msm_obj->domain); id++) { struct msm_mmu *mmu = priv->mmus[id]; if (mmu && msm_obj->domain[id].iova) { if (obj->import_attach && mmu->funcs->unmap_dma_buf) { mmu->funcs->unmap_dma_buf(mmu, msm_obj->sgt, obj->import_attach->dmabuf, DMA_BIDIRECTIONAL); } else mmu->funcs->unmap_sg(mmu, msm_obj->sgt, DMA_BIDIRECTIONAL); } } put_iova(obj); if (obj->import_attach) { if (msm_obj->vaddr) Loading
drivers/gpu/drm/msm/msm_iommu.c +2 −2 Original line number Diff line number Diff line Loading @@ -44,7 +44,7 @@ static void msm_iommu_detach(struct msm_mmu *mmu, const char **names, int cnt) } static int msm_iommu_map(struct msm_mmu *mmu, uint32_t iova, struct sg_table *sgt, unsigned len, int prot) struct sg_table *sgt, int prot) { struct msm_iommu *iommu = to_msm_iommu(mmu); struct iommu_domain *domain = iommu->domain; Loading Loading @@ -83,7 +83,7 @@ fail: } static int msm_iommu_unmap(struct msm_mmu *mmu, uint32_t iova, struct sg_table *sgt, unsigned len) struct sg_table *sgt) { struct msm_iommu *iommu = to_msm_iommu(mmu); struct iommu_domain *domain = iommu->domain; Loading
drivers/gpu/drm/msm/msm_mmu.h +2 −3 Original line number Diff line number Diff line Loading @@ -35,9 +35,8 @@ struct msm_mmu_funcs { int (*attach)(struct msm_mmu *mmu, const char **names, int cnt); void (*detach)(struct msm_mmu *mmu, const char **names, int cnt); int (*map)(struct msm_mmu *mmu, uint32_t iova, struct sg_table *sgt, unsigned len, int prot); int (*unmap)(struct msm_mmu *mmu, uint32_t iova, struct sg_table *sgt, unsigned len); int prot); int (*unmap)(struct msm_mmu *mmu, uint32_t iova, struct sg_table *sgt); int (*map_sg)(struct msm_mmu *mmu, struct sg_table *sgt, enum dma_data_direction dir); void (*unmap_sg)(struct msm_mmu *mmu, struct sg_table *sgt, Loading
drivers/gpu/drm/msm/msm_smmu.c +2 −2 Original line number Diff line number Diff line Loading @@ -105,7 +105,7 @@ static void msm_smmu_detach(struct msm_mmu *mmu, const char **names, int cnt) } static int msm_smmu_map(struct msm_mmu *mmu, uint32_t iova, struct sg_table *sgt, unsigned len, int prot) struct sg_table *sgt, int prot) { struct msm_smmu *smmu = to_msm_smmu(mmu); struct msm_smmu_client *client = msm_smmu_to_client(smmu); Loading Loading @@ -173,7 +173,7 @@ static void msm_smmu_unmap_sg(struct msm_mmu *mmu, struct sg_table *sgt, } static int msm_smmu_unmap(struct msm_mmu *mmu, uint32_t iova, struct sg_table *sgt, unsigned len) struct sg_table *sgt) { struct msm_smmu *smmu = to_msm_smmu(mmu); struct msm_smmu_client *client = msm_smmu_to_client(smmu); Loading