Loading msm/msm_gem.c +28 −1 Original line number Diff line number Diff line Loading @@ -422,9 +422,36 @@ int msm_gem_get_iova(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", Loading msm/msm_gem_prime.c +15 −4 Original line number Diff line number Diff line Loading @@ -133,15 +133,26 @@ struct drm_gem_object *msm_gem_prime_import(struct drm_device *dev, } if (flags & ION_FLAG_SECURE) { if (flags & ION_FLAG_CP_PIXEL) if (flags & ION_FLAG_CP_PIXEL) { attach_dev = kms->funcs->get_address_space_device(kms, MSM_SMMU_DOMAIN_SECURE); /* * While transitioning from secure use-cases, the * secure-cb might still not be attached back, while * the prime_fd_to_handle call is made for the next * frame. Attach those buffers to default drm device * and reattaching with the correct context-bank * will be handled in msm_gem_delayed_import */ if (!attach_dev) attach_dev = dev->dev; else if ((flags & ION_FLAG_CP_SEC_DISPLAY) || (flags & ION_FLAG_CP_CAMERA_PREVIEW)) } else if ((flags & ION_FLAG_CP_SEC_DISPLAY) || (flags & ION_FLAG_CP_CAMERA_PREVIEW)) { attach_dev = dev->dev; else } else { DRM_ERROR("invalid ion secure flag: 0x%lx\n", flags); } } else { attach_dev = kms->funcs->get_address_space_device(kms, MSM_SMMU_DOMAIN_UNSECURE); Loading Loading
msm/msm_gem.c +28 −1 Original line number Diff line number Diff line Loading @@ -422,9 +422,36 @@ int msm_gem_get_iova(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", Loading
msm/msm_gem_prime.c +15 −4 Original line number Diff line number Diff line Loading @@ -133,15 +133,26 @@ struct drm_gem_object *msm_gem_prime_import(struct drm_device *dev, } if (flags & ION_FLAG_SECURE) { if (flags & ION_FLAG_CP_PIXEL) if (flags & ION_FLAG_CP_PIXEL) { attach_dev = kms->funcs->get_address_space_device(kms, MSM_SMMU_DOMAIN_SECURE); /* * While transitioning from secure use-cases, the * secure-cb might still not be attached back, while * the prime_fd_to_handle call is made for the next * frame. Attach those buffers to default drm device * and reattaching with the correct context-bank * will be handled in msm_gem_delayed_import */ if (!attach_dev) attach_dev = dev->dev; else if ((flags & ION_FLAG_CP_SEC_DISPLAY) || (flags & ION_FLAG_CP_CAMERA_PREVIEW)) } else if ((flags & ION_FLAG_CP_SEC_DISPLAY) || (flags & ION_FLAG_CP_CAMERA_PREVIEW)) { attach_dev = dev->dev; else } else { DRM_ERROR("invalid ion secure flag: 0x%lx\n", flags); } } else { attach_dev = kms->funcs->get_address_space_device(kms, MSM_SMMU_DOMAIN_UNSECURE); Loading