Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6b550ff5 authored by Akhil P Oommen's avatar Akhil P Oommen
Browse files

msm: kgsl: Fix gdsc disable timeout during reset



Smmu driver takes a vote on CX gdsc before calling the kgsl pagefault
handler. If there is contention for device mutex in this path and the
dispatcher fault handler is holding this lock, trying to turn off CX
gdsc will fail during the reset. So to avoid blocking here, try to lock
device mutex and return if it fails.

Since we are modifying here, keep the pagefault header for UCHE block
short.

Change-Id: Idf1726960071d66b9112f6b4abdf19a49afacefd
Signed-off-by: default avatarAkhil P Oommen <akhilpo@codeaurora.org>
parent 73309377
Loading
Loading
Loading
Loading
+12 −4
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
 * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
 */

#include <linux/firmware.h>
@@ -1313,11 +1313,19 @@ static const char *a6xx_fault_block_uche(struct kgsl_device *device,
	unsigned int uche_client_id = 0;
	static char str[40];

	mutex_lock(&device->mutex);
	/*
	 * Smmu driver takes a vote on CX gdsc before calling the kgsl pagefault
	 * handler. If there is contention for device mutex in this path and the
	 * dispatcher fault handler is holding this lock, trying to turn off CX
	 * gdsc will fail during the reset. So to avoid blocking here, try to
	 * lock device mutex and return if it fails.
	 */
	if (!mutex_trylock(&device->mutex))
		return "UCHE";

	if (!kgsl_state_is_awake(device)) {
		mutex_unlock(&device->mutex);
		return "UCHE: unknown";
		return "UCHE";
	}

	kgsl_regread(device, A6XX_UCHE_CLIENT_PF, &uche_client_id);
@@ -1325,7 +1333,7 @@ static const char *a6xx_fault_block_uche(struct kgsl_device *device,

	/* Ignore the value if the gpu is in IFPC */
	if (uche_client_id == SCOOBYDOO)
		return "UCHE: unknown";
		return "UCHE";

	uche_client_id &= A6XX_UCHE_CLIENT_PF_CLIENT_ID_MASK;
	snprintf(str, sizeof(str), "UCHE: %s",