disp: msm: perform delayed buf attach during secure transitions

While transitioning from secure usecases, the secure
context bank is attached back only during the commit
phase. This leads to invalid secure context-bank device
issue, when the prime_to_fd call is made for the next
frame. Avoid it, by attaching to default drm device
during the prime_to_fd call and reattach it to the
secure context-bank device at the delayed import time.

Change-Id: I43e6da7f117f20746943a48b5f2657e9ae2947ea
Signed-off-by: Veera Sundaram Sankaran <veeras@codeaurora.org>
Cette révision appartient à :
Veera Sundaram Sankaran
2019-12-13 12:03:29 -08:00
révisé par Gerrit - the friendly Code Review server
Parent e7f3931297
révision a9574eb8c2
2 fichiers modifiés avec 45 ajouts et 7 suppressions

Voir le fichier

@@ -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>
*
@@ -416,9 +416,36 @@ static int msm_gem_get_iova_locked(struct drm_gem_object *obj,
if (!vma) {
struct page **pages;
struct device *dev;
struct dma_buf *dmabuf;
bool reattach = false;
dev = msm_gem_get_aspace_device(aspace);
if (dev && obj->import_attach &&
(dev != obj->import_attach->dev)) {
dmabuf = obj->import_attach->dmabuf;
DRM_DEBUG("detach nsec-dev:%pK attach sec-dev:%pK\n",
obj->import_attach->dev, dev);
SDE_EVT32(obj->import_attach->dev, dev, msm_obj->sgt);
if (msm_obj->sgt)
dma_buf_unmap_attachment(obj->import_attach,
msm_obj->sgt, DMA_BIDIRECTIONAL);
dma_buf_detach(dmabuf, obj->import_attach);
obj->import_attach = dma_buf_attach(dmabuf, dev);
if (IS_ERR(obj->import_attach)) {
DRM_ERROR("dma_buf_attach failure, err=%ld\n",
PTR_ERR(obj->import_attach));
goto unlock;
}
reattach = true;
}
/* perform delayed import for buffers without existing sgt */
if (((msm_obj->flags & MSM_BO_EXTBUF) && !(msm_obj->sgt))) {
if (((msm_obj->flags & MSM_BO_EXTBUF) && !(msm_obj->sgt))
|| reattach) {
ret = msm_gem_delayed_import(obj);
if (ret) {
DRM_ERROR("delayed dma-buf import failed %d\n",