浏览代码

Merge "disp: msm: remap dmabuf attach during secure transitions"

qctecmdr 5 年之前
父节点
当前提交
7e1ca767cf
共有 2 个文件被更改,包括 11 次插入2 次删除
  1. 6 2
      msm/msm_gem.c
  2. 5 0
      msm/msm_gem.h

+ 6 - 2
msm/msm_gem.c

@@ -421,8 +421,9 @@ static int msm_gem_get_iova_locked(struct drm_gem_object *obj,
 		bool reattach = false;
 
 		dev = msm_gem_get_aspace_device(aspace);
-		if (dev && obj->import_attach &&
-				(dev != obj->import_attach->dev)) {
+		if ((dev && obj->import_attach) &&
+				((dev != obj->import_attach->dev) ||
+				msm_obj->obj_dirty)) {
 			dmabuf = obj->import_attach->dmabuf;
 
 			DRM_DEBUG("detach nsec-dev:%pK attach sec-dev:%pK\n",
@@ -440,6 +441,7 @@ static int msm_gem_get_iova_locked(struct drm_gem_object *obj,
 						PTR_ERR(obj->import_attach));
 				goto unlock;
 			}
+			msm_obj->obj_dirty = false;
 			reattach = true;
 		}
 
@@ -631,6 +633,7 @@ void msm_gem_aspace_domain_attach_detach_update(
 			if (obj->import_attach) {
 				mutex_lock(&msm_obj->lock);
 				put_iova(obj);
+				msm_obj->obj_dirty = true;
 				mutex_unlock(&msm_obj->lock);
 			}
 		}
@@ -1091,6 +1094,7 @@ static int msm_gem_new_impl(struct drm_device *dev,
 	INIT_LIST_HEAD(&msm_obj->iova_list);
 	msm_obj->aspace = NULL;
 	msm_obj->in_active_list = false;
+	msm_obj->obj_dirty = false;
 
 	if (struct_mutex_locked) {
 		WARN_ON(!mutex_is_locked(&dev->struct_mutex));

+ 5 - 0
msm/msm_gem.h

@@ -139,6 +139,11 @@ struct msm_gem_object {
 	struct msm_gem_address_space *aspace;
 	bool in_active_list;
 	char name[32]; /* Identifier to print for the debugfs files */
+
+	/* Indicates whether object  needs to request for
+	 * new pagetables due to cb switch
+	 */
+	bool obj_dirty;
 };
 #define to_msm_bo(x) container_of(x, struct msm_gem_object, base)