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

Commit 623b62d9 authored by Harsh Vardhan Dwivedi's avatar Harsh Vardhan Dwivedi
Browse files

msm: kgsl: Disable coresight before snapshot if already enabled



Concurrently running coresight while dumping debug bus registers
breaks coresight. In these instances, disable coresight first,
collect snapshot and then re-enable coresight.

However, since this disabling is temporary, do not disable
through coresight_disable() call, instead disable coresight
by programming GPU coresight registers.

CRs-fixed: 656398
Change-Id: Icc3ddfe88c17777e3132a1e03994b263d0d241a4
Signed-off-by: default avatarHarsh Vardhan Dwivedi <hdwivedi@codeaurora.org>
parent 8dce4b19
Loading
Loading
Loading
Loading
+17 −4
Original line number Diff line number Diff line
@@ -155,7 +155,13 @@ static void adreno_coresight_disable(struct coresight_device *csdev)
	mutex_unlock(&device->mutex);
}

static int _adreno_coresight_get(struct adreno_device *adreno_dev)
/**
 * _adreno_coresight_get_and_clear(): Save the current value of coresight
 * registers and clear the registers subsequently. Clearing registers
 * has the effect of disabling coresight.
 * @adreno_dev: Pointer to adreno device struct
 */
static int _adreno_coresight_get_and_clear(struct adreno_device *adreno_dev)
{
	struct adreno_gpudev *gpudev = ADRENO_GPU_DEVICE(adreno_dev);
	struct kgsl_device *device = &adreno_dev->dev;
@@ -166,10 +172,17 @@ static int _adreno_coresight_get(struct adreno_device *adreno_dev)
		return -ENODEV;

	if (!kgsl_active_count_get(device)) {
		for (i = 0; i < coresight->count; i++)

		/*
		 * Save the current value of each coresight register
		 * and then clear each register
		 */
		for (i = 0; i < coresight->count; i++) {
			kgsl_regread(device, coresight->registers[i].offset,
				&coresight->registers[i].value);

			kgsl_regwrite(device, coresight->registers[i].offset,
				0);
		}
		kgsl_active_count_put(device);
	}

@@ -254,7 +267,7 @@ static int adreno_coresight_enable(struct coresight_device *csdev)
void adreno_coresight_stop(struct adreno_device *adreno_dev)
{
	if (test_bit(ADRENO_DEVICE_CORESIGHT, &adreno_dev->priv))
		_adreno_coresight_get(adreno_dev);
		_adreno_coresight_get_and_clear(adreno_dev);
}

/**
+12 −0
Original line number Diff line number Diff line
@@ -1232,7 +1232,19 @@ static int dispatcher_do_fault(struct kgsl_device *device)

	if (!test_bit(KGSL_FT_SKIP_PMDUMP, &cmdbatch->fault_policy)) {
		adreno_fault_header(device, cmdbatch);

		/*
		 * Disable coresight if it is enabled, before snapshot.
		 * We check inside adreno_coresight_stop() if coresight
		 * is currently enabled or not.
		 */
		adreno_coresight_stop(adreno_dev);

		kgsl_device_snapshot(device, cmdbatch->context);

		/* Re-enable coresight after snapshot */
		adreno_coresight_start(adreno_dev);

	}

	mutex_unlock(&device->mutex);