From 6b8c6087fe57bc4f93d95a792c4a6b81c6c06ede Mon Sep 17 00:00:00 2001 From: Himateja Reddy Date: Mon, 23 Jan 2023 12:56:14 -0800 Subject: [PATCH] msm: adsprpc: Add IOMMU_CACHE flag for iommy_map_sg Currently memory shared to QRTR is not mapped with IOMMU_CACHE flag. When using iommu_map_sg, IOMMU_CACHE flag makes the memory coherent. Add IOMMU_CACHE flag to iommu_mag_sg to make memory shared to QRTR coherent on APPS. Also remove DMA_ATTR_NO_KERNEL_MAPPING attribute while allocating memory as it doesn't have significance when the memory is coherent. Signed-off-by: Himateja Reddy --- dsp/adsprpc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dsp/adsprpc.c b/dsp/adsprpc.c index f7550e88a4..c10844841b 100644 --- a/dsp/adsprpc.c +++ b/dsp/adsprpc.c @@ -7440,7 +7440,7 @@ static int fastrpc_cb_probe(struct device *dev) buf->virt = NULL; buf->phys = 0; buf->size = frpc_gen_addr_pool[1]; - buf->dma_attr = DMA_ATTR_DELAYED_UNMAP | DMA_ATTR_NO_KERNEL_MAPPING; + buf->dma_attr = DMA_ATTR_DELAYED_UNMAP; /* Allocate memory for adding to genpool */ buf->virt = dma_alloc_attrs(sess->smmu.dev, buf->size, (dma_addr_t *)&buf->phys, @@ -7465,7 +7465,7 @@ static int fastrpc_cb_probe(struct device *dev) } /* Map the allocated memory with fixed IOVA and is shared to remote subsystem */ err = iommu_map_sg(domain, frpc_gen_addr_pool[0], sgt.sgl, - sgt.nents, IOMMU_READ | IOMMU_WRITE); + sgt.nents, IOMMU_READ | IOMMU_WRITE | IOMMU_CACHE); if (err < 0) { ADSPRPC_ERR("iommu_map_sg failed with err %d", err); goto iommu_map_bail;