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

Commit 06670404 authored by Akhil P Oommen's avatar Akhil P Oommen Committed by Gerrit - the friendly Code Review server
Browse files

msm: kgsl: Reset ringbuffer pointers if CP INIT fails



This helps to avoid a corner case where preemption path sees the mismatch
in rptr and wptr, and misinterprets it as if a real cmdbatch was submitted,
and tries to trigger preemption on a power collapsed device, which then
leads to NoC errors.

Change-Id: I98fd98fb0b2b01fc7fd997d2dbe44ea5109d4bea
Signed-off-by: default avatarAkhil P Oommen <akhilpo@codeaurora.org>
parent 66651493
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -1155,6 +1155,7 @@ static void _set_ordinals(struct adreno_device *adreno_dev,
static int a6xx_send_cp_init(struct adreno_device *adreno_dev,
			 struct adreno_ringbuffer *rb)
{
	struct kgsl_device *device = KGSL_DEVICE(adreno_dev);
	unsigned int *cmds;
	int ret;

@@ -1167,10 +1168,17 @@ static int a6xx_send_cp_init(struct adreno_device *adreno_dev,
	_set_ordinals(adreno_dev, cmds, 11);

	ret = adreno_ringbuffer_submit_spin(rb, NULL, 2000);
	if (ret)
	if (ret) {
		adreno_spin_idle_debug(adreno_dev,
				"CP initialization failed to idle\n");

		if (!adreno_is_a3xx(adreno_dev))
			kgsl_sharedmem_writel(device, &device->scratch,
					SCRATCH_RPTR_OFFSET(rb->id), 0);
		rb->wptr = 0;
		rb->_wptr = 0;
	}

	return ret;
}