Skip to contentSkip to conversation

drm/i915: Save PM interrupt register offsets in device info

PATCH In review Sagar Arun Kamble 7 participants 12 messages Oct 24, 2017 – Oct 26, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 drm/i915: Save PM interrupt register offsets in device info

PM interrupt register offsets are constant per platforms and saving those in device info is more appropriate than getting those through functions. This patch removes functions gen6_pm_iir/imr/ier and saves those offsets in device info.

v2: Use INTEL_INFO() to access device info. (Chris)

Cc Chris Wilson <[email protected]>
Cc Tvrtko Ursulin <[email protected]>
Cc Joonas Lahtinen <[email protected]>
---
 drivers/gpu/drm/i915/i915_drv.h          |  5 +++++
 drivers/gpu/drm/i915/i915_irq.c          | 31 +++++++++----------------------
 drivers/gpu/drm/i915/intel_device_info.c | 11 +++++++++++
 3 files changed, 25 insertions(+), 22 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +5 -0
index 54b5d4c..2f77d26 100644
@@ -888,6 +888,11 @@ struct intel_device_info {
 		u16 degamma_lut_size;
 		u16 gamma_lut_size;
 	} color;
+
+	/* PM interrupt register offsets */
+	i915_reg_t pm_iir_offset;
+	i915_reg_t pm_imr_offset;
+	i915_reg_t pm_ier_offset;
 };
 
 struct intel_display_error_state;
drivers/gpu/drm/i915/i915_irq.c +9 -22
index b1296a5..5d448af 100644
@@ -306,21 +306,6 @@ void gen5_disable_gt_irq(struct drm_i915_private *dev_priv, uint32_t mask)
 	ilk_update_gt_irq(dev_priv, mask, 0);
 }
 
-static i915_reg_t gen6_pm_iir(struct drm_i915_private *dev_priv)
-{
-	return INTEL_GEN(dev_priv) >= 8 ? GEN8_GT_IIR(2) : GEN6_PMIIR;
-}
-
-static i915_reg_t gen6_pm_imr(struct drm_i915_private *dev_priv)
-{
-	return INTEL_GEN(dev_priv) >= 8 ? GEN8_GT_IMR(2) : GEN6_PMIMR;
-}
-
-static i915_reg_t gen6_pm_ier(struct drm_i915_private *dev_priv)
-{
-	return INTEL_GEN(dev_priv) >= 8 ? GEN8_GT_IER(2) : GEN6_PMIER;
-}
-
 /**
  * snb_update_pm_irq - update GEN6_PMIMR
  * @dev_priv: driver private
@@ -332,6 +317,7 @@ static void snb_update_pm_irq(struct drm_i915_private *dev_priv,
 			      uint32_t enabled_irq_mask)
 {
 	uint32_t new_val;
+	i915_reg_t reg = INTEL_INFO(dev_priv)->pm_imr_offset;
 
 	WARN_ON(enabled_irq_mask & ~interrupt_mask);
 
@@ -343,8 +329,8 @@ static void snb_update_pm_irq(struct drm_i915_private *dev_priv,
 
 	if (new_val != dev_priv->pm_imr) {
 		dev_priv->pm_imr = new_val;
-		I915_WRITE(gen6_pm_imr(dev_priv), dev_priv->pm_imr);
-		POSTING_READ(gen6_pm_imr(dev_priv));
+		I915_WRITE(reg, dev_priv->pm_imr);
+		POSTING_READ(reg);
 	}
 }
 
@@ -371,7 +357,7 @@ void gen6_mask_pm_irq(struct drm_i915_private *dev_priv, u32 mask)
 
 static void gen6_reset_pm_iir(struct drm_i915_private *dev_priv, u32 reset_mask)
 {
-	i915_reg_t reg = gen6_pm_iir(dev_priv);
+	i915_reg_t reg = INTEL_INFO(dev_priv)->pm_iir_offset;
 
 	lockdep_assert_held(&dev_priv->irq_lock);
 
@@ -385,7 +371,7 @@ static void gen6_enable_pm_irq(struct drm_i915_private *dev_priv, u32 enable_mas
 	lockdep_assert_held(&dev_priv->irq_lock);
 
 	dev_priv->pm_ier |= enable_mask;
-	I915_WRITE(gen6_pm_ier(dev_priv), dev_priv->pm_ier);
+	I915_WRITE(INTEL_INFO(dev_priv)->pm_ier_offset, dev_priv->pm_ier);
 	gen6_unmask_pm_irq(dev_priv, enable_mask);
 	/* unmask_pm_irq provides an implicit barrier (POSTING_READ) */
 }
@@ -396,7 +382,7 @@ static void gen6_disable_pm_irq(struct drm_i915_private *dev_priv, u32 disable_m
 
 	dev_priv->pm_ier &= ~disable_mask;
 	__gen6_mask_pm_irq(dev_priv, disable_mask);
-	I915_WRITE(gen6_pm_ier(dev_priv), dev_priv->pm_ier);
+	I915_WRITE(INTEL_INFO(dev_priv)->pm_ier_offset, dev_priv->pm_ier);
 	/* though a barrier is missing here, but don't really need a one */
 }
 
@@ -417,7 +403,8 @@ void gen6_enable_rps_interrupts(struct drm_i915_private *dev_priv)
 
 	spin_lock_irq(&dev_priv->irq_lock);
 	WARN_ON_ONCE(rps->pm_iir);
-	WARN_ON_ONCE(I915_READ(gen6_pm_iir(dev_priv)) & dev_priv->pm_rps_events);
+	WARN_ON_ONCE(I915_READ(INTEL_INFO(dev_priv)->pm_iir_offset) &
+			       dev_priv->pm_rps_events);
 	rps->interrupts_enabled = true;
 	gen6_enable_pm_irq(dev_priv, dev_priv->pm_rps_events);
 
@@ -461,7 +448,7 @@ void gen9_enable_guc_interrupts(struct drm_i915_private *dev_priv)
 {
 	spin_lock_irq(&dev_priv->irq_lock);
 	if (!dev_priv->guc.interrupts_enabled) {
-		WARN_ON_ONCE(I915_READ(gen6_pm_iir(dev_priv)) &
+		WARN_ON_ONCE(I915_READ(INTEL_INFO(dev_priv)->pm_iir_offset) &
 				       dev_priv->pm_guc_events);
 		dev_priv->guc.interrupts_enabled = true;
 		gen6_enable_pm_irq(dev_priv, dev_priv->pm_guc_events);
drivers/gpu/drm/i915/intel_device_info.c +11 -0
index 875d428..d1a4911 100644
@@ -462,4 +462,15 @@ void intel_device_info_runtime_init(struct drm_i915_private *dev_priv)
 			 info->sseu.has_subslice_pg ? "y" : "n");
 	DRM_DEBUG_DRIVER("has EU power gating: %s\n",
 			 info->sseu.has_eu_pg ? "y" : "n");
+
+	/* Initialize PM interrupt register offsets */
+	if (INTEL_GEN(dev_priv) >= 8) {
+		info->pm_iir_offset = GEN8_GT_IIR(2);
+		info->pm_imr_offset = GEN8_GT_IMR(2);
+		info->pm_ier_offset = GEN8_GT_IER(2);
+	} else {
+		info->pm_iir_offset = GEN6_PMIIR;
+		info->pm_imr_offset = GEN6_PMIMR;
+		info->pm_ier_offset = GEN6_PMIER;
+	}
 }
Signature · 6 lines
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw
Quoted 47 lines · Sagar Arun Kamble

PM interrupt register offsets are constant per platforms and saving those in device info is more appropriate than getting those through functions. This patch removes functions gen6_pm_iir/imr/ier and saves those offsets in device info.

v2: Use INTEL_INFO() to access device info. (Chris)

Cc Chris Wilson <[email protected]>
Cc Tvrtko Ursulin <[email protected]>
Cc Joonas Lahtinen <[email protected]>
---
 drivers/gpu/drm/i915/i915_drv.h          |  5 +++++
 drivers/gpu/drm/i915/i915_irq.c          | 31  
+++++++++----------------------
 drivers/gpu/drm/i915/intel_device_info.c | 11 +++++++++++
 3 files changed, 25 insertions(+), 22 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +5 -0
index 54b5d4c..2f77d26 100644
@@ -888,6 +888,11 @@ struct intel_device_info {
 		u16 degamma_lut_size;
 		u16 gamma_lut_size;
 	} color;
+
+	/* PM interrupt register offsets */
+	i915_reg_t pm_iir_offset;
+	i915_reg_t pm_imr_offset;
+	i915_reg_t pm_ier_offset;
 };
 struct intel_display_error_state;
drivers/gpu/drm/i915/i915_irq.c +0 -5
index b1296a5..5d448af 100644
@@ -306,21 +306,6 @@ void gen5_disable_gt_irq(struct drm_i915_private  
 *dev_priv, uint32_t mask)
 	ilk_update_gt_irq(dev_priv, mask, 0);
 }
-static i915_reg_t gen6_pm_iir(struct drm_i915_private *dev_priv)
-{
-	return INTEL_GEN(dev_priv) >= 8 ? GEN8_GT_IIR(2) : GEN6_PMIIR;
-}
-

drivers/gpu/drm/i915/i915_irq.c void gen5_disable_gt_irq(struct drm_i915_private · line 323

Quoted 10 lines
drivers/gpu/drm/i915/i915_irq.c +0 -10
-static i915_reg_t gen6_pm_imr(struct drm_i915_private *dev_priv)
-{
-	return INTEL_GEN(dev_priv) >= 8 ? GEN8_GT_IMR(2) : GEN6_PMIMR;
-}
-
-static i915_reg_t gen6_pm_ier(struct drm_i915_private *dev_priv)
-{
-	return INTEL_GEN(dev_priv) >= 8 ? GEN8_GT_IER(2) : GEN6_PMIER;
-}
-

btw, if you keep these functions but modify them into:

	return INTEL_INFO(dev_priv)->pm_xxx_offset;

then most of below changes will not be needed

drivers/gpu/drm/i915/i915_irq.c static void snb_update_pm_irq(struct · line 321

Quoted 9 lines
drivers/gpu/drm/i915/i915_irq.c +1 -0
 /**
  * snb_update_pm_irq - update GEN6_PMIMR
  * @dev_priv: driver private
@@ -332,6 +317,7 @@ static void snb_update_pm_irq(struct  
 drm_i915_private *dev_priv,
 			      uint32_t enabled_irq_mask)
 {
 	uint32_t new_val;
+	i915_reg_t reg = INTEL_INFO(dev_priv)->pm_imr_offset;

s/reg/imr ?

Quoted 12 lines
drivers/gpu/drm/i915/i915_irq.c +2 -2
 	WARN_ON(enabled_irq_mask & ~interrupt_mask);
@@ -343,8 +329,8 @@ static void snb_update_pm_irq(struct  
 drm_i915_private *dev_priv,
 	if (new_val != dev_priv->pm_imr) {
 		dev_priv->pm_imr = new_val;
-		I915_WRITE(gen6_pm_imr(dev_priv), dev_priv->pm_imr);
-		POSTING_READ(gen6_pm_imr(dev_priv));
+		I915_WRITE(reg, dev_priv->pm_imr);
+		POSTING_READ(reg);
 	}
 }

drivers/gpu/drm/i915/i915_irq.c void gen6_mask_pm_irq(struct drm_i915_private · line 360

Quoted 5 lines
drivers/gpu/drm/i915/i915_irq.c +1 -1
@@ -371,7 +357,7 @@ void gen6_mask_pm_irq(struct drm_i915_private  
 *dev_priv, u32 mask)
 static void gen6_reset_pm_iir(struct drm_i915_private *dev_priv, u32 reset_mask)
 {
-	i915_reg_t reg = gen6_pm_iir(dev_priv);
+	i915_reg_t reg = INTEL_INFO(dev_priv)->pm_iir_offset;

s/reg/iir ?

Quoted 19 lines
drivers/gpu/drm/i915/i915_irq.c +0 -0
 	lockdep_assert_held(&dev_priv->irq_lock);
@@ -385,7 +371,7 @@ static void gen6_enable_pm_irq(struct  

drm_i915_private *dev_priv, u32 enable_mas

 	lockdep_assert_held(&dev_priv->irq_lock);
	dev_priv->pm_ier |= enable_mask;
drivers/gpu/drm/i915/i915_irq.c +1 -1
-	I915_WRITE(gen6_pm_ier(dev_priv), dev_priv->pm_ier);
+	I915_WRITE(INTEL_INFO(dev_priv)->pm_ier_offset, dev_priv->pm_ier);
 	gen6_unmask_pm_irq(dev_priv, enable_mask);
 	/* unmask_pm_irq provides an implicit barrier (POSTING_READ) */
 }
@@ -396,7 +382,7 @@ static void gen6_disable_pm_irq(struct  

drm_i915_private *dev_priv, u32 disable_m

	dev_priv->pm_ier &= ~disable_mask;
drivers/gpu/drm/i915/i915_irq.c +1 -1
 	__gen6_mask_pm_irq(dev_priv, disable_mask);
-	I915_WRITE(gen6_pm_ier(dev_priv), dev_priv->pm_ier);
+	I915_WRITE(INTEL_INFO(dev_priv)->pm_ier_offset, dev_priv->pm_ier);
 	/* though a barrier is missing here, but don't really need a one */
 }

drivers/gpu/drm/i915/i915_irq.c void gen6_enable_rps_interrupts(struct · line 408

Quoted 7 lines
drivers/gpu/drm/i915/i915_irq.c +2 -1
@@ -417,7 +403,8 @@ void gen6_enable_rps_interrupts(struct  
 drm_i915_private *dev_priv)
 	spin_lock_irq(&dev_priv->irq_lock);
 	WARN_ON_ONCE(rps->pm_iir);
-	WARN_ON_ONCE(I915_READ(gen6_pm_iir(dev_priv)) &  
 dev_priv->pm_rps_events);
+	WARN_ON_ONCE(I915_READ(INTEL_INFO(dev_priv)->pm_iir_offset) &
+			       dev_priv->pm_rps_events);

Can you define separate iir_reg variable as in above functions to simplify this nested statement ?

Quoted 32 lines
drivers/gpu/drm/i915/i915_irq.c +1 -1
 	rps->interrupts_enabled = true;
 	gen6_enable_pm_irq(dev_priv, dev_priv->pm_rps_events);
@@ -461,7 +448,7 @@ void gen9_enable_guc_interrupts(struct  
 drm_i915_private *dev_priv)
 {
 	spin_lock_irq(&dev_priv->irq_lock);
 	if (!dev_priv->guc.interrupts_enabled) {
-		WARN_ON_ONCE(I915_READ(gen6_pm_iir(dev_priv)) &
+		WARN_ON_ONCE(I915_READ(INTEL_INFO(dev_priv)->pm_iir_offset) &
 				       dev_priv->pm_guc_events);
 		dev_priv->guc.interrupts_enabled = true;
drivers/gpu/drm/i915/i915_irq.c +0 -0
 		gen6_enable_pm_irq(dev_priv, dev_priv->pm_guc_events);
drivers/gpu/drm/i915/intel_device_info.c +11 -0
index 875d428..d1a4911 100644
@@ -462,4 +462,15 @@ void intel_device_info_runtime_init(struct  
 drm_i915_private *dev_priv)
 			 info->sseu.has_subslice_pg ? "y" : "n");
 	DRM_DEBUG_DRIVER("has EU power gating: %s\n",
 			 info->sseu.has_eu_pg ? "y" : "n");
+
+	/* Initialize PM interrupt register offsets */
+	if (INTEL_GEN(dev_priv) >= 8) {
+		info->pm_iir_offset = GEN8_GT_IIR(2);
+		info->pm_imr_offset = GEN8_GT_IMR(2);
+		info->pm_ier_offset = GEN8_GT_IER(2);
+	} else {
+		info->pm_iir_offset = GEN6_PMIIR;
+		info->pm_imr_offset = GEN6_PMIMR;
+		info->pm_ier_offset = GEN6_PMIER;
+	}
Quoted 1 line

}

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

#2 lore raw
Quoted 62 lines · Michal Wajdeczko
Quoted 47 lines · Sagar Arun Kamble

PM interrupt register offsets are constant per platforms and saving those in device info is more appropriate than getting those through functions. This patch removes functions gen6_pm_iir/imr/ier and saves those offsets in device info.

v2: Use INTEL_INFO() to access device info. (Chris)

Cc Chris Wilson <[email protected]>
Cc Tvrtko Ursulin <[email protected]>
Cc Joonas Lahtinen <[email protected]>

---
 drivers/gpu/drm/i915/i915_drv.h          |  5 +++++ drivers/gpu/drm/i915/i915_irq.c          | 31
+++++++++----------------------
 drivers/gpu/drm/i915/intel_device_info.c | 11 +++++++++++

 3 files changed, 25 insertions(+), 22 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +5 -0
index 54b5d4c..2f77d26 100644
@@ -888,6 +888,11 @@ struct intel_device_info {
          u16 degamma_lut_size;
          u16 gamma_lut_size;
      } color;
+
+    /* PM interrupt register offsets */
+    i915_reg_t pm_iir_offset;
+    i915_reg_t pm_imr_offset;
+    i915_reg_t pm_ier_offset;
  };
 struct intel_display_error_state;
drivers/gpu/drm/i915/i915_irq.c +0 -5
index b1296a5..5d448af 100644
@@ -306,21 +306,6 @@ void gen5_disable_gt_irq(struct drm_i915_private 
 *dev_priv, uint32_t mask)
      ilk_update_gt_irq(dev_priv, mask, 0);
  }
-static i915_reg_t gen6_pm_iir(struct drm_i915_private *dev_priv)
-{
-    return INTEL_GEN(dev_priv) >= 8 ? GEN8_GT_IIR(2) : GEN6_PMIIR;
-}
-

drivers/gpu/drm/i915/i915_irq.c void gen5_disable_gt_irq(struct drm_i915_private · line 323

Quoted 10 lines
drivers/gpu/drm/i915/i915_irq.c +0 -10
-static i915_reg_t gen6_pm_imr(struct drm_i915_private *dev_priv)
-{
-    return INTEL_GEN(dev_priv) >= 8 ? GEN8_GT_IMR(2) : GEN6_PMIMR;
-}
-
-static i915_reg_t gen6_pm_ier(struct drm_i915_private *dev_priv)
-{
-    return INTEL_GEN(dev_priv) >= 8 ? GEN8_GT_IER(2) : GEN6_PMIER;
-}
-

btw, if you keep these functions but modify them into:

Quoted 3 lines

    return INTEL_INFO(dev_priv)->pm_xxx_offset;

then most of below changes will not be needed

Yes. Will keep these functions.

Quoted 12 lines

drivers/gpu/drm/i915/i915_irq.c static void snb_update_pm_irq(struct · line 321

Quoted 10 lines
drivers/gpu/drm/i915/i915_irq.c +1 -0
  /**
   * snb_update_pm_irq - update GEN6_PMIMR
   * @dev_priv: driver private
@@ -332,6 +317,7 @@ static void snb_update_pm_irq(struct 
 drm_i915_private *dev_priv,
                    uint32_t enabled_irq_mask)
  {
      uint32_t new_val;
+    i915_reg_t reg = INTEL_INFO(dev_priv)->pm_imr_offset;

s/reg/imr ?

will remove this change since we are keeping gen6_pm* functions.

Quoted 12 lines
Quoted 12 lines
drivers/gpu/drm/i915/i915_irq.c +2 -2
     WARN_ON(enabled_irq_mask & ~interrupt_mask);
@@ -343,8 +329,8 @@ static void snb_update_pm_irq(struct 
 drm_i915_private *dev_priv,
     if (new_val != dev_priv->pm_imr) {
          dev_priv->pm_imr = new_val;
-        I915_WRITE(gen6_pm_imr(dev_priv), dev_priv->pm_imr);
-        POSTING_READ(gen6_pm_imr(dev_priv));
+        I915_WRITE(reg, dev_priv->pm_imr);
+        POSTING_READ(reg);
      }
  }
Quoted 8 lines

drivers/gpu/drm/i915/i915_irq.c void gen6_mask_pm_irq(struct drm_i915_private · line 360

Quoted 6 lines
drivers/gpu/drm/i915/i915_irq.c +1 -1
@@ -371,7 +357,7 @@ void gen6_mask_pm_irq(struct drm_i915_private 
 *dev_priv, u32 mask)
 static void gen6_reset_pm_iir(struct drm_i915_private *dev_priv, u32 reset_mask)
  {
-    i915_reg_t reg = gen6_pm_iir(dev_priv);
+    i915_reg_t reg = INTEL_INFO(dev_priv)->pm_iir_offset;

s/reg/iir ?

will remove this as well.

Quoted 22 lines
Quoted 22 lines
drivers/gpu/drm/i915/i915_irq.c +0 -0
     lockdep_assert_held(&dev_priv->irq_lock);
@@ -385,7 +371,7 @@ static void gen6_enable_pm_irq(struct 

drm_i915_private *dev_priv, u32 enable_mas lockdep_assert_held(&dev_priv->irq_lock); dev_priv->pm_ier |= enable_mask;
-    I915_WRITE(gen6_pm_ier(dev_priv), dev_priv->pm_ier);
+    I915_WRITE(INTEL_INFO(dev_priv)->pm_ier_offset, dev_priv->pm_ier); gen6_unmask_pm_irq(dev_priv, enable_mask);
     /* unmask_pm_irq provides an implicit barrier (POSTING_READ) */ }

drivers/gpu/drm/i915/i915_irq.c +0 -0
@@ -396,7 +382,7 @@ static void gen6_disable_pm_irq(struct 

drm_i915_private *dev_priv, u32 disable_m
    dev_priv->pm_ier &= ~disable_mask; __gen6_mask_pm_irq(dev_priv, disable_mask);
-    I915_WRITE(gen6_pm_ier(dev_priv), dev_priv->pm_ier);
+    I915_WRITE(INTEL_INFO(dev_priv)->pm_ier_offset, dev_priv->pm_ier); /* though a barrier is missing here, but don't really need a one */ }

drivers/gpu/drm/i915/i915_irq.c +0 -0
@@ -417,7 +403,8 @@ void gen6_enable_rps_interrupts(struct 
 drm_i915_private *dev_priv)
     spin_lock_irq(&dev_priv->irq_lock);
Quoted 8 lines

drivers/gpu/drm/i915/i915_irq.c void gen6_enable_rps_interrupts(struct drm_i915_private *dev_priv) · line 407

Quoted 5 lines
drivers/gpu/drm/i915/i915_irq.c +2 -1
      WARN_ON_ONCE(rps->pm_iir);
-    WARN_ON_ONCE(I915_READ(gen6_pm_iir(dev_priv)) & 
 dev_priv->pm_rps_events);
+ WARN_ON_ONCE(I915_READ(INTEL_INFO(dev_priv)->pm_iir_offset) &
+                   dev_priv->pm_rps_events);

Can you define separate iir_reg variable as in above functions to simplify this nested statement ?

and this as well.

Quoted 26 lines
Quoted 26 lines
drivers/gpu/drm/i915/i915_irq.c +1 -1
      rps->interrupts_enabled = true;
      gen6_enable_pm_irq(dev_priv, dev_priv->pm_rps_events);
@@ -461,7 +448,7 @@ void gen9_enable_guc_interrupts(struct 
 drm_i915_private *dev_priv)
  {
      spin_lock_irq(&dev_priv->irq_lock);
      if (!dev_priv->guc.interrupts_enabled) {
-        WARN_ON_ONCE(I915_READ(gen6_pm_iir(dev_priv)) &
+ WARN_ON_ONCE(I915_READ(INTEL_INFO(dev_priv)->pm_iir_offset) &
                         dev_priv->pm_guc_events);
          dev_priv->guc.interrupts_enabled = true;

         gen6_enable_pm_irq(dev_priv, dev_priv->pm_guc_events);

drivers/gpu/drm/i915/intel_device_info.c +4 -0
index 875d428..d1a4911 100644
@@ -462,4 +462,15 @@ void intel_device_info_runtime_init(struct 
 drm_i915_private *dev_priv)
               info->sseu.has_subslice_pg ? "y" : "n");
      DRM_DEBUG_DRIVER("has EU power gating: %s\n",
               info->sseu.has_eu_pg ? "y" : "n");
+
+    /* Initialize PM interrupt register offsets */
+    if (INTEL_GEN(dev_priv) >= 8) {
+        info->pm_iir_offset = GEN8_GT_IIR(2);
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/i915/intel_device_info.c +7 -0
+        info->pm_imr_offset = GEN8_GT_IMR(2);
+        info->pm_ier_offset = GEN8_GT_IER(2);
+    } else {
+        info->pm_iir_offset = GEN6_PMIIR;
+        info->pm_imr_offset = GEN6_PMIMR;
+        info->pm_ier_offset = GEN6_PMIER;
+    }

 }

_______________________________________________
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 [v2,1/1] drm/i915: Save PM interrupt register offsets in device info

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

== Series Details ==

Series: series starting with [v2,1/1] drm/i915: Save PM interrupt register offsets in device info
URL : https://patchwork.freedesktop.org/series/32526/
State : success

== Summary ==

Series 32526v1 series starting with [v2,1/1] drm/i915: Save PM interrupt register offsets in device info
https://patchwork.freedesktop.org/api/1.0/series/32526/revisions/1/mbox/

Test drv_module_reload:

        Subgroup basic-no-display:
                dmesg-warn -> INCOMPLETE (fi-cfl-s) fdo#103206

fdo#103206 https://bugs.freedesktop.org/show_bug.cgi?id=103206

fi-bdw-5557u     total:289  pass:268  dwarn:0   dfail:0   fail:0   skip:21  time:447s
fi-bdw-gvtdvm    total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24  time:451s
fi-blb-e6850     total:289  pass:223  dwarn:1   dfail:0   fail:0   skip:65  time:370s
fi-bsw-n3050     total:289  pass:243  dwarn:0   dfail:0   fail:0   skip:46  time:518s
fi-bwr-2160      total:289  pass:183  dwarn:0   dfail:0   fail:0   skip:106 time:262s
fi-bxt-dsi       total:289  pass:259  dwarn:0   dfail:0   fail:0   skip:30  time:494s
fi-bxt-j4205     total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:503s
fi-byt-j1900     total:289  pass:253  dwarn:1   dfail:0   fail:0   skip:35  time:498s
fi-byt-n2820     total:289  pass:249  dwarn:1   dfail:0   fail:0   skip:39  time:486s
fi-cfl-s         total:287  pass:253  dwarn:2   dfail:0   fail:0   skip:31 
fi-cnl-y         total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:635s
fi-elk-e7500     total:289  pass:229  dwarn:0   dfail:0   fail:0   skip:60  time:422s
fi-gdg-551       total:289  pass:178  dwarn:1   dfail:0   fail:1   skip:109 time:251s
fi-glk-1         total:289  pass:261  dwarn:0   dfail:0   fail:0   skip:28  time:581s
fi-glk-dsi       total:289  pass:258  dwarn:0   dfail:0   fail:1   skip:30  time:492s
fi-hsw-4770      total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:453s
fi-hsw-4770r     total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:428s
fi-ilk-650       total:289  pass:228  dwarn:0   dfail:0   fail:0   skip:61  time:434s
fi-ivb-3520m     total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:491s
fi-ivb-3770      total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:460s
fi-kbl-7500u     total:289  pass:264  dwarn:1   dfail:0   fail:0   skip:24  time:491s
fi-kbl-7560u     total:289  pass:270  dwarn:0   dfail:0   fail:0   skip:19  time:572s
fi-kbl-7567u     total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:477s
fi-kbl-r         total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:588s
fi-pnv-d510      total:289  pass:222  dwarn:1   dfail:0   fail:0   skip:66  time:544s
fi-skl-6260u     total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:455s
fi-skl-6700hq    total:289  pass:263  dwarn:0   dfail:0   fail:0   skip:26  time:646s
fi-skl-6700k     total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24  time:519s
fi-skl-6770hq    total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:503s
fi-skl-gvtdvm    total:289  pass:266  dwarn:0   dfail:0   fail:0   skip:23  time:451s
fi-snb-2520m     total:289  pass:250  dwarn:0   dfail:0   fail:0   skip:39  time:565s
fi-snb-2600      total:289  pass:249  dwarn:0   dfail:0   fail:0   skip:40  time:421s

5c82a37eff83ab4e60e760fbaf03db5ba0563497 drm-tip: 2017y-10m-23d-18h-06m-28s UTC integration manifest 21074be0b1a8 drm/i915: Save PM interrupt register offsets in device info

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_6155/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#4 lore raw

✓ Fi.CI.IGT: success for series starting with [v2,1/1] drm/i915: Save PM interrupt register offsets in device info

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

== Series Details ==

Series: series starting with [v2,1/1] drm/i915: Save PM interrupt register offsets in device info
URL : https://patchwork.freedesktop.org/series/32526/
State : success

== Summary ==

Test kms_busy:

        Subgroup extended-modeset-hang-oldfb-with-reset-render-C:
                pass       -> DMESG-WARN (shard-hsw) fdo#102249 +1
Test drv_module_reload:
        Subgroup basic-reload-inject:
                dmesg-warn -> PASS       (shard-hsw) fdo#102707
Test perf:
        Subgroup polling:
                fail       -> PASS       (shard-hsw) fdo#102252

fdo#102249 https://bugs.freedesktop.org/show_bug.cgi?id=102249
fdo#102707 https://bugs.freedesktop.org/show_bug.cgi?id=102707
fdo#102252 https://bugs.freedesktop.org/show_bug.cgi?id=102252

shard-hsw total:2540 pass:1433 dwarn:2 dfail:0 fail:8 skip:1097 time:9224s

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_6155/shards.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#5 lore raw
In reply to Sagar Arun Kamble

Quoting Sagar Arun Kamble (2017-10-24 11:41:13)

Quoted 9 lines
drivers/gpu/drm/i915/intel_device_info.c +1 -0
index 875d428..d1a4911 100644
@@ -462,4 +462,15 @@ void intel_device_info_runtime_init(struct drm_i915_private *dev_priv)
                         info->sseu.has_subslice_pg ? "y" : "n");
        DRM_DEBUG_DRIVER("has EU power gating: %s\n",
                         info->sseu.has_eu_pg ? "y" : "n");
+

drivers/gpu/drm/i915/intel_device_info.c void intel_device_info_runtime_init(struct drm_i915_private *dev_priv) · line 475

Quoted 10 lines
drivers/gpu/drm/i915/intel_device_info.c +10 -0
+       /* Initialize PM interrupt register offsets */
+       if (INTEL_GEN(dev_priv) >= 8) {
+               info->pm_iir_offset = GEN8_GT_IIR(2);
+               info->pm_imr_offset = GEN8_GT_IMR(2);
+               info->pm_ier_offset = GEN8_GT_IER(2);
+       } else {
+               info->pm_iir_offset = GEN6_PMIIR;
+               info->pm_imr_offset = GEN6_PMIMR;
+               info->pm_ier_offset = GEN6_PMIER;
+       }

If you are going to take another pass at this, move these into the static tables in i915_pci.c

Updating GEN6_FEATURES and GEN8_FEATURES will then percolate into individual platform defines.
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

maintainer
#6 lore raw
Quoted 24 lines · Chris Wilson

Quoting Sagar Arun Kamble (2017-10-24 11:41:13)

Quoted 9 lines
drivers/gpu/drm/i915/intel_device_info.c +1 -0
index 875d428..d1a4911 100644
@@ -462,4 +462,15 @@ void intel_device_info_runtime_init(struct drm_i915_private *dev_priv)
                         info->sseu.has_subslice_pg ? "y" : "n");
        DRM_DEBUG_DRIVER("has EU power gating: %s\n",
                         info->sseu.has_eu_pg ? "y" : "n");
+

drivers/gpu/drm/i915/intel_device_info.c void intel_device_info_runtime_init(struct drm_i915_private *dev_priv) · line 475

Quoted 10 lines
drivers/gpu/drm/i915/intel_device_info.c +10 -0
+       /* Initialize PM interrupt register offsets */
+       if (INTEL_GEN(dev_priv) >= 8) {
+               info->pm_iir_offset = GEN8_GT_IIR(2);
+               info->pm_imr_offset = GEN8_GT_IMR(2);
+               info->pm_ier_offset = GEN8_GT_IER(2);
+       } else {
+               info->pm_iir_offset = GEN6_PMIIR;
+               info->pm_imr_offset = GEN6_PMIMR;
+               info->pm_ier_offset = GEN6_PMIER;
+       }

If you are going to take another pass at this, move these into the static tables in i915_pci.c

Quoted 2 lines

Updating GEN6_FEATURES and GEN8_FEATURES will then percolate into individual platform defines.

Like I wrote in reply to v1, I'm not convinced we should do this at all.

What makes *these* registers so important they must be in device info? What makes most of i915_reg.h so unimportant they don't deserve the same treatment? Where do you draw the line?

I'd draw the line at, no registers at device info.

BR,
Jani.

Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
maintainer
#7 lore raw
Quoted 28 lines · Jani Nikula
Quoted 24 lines · Chris Wilson

Quoting Sagar Arun Kamble (2017-10-24 11:41:13)

Quoted 9 lines
drivers/gpu/drm/i915/intel_device_info.c +1 -0
index 875d428..d1a4911 100644
@@ -462,4 +462,15 @@ void intel_device_info_runtime_init(struct drm_i915_private *dev_priv)
                          info->sseu.has_subslice_pg ? "y" : "n");
         DRM_DEBUG_DRIVER("has EU power gating: %s\n",
                          info->sseu.has_eu_pg ? "y" : "n");
+

drivers/gpu/drm/i915/intel_device_info.c void intel_device_info_runtime_init(struct drm_i915_private *dev_priv) · line 475

Quoted 10 lines
drivers/gpu/drm/i915/intel_device_info.c +10 -0
+       /* Initialize PM interrupt register offsets */
+       if (INTEL_GEN(dev_priv) >= 8) {
+               info->pm_iir_offset = GEN8_GT_IIR(2);
+               info->pm_imr_offset = GEN8_GT_IMR(2);
+               info->pm_ier_offset = GEN8_GT_IER(2);
+       } else {
+               info->pm_iir_offset = GEN6_PMIIR;
+               info->pm_imr_offset = GEN6_PMIMR;
+               info->pm_ier_offset = GEN6_PMIER;
+       }

If you are going to take another pass at this, move these into the static tables in i915_pci.c

Quoted 2 lines

Updating GEN6_FEATURES and GEN8_FEATURES will then percolate into individual platform defines.

Quoted 7 lines

Like I wrote in reply to v1, I'm not convinced we should do this at all.

What makes *these* registers so important they must be in device info? What makes most of i915_reg.h so unimportant they don't deserve the same treatment? Where do you draw the line?

I'd draw the line at, no registers at device info.

I suggested to Sagar this change during review so feel responsible to chime in.

So in general I just find the amount of times our driver asks itself what it's running on a bit tasteless. :(

I did quick and dirty check by bumping a counter in all the IS_this|or|that checks, all which can be known at driver probe time, and wired it up to the PMU so I can check their frequency. The annotated perf stat output:

root@e31:~# perf stat -a -e i915/whoami/ -I 1000
#           time             counts unit events
# idle system no X running
     1.000298100                 10      i915/whoami/ 

     2.000750955                  8      i915/whoami/ 

     3.001104193                 10      i915/whoami/ 

     4.001333433                 10      i915/whoami/ 

     5.001703162                 10      i915/whoami/ 

     6.002122721                 10      i915/whoami/ 
# starting X now..
     7.002266228              2,203      i915/whoami/ 

     8.002392598              4,682      i915/whoami/ 

     9.002764398                  0      i915/whoami/ 

    10.003027119                  0      i915/whoami/ 

    11.003486048                 42      i915/whoami/ 

# X idling..

    12.003854660                  0      i915/whoami/ 

    13.004221680                  0      i915/whoami/ 

    14.004622571                  0      i915/whoami/ 

    15.004968110                  0      i915/whoami/ 

    16.005372363                  0      i915/whoami/ 

    17.005778034                  0      i915/whoami/ 

    18.005941970                  0      i915/whoami/ 

    19.006313427                  0      i915/whoami/ 

    20.006676048                  0      i915/whoami/ 

    21.007059927                  0      i915/whoami/ 

    22.007507818                  0      i915/whoami/ 

    23.007887628                  0      i915/whoami/ 

    24.008207035                  0      i915/whoami/ 

    25.008580496                  0      i915/whoami/ 

# time counts unit events

    26.008949236                  0      i915/whoami/ 

    27.009433473                  0      i915/whoami/ 
# gfxbench trex starting up
    28.009677600              2,605      i915/whoami/ 

    29.009941972                716      i915/whoami/ 

    30.010127588              2,190      i915/whoami/ 

    31.010249535                 46      i915/whoami/ 

    32.010383565                 36      i915/whoami/ 

    33.010527674                  0      i915/whoami/ 
# trex running
    34.010760584              4,709      i915/whoami/ 

    35.011079891              5,381      i915/whoami/ 

    36.011280234              5,306      i915/whoami/ 

    37.011719986              5,505      i915/whoami/ 

    38.012017531              5,386      i915/whoami/ 

    39.012529241              5,687      i915/whoami/ 

    40.012922986              6,009      i915/whoami/ 

    41.013120143              5,791      i915/whoami/ 

    42.013399982              5,296      i915/whoami/ 

    43.013712979              5,349      i915/whoami/ 

    44.014107375              5,127      i915/whoami/ 

    45.014553950              5,387      i915/whoami/ 

    46.014953020              5,364      i915/whoami/ 

    47.015243748              4,738      i915/whoami/ 

    48.015560460              4,788      i915/whoami/ 

    49.015867395              4,927      i915/whoami/ 

    50.016152690              4,886      i915/whoami/ 

So.. I am not saying these particular registers are mega important, and not even saying that these 5k/s conditionals are measurable (either as branches or increased code size effect), but overall the situation is a bit of.. bleurgh from the elegance point of view. :(

If we have register sets which are 100% mutually exclusive, then I see them as candidates to put them in some object at probe time. It doesn't have to be device_info but I don't see why we wouldn't do it. It is just a different flavour of the vfunc approach after all.

Regards,

Tvrtko

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

maintainer
#8 lore raw
Quoted 172 lines · Tvrtko Ursulin
Quoted 28 lines · Jani Nikula
Quoted 24 lines · Chris Wilson

Quoting Sagar Arun Kamble (2017-10-24 11:41:13)

Quoted 9 lines
drivers/gpu/drm/i915/intel_device_info.c +1 -0
index 875d428..d1a4911 100644
@@ -462,4 +462,15 @@ void intel_device_info_runtime_init(struct drm_i915_private *dev_priv)
                          info->sseu.has_subslice_pg ? "y" : "n");
         DRM_DEBUG_DRIVER("has EU power gating: %s\n",
                          info->sseu.has_eu_pg ? "y" : "n");
+

drivers/gpu/drm/i915/intel_device_info.c void intel_device_info_runtime_init(struct drm_i915_private *dev_priv) · line 475

Quoted 10 lines
drivers/gpu/drm/i915/intel_device_info.c +10 -0
+       /* Initialize PM interrupt register offsets */
+       if (INTEL_GEN(dev_priv) >= 8) {
+               info->pm_iir_offset = GEN8_GT_IIR(2);
+               info->pm_imr_offset = GEN8_GT_IMR(2);
+               info->pm_ier_offset = GEN8_GT_IER(2);
+       } else {
+               info->pm_iir_offset = GEN6_PMIIR;
+               info->pm_imr_offset = GEN6_PMIMR;
+               info->pm_ier_offset = GEN6_PMIER;
+       }

If you are going to take another pass at this, move these into the static tables in i915_pci.c

Quoted 2 lines

Updating GEN6_FEATURES and GEN8_FEATURES will then percolate into individual platform defines.

Quoted 7 lines

Like I wrote in reply to v1, I'm not convinced we should do this at all.

What makes *these* registers so important they must be in device info? What makes most of i915_reg.h so unimportant they don't deserve the same treatment? Where do you draw the line?

I'd draw the line at, no registers at device info.

I suggested to Sagar this change during review so feel responsible to chime in.

So in general I just find the amount of times our driver asks itself what it's running on a bit tasteless. :(

I did quick and dirty check by bumping a counter in all the IS_this|or|that checks, all which can be known at driver probe time, and wired it up to the PMU so I can check their frequency. The annotated perf stat output:

root@e31:~# perf stat -a -e i915/whoami/ -I 1000
#           time             counts unit events
# idle system no X running
      1.000298100                 10      i915/whoami/ 

      2.000750955                  8      i915/whoami/ 

      3.001104193                 10      i915/whoami/ 

      4.001333433                 10      i915/whoami/ 

      5.001703162                 10      i915/whoami/ 

      6.002122721                 10      i915/whoami/ 
# starting X now..
      7.002266228              2,203      i915/whoami/ 

      8.002392598              4,682      i915/whoami/ 

      9.002764398                  0      i915/whoami/ 

     10.003027119                  0      i915/whoami/ 

     11.003486048                 42      i915/whoami/ 

# X idling..

     12.003854660                  0      i915/whoami/ 

     13.004221680                  0      i915/whoami/ 

     14.004622571                  0      i915/whoami/ 

     15.004968110                  0      i915/whoami/ 

     16.005372363                  0      i915/whoami/ 

     17.005778034                  0      i915/whoami/ 

     18.005941970                  0      i915/whoami/ 

     19.006313427                  0      i915/whoami/ 

     20.006676048                  0      i915/whoami/ 

     21.007059927                  0      i915/whoami/ 

     22.007507818                  0      i915/whoami/ 

     23.007887628                  0      i915/whoami/ 

     24.008207035                  0      i915/whoami/ 

     25.008580496                  0      i915/whoami/ 

# time counts unit events

     26.008949236                  0      i915/whoami/ 

     27.009433473                  0      i915/whoami/ 
# gfxbench trex starting up
     28.009677600              2,605      i915/whoami/ 

     29.009941972                716      i915/whoami/ 

     30.010127588              2,190      i915/whoami/ 

     31.010249535                 46      i915/whoami/ 

     32.010383565                 36      i915/whoami/ 

     33.010527674                  0      i915/whoami/ 
# trex running
     34.010760584              4,709      i915/whoami/ 

     35.011079891              5,381      i915/whoami/ 

     36.011280234              5,306      i915/whoami/ 

     37.011719986              5,505      i915/whoami/ 

     38.012017531              5,386      i915/whoami/ 

     39.012529241              5,687      i915/whoami/ 

     40.012922986              6,009      i915/whoami/ 

     41.013120143              5,791      i915/whoami/ 

     42.013399982              5,296      i915/whoami/ 

     43.013712979              5,349      i915/whoami/ 

     44.014107375              5,127      i915/whoami/ 

     45.014553950              5,387      i915/whoami/ 

     46.014953020              5,364      i915/whoami/ 

     47.015243748              4,738      i915/whoami/ 

     48.015560460              4,788      i915/whoami/ 

     49.015867395              4,927      i915/whoami/ 

     50.016152690              4,886      i915/whoami/ 

So.. I am not saying these particular registers are mega important, and not even saying that these 5k/s conditionals are measurable (either as branches or increased code size effect), but overall the situation is a bit of.. bleurgh from the elegance point of view. :(

Quoted 4 lines

If we have register sets which are 100% mutually exclusive, then I see them as candidates to put them in some object at probe time. It doesn't have to be device_info but I don't see why we wouldn't do it. It is just a different flavour of the vfunc approach after all.

I think to fix something that is inelegant, you have to have a plan to actually improve things in the long run. IMO adding a few random registers to device info without a plan is less elegant and less consistent than the status quo.

We currently have at least three ways to index pipe/port/transcoder/etc based registers. Combine that with storing some register offsets in device info, you'll have six ways. There's a chance we'll end up adding the register offsets to device info both statically and dynamically. We're already struggling with guiding new contributors to defining registers in the existing schemes.

Now, I'm sure we could spend weeks on end devising a plan how to move register offsets to device info or another structure, working out the details and bikeshedding. After that, we could do weeks and weeks of busywork converting registers, causing conflicts in all the work in our internal trees and developers' own branches, not to mention making bug fix and feature backports more painful.

I have a pretty strong feeling this is not a good use of our time.

BR,
Jani.

Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#9 lore raw
Quoted 190 lines · Jani Nikula
Quoted 172 lines · Tvrtko Ursulin
Quoted 28 lines · Jani Nikula
Quoted 24 lines · Chris Wilson

Quoting Sagar Arun Kamble (2017-10-24 11:41:13)

Quoted 9 lines
drivers/gpu/drm/i915/intel_device_info.c +1 -0
index 875d428..d1a4911 100644
@@ -462,4 +462,15 @@ void intel_device_info_runtime_init(struct drm_i915_private *dev_priv)
                           info->sseu.has_subslice_pg ? "y" : "n");
          DRM_DEBUG_DRIVER("has EU power gating: %s\n",
                           info->sseu.has_eu_pg ? "y" : "n");
+

drivers/gpu/drm/i915/intel_device_info.c void intel_device_info_runtime_init(struct drm_i915_private *dev_priv) · line 475

Quoted 10 lines
drivers/gpu/drm/i915/intel_device_info.c +10 -0
+       /* Initialize PM interrupt register offsets */
+       if (INTEL_GEN(dev_priv) >= 8) {
+               info->pm_iir_offset = GEN8_GT_IIR(2);
+               info->pm_imr_offset = GEN8_GT_IMR(2);
+               info->pm_ier_offset = GEN8_GT_IER(2);
+       } else {
+               info->pm_iir_offset = GEN6_PMIIR;
+               info->pm_imr_offset = GEN6_PMIMR;
+               info->pm_ier_offset = GEN6_PMIER;
+       }

If you are going to take another pass at this, move these into the static tables in i915_pci.c

Quoted 2 lines

Updating GEN6_FEATURES and GEN8_FEATURES will then percolate into individual platform defines.

Quoted 7 lines

Like I wrote in reply to v1, I'm not convinced we should do this at all.

What makes *these* registers so important they must be in device info? What makes most of i915_reg.h so unimportant they don't deserve the same treatment? Where do you draw the line?

I'd draw the line at, no registers at device info.

I suggested to Sagar this change during review so feel responsible to chime in.

So in general I just find the amount of times our driver asks itself what it's running on a bit tasteless. :(

I did quick and dirty check by bumping a counter in all the IS_this|or|that checks, all which can be known at driver probe time, and wired it up to the PMU so I can check their frequency. The annotated perf stat output:

root@e31:~# perf stat -a -e i915/whoami/ -I 1000
#           time             counts unit events
# idle system no X running
       1.000298100                 10      i915/whoami/

       2.000750955                  8      i915/whoami/

       3.001104193                 10      i915/whoami/

       4.001333433                 10      i915/whoami/

       5.001703162                 10      i915/whoami/

       6.002122721                 10      i915/whoami/
# starting X now..
       7.002266228              2,203      i915/whoami/

       8.002392598              4,682      i915/whoami/

       9.002764398                  0      i915/whoami/

      10.003027119                  0      i915/whoami/

      11.003486048                 42      i915/whoami/

# X idling..

      12.003854660                  0      i915/whoami/

      13.004221680                  0      i915/whoami/

      14.004622571                  0      i915/whoami/

      15.004968110                  0      i915/whoami/

      16.005372363                  0      i915/whoami/

      17.005778034                  0      i915/whoami/

      18.005941970                  0      i915/whoami/

      19.006313427                  0      i915/whoami/

      20.006676048                  0      i915/whoami/

      21.007059927                  0      i915/whoami/

      22.007507818                  0      i915/whoami/

      23.007887628                  0      i915/whoami/

      24.008207035                  0      i915/whoami/

      25.008580496                  0      i915/whoami/

# time counts unit events

      26.008949236                  0      i915/whoami/

      27.009433473                  0      i915/whoami/
# gfxbench trex starting up
      28.009677600              2,605      i915/whoami/

      29.009941972                716      i915/whoami/

      30.010127588              2,190      i915/whoami/

      31.010249535                 46      i915/whoami/

      32.010383565                 36      i915/whoami/

      33.010527674                  0      i915/whoami/
# trex running
      34.010760584              4,709      i915/whoami/

      35.011079891              5,381      i915/whoami/

      36.011280234              5,306      i915/whoami/

      37.011719986              5,505      i915/whoami/

      38.012017531              5,386      i915/whoami/

      39.012529241              5,687      i915/whoami/

      40.012922986              6,009      i915/whoami/

      41.013120143              5,791      i915/whoami/

      42.013399982              5,296      i915/whoami/

      43.013712979              5,349      i915/whoami/

      44.014107375              5,127      i915/whoami/

      45.014553950              5,387      i915/whoami/

      46.014953020              5,364      i915/whoami/

      47.015243748              4,738      i915/whoami/

      48.015560460              4,788      i915/whoami/

      49.015867395              4,927      i915/whoami/

      50.016152690              4,886      i915/whoami/

So.. I am not saying these particular registers are mega important, and not even saying that these 5k/s conditionals are measurable (either as branches or increased code size effect), but overall the situation is a bit of.. bleurgh from the elegance point of view. :(

Quoted 4 lines

If we have register sets which are 100% mutually exclusive, then I see them as candidates to put them in some object at probe time. It doesn't have to be device_info but I don't see why we wouldn't do it. It is just a different flavour of the vfunc approach after all.

I think to fix something that is inelegant, you have to have a plan to actually improve things in the long run. IMO adding a few random registers to device info without a plan is less elegant and less consistent than the status quo.

We currently have at least three ways to index pipe/port/transcoder/etc based registers. Combine that with storing some register offsets in device info, you'll have six ways. There's a chance we'll end up adding the register offsets to device info both statically and dynamically. We're already struggling with guiding new contributors to defining registers in the existing schemes.

Quoted 8 lines

Now, I'm sure we could spend weeks on end devising a plan how to move register offsets to device info or another structure, working out the details and bikeshedding. After that, we could do weeks and weeks of busywork converting registers, causing conflicts in all the work in our internal trees and developers' own branches, not to mention making bug fix and feature backports more painful.

I have a pretty strong feeling this is not a good use of our time.

I can only read here a dislike of a big rework (which I did not suggest to start with), and dislike of the piecemeal changes. So basically preference for a status quo. And there will be more and more of such checks. So today it is 5k/sec, in a year it might be more.

So to clarify. Do you actually oppose some subsystem/area moving some registers to any data structure, or just to device info?

Do you have a suggestion on what we could do? Or you simply think this is a complete non-issue?

Regards,

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

maintainer
#10 lore raw
Quoted 198 lines · Tvrtko Ursulin
Quoted 197 lines · Jani Nikula
Quoted 172 lines · Tvrtko Ursulin
Quoted 28 lines · Jani Nikula
Quoted 24 lines · Chris Wilson

Quoting Sagar Arun Kamble (2017-10-24 11:41:13)

Quoted 9 lines
drivers/gpu/drm/i915/intel_device_info.c +1 -0
index 875d428..d1a4911 100644
@@ -462,4 +462,15 @@ void intel_device_info_runtime_init(struct drm_i915_private *dev_priv)
                           info->sseu.has_subslice_pg ? "y" : "n");
          DRM_DEBUG_DRIVER("has EU power gating: %s\n",
                           info->sseu.has_eu_pg ? "y" : "n");
+

drivers/gpu/drm/i915/intel_device_info.c void intel_device_info_runtime_init(struct drm_i915_private *dev_priv) · line 475

Quoted 10 lines
drivers/gpu/drm/i915/intel_device_info.c +10 -0
+       /* Initialize PM interrupt register offsets */
+       if (INTEL_GEN(dev_priv) >= 8) {
+               info->pm_iir_offset = GEN8_GT_IIR(2);
+               info->pm_imr_offset = GEN8_GT_IMR(2);
+               info->pm_ier_offset = GEN8_GT_IER(2);
+       } else {
+               info->pm_iir_offset = GEN6_PMIIR;
+               info->pm_imr_offset = GEN6_PMIMR;
+               info->pm_ier_offset = GEN6_PMIER;
+       }

If you are going to take another pass at this, move these into the static tables in i915_pci.c

Quoted 2 lines

Updating GEN6_FEATURES and GEN8_FEATURES will then percolate into individual platform defines.

Quoted 7 lines

Like I wrote in reply to v1, I'm not convinced we should do this at all.

What makes *these* registers so important they must be in device info? What makes most of i915_reg.h so unimportant they don't deserve the same treatment? Where do you draw the line?

I'd draw the line at, no registers at device info.

I suggested to Sagar this change during review so feel responsible to chime in.

So in general I just find the amount of times our driver asks itself what it's running on a bit tasteless. :(

I did quick and dirty check by bumping a counter in all the IS_this|or|that checks, all which can be known at driver probe time, and wired it up to the PMU so I can check their frequency. The annotated perf stat output:

root@e31:~# perf stat -a -e i915/whoami/ -I 1000
#           time             counts unit events
# idle system no X running
       1.000298100                 10      i915/whoami/

       2.000750955                  8      i915/whoami/

       3.001104193                 10      i915/whoami/

       4.001333433                 10      i915/whoami/

       5.001703162                 10      i915/whoami/

       6.002122721                 10      i915/whoami/
# starting X now..
       7.002266228              2,203      i915/whoami/

       8.002392598              4,682      i915/whoami/

       9.002764398                  0      i915/whoami/

      10.003027119                  0      i915/whoami/

      11.003486048                 42      i915/whoami/

# X idling..

      12.003854660                  0      i915/whoami/

      13.004221680                  0      i915/whoami/

      14.004622571                  0      i915/whoami/

      15.004968110                  0      i915/whoami/

      16.005372363                  0      i915/whoami/

      17.005778034                  0      i915/whoami/

      18.005941970                  0      i915/whoami/

      19.006313427                  0      i915/whoami/

      20.006676048                  0      i915/whoami/

      21.007059927                  0      i915/whoami/

      22.007507818                  0      i915/whoami/

      23.007887628                  0      i915/whoami/

      24.008207035                  0      i915/whoami/

      25.008580496                  0      i915/whoami/

# time counts unit events

      26.008949236                  0      i915/whoami/

      27.009433473                  0      i915/whoami/
# gfxbench trex starting up
      28.009677600              2,605      i915/whoami/

      29.009941972                716      i915/whoami/

      30.010127588              2,190      i915/whoami/

      31.010249535                 46      i915/whoami/

      32.010383565                 36      i915/whoami/

      33.010527674                  0      i915/whoami/
# trex running
      34.010760584              4,709      i915/whoami/

      35.011079891              5,381      i915/whoami/

      36.011280234              5,306      i915/whoami/

      37.011719986              5,505      i915/whoami/

      38.012017531              5,386      i915/whoami/

      39.012529241              5,687      i915/whoami/

      40.012922986              6,009      i915/whoami/

      41.013120143              5,791      i915/whoami/

      42.013399982              5,296      i915/whoami/

      43.013712979              5,349      i915/whoami/

      44.014107375              5,127      i915/whoami/

      45.014553950              5,387      i915/whoami/

      46.014953020              5,364      i915/whoami/

      47.015243748              4,738      i915/whoami/

      48.015560460              4,788      i915/whoami/

      49.015867395              4,927      i915/whoami/

      50.016152690              4,886      i915/whoami/

So.. I am not saying these particular registers are mega important, and not even saying that these 5k/s conditionals are measurable (either as branches or increased code size effect), but overall the situation is a bit of.. bleurgh from the elegance point of view. :(

Quoted 4 lines

If we have register sets which are 100% mutually exclusive, then I see them as candidates to put them in some object at probe time. It doesn't have to be device_info but I don't see why we wouldn't do it. It is just a different flavour of the vfunc approach after all.

I think to fix something that is inelegant, you have to have a plan to actually improve things in the long run. IMO adding a few random registers to device info without a plan is less elegant and less consistent than the status quo.

We currently have at least three ways to index pipe/port/transcoder/etc based registers. Combine that with storing some register offsets in device info, you'll have six ways. There's a chance we'll end up adding the register offsets to device info both statically and dynamically. We're already struggling with guiding new contributors to defining registers in the existing schemes.

Now, I'm sure we could spend weeks on end devising a plan how to move register offsets to device info or another structure, working out the details and bikeshedding. After that, we could do weeks and weeks of busywork converting registers, causing conflicts in all the work in our internal trees and developers' own branches, not to mention making bug fix and feature backports more painful.

Quoted 4 lines
Quoted 1 line

I have a pretty strong feeling this is not a good use of our time.

I can only read here a dislike of a big rework (which I did not suggest to start with), and dislike of the piecemeal changes.

Any change would have to be piecemeal anyway. I don't have a dislike for that per se. I'm just saying that adding some registers to some data structures on a whim leads to an ugly inconsistent end result, and it gets cargo-culted to more and more places, uncontrolled. The driver will become harder to maintain. The changes must be done piecemeal, but there needs to be a plan where we want to take all this in the long term.

And that plan is going to be an awful bikeshed fest.

Quoted 3 lines

So basically preference for a status quo. And there will be more and more of such checks. So today it is 5k/sec, in a year it might be more.

Even with cached register offsets you'll anyway be doing 5k fetches of the cached offsets per second. Sure you'll save a branch and couple of immediates in code, but I can't imagine it being a huge penalty.

Quoted 5 lines

So to clarify. Do you actually oppose some subsystem/area moving some registers to any data structure, or just to device info?

Do you have a suggestion on what we could do? Or you simply think this is a complete non-issue?

This is not a non-issue, but, to be quite honest, I'd rather see people go to bugzilla and fix a dozen actual issues that are hitting CI or end users out there, today.

BR,
Jani.

Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
maintainer
#11 lore raw
Quoted 224 lines · Jani Nikula
Quoted 198 lines · Tvrtko Ursulin
Quoted 197 lines · Jani Nikula
Quoted 172 lines · Tvrtko Ursulin
Quoted 28 lines · Jani Nikula
Quoted 24 lines · Chris Wilson

Quoting Sagar Arun Kamble (2017-10-24 11:41:13)

Quoted 9 lines
drivers/gpu/drm/i915/intel_device_info.c +1 -0
index 875d428..d1a4911 100644
@@ -462,4 +462,15 @@ void intel_device_info_runtime_init(struct drm_i915_private *dev_priv)
                           info->sseu.has_subslice_pg ? "y" : "n");
          DRM_DEBUG_DRIVER("has EU power gating: %s\n",
                           info->sseu.has_eu_pg ? "y" : "n");
+

drivers/gpu/drm/i915/intel_device_info.c void intel_device_info_runtime_init(struct drm_i915_private *dev_priv) · line 475

Quoted 10 lines
drivers/gpu/drm/i915/intel_device_info.c +10 -0
+       /* Initialize PM interrupt register offsets */
+       if (INTEL_GEN(dev_priv) >= 8) {
+               info->pm_iir_offset = GEN8_GT_IIR(2);
+               info->pm_imr_offset = GEN8_GT_IMR(2);
+               info->pm_ier_offset = GEN8_GT_IER(2);
+       } else {
+               info->pm_iir_offset = GEN6_PMIIR;
+               info->pm_imr_offset = GEN6_PMIMR;
+               info->pm_ier_offset = GEN6_PMIER;
+       }

If you are going to take another pass at this, move these into the static tables in i915_pci.c

Quoted 2 lines

Updating GEN6_FEATURES and GEN8_FEATURES will then percolate into individual platform defines.

Quoted 7 lines

Like I wrote in reply to v1, I'm not convinced we should do this at all.

What makes *these* registers so important they must be in device info? What makes most of i915_reg.h so unimportant they don't deserve the same treatment? Where do you draw the line?

I'd draw the line at, no registers at device info.

I suggested to Sagar this change during review so feel responsible to chime in.

So in general I just find the amount of times our driver asks itself what it's running on a bit tasteless. :(

I did quick and dirty check by bumping a counter in all the IS_this|or|that checks, all which can be known at driver probe time, and wired it up to the PMU so I can check their frequency. The annotated perf stat output:

root@e31:~# perf stat -a -e i915/whoami/ -I 1000
#           time             counts unit events
# idle system no X running
       1.000298100                 10      i915/whoami/

       2.000750955                  8      i915/whoami/

       3.001104193                 10      i915/whoami/

       4.001333433                 10      i915/whoami/

       5.001703162                 10      i915/whoami/

       6.002122721                 10      i915/whoami/
# starting X now..
       7.002266228              2,203      i915/whoami/

       8.002392598              4,682      i915/whoami/

       9.002764398                  0      i915/whoami/

      10.003027119                  0      i915/whoami/

      11.003486048                 42      i915/whoami/

# X idling..

      12.003854660                  0      i915/whoami/

      13.004221680                  0      i915/whoami/

      14.004622571                  0      i915/whoami/

      15.004968110                  0      i915/whoami/

      16.005372363                  0      i915/whoami/

      17.005778034                  0      i915/whoami/

      18.005941970                  0      i915/whoami/

      19.006313427                  0      i915/whoami/

      20.006676048                  0      i915/whoami/

      21.007059927                  0      i915/whoami/

      22.007507818                  0      i915/whoami/

      23.007887628                  0      i915/whoami/

      24.008207035                  0      i915/whoami/

      25.008580496                  0      i915/whoami/

# time counts unit events

      26.008949236                  0      i915/whoami/

      27.009433473                  0      i915/whoami/
# gfxbench trex starting up
      28.009677600              2,605      i915/whoami/

      29.009941972                716      i915/whoami/

      30.010127588              2,190      i915/whoami/

      31.010249535                 46      i915/whoami/

      32.010383565                 36      i915/whoami/

      33.010527674                  0      i915/whoami/
# trex running
      34.010760584              4,709      i915/whoami/

      35.011079891              5,381      i915/whoami/

      36.011280234              5,306      i915/whoami/

      37.011719986              5,505      i915/whoami/

      38.012017531              5,386      i915/whoami/

      39.012529241              5,687      i915/whoami/

      40.012922986              6,009      i915/whoami/

      41.013120143              5,791      i915/whoami/

      42.013399982              5,296      i915/whoami/

      43.013712979              5,349      i915/whoami/

      44.014107375              5,127      i915/whoami/

      45.014553950              5,387      i915/whoami/

      46.014953020              5,364      i915/whoami/

      47.015243748              4,738      i915/whoami/

      48.015560460              4,788      i915/whoami/

      49.015867395              4,927      i915/whoami/

      50.016152690              4,886      i915/whoami/

So.. I am not saying these particular registers are mega important, and not even saying that these 5k/s conditionals are measurable (either as branches or increased code size effect), but overall the situation is a bit of.. bleurgh from the elegance point of view. :(

Quoted 4 lines

If we have register sets which are 100% mutually exclusive, then I see them as candidates to put them in some object at probe time. It doesn't have to be device_info but I don't see why we wouldn't do it. It is just a different flavour of the vfunc approach after all.

I think to fix something that is inelegant, you have to have a plan to actually improve things in the long run. IMO adding a few random registers to device info without a plan is less elegant and less consistent than the status quo.

We currently have at least three ways to index pipe/port/transcoder/etc based registers. Combine that with storing some register offsets in device info, you'll have six ways. There's a chance we'll end up adding the register offsets to device info both statically and dynamically. We're already struggling with guiding new contributors to defining registers in the existing schemes.

Now, I'm sure we could spend weeks on end devising a plan how to move register offsets to device info or another structure, working out the details and bikeshedding. After that, we could do weeks and weeks of busywork converting registers, causing conflicts in all the work in our internal trees and developers' own branches, not to mention making bug fix and feature backports more painful.

Quoted 4 lines
Quoted 1 line

I have a pretty strong feeling this is not a good use of our time.

I can only read here a dislike of a big rework (which I did not suggest to start with), and dislike of the piecemeal changes.

Any change would have to be piecemeal anyway. I don't have a dislike for that per se. I'm just saying that adding some registers to some data structures on a whim leads to an ugly inconsistent end result, and it gets cargo-culted to more and more places, uncontrolled. The driver will become harder to maintain. The changes must be done piecemeal, but there needs to be a plan where we want to take all this in the long term.

And that plan is going to be an awful bikeshed fest.

Quoted 3 lines

So basically preference for a status quo. And there will be more and more of such checks. So today it is 5k/sec, in a year it might be more.

Even with cached register offsets you'll anyway be doing 5k fetches of the cached offsets per second. Sure you'll save a branch and couple of immediates in code, but I can't imagine it being a huge penalty.

Quoted 3 lines

So to clarify. Do you actually oppose some subsystem/area moving some registers to any data structure, or just to device info?

Quoted 6 lines
Quoted 2 lines

Do you have a suggestion on what we could do? Or you simply think this is a complete non-issue?

This is not a non-issue, but, to be quite honest, I'd rather see people go to bugzilla and fix a dozen actual issues that are hitting CI or end users out there, today.

As to the registers in question which apparently do get accessed a lot, I'd go with what Ville suggests in [1]. Fits our existing models, doesn't introduce anything new, addresses the issue.

BR,
Jani.

[1] http://mid.mail-archive.com/[email protected]

Quoted 4 lines

BR,
Jani.

Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx