disp: msm: use FB_NON_SEC_DIR_TRANS plane hint for TUI VM buffers

Add plane buffer flag to get the correct aspace during
TUI VM usecase. FB_NON_SEC_DIR_TRANS plane flag is set
by user-mode to indicate S2-only non-secure buffer in
TUI VM. Return the default drm device when SMMU is not
available during get_aspace_device to make the working
seamless with/without SMMU.

Change-Id: I158dc17ba51ff4b2f302d3e7017db8ab3cfe2b84
Signed-off-by: Veera Sundaram Sankaran <veeras@codeaurora.org>
This commit is contained in:
Veera Sundaram Sankaran
2020-03-04 11:56:18 -08:00
committed by Gerrit - the friendly Code Review server
parent bfec52ae7b
commit 68b75aac24
4 changed files with 33 additions and 10 deletions

View File

@@ -1259,12 +1259,6 @@ struct drm_gem_object *msm_gem_import(struct drm_device *dev,
int ret;
unsigned long flags = 0;
/* if we don't have IOMMU, don't bother pretending we can import: */
if (!iommu_present(&platform_bus_type)) {
dev_err(dev->dev, "cannot import without IOMMU\n");
return ERR_PTR(-EINVAL);
}
size = PAGE_ALIGN(dmabuf->size);
ret = msm_gem_new_impl(dev, size, MSM_BO_WC, dmabuf->resv, &obj,

View File

@@ -1726,6 +1726,8 @@ int sde_crtc_find_plane_fb_modes(struct drm_crtc *crtc,
case SDE_DRM_FB_SEC_DIR_TRANS:
(*fb_sec_dir)++;
break;
case SDE_DRM_FB_NON_SEC_DIR_TRANS:
break;
default:
SDE_ERROR("Error: Plane[%d], fb_trans_mode:%d",
DRMID(plane), mode);
@@ -1773,6 +1775,8 @@ int sde_crtc_state_find_plane_fb_modes(struct drm_crtc_state *state,
case SDE_DRM_FB_SEC_DIR_TRANS:
(*fb_sec_dir)++;
break;
case SDE_DRM_FB_NON_SEC_DIR_TRANS:
break;
default:
SDE_ERROR("Error: Plane[%d], fb_trans_mode:%d",
DRMID(plane), mode);
@@ -1927,6 +1931,10 @@ int sde_crtc_get_secure_transition_ops(struct drm_crtc *crtc,
old_valid_fb, post_commit, &ops);
break;
case SDE_DRM_FB_NON_SEC_DIR_TRANS:
ops = 0;
break;
default:
SDE_ERROR("crtc%d: invalid plane fb_mode %d\n",
DRMID(crtc), translation_mode);

View File

@@ -2147,13 +2147,33 @@ _sde_kms_get_address_space(struct msm_kms *kms,
static struct device *_sde_kms_get_address_space_device(struct msm_kms *kms,
unsigned int domain)
{
struct msm_gem_address_space *aspace =
_sde_kms_get_address_space(kms, domain);
struct sde_kms *sde_kms;
struct device *dev;
struct msm_gem_address_space *aspace;
return (aspace && aspace->domain_attached) ?
if (!kms) {
SDE_ERROR("invalid kms\n");
return NULL;
}
sde_kms = to_sde_kms(kms);
if (!sde_kms || !sde_kms->dev || !sde_kms->dev->dev) {
SDE_ERROR("invalid params\n");
return NULL;
}
/* return default device, when IOMMU is not present */
if (!iommu_present(&platform_bus_type)) {
dev = sde_kms->dev->dev;
} else {
aspace = _sde_kms_get_address_space(kms, domain);
dev = (aspace && aspace->domain_attached) ?
msm_gem_get_aspace_device(aspace) : NULL;
}
return dev;
}
static void _sde_kms_post_open(struct msm_kms *kms, struct drm_file *file)
{
struct drm_device *dev = NULL;

View File

@@ -701,6 +701,7 @@ static int _sde_plane_get_aspace(
if (!aspace)
return -EINVAL;
break;
case SDE_DRM_FB_NON_SEC_DIR_TRANS:
case SDE_DRM_FB_SEC_DIR_TRANS:
*aspace = NULL;
break;