Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Ville Syrjala <ville.syrjala@linux.intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: [Intel-gfx] [PATCH 5/6] drm/i915: Reject excessive SAGV block time
Date: Tue,  8 Mar 2022 19:32:29 +0200	[thread overview]
Message-ID: <20220308173230.4182-6-ville.syrjala@linux.intel.com> (raw)
In-Reply-To: <20220308173230.4182-1-ville.syrjala@linux.intel.com>

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

If the mailbox returns an exceesively large SAGV block time let's just
reject it. This avoids having to worry about overflows when we add the
SAGV block time to the wm0 latency.

We shall put the limit arbitrarily at U16_MAX. >65msec latency
doesn't really make sense to me in any case.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_pm.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index 36f5bccabf64..166246fa27e4 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -3716,6 +3716,12 @@ static void intel_sagv_init(struct drm_i915_private *i915)
 	drm_dbg_kms(&i915->drm, "SAGV supported: %s, original SAGV block time: %u us\n",
 		    str_yes_no(intel_has_sagv(i915)), i915->sagv_block_time_us);
 
+	/* avoid overflow when adding with wm0 latency/etc. */
+	if (drm_WARN(&i915->drm, i915->sagv_block_time_us > U16_MAX,
+		     "Excessive SAGV block time %u, ignoring\n",
+		     i915->sagv_block_time_us))
+		i915->sagv_block_time_us = 0;
+
 	if (!intel_has_sagv(i915))
 		i915->sagv_block_time_us = 0;
 }
-- 
2.34.1


  parent reply	other threads:[~2022-03-08 17:41 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-08 17:32 [Intel-gfx] [PATCH 0/6] drm/i915: SAGV block time fixes Ville Syrjala
2022-03-08 17:32 ` [Intel-gfx] [PATCH 1/6] drm/i915: Remove leftover cnl SAGV block time Ville Syrjala
2022-03-09 10:24   ` Govindapillai, Vinod
2022-03-08 17:32 ` [Intel-gfx] [PATCH 2/6] drm/i915: Rework SAGV block time probing Ville Syrjala
2022-03-09 10:41   ` Govindapillai, Vinod
2022-03-09 12:59     ` Ville Syrjälä
2022-03-08 17:32 ` [Intel-gfx] [PATCH 3/6] drm/i915: Treat SAGV block time 0 as SAGV disabled Ville Syrjala
2022-03-09 11:29   ` Govindapillai, Vinod
2022-03-09 13:00     ` Ville Syrjälä
2022-03-08 17:32 ` [Intel-gfx] [PATCH 4/6] drm/i915: Probe whether SAGV works on pre-icl Ville Syrjala
2022-03-08 17:32 ` Ville Syrjala [this message]
2022-03-08 17:32 ` [Intel-gfx] [PATCH 6/6] drm/i915: Rename pre-icl SAGV enable/disable functions Ville Syrjala
2022-03-09  2:45 ` [Intel-gfx] ✓ Fi.CI.BAT: success for drm/i915: SAGV block time fixes Patchwork
2022-03-09 10:52 ` [Intel-gfx] ✓ Fi.CI.IGT: " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220308173230.4182-6-ville.syrjala@linux.intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox