diff mbox

drm/i915/pm: Warn if rpm frequencies are not set

Message ID 20180320135842.11752-1-mika.kuoppala@linux.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Mika Kuoppala March 20, 2018, 1:58 p.m. UTC
We do end up setting ring frequencies on a hardware
which is not yet there wrt runtime pm enablement.

Instead of ending up in an endless loop iterating through
frequencies if min and max frequencies are still set to zero,
warn and bail out early.

Cc: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_pm.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Chris Wilson March 20, 2018, 2:25 p.m. UTC | #1
Quoting Mika Kuoppala (2018-03-20 13:58:42)
> We do end up setting ring frequencies on a hardware
> which is not yet there wrt runtime pm enablement.
> 
> Instead of ending up in an endless loop iterating through
> frequencies if min and max frequencies are still set to zero,
> warn and bail out early.

Hmm, if you are hitting this in practice, I
would just go with

if (rps->max_freq <= rps->min_freq)
	return;

I'm sure we have warnings else where for invalid min/max freq.

Don't worry about min_ring_freq unless you have a document that says
otherwise.
-Chris
Mika Kuoppala March 20, 2018, 2:39 p.m. UTC | #2
Chris Wilson <chris@chris-wilson.co.uk> writes:

> Quoting Mika Kuoppala (2018-03-20 13:58:42)
>> We do end up setting ring frequencies on a hardware
>> which is not yet there wrt runtime pm enablement.
>> 
>> Instead of ending up in an endless loop iterating through
>> frequencies if min and max frequencies are still set to zero,
>> warn and bail out early.
>
> Hmm, if you are hitting this in practice, I
> would just go with

I did.

>
> if (rps->max_freq <= rps->min_freq)
> 	return;

Ok, this is enough to fix the loop..

>
> I'm sure we have warnings else where for invalid min/max freq.

but I didn't bump into any of these.

>
> Don't worry about min_ring_freq unless you have a document that says
> otherwise.

Yeah, different story for that one.
-Mika
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index dd5ddb77b306..61378222f4dd 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -6918,6 +6918,11 @@  static void gen6_update_ring_freq(struct drm_i915_private *dev_priv)
 	/* convert DDR frequency from units of 266.6MHz to bandwidth */
 	min_ring_freq = mult_frac(min_ring_freq, 8, 3);
 
+	if (WARN_ON(rps->min_freq == 0 ||
+		    rps->max_freq == 0 ||
+		    min_ring_freq == 0))
+		return;
+
 	min_gpu_freq = rps->min_freq;
 	max_gpu_freq = rps->max_freq;
 	if (IS_GEN9_BC(dev_priv) || IS_CANNONLAKE(dev_priv)) {