From babaee2f7f22bf67d5c66a168e9153f05be63369 Mon Sep 17 00:00:00 2001 From: Jayaprakash Date: Fri, 23 Oct 2020 13:08:10 +0530 Subject: [PATCH] disp: msm: re-apply dma_map_attr during secure-UI to secure-vid transition Add changes to re-apply the dma_map attributes during secure UI to secure-video transition to avoid mismatch of attributes between the import_attach newly created and the msm_iommu mappings already existed. Change-Id: I5a902d6d88c6ea9f633b4396e8121c2b14708f31 Signed-off-by: Jayaprakash --- msm/msm_gem.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/msm/msm_gem.c b/msm/msm_gem.c index c6e3c920de0b..9ccff79644fb 100644 --- a/msm/msm_gem.c +++ b/msm/msm_gem.c @@ -431,12 +431,14 @@ static int msm_gem_get_iova_locked(struct drm_gem_object *obj, struct device *dev; struct dma_buf *dmabuf; bool reattach = false; + unsigned long dma_map_attrs; dev = msm_gem_get_aspace_device(aspace); if ((dev && obj->import_attach) && ((dev != obj->import_attach->dev) || msm_obj->obj_dirty)) { dmabuf = obj->import_attach->dmabuf; + dma_map_attrs = obj->import_attach->dma_map_attrs; DRM_DEBUG("detach nsec-dev:%pK attach sec-dev:%pK\n", obj->import_attach->dev, dev); @@ -455,6 +457,12 @@ static int msm_gem_get_iova_locked(struct drm_gem_object *obj, ret = PTR_ERR(obj->import_attach); return ret; } + /* + * obj->import_attach is created as part of dma_buf_attach. + * Re-apply the dma_map_attr in this case to be in sync + * with iommu_map attrs during map_attachment callback. + */ + obj->import_attach->dma_map_attrs |= dma_map_attrs; msm_obj->obj_dirty = false; reattach = true; }