]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/i915: Introduce i915_has_legacy_blc_interrupt()
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Fri, 27 Sep 2024 14:35:42 +0000 (17:35 +0300)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Tue, 1 Oct 2024 15:30:27 +0000 (18:30 +0300)
i915_has_asle() is a bit of a mess. It does some kind of
partial check whether the platform has the legacy BLC
interrupt or not, and then it checks whether OpRegion
ASLE is present.

Let's split the legacy BLC interrupt check into its
own thing, and while at it let's make it accurate.
Currently it misses i85x (not a problem since gen2
never has OpRegion, nor do we currently call
i915_enable_asle_pipestat() on gen2), and it
doesn't reject ILK-M (not that anyone should call
this on ILK). The exlusion of VLV/CHV (where one
might even consider calling this, being gmch
platforms) only happens due to .is_mobile==false.

List the platforms that actually do have the legacy
BLC interrupt in a bit more explicit fashion.
i915gm/i945gm/i965gm/gm45 we can cover with a
display_ver+is_mobile check, pnv needs an exception
due to having a variant with is_mobile==false, and
i85x is the only relevant gen2 platform so easier to
handle on its own.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240927143545.8665-2-ville.syrjala@linux.intel.com
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
drivers/gpu/drm/i915/display/intel_display_irq.c

index 6878dde85031ca3f14444c48dc05438745d71df4..ba82830c464edbf75999ce7b4409826b4ac68f2f 100644 (file)
@@ -272,14 +272,17 @@ void i915_disable_pipestat(struct drm_i915_private *dev_priv,
        intel_uncore_posting_read(&dev_priv->uncore, reg);
 }
 
-static bool i915_has_asle(struct drm_i915_private *i915)
+static bool i915_has_legacy_blc_interrupt(struct intel_display *display)
 {
-       struct intel_display *display = &i915->display;
+       struct drm_i915_private *i915 = to_i915(display->drm);
 
-       if (!IS_PINEVIEW(i915) && !IS_MOBILE(i915))
-               return false;
+       if (IS_I85X(i915))
+               return true;
+
+       if (IS_PINEVIEW(i915))
+               return true;
 
-       return intel_opregion_asle_present(display);
+       return IS_DISPLAY_VER(display, 3, 4) && IS_MOBILE(i915);
 }
 
 /**
@@ -288,7 +291,12 @@ static bool i915_has_asle(struct drm_i915_private *i915)
  */
 void i915_enable_asle_pipestat(struct drm_i915_private *dev_priv)
 {
-       if (!i915_has_asle(dev_priv))
+       struct intel_display *display = &dev_priv->display;
+
+       if (!intel_opregion_asle_present(display))
+               return;
+
+       if (!i915_has_legacy_blc_interrupt(display))
                return;
 
        spin_lock_irq(&dev_priv->irq_lock);