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

Commit 0ca3c71c authored by Sharat Masetty's avatar Sharat Masetty
Browse files

msm: kgsl: Print always on counters if HFI timed out



This patch adds some instrumentation to dump the always on
counters in case the polling routine timed out waiting for a response
from GMU after we send the HFI command. There are some cases
where we suspect that the polling logic may be prematurely timing
out. This patch should help throw more light into such cases.

Change-Id: I055d529cca7bb242420cfc7e37f2b4ad5ac43195
Signed-off-by: default avatarSharat Masetty <smasetty@codeaurora.org>
parent dbb7cabe
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -265,7 +265,12 @@ static int poll_adreno_gmu_reg(struct adreno_device *adreno_dev,
	unsigned int mask, unsigned int timeout_ms)
{
	unsigned int val;
	struct kgsl_device *device = KGSL_DEVICE(adreno_dev);
	struct gmu_device *gmu = KGSL_GMU_DEVICE(device);
	unsigned long timeout = jiffies + msecs_to_jiffies(timeout_ms);
	u64 ao_pre_poll, ao_post_poll;

	ao_pre_poll = gmu_core_dev_read_ao_counter(device);

	while (time_is_after_jiffies(timeout)) {
		adreno_read_gmureg(adreno_dev, offset_name, &val);
@@ -274,11 +279,16 @@ static int poll_adreno_gmu_reg(struct adreno_device *adreno_dev,
		usleep_range(10, 100);
	}

	ao_post_poll = gmu_core_dev_read_ao_counter(device);

	/* Check one last time */
	adreno_read_gmureg(adreno_dev, offset_name, &val);
	if ((val & mask) == expected_val)
		return 0;

	dev_err(&gmu->pdev->dev, "kgsl hfi poll timeout: always on: %lld ms\n",
		div_u64((ao_post_poll - ao_pre_poll) * 52, USEC_PER_SEC));

	return -ETIMEDOUT;
}