summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYashwanth <yvulapu@codeaurora.org>2020-02-13 19:06:05 +0530
committerYashwanth <yvulapu@codeaurora.org>2020-02-17 15:56:58 +0530
commita1450df4414f01583e50a6b8471a04b6d47c5dd2 (patch)
tree40ea0a0307b8f1660be10fc26eeaa1e531f8a0ee
parent2ce4335f1ba4c150846815a40b5a6e211cc7744b (diff)
downloaddisplay-drivers-a1450df4414f01583e50a6b8471a04b6d47c5dd2.tar.gz
disp: msm: remap dmabuf attach during secure transitions
During secure cb detach, gem objects stored in the aspace active list are not cleaned up properly leading to crash when secure cb attaches again. This change remaps dma buffer for those gem objects. Change-Id: I7626e87ab60a61261c802a7e7763982546c4c2e7 Signed-off-by: Yashwanth <yvulapu@codeaurora.org>
-rw-r--r--msm/msm_gem.c10
-rw-r--r--msm/msm_gem.h5
2 files changed, 12 insertions, 3 deletions
diff --git a/msm/msm_gem.c b/msm/msm_gem.c
index fd5f29ec..944cb4e8 100644
--- a/msm/msm_gem.c
+++ b/msm/msm_gem.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018-2019, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2018-2020, The Linux Foundation. All rights reserved.
* Copyright (C) 2013 Red Hat
* Author: Rob Clark <robdclark@gmail.com>
*
@@ -427,8 +427,9 @@ int msm_gem_get_iova(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",
@@ -446,6 +447,7 @@ int msm_gem_get_iova(struct drm_gem_object *obj,
PTR_ERR(obj->import_attach));
goto unlock;
}
+ msm_obj->obj_dirty = false;
reattach = true;
}
@@ -558,6 +560,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);
}
}
@@ -1005,6 +1008,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));
diff --git a/msm/msm_gem.h b/msm/msm_gem.h
index 49a44124..9b9290e0 100644
--- a/msm/msm_gem.h
+++ b/msm/msm_gem.h
@@ -136,6 +136,11 @@ struct msm_gem_object {
struct msm_gem_address_space *aspace;
bool in_active_list;
+
+ /* 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)