[Intel-gfx] [PATCH 13/21] drm/i915: Convert init_unused_rings to uncore

Tvrtko Ursulin tvrtko.ursulin at linux.intel.com
Thu Jun 6 09:36:31 UTC 2019


From: Tvrtko Ursulin <tvrtko.ursulin at intel.com>

More removal of implicit dev_priv from using old mmio accessors.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
---
 drivers/gpu/drm/i915/i915_gem.c | 40 +++++++++++++++++----------------
 1 file changed, 21 insertions(+), 19 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index f5bf1fe208a6..4cffa7bea582 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -1231,28 +1231,30 @@ void i915_gem_init_swizzling(struct intel_uncore *uncore)
 		MISSING_CASE(INTEL_GEN(i915));
 }
 
-static void init_unused_ring(struct drm_i915_private *dev_priv, u32 base)
+static void init_unused_ring(struct intel_uncore *uncore, u32 base)
 {
-	I915_WRITE(RING_CTL(base), 0);
-	I915_WRITE(RING_HEAD(base), 0);
-	I915_WRITE(RING_TAIL(base), 0);
-	I915_WRITE(RING_START(base), 0);
+	intel_uncore_write(uncore, RING_CTL(base), 0);
+	intel_uncore_write(uncore, RING_HEAD(base), 0);
+	intel_uncore_write(uncore, RING_TAIL(base), 0);
+	intel_uncore_write(uncore, RING_START(base), 0);
 }
 
-static void init_unused_rings(struct drm_i915_private *dev_priv)
+static void init_unused_rings(struct intel_uncore *uncore)
 {
-	if (IS_I830(dev_priv)) {
-		init_unused_ring(dev_priv, PRB1_BASE);
-		init_unused_ring(dev_priv, SRB0_BASE);
-		init_unused_ring(dev_priv, SRB1_BASE);
-		init_unused_ring(dev_priv, SRB2_BASE);
-		init_unused_ring(dev_priv, SRB3_BASE);
-	} else if (IS_GEN(dev_priv, 2)) {
-		init_unused_ring(dev_priv, SRB0_BASE);
-		init_unused_ring(dev_priv, SRB1_BASE);
-	} else if (IS_GEN(dev_priv, 3)) {
-		init_unused_ring(dev_priv, PRB1_BASE);
-		init_unused_ring(dev_priv, PRB2_BASE);
+	struct drm_i915_private *i915 = uncore_to_i915(uncore);
+
+	if (IS_I830(i915)) {
+		init_unused_ring(uncore, PRB1_BASE);
+		init_unused_ring(uncore, SRB0_BASE);
+		init_unused_ring(uncore, SRB1_BASE);
+		init_unused_ring(uncore, SRB2_BASE);
+		init_unused_ring(uncore, SRB3_BASE);
+	} else if (IS_GEN(i915, 2)) {
+		init_unused_ring(uncore, SRB0_BASE);
+		init_unused_ring(uncore, SRB1_BASE);
+	} else if (IS_GEN(i915, 3)) {
+		init_unused_ring(uncore, PRB1_BASE);
+		init_unused_ring(uncore, PRB2_BASE);
 	}
 }
 
@@ -1285,7 +1287,7 @@ int i915_gem_init_hw(struct drm_i915_private *dev_priv)
 	 * will prevent c3 entry. Makes sure all unused rings
 	 * are totally idle.
 	 */
-	init_unused_rings(dev_priv);
+	init_unused_rings(&dev_priv->uncore);
 
 	BUG_ON(!dev_priv->kernel_context);
 	ret = i915_terminally_wedged(dev_priv);
-- 
2.20.1



More information about the Intel-gfx mailing list