diff mbox series

[2/7] drm/i915: Move display_irqs_enabled to intel_irq

Message ID 20190425215041.28978-2-rodrigo.vivi@intel.com (mailing list archive)
State New, archived
Headers show
Series [1/7] drm/i915: Introduce intel_irq | expand

Commit Message

Rodrigo Vivi April 25, 2019, 9:50 p.m. UTC
Let's continue the IRQ consolidation with display_irqs_enabled.

Another possibility was a full split on gt_irq vs de_irq,
but for now display_irqs_enabled is already protected
buy the same lock. So, at least for now, let's keep
them together.

Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
---
 drivers/gpu/drm/i915/i915_drv.h      |  3 +--
 drivers/gpu/drm/i915/i915_irq.c      | 22 +++++++++++-----------
 drivers/gpu/drm/i915/intel_hotplug.c | 10 ++++++----
 3 files changed, 18 insertions(+), 17 deletions(-)
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index ae885b82bde8..0ce19847273e 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -650,6 +650,7 @@  struct intel_rps_ei {
 struct intel_irq {
 	/* protects the irq masks */
 	spinlock_t lock;
+	bool display_interrupts_enabled;
 };
 
 struct intel_rps {
@@ -1558,8 +1559,6 @@  struct drm_i915_private {
 
 	struct intel_irq irq;
 
-	bool display_irqs_enabled;
-
 	/* To control wakeup latency, e.g. for irq-driven dp aux transfers. */
 	struct pm_qos_request pm_qos;
 
diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
index 679dc63244d9..754c44569cc4 100644
--- a/drivers/gpu/drm/i915/i915_irq.c
+++ b/drivers/gpu/drm/i915/i915_irq.c
@@ -1909,7 +1909,7 @@  static void i9xx_pipestat_irq_ack(struct drm_i915_private *dev_priv,
 
 	spin_lock(&dev_priv->irq.lock);
 
-	if (!dev_priv->display_irqs_enabled) {
+	if (!dev_priv->irq.display_interrupts_enabled) {
 		spin_unlock(&dev_priv->irq.lock);
 		return;
 	}
@@ -3485,7 +3485,7 @@  static void valleyview_irq_reset(struct drm_device *dev)
 	gen5_gt_irq_reset(dev_priv);
 
 	spin_lock_irq(&dev_priv->irq.lock);
-	if (dev_priv->display_irqs_enabled)
+	if (dev_priv->irq.display_interrupts_enabled)
 		vlv_display_irq_reset(dev_priv);
 	spin_unlock_irq(&dev_priv->irq.lock);
 }
@@ -3631,7 +3631,7 @@  static void cherryview_irq_reset(struct drm_device *dev)
 	GEN3_IRQ_RESET(uncore, GEN8_PCU_);
 
 	spin_lock_irq(&dev_priv->irq.lock);
-	if (dev_priv->display_irqs_enabled)
+	if (dev_priv->irq.display_interrupts_enabled)
 		vlv_display_irq_reset(dev_priv);
 	spin_unlock_irq(&dev_priv->irq.lock);
 }
@@ -4007,10 +4007,10 @@  void valleyview_enable_display_irqs(struct drm_i915_private *dev_priv)
 {
 	lockdep_assert_held(&dev_priv->irq.lock);
 
-	if (dev_priv->display_irqs_enabled)
+	if (dev_priv->irq.display_interrupts_enabled)
 		return;
 
-	dev_priv->display_irqs_enabled = true;
+	dev_priv->irq.display_interrupts_enabled = true;
 
 	if (intel_irqs_enabled(dev_priv)) {
 		vlv_display_irq_reset(dev_priv);
@@ -4022,10 +4022,10 @@  void valleyview_disable_display_irqs(struct drm_i915_private *dev_priv)
 {
 	lockdep_assert_held(&dev_priv->irq.lock);
 
-	if (!dev_priv->display_irqs_enabled)
+	if (!dev_priv->irq.display_interrupts_enabled)
 		return;
 
-	dev_priv->display_irqs_enabled = false;
+	dev_priv->irq.display_interrupts_enabled = false;
 
 	if (intel_irqs_enabled(dev_priv))
 		vlv_display_irq_reset(dev_priv);
@@ -4039,7 +4039,7 @@  static int valleyview_irq_postinstall(struct drm_device *dev)
 	gen5_gt_irq_postinstall(dev);
 
 	spin_lock_irq(&dev_priv->irq.lock);
-	if (dev_priv->display_irqs_enabled)
+	if (dev_priv->irq.display_interrupts_enabled)
 		vlv_display_irq_postinstall(dev_priv);
 	spin_unlock_irq(&dev_priv->irq.lock);
 
@@ -4242,7 +4242,7 @@  static int cherryview_irq_postinstall(struct drm_device *dev)
 	gen8_gt_irq_postinstall(dev_priv);
 
 	spin_lock_irq(&dev_priv->irq.lock);
-	if (dev_priv->display_irqs_enabled)
+	if (dev_priv->irq.display_interrupts_enabled)
 		vlv_display_irq_postinstall(dev_priv);
 	spin_unlock_irq(&dev_priv->irq.lock);
 
@@ -4746,9 +4746,9 @@  void intel_irq_init(struct drm_i915_private *dev_priv)
 	 * outside of the power domain. We defer setting up the display irqs
 	 * in this case to the runtime pm.
 	 */
-	dev_priv->display_irqs_enabled = true;
+	dev_priv->irq.display_interrupts_enabled = true;
 	if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv))
-		dev_priv->display_irqs_enabled = false;
+		dev_priv->irq.display_interrupts_enabled = false;
 
 	dev_priv->hotplug.hpd_storm_threshold = HPD_STORM_DEFAULT_THRESHOLD;
 	/* If we have MST support, we want to avoid doing short HPD IRQ storm
diff --git a/drivers/gpu/drm/i915/intel_hotplug.c b/drivers/gpu/drm/i915/intel_hotplug.c
index 8260e81f88e7..89ee666eb78c 100644
--- a/drivers/gpu/drm/i915/intel_hotplug.c
+++ b/drivers/gpu/drm/i915/intel_hotplug.c
@@ -258,7 +258,8 @@  static void intel_hpd_irq_storm_reenable_work(struct work_struct *work)
 		}
 		drm_connector_list_iter_end(&conn_iter);
 	}
-	if (dev_priv->display_irqs_enabled && dev_priv->display.hpd_irq_setup)
+	if (dev_priv->irq.display_interrupts_enabled &&
+	    dev_priv->display.hpd_irq_setup)
 		dev_priv->display.hpd_irq_setup(dev_priv);
 	spin_unlock_irq(&dev_priv->irq.lock);
 
@@ -502,7 +503,7 @@  void intel_hpd_irq_handler(struct drm_i915_private *dev_priv,
 	 * Disable any IRQs that storms were detected on. Polling enablement
 	 * happens later in our hotplug work.
 	 */
-	if (storm_detected && dev_priv->display_irqs_enabled)
+	if (storm_detected && dev_priv->irq.display_interrupts_enabled)
 		dev_priv->display.hpd_irq_setup(dev_priv);
 	spin_unlock(&dev_priv->irq.lock);
 
@@ -548,9 +549,10 @@  void intel_hpd_init(struct drm_i915_private *dev_priv)
 	 * Interrupt setup is already guaranteed to be single-threaded, this is
 	 * just to make the assert_spin_locked checks happy.
 	 */
-	if (dev_priv->display_irqs_enabled && dev_priv->display.hpd_irq_setup) {
+	if (dev_priv->irq.display_interrupts_enabled &&
+	    dev_priv->display.hpd_irq_setup) {
 		spin_lock_irq(&dev_priv->irq.lock);
-		if (dev_priv->display_irqs_enabled)
+		if (dev_priv->irq.display_interrupts_enabled)
 			dev_priv->display.hpd_irq_setup(dev_priv);
 		spin_unlock_irq(&dev_priv->irq.lock);
 	}