Skip to contentSkip to conversation

drm/i915: Update only cur_freq without setting RPNSWREQ when device is suspended

PATCH Superseded Sagar Arun Kamble 2 participants 4 messages Sep 27, 2016 – Sep 28, 2016

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 drm/i915: Update only cur_freq without setting RPNSWREQ when device is suspended

If min/max frequency is updated from debugfs/sysfs and device is suspended, just update the driver tracking state cur_freq and it will come into effect when HW becomes busy next.

---
 drivers/gpu/drm/i915/intel_pm.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/gpu/drm/i915/intel_pm.c +7 -0
index 5d39ad2..57ded11 100644
@@ -5064,6 +5064,13 @@ void gen6_rps_boost(struct drm_i915_private *dev_priv,
 
 void intel_set_rps(struct drm_i915_private *dev_priv, u8 val)
 {
+	lockdep_assert_held(&dev_priv->rps.hw_lock);
+
+	if (!dev_priv->gt.awake) {
+		dev_priv->rps.cur_freq = val;
+		return;
+	}
+
 	if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv))
 		valleyview_set_rps(dev_priv, val);
 	else
Signature · 6 lines
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

PATCH 2/2 drm/i915: Handle GEN6_PMINTRMSK for proper masking of RPS interrupts with GuC submission

Driver needs to ensure that it doesn't mask the PM interrupts, which are unmasked/needed by GuC firmware. For that, Driver maintains a bitmask of interrupts to be kept enabled, pm_intr_keep.

By default, RP Up/Down Threshold Interrupt bits (and others) in GEN6_PMINTRMSK register were unmasked (by BIOS) before GuC Load. Hence Driver was keeping them unmasked always assuming GuC needed them. As an optimization, Driver needs to mask these bits in order to avoid redundant UP threshold interrupts when frequency is set to maximum, RP0 or Down threshold interrupts when frequency is set to minimum, RPn.

This patch will mask all bits in GEN6_PMINTRMSK before GuC is loaded to ensure pm_intr_keep reflects only interrupts that are needed by GuC. Post GuC load, writing cur_freq will restore bits other than pm_intr_keep.

Cc Chris Wilson <[email protected]>
Cc Szwichtenberg, Radoslaw <[email protected]>
---
 drivers/gpu/drm/i915/i915_gem.c  | 13 +++++++++++++
 drivers/gpu/drm/i915/intel_drv.h |  1 +
 drivers/gpu/drm/i915/intel_pm.c  |  2 +-
 3 files changed, 15 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_gem.c +13 -0
index 1418c1c..cafb4d0 100644
@@ -4399,12 +4399,25 @@ i915_gem_init_hw(struct drm_device *dev)
 
 	intel_mocs_init_l3cc_table(dev);
 
+	/*
+	 * Mask all interrupts to know which interrupts are needed by GuC.
+	 * Restore host side interrupt masks post load.
+	*/
+	I915_WRITE(GEN6_PMINTRMSK, gen6_sanitize_rps_pm_mask(dev_priv, ~0u));
+
 	/* We can't enable contexts until all firmware is loaded */
 	ret = intel_guc_setup(dev);
 	if (ret)
 		goto out;
 
 out:
+	/*
+	 * Below write will ensure mask for RPS interrupts is restored back
+	 * w.r.t cur_freq, particularly post reset.
+	 */
+	I915_WRITE(GEN6_PMINTRMSK,
+		   gen6_rps_pm_mask(dev_priv, dev_priv->rps.cur_freq));
+
 	intel_uncore_forcewake_put(dev_priv, FORCEWAKE_ALL);
 	return ret;
 }
drivers/gpu/drm/i915/intel_drv.h +1 -0
index 4bfb01c..431c17d 100644
@@ -1734,6 +1734,7 @@ void intel_enable_gt_powersave(struct drm_i915_private *dev_priv);
 void intel_autoenable_gt_powersave(struct drm_i915_private *dev_priv);
 void intel_disable_gt_powersave(struct drm_i915_private *dev_priv);
 void intel_suspend_gt_powersave(struct drm_i915_private *dev_priv);
+u32 gen6_rps_pm_mask(struct drm_i915_private *dev_priv, u8 val);
 void gen6_rps_busy(struct drm_i915_private *dev_priv);
 void gen6_rps_reset_ei(struct drm_i915_private *dev_priv);
 void gen6_rps_idle(struct drm_i915_private *dev_priv);
drivers/gpu/drm/i915/intel_pm.c +1 -1
index 57ded11..7c88acfa 100644
@@ -4878,7 +4878,7 @@ static void gen6_set_rps_thresholds(struct drm_i915_private *dev_priv, u8 val)
 	dev_priv->rps.last_adj = 0;
 }
 
-static u32 gen6_rps_pm_mask(struct drm_i915_private *dev_priv, u8 val)
+u32 gen6_rps_pm_mask(struct drm_i915_private *dev_priv, u8 val)
 {
 	u32 mask = 0;
 
Signature · 6 lines
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#2 lore raw

PATCH v2 1/1 drm/i915: Handle GEN6_PMINTRMSK for proper masking of RPS interrupts with GuC submission

Driver needs to ensure that it doesn't mask the PM interrupts, which are unmasked/needed by GuC firmware. For that, Driver maintains a bitmask of interrupts to be kept enabled, pm_intr_keep.

By default, RP Up/Down Threshold Interrupt bits (and others) in GEN6_PMINTRMSK register were unmasked (by BIOS) before GuC Load. Hence Driver was keeping them unmasked always assuming GuC needed them. As an optimization, Driver needs to mask these bits in order to avoid redundant UP threshold interrupts when frequency is set to maximum, RP0 or Down threshold interrupts when frequency is set to minimum, RPn.

This patch will mask all bits in GEN6_PMINTRMSK before GuC is loaded to ensure pm_intr_keep reflects only interrupts that are needed by GuC. Post GuC load, writing cur_freq will restore bits other than pm_intr_keep.

v2: No functional change. Moving the sanitization of PMINTRMSK inside
intel_guc_setup. Should take care of scenarios where standalone guc setup is done like deferred load in Android. (Sagar)

Cc Chris Wilson <[email protected]>
Cc Szwichtenberg, Radoslaw <[email protected]>
---
 drivers/gpu/drm/i915/intel_drv.h        |  1 +
 drivers/gpu/drm/i915/intel_guc_loader.c | 13 +++++++++++++
 drivers/gpu/drm/i915/intel_pm.c         |  2 +-
 3 files changed, 15 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_drv.h +1 -0
index 4bfb01c..431c17d 100644
@@ -1734,6 +1734,7 @@ void intel_enable_gt_powersave(struct drm_i915_private *dev_priv);
 void intel_autoenable_gt_powersave(struct drm_i915_private *dev_priv);
 void intel_disable_gt_powersave(struct drm_i915_private *dev_priv);
 void intel_suspend_gt_powersave(struct drm_i915_private *dev_priv);
+u32 gen6_rps_pm_mask(struct drm_i915_private *dev_priv, u8 val);
 void gen6_rps_busy(struct drm_i915_private *dev_priv);
 void gen6_rps_reset_ei(struct drm_i915_private *dev_priv);
 void gen6_rps_idle(struct drm_i915_private *dev_priv);
drivers/gpu/drm/i915/intel_guc_loader.c +13 -0
index 7ace96b..061d917 100644
@@ -483,6 +483,12 @@ int intel_guc_setup(struct drm_device *dev)
 
 	guc_interrupts_release(dev_priv);
 
+	/*
+	 * Mask all interrupts to know which interrupts are needed by GuC.
+	 * Restore host side interrupt masks post load.
+	*/
+	I915_WRITE(GEN6_PMINTRMSK, gen6_sanitize_rps_pm_mask(dev_priv, ~0u));
+
 	guc_fw->guc_fw_load_status = GUC_FIRMWARE_PENDING;
 
 	DRM_DEBUG_DRIVER("GuC fw status: fetch %s, load %s\n",
@@ -532,6 +538,13 @@ int intel_guc_setup(struct drm_device *dev)
 		guc_interrupts_capture(dev_priv);
 	}
 
+	/*
+	 * Below write will ensure mask for RPS interrupts is restored back
+	 * w.r.t cur_freq, particularly post reset.
+	 */
+	I915_WRITE(GEN6_PMINTRMSK,
+		   gen6_rps_pm_mask(dev_priv, dev_priv->rps.cur_freq));
+
 	return 0;
 
 fail:
drivers/gpu/drm/i915/intel_pm.c +1 -1
index 57ded11..7c88acfa 100644
@@ -4878,7 +4878,7 @@ static void gen6_set_rps_thresholds(struct drm_i915_private *dev_priv, u8 val)
 	dev_priv->rps.last_adj = 0;
 }
 
-static u32 gen6_rps_pm_mask(struct drm_i915_private *dev_priv, u8 val)
+u32 gen6_rps_pm_mask(struct drm_i915_private *dev_priv, u8 val)
 {
 	u32 mask = 0;
 
Signature · 6 lines
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#3 lore raw

✓ Fi.CI.BAT: success for series starting with [1/2] drm/i915: Update only cur_freq without setting RPNSWREQ when device is suspended

In reply to Sagar Arun Kamble
== Series Details ==

== Series Details ==

Series: series starting with [1/2] drm/i915: Update only cur_freq without setting RPNSWREQ when device is suspended
URL : https://patchwork.freedesktop.org/series/12986/
State : success

== Summary ==

Series 12986v1 Series without cover letter
https://patchwork.freedesktop.org/api/1.0/series/12986/revisions/1/mbox/

Test gem_exec_gttfill:

        Subgroup basic:
                skip       -> PASS       (fi-snb-2600)
Test kms_pipe_crc_basic:
        Subgroup suspend-read-crc-pipe-a:
                dmesg-warn -> PASS       (fi-byt-j1900)
        Subgroup suspend-read-crc-pipe-b:
                dmesg-warn -> PASS       (fi-byt-j1900)
Test kms_psr_sink_crc:
        Subgroup psr_basic:
                dmesg-warn -> PASS       (fi-skl-6700hq)
fi-bdw-5557u     total:244  pass:229  dwarn:0   dfail:0   fail:0   skip:15 
fi-bsw-n3050     total:244  pass:202  dwarn:0   dfail:0   fail:0   skip:42 
fi-byt-j1900     total:244  pass:212  dwarn:0   dfail:0   fail:1   skip:31 
fi-byt-n2820     total:244  pass:208  dwarn:0   dfail:0   fail:1   skip:35 
fi-hsw-4770      total:244  pass:222  dwarn:0   dfail:0   fail:0   skip:22 
fi-hsw-4770r     total:244  pass:222  dwarn:0   dfail:0   fail:0   skip:22 
fi-ilk-650       total:244  pass:182  dwarn:0   dfail:0   fail:2   skip:60 
fi-ivb-3520m     total:244  pass:219  dwarn:0   dfail:0   fail:0   skip:25 
fi-ivb-3770      total:244  pass:207  dwarn:0   dfail:0   fail:0   skip:37 
fi-skl-6260u     total:244  pass:230  dwarn:0   dfail:0   fail:0   skip:14 
fi-skl-6700hq    total:244  pass:222  dwarn:0   dfail:0   fail:0   skip:22 
fi-skl-6700k     total:244  pass:219  dwarn:1   dfail:0   fail:0   skip:24 
fi-skl-6770hq    total:244  pass:228  dwarn:1   dfail:0   fail:1   skip:14 
fi-snb-2520m     total:244  pass:208  dwarn:0   dfail:0   fail:0   skip:36 
fi-snb-2600      total:244  pass:207  dwarn:0   dfail:0   fail:0   skip:37 

Results at /archive/results/CI_IGT_test/Patchwork_2582/

15462029fe48ae56e7fb17d1fe4c8b70c1d3762f drm-intel-nightly: 2016y-09m-27d-16h-32m-56s UTC integration manifest f85aec2 drm/i915: Handle GEN6_PMINTRMSK for proper masking of RPS interrupts with GuC submission 04d2e70 drm/i915: Update only cur_freq without setting RPNSWREQ when device is suspended

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx