From c5ed5793091bd9ed349c0f514aaa6806a8bee25c Mon Sep 17 00:00:00 2001 From: Yashwanth Date: Wed, 29 Dec 2021 10:37:55 +0530 Subject: [PATCH] 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: