[Intel-gfx] [PATCH v2 4/8] drm/i915/tc/icl: Implement TC cold sequences

Imre Deak imre.deak at intel.com
Tue Apr 7 21:52:26 UTC 2020


On Tue, Apr 07, 2020 at 11:01:14PM +0300, Souza, Jose wrote:
> [...]
> > > +	} while (ret == -EAGAIN);
> > 
> > Let's protect against an endless loop.
> 
> const ktime_t timeout = ktime_add_ms(ktime_get_raw(), 3);
> int ret;
> 
> do {
> 	ret = sandybridge_pcode_write_timeout(i915,
> 					      ICL_PCODE_EXIT_TCCOLD,
> 					      0, 250, 1);
> } while (ret == -EAGAIN && ktime_compare(timeout, ktime_get_raw()) > 0);

Why not just a simple

	trial = 0;
	while (1) {
		ret = pcode_write();
		if (ret != -EAGAIN || ++trial == 3)
			break;
		msleep(1);
	}

with the msleep(1), as if the PCODE run/busy flag didn't get cleared after
the 1ms polling, it probably doesn't make sense to retry in a tight loop.

--Imre


More information about the Intel-gfx mailing list