From 643e9c2d80d317940f9cd32cb5cce53da00d763a Mon Sep 17 00:00:00 2001 From: Veera Sundaram Sankaran Date: Wed, 18 Nov 2020 16:34:03 -0800 Subject: [PATCH] disp: msm: sde: move vm-ownership check to crtc custom events Currently all the custom event register/unregister calls are blocked based on the vm-ownership checks. Avoid this check for connector events as it has only software updates unlike the crtc events which directly touch the HW registers. This allows the connector events to be registered before the first commit where the VM ownership is obtained. Change-Id: Id78e365929cb958ead10221b9267f1c1c0406a27 Signed-off-by: Veera Sundaram Sankaran --- msm/sde/sde_kms.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/msm/sde/sde_kms.c b/msm/sde/sde_kms.c index 745001b7ef01..498349cb88c7 100644 --- a/msm/sde/sde_kms.c +++ b/msm/sde/sde_kms.c @@ -4595,18 +4595,24 @@ static int _sde_kms_register_events(struct msm_kms *kms, } sde_kms = to_sde_kms(kms); - vm_ops = sde_vm_get_ops(sde_kms); - sde_vm_lock(sde_kms); - if (vm_ops && vm_ops->vm_owns_hw && !vm_ops->vm_owns_hw(sde_kms)) { - sde_vm_unlock(sde_kms); - DRM_INFO("HW is owned by other VM\n"); - return -EACCES; - } + /* check vm ownership, if event registration requires HW access */ switch (obj->type) { case DRM_MODE_OBJECT_CRTC: + vm_ops = sde_vm_get_ops(sde_kms); + sde_vm_lock(sde_kms); + + if (vm_ops && vm_ops->vm_owns_hw + && !vm_ops->vm_owns_hw(sde_kms)) { + sde_vm_unlock(sde_kms); + SDE_DEBUG("HW is owned by other VM\n"); + return -EACCES; + } + crtc = obj_to_crtc(obj); ret = sde_crtc_register_custom_event(sde_kms, crtc, event, en); + + sde_vm_unlock(sde_kms); break; case DRM_MODE_OBJECT_CONNECTOR: conn = obj_to_connector(obj); @@ -4615,7 +4621,6 @@ static int _sde_kms_register_events(struct msm_kms *kms, break; } - sde_vm_unlock(sde_kms); return ret; }