public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Intel-gfx@lists.freedesktop.org
Subject: [PATCH 18/21] drm/i915: Convert i915_gem_init_hw to uncore
Date: Thu,  6 Jun 2019 10:36:36 +0100	[thread overview]
Message-ID: <20190606093639.9372-19-tvrtko.ursulin@linux.intel.com> (raw)
In-Reply-To: <20190606093639.9372-1-tvrtko.ursulin@linux.intel.com>

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

More removal of implicit dev_priv from using old mmio accessors.

Actually the top level function remains but is split into a part which
writes to i915 and part which operates on uncore to initialize the
hardware.

GuC and engines are the only odd ones out remaining.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
---
 drivers/gpu/drm/i915/i915_gem.c | 62 +++++++++++++++++++--------------
 1 file changed, 36 insertions(+), 26 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 1c5e6c1a5360..d2b185aa4338 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -1258,28 +1258,29 @@ static void init_unused_rings(struct intel_uncore *uncore)
 	}
 }
 
-int i915_gem_init_hw(struct drm_i915_private *dev_priv)
+static int init_hw(struct intel_uncore *uncore)
 {
+	struct drm_i915_private *i915 = uncore_to_i915(uncore);
 	int ret;
 
-	dev_priv->gt.last_init_time = ktime_get();
-
 	/* Double layer security blanket, see i915_gem_init() */
-	intel_uncore_forcewake_get(&dev_priv->uncore, FORCEWAKE_ALL);
+	intel_uncore_forcewake_get(uncore, FORCEWAKE_ALL);
 
-	if (HAS_EDRAM(dev_priv) && INTEL_GEN(dev_priv) < 9)
-		I915_WRITE(HSW_IDICR, I915_READ(HSW_IDICR) | IDIHASHMSK(0xf));
+	if (HAS_EDRAM(i915) && INTEL_GEN(i915) < 9)
+		intel_uncore_rmw(uncore, HSW_IDICR, 0, IDIHASHMSK(0xf));
 
-	if (IS_HASWELL(dev_priv))
-		I915_WRITE(MI_PREDICATE_RESULT_2, IS_HSW_GT3(dev_priv) ?
-			   LOWER_SLICE_ENABLED : LOWER_SLICE_DISABLED);
+	if (IS_HASWELL(i915))
+		intel_uncore_write(uncore,
+				   MI_PREDICATE_RESULT_2,
+				   IS_HSW_GT3(i915) ?
+				   LOWER_SLICE_ENABLED : LOWER_SLICE_DISABLED);
 
 	/* Apply the GT workarounds... */
-	intel_gt_apply_workarounds(&dev_priv->uncore);
+	intel_gt_apply_workarounds(uncore);
 	/* ...and determine whether they are sticking. */
-	intel_gt_verify_workarounds(&dev_priv->uncore, "init");
+	intel_gt_verify_workarounds(uncore, "init");
 
-	i915_gem_init_swizzling(&dev_priv->uncore);
+	i915_gem_init_swizzling(uncore);
 
 	/*
 	 * At least 830 can leave some of the unused rings
@@ -1287,51 +1288,60 @@ 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->uncore);
-
-	BUG_ON(!dev_priv->kernel_context);
-	ret = i915_terminally_wedged(dev_priv);
-	if (ret)
-		goto out;
+	init_unused_rings(uncore);
 
-	ret = i915_ppgtt_init_hw(&dev_priv->uncore);
+	ret = i915_ppgtt_init_hw(uncore);
 	if (ret) {
 		DRM_ERROR("Enabling PPGTT failed (%d)\n", ret);
 		goto out;
 	}
 
-	ret = intel_wopcm_init_hw(&dev_priv->wopcm);
+	ret = intel_wopcm_init_hw(&i915->wopcm);
 	if (ret) {
 		DRM_ERROR("Enabling WOPCM failed (%d)\n", ret);
 		goto out;
 	}
 
 	/* We can't enable contexts until all firmware is loaded */
-	ret = intel_uc_init_hw(dev_priv);
+	ret = intel_uc_init_hw(i915);
 	if (ret) {
 		DRM_ERROR("Enabling uc failed (%d)\n", ret);
 		goto out;
 	}
 
-	intel_mocs_init_l3cc_table(&dev_priv->uncore);
+	intel_mocs_init_l3cc_table(uncore);
 
 	/* Only when the HW is re-initialised, can we replay the requests */
-	ret = intel_engines_resume(dev_priv);
+	ret = intel_engines_resume(i915);
 	if (ret)
 		goto cleanup_uc;
 
-	intel_uncore_forcewake_put(&dev_priv->uncore, FORCEWAKE_ALL);
+	intel_uncore_forcewake_put(uncore, FORCEWAKE_ALL);
 
 	return 0;
 
 cleanup_uc:
-	intel_uc_fini_hw(dev_priv);
+	intel_uc_fini_hw(i915);
 out:
-	intel_uncore_forcewake_put(&dev_priv->uncore, FORCEWAKE_ALL);
+	intel_uncore_forcewake_put(uncore, FORCEWAKE_ALL);
 
 	return ret;
 }
 
+int i915_gem_init_hw(struct drm_i915_private *i915)
+{
+	int ret;
+
+	i915->gt.last_init_time = ktime_get();
+
+	BUG_ON(!i915->kernel_context);
+	ret = i915_terminally_wedged(i915);
+	if (ret)
+		return ret;
+
+	return init_hw(&i915->uncore);
+}
+
 static int __intel_engines_record_defaults(struct drm_i915_private *i915)
 {
 	struct intel_engine_cs *engine;
-- 
2.20.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2019-06-06  9:37 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-06  9:36 [PATCH 00/21] Implicit dev_priv removal Tvrtko Ursulin
2019-06-06  9:36 ` [PATCH 01/21] drm/i915: Reset only affected engines when handling error capture Tvrtko Ursulin
2019-06-06  9:44   ` Chris Wilson
2019-06-06  9:49     ` Tvrtko Ursulin
2019-06-06  9:36 ` [PATCH 02/21] drm/i915: Tidy engine mask types in hangcheck Tvrtko Ursulin
2019-06-06  9:45   ` Chris Wilson
2019-06-06  9:36 ` [PATCH 03/21] drm/i915: Make Gen6/7 RING_FAULT_REG access engine centric Tvrtko Ursulin
2019-06-06  9:47   ` Chris Wilson
2019-06-06  9:36 ` [PATCH 04/21] drm/i915: Extract engine fault reset to a helper Tvrtko Ursulin
2019-06-06  9:48   ` Chris Wilson
2019-06-06  9:36 ` [PATCH 05/21] drm/i915: Make i915_clear_error_registers take uncore Tvrtko Ursulin
2019-06-06  9:50   ` Chris Wilson
2019-06-06  9:51     ` Chris Wilson
2019-06-06 10:29     ` Tvrtko Ursulin
2019-06-06  9:36 ` [PATCH 06/21] drm/i915: Convert some more bits to use engine mmio accessors Tvrtko Ursulin
2019-06-06  9:53   ` Chris Wilson
2019-06-06  9:36 ` [PATCH 07/21] drm/i915: Make read_subslice_reg take uncore Tvrtko Ursulin
2019-06-06  9:54   ` Chris Wilson
2019-06-06  9:36 ` [PATCH 08/21] drm/i915: Tidy intel_execlists_submission_init Tvrtko Ursulin
2019-06-06  9:55   ` Chris Wilson
2019-06-06  9:36 ` [PATCH 09/21] drm/i915: Make i915_check_and_clear_faults take uncore Tvrtko Ursulin
2019-06-06  9:57   ` Chris Wilson
2019-06-06 10:31     ` Tvrtko Ursulin
2019-06-06  9:36 ` [PATCH 10/21] drm/i915: Move scheduler caps init to i915_gem_init Tvrtko Ursulin
2019-06-06  9:59   ` Chris Wilson
2019-06-06  9:36 ` [PATCH 11/21] drm/i915: Remove impossible path from i915_gem_init_swizzling Tvrtko Ursulin
2019-06-06 10:01   ` Chris Wilson
2019-06-06 10:23     ` Tvrtko Ursulin
2019-06-06  9:36 ` [PATCH 12/21] drm/i915: Convert i915_gem_init_swizzling to uncore Tvrtko Ursulin
2019-06-06  9:36 ` [PATCH 13/21] drm/i915: Convert init_unused_rings " Tvrtko Ursulin
2019-06-06  9:36 ` [PATCH 14/21] drm/i915: Convert gt workarounds " Tvrtko Ursulin
2019-06-06  9:36 ` [PATCH 15/21] drm/i915: Convert intel_mocs_init_l3cc_table " Tvrtko Ursulin
2019-06-06  9:36 ` [PATCH 16/21] drm/i915: Convert i915_ppgtt_init_hw " Tvrtko Ursulin
2019-06-06  9:36 ` [PATCH 17/21] drm/i915: Consolidate some open coded mmio rmw Tvrtko Ursulin
2019-06-06 13:46   ` Rodrigo Vivi
2019-06-06  9:36 ` Tvrtko Ursulin [this message]
2019-06-06  9:36 ` [PATCH 19/21] drm/i915: Convert intel_vgt_(de)balloon to uncore Tvrtko Ursulin
2019-06-06  9:36 ` [PATCH 20/21] drm/i915: Make GuC GGTT reservation work on ggtt Tvrtko Ursulin
2019-06-06 11:58   ` Michal Wajdeczko
2019-06-06 12:23     ` Tvrtko Ursulin
2019-06-06 13:21       ` Michal Wajdeczko
2019-06-06 13:44   ` Rodrigo Vivi
2019-06-06  9:36 ` [PATCH 21/21] drm/i915: Unexport i915_gem_init/fini_aliasing_ppgtt Tvrtko Ursulin
2019-06-06 13:39   ` Rodrigo Vivi
2019-06-06 10:05 ` [PATCH 00/21] Implicit dev_priv removal Chris Wilson
2019-06-06 10:35   ` Tvrtko Ursulin
2019-06-06 10:10 ` ✗ Fi.CI.CHECKPATCH: warning for " Patchwork
2019-06-06 10:19 ` ✗ Fi.CI.SPARSE: " Patchwork
2019-06-06 12:42 ` ✓ Fi.CI.BAT: success " Patchwork
2019-06-08 15:11 ` ✗ Fi.CI.IGT: failure " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190606093639.9372-19-tvrtko.ursulin@linux.intel.com \
    --to=tvrtko.ursulin@linux.intel.com \
    --cc=Intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox