From c5ed5793091bd9ed349c0f514aaa6806a8bee25c Mon Sep 17 00:00:00 2001 From: Yashwanth Date: Wed, 29 Dec 2021 10:37:55 +0530 Subject: [PATCH 1/2] disp: msm: sde: update atomic check for VM_REQ_ACQUIRE state Following is the sequence during which issue is observed: 1) HAL sends a commit with VM_REQ_RELEASE property set indicating transition from primary vm to trusted vm. 2) Before the transition commit ends, there is atomic check for next commit from HAL with VM_REQ_ACQUIRE property indicating transition from trusted vm to primary vm. 3) Since the HW is currently owned by the primary vm, it performs a early return during check phase. After this, transition has occurred from primary to trusted and when the next commit is scheduled on primary, it results in crash since it is currently not the owner. This change adds necessary to check avoid commit with VM_REQ_ACQUIRE state before the transition. Change-Id: I4650305a95ef6bc495375a21a799522e67a61883 Signed-off-by: Yashwanth --- msm/sde/sde_vm_common.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/msm/sde/sde_vm_common.c b/msm/sde/sde_vm_common.c index aad4f8ba..a2c85e75 100644 --- a/msm/sde/sde_vm_common.c +++ b/msm/sde/sde_vm_common.c @@ -1,5 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-only /* + * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. * Copyright (c) 2020-2021, The Linux Foundation. All rights reserved. */ @@ -318,7 +319,7 @@ int sde_vm_request_valid(struct sde_kms *sde_kms, rc = -EINVAL; break; case VM_REQ_ACQUIRE: - if (old_state != VM_REQ_RELEASE) + if ((old_state != VM_REQ_RELEASE) || vm_owns_hw) rc = -EINVAL; break; default: From ccea75e206a730ada5838d18e95f29d53bd56434 Mon Sep 17 00:00:00 2001 From: Yashwanth Date: Wed, 9 Mar 2022 12:14:04 +0530 Subject: [PATCH 2/2] disp: msm: sde: update atomic check for VM_ACQUIRE state This change updates atomic check for VM_ACQUIRE transition only for android VM since in trusted VM, vm_owns_hw is updated asynchronously. This change fixes atomic check failures seen with commit ea9696a769d3 ("disp: msm: sde: update atomic check for VM_REQ_ACQUIRE state"). Change-Id: I951e41490c01b543b591c0bbe2700fd8eea39c78 Signed-off-by: Yashwanth --- msm/sde/sde_vm_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/msm/sde/sde_vm_common.c b/msm/sde/sde_vm_common.c index a2c85e75..c6f92c65 100644 --- a/msm/sde/sde_vm_common.c +++ b/msm/sde/sde_vm_common.c @@ -319,7 +319,7 @@ int sde_vm_request_valid(struct sde_kms *sde_kms, rc = -EINVAL; break; case VM_REQ_ACQUIRE: - if ((old_state != VM_REQ_RELEASE) || vm_owns_hw) + if ((old_state != VM_REQ_RELEASE) || (vm_owns_hw && !sde_in_trusted_vm(sde_kms))) rc = -EINVAL; break; default: