Loading Documentation/DMA-attributes.txt +10 −0 Original line number Diff line number Diff line Loading @@ -109,3 +109,13 @@ of mapping (no unaligned accesses, no re-ordering, no write merging, no buffering, no pre-fetching). This has severe performance penalties and should not be used for general purpose DMA allocations. It should only be used if one of the restrictions on strongly ordered memory is required. DMA_ATTR_NO_DELAYED_UNMAP ------------------------- DMA_ATTR_NO_DELAYED_UNMAP is used only by the msm specific lazy mapping feature. By default, the lazy mapping and unmapping holds an additional reference so that when the buffer is freed, the mapping is not destroyed and can be re-used. By specifying this attribute, an additional reference will NOT be held by the lazy mapping code and it will be released as soon as the buffer is freed. arch/arm64/mm/dma-mapping.c +1 −1 Original line number Diff line number Diff line Loading @@ -801,7 +801,7 @@ __iommu_create_mapping(struct device *dev, struct page **pages, size_t size) len = (j - i) << PAGE_SHIFT; ret = iommu_map(mapping->domain, iova, phys, len, IOMMU_READ|IOMMU_WRITE); IOMMU_READ|IOMMU_WRITE|IOMMU_NOEXEC); if (ret < 0) goto fail; iova += len; Loading drivers/gpu/msm/kgsl_iommu.c +1 −1 Original line number Diff line number Diff line Loading @@ -1299,7 +1299,7 @@ kgsl_iommu_map(struct kgsl_pagetable *pt, BUG_ON(NULL == iommu_pt); flags = IOMMU_READ | IOMMU_WRITE; flags = IOMMU_READ | IOMMU_WRITE | IOMMU_NOEXEC; /* Set up the protection for the page(s) */ if (memdesc->flags & KGSL_MEMFLAGS_GPUREADONLY) Loading drivers/iommu/msm_dma_iommu_mapping.c +6 −5 Original line number Diff line number Diff line Loading @@ -156,13 +156,14 @@ static void msm_iommu_meta_put(struct msm_iommu_meta *meta); static inline int __msm_dma_map_sg(struct device *dev, struct scatterlist *sg, int nents, enum dma_data_direction dir, struct dma_buf *dma_buf, int flags) struct dma_buf *dma_buf, struct dma_attrs *attrs) { struct msm_iommu_map *iommu_map; struct msm_iommu_meta *iommu_meta = NULL; int ret = 0; bool extra_meta_ref_taken = false; bool late_unmap = (flags & MSM_DMA_ATTR_NO_DELAYED_UNMAP) == 0; int late_unmap = !dma_get_attr(DMA_ATTR_NO_DELAYED_UNMAP, attrs); mutex_lock(&msm_iommu_map_mutex); iommu_meta = msm_iommu_meta_lookup(dma_buf->priv); Loading Loading @@ -195,7 +196,7 @@ static inline int __msm_dma_map_sg(struct device *dev, struct scatterlist *sg, goto out_unlock; } ret = dma_map_sg(dev, sg, nents, dir); ret = dma_map_sg_attrs(dev, sg, nents, dir, attrs); if (ret != nents) { kfree(iommu_map); goto out_unlock; Loading Loading @@ -243,7 +244,7 @@ out: */ int msm_dma_map_sg_attrs(struct device *dev, struct scatterlist *sg, int nents, enum dma_data_direction dir, struct dma_buf *dma_buf, int flags) struct dma_attrs *attrs) { int ret; Loading @@ -262,7 +263,7 @@ int msm_dma_map_sg_attrs(struct device *dev, struct scatterlist *sg, int nents, return -EINVAL; } ret = __msm_dma_map_sg(dev, sg, nents, dir, dma_buf, flags); ret = __msm_dma_map_sg(dev, sg, nents, dir, dma_buf, attrs); return ret; } Loading drivers/video/msm/mdss/mdss_mdp_splash_logo.c +2 −1 Original line number Diff line number Diff line Loading @@ -169,7 +169,8 @@ static int mdss_mdp_splash_iommu_attach(struct msm_fb_data_type *mfd) rc = mdss_smmu_map(MDSS_IOMMU_DOMAIN_UNSECURE, mdp5_data->splash_mem_addr, mdp5_data->splash_mem_addr, mdp5_data->splash_mem_size, IOMMU_READ); mdp5_data->splash_mem_size, IOMMU_READ | IOMMU_NOEXEC); if (rc) { pr_debug("iommu memory mapping failed rc=%d\n", rc); } else { Loading Loading
Documentation/DMA-attributes.txt +10 −0 Original line number Diff line number Diff line Loading @@ -109,3 +109,13 @@ of mapping (no unaligned accesses, no re-ordering, no write merging, no buffering, no pre-fetching). This has severe performance penalties and should not be used for general purpose DMA allocations. It should only be used if one of the restrictions on strongly ordered memory is required. DMA_ATTR_NO_DELAYED_UNMAP ------------------------- DMA_ATTR_NO_DELAYED_UNMAP is used only by the msm specific lazy mapping feature. By default, the lazy mapping and unmapping holds an additional reference so that when the buffer is freed, the mapping is not destroyed and can be re-used. By specifying this attribute, an additional reference will NOT be held by the lazy mapping code and it will be released as soon as the buffer is freed.
arch/arm64/mm/dma-mapping.c +1 −1 Original line number Diff line number Diff line Loading @@ -801,7 +801,7 @@ __iommu_create_mapping(struct device *dev, struct page **pages, size_t size) len = (j - i) << PAGE_SHIFT; ret = iommu_map(mapping->domain, iova, phys, len, IOMMU_READ|IOMMU_WRITE); IOMMU_READ|IOMMU_WRITE|IOMMU_NOEXEC); if (ret < 0) goto fail; iova += len; Loading
drivers/gpu/msm/kgsl_iommu.c +1 −1 Original line number Diff line number Diff line Loading @@ -1299,7 +1299,7 @@ kgsl_iommu_map(struct kgsl_pagetable *pt, BUG_ON(NULL == iommu_pt); flags = IOMMU_READ | IOMMU_WRITE; flags = IOMMU_READ | IOMMU_WRITE | IOMMU_NOEXEC; /* Set up the protection for the page(s) */ if (memdesc->flags & KGSL_MEMFLAGS_GPUREADONLY) Loading
drivers/iommu/msm_dma_iommu_mapping.c +6 −5 Original line number Diff line number Diff line Loading @@ -156,13 +156,14 @@ static void msm_iommu_meta_put(struct msm_iommu_meta *meta); static inline int __msm_dma_map_sg(struct device *dev, struct scatterlist *sg, int nents, enum dma_data_direction dir, struct dma_buf *dma_buf, int flags) struct dma_buf *dma_buf, struct dma_attrs *attrs) { struct msm_iommu_map *iommu_map; struct msm_iommu_meta *iommu_meta = NULL; int ret = 0; bool extra_meta_ref_taken = false; bool late_unmap = (flags & MSM_DMA_ATTR_NO_DELAYED_UNMAP) == 0; int late_unmap = !dma_get_attr(DMA_ATTR_NO_DELAYED_UNMAP, attrs); mutex_lock(&msm_iommu_map_mutex); iommu_meta = msm_iommu_meta_lookup(dma_buf->priv); Loading Loading @@ -195,7 +196,7 @@ static inline int __msm_dma_map_sg(struct device *dev, struct scatterlist *sg, goto out_unlock; } ret = dma_map_sg(dev, sg, nents, dir); ret = dma_map_sg_attrs(dev, sg, nents, dir, attrs); if (ret != nents) { kfree(iommu_map); goto out_unlock; Loading Loading @@ -243,7 +244,7 @@ out: */ int msm_dma_map_sg_attrs(struct device *dev, struct scatterlist *sg, int nents, enum dma_data_direction dir, struct dma_buf *dma_buf, int flags) struct dma_attrs *attrs) { int ret; Loading @@ -262,7 +263,7 @@ int msm_dma_map_sg_attrs(struct device *dev, struct scatterlist *sg, int nents, return -EINVAL; } ret = __msm_dma_map_sg(dev, sg, nents, dir, dma_buf, flags); ret = __msm_dma_map_sg(dev, sg, nents, dir, dma_buf, attrs); return ret; } Loading
drivers/video/msm/mdss/mdss_mdp_splash_logo.c +2 −1 Original line number Diff line number Diff line Loading @@ -169,7 +169,8 @@ static int mdss_mdp_splash_iommu_attach(struct msm_fb_data_type *mfd) rc = mdss_smmu_map(MDSS_IOMMU_DOMAIN_UNSECURE, mdp5_data->splash_mem_addr, mdp5_data->splash_mem_addr, mdp5_data->splash_mem_size, IOMMU_READ); mdp5_data->splash_mem_size, IOMMU_READ | IOMMU_NOEXEC); if (rc) { pr_debug("iommu memory mapping failed rc=%d\n", rc); } else { Loading