Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 502e8b01 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "iommu: msm: Provide the IOMMU_NOEXEC flag explicitly during mapping"

parents b4a36d0a 3f839664
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -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.
+1 −1
Original line number Diff line number Diff line
@@ -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;
+1 −1
Original line number Diff line number Diff line
@@ -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)
+6 −5
Original line number Diff line number Diff line
@@ -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);
@@ -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;
@@ -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;

@@ -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;
}
+2 −1
Original line number Diff line number Diff line
@@ -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