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

Commit 27f72fc3 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: kgsl: Wait additional 50ms for CP to complete preemption"

parents 648a2efe 86c71da0
Loading
Loading
Loading
Loading
+21 −3
Original line number Diff line number Diff line
@@ -3078,20 +3078,32 @@ static void a5xx_preempt_complete_state(
	uint64_t rbbase;
	unsigned int wptr;
	unsigned int val;
	static unsigned long wait_for_preemption_complete;

	del_timer_sync(&dispatcher->preempt_timer);

	adreno_readreg(adreno_dev, ADRENO_REG_CP_PREEMPT, &val);

	if (val) {
		/*
		 * Wait for 50ms for preemption state to be updated by CP
		 * before triggering hang
		 */
		if (wait_for_preemption_complete == 0)
			wait_for_preemption_complete = jiffies +
						msecs_to_jiffies(50);
		if (time_after(jiffies, wait_for_preemption_complete)) {
			wait_for_preemption_complete = 0;
			KGSL_DRV_ERR(device,
		"Invalid state after preemption CP_PREEMPT:%08x BUSY:%1x STOP:%1x\n",
			"Invalid state after preemption CP_PREEMPT:%08x STOP:%1x BUSY:%1x\n",
					 val, (val & 0x1), (val & 0x10)>>4);
			adreno_set_gpu_fault(adreno_dev, ADRENO_PREEMPT_FAULT);
		}
		adreno_dispatcher_schedule(device);
		return;
	}

	wait_for_preemption_complete = 0;
	adreno_readreg64(adreno_dev, ADRENO_REG_CP_RB_BASE,
				ADRENO_REG_CP_RB_BASE_HI, &rbbase);
	if (rbbase != adreno_dev->next_rb->buffer_desc.gpuaddr) {
@@ -3165,6 +3177,12 @@ static void a5xx_preemption_schedule(

	mutex_lock(&device->mutex);

	/*
	 * This barrier is needed for most updated preemption_state
	 * to be read.
	 */
	smp_mb();

	if (KGSL_STATE_ACTIVE == device->state)
		FOR_EACH_RINGBUFFER(adreno_dev, rb, i)
			rb->rptr = adreno_get_rptr(rb);