[PATCH 2/3] force-awake

Chris Wilson chris at chris-wilson.co.uk
Tue Jan 9 14:32:33 UTC 2018


---
 drivers/gpu/drm/i915/i915_drv.c       | 6 ++++++
 drivers/gpu/drm/i915/i915_drv.h       | 1 +
 drivers/gpu/drm/i915/intel_sideband.c | 8 ++++++++
 3 files changed, 15 insertions(+)

diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 6c8da9d20c33..d4b90cc0130b 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -902,6 +902,9 @@ static int i915_driver_init_early(struct drm_i915_private *dev_priv,
 	spin_lock_init(&dev_priv->uncore.lock);
 
 	mutex_init(&dev_priv->sb_lock);
+	pm_qos_add_request(&dev_priv->sb_qos,
+			   PM_QOS_CPU_DMA_LATENCY, PM_QOS_DEFAULT_VALUE);
+
 	mutex_init(&dev_priv->modeset_restore_lock);
 	mutex_init(&dev_priv->av_mutex);
 	mutex_init(&dev_priv->wm.wm_mutex);
@@ -953,6 +956,9 @@ static void i915_driver_cleanup_early(struct drm_i915_private *dev_priv)
 	intel_irq_fini(dev_priv);
 	i915_workqueues_cleanup(dev_priv);
 	i915_engines_cleanup(dev_priv);
+
+	pm_qos_remove_request(&dev_priv->sb_qos);
+	mutex_destroy(&dev_priv->sb_lock);
 }
 
 static int i915_mmio_setup(struct drm_i915_private *dev_priv)
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index a689396d0ff6..ff3f9effc0bb 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -1887,6 +1887,7 @@ struct drm_i915_private {
 
 	/* Sideband mailbox protection */
 	struct mutex sb_lock;
+	struct pm_qos_request sb_qos;
 
 	/** Cached value of IMR to avoid reads in updating the bitfield */
 	union {
diff --git a/drivers/gpu/drm/i915/intel_sideband.c b/drivers/gpu/drm/i915/intel_sideband.c
index 27ba0ad68e96..1a1574dddd06 100644
--- a/drivers/gpu/drm/i915/intel_sideband.c
+++ b/drivers/gpu/drm/i915/intel_sideband.c
@@ -41,6 +41,10 @@
 /* Private register write, double-word addressing, non-posted */
 #define SB_CRWRDA_NP	0x07
 
+static void ping(void *info)
+{
+}
+
 static int vlv_sideband_rw(struct drm_i915_private *dev_priv,
 			   u32 devfn, u32 port, u32 opcode,
 			   u32 addr, u32 *val)
@@ -65,6 +69,9 @@ static int vlv_sideband_rw(struct drm_i915_private *dev_priv,
 	 * Prevent the cpu from sleeping while we use this sideband, otherwise
 	 * the punit may cause a machine hang.
 	 */
+	pm_qos_update_request(&dev_priv->sb_qos, 0);
+	on_each_cpu(ping, NULL, 1);
+
 	preempt_disable();
 
 	I915_WRITE_FW(VLV_IOSF_ADDR, addr);
@@ -90,6 +97,7 @@ static int vlv_sideband_rw(struct drm_i915_private *dev_priv,
 	}
 
 	preempt_enable();
+	pm_qos_update_request(&dev_priv->sb_qos, PM_QOS_DEFAULT_VALUE);
 	iosf_mbi_punit_release();
 
 	return err;
-- 
2.15.1



More information about the Intel-gfx-trybot mailing list