Skip to contentSkip to conversation

drm/i915: Split execlists hardware status page initialisation from setup

PATCH In review Tvrtko Ursulin 3 participants 5 messages Apr 12, 2016 – Apr 13, 2016

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

PATCH 1/2 drm/i915: Split execlists hardware status page initialisation from setup

From: Tvrtko Ursulin <[email protected]>

Split the hardware status page into setup and initialisation, where setup means setting up the driver state to support the engine, and initialization means programming the hardware with the before set up state.

This way the design matches the design of the engine setup/init code which is split in the same fashion and it enables the stages to be used in a balanced fashion (engine setup - hws setup, engine init - hws init).

This will enable the upcoming improvements to slot in without any kludges on the GPU reset path.

---
 drivers/gpu/drm/i915/intel_lrc.c | 50 ++++++++++++++++++++++------------------
 1 file changed, 27 insertions(+), 23 deletions(-)
drivers/gpu/drm/i915/intel_lrc.c +27 -23
index e6e69c2f2386..3fd2ae6ce8e7 100644
@@ -229,9 +229,6 @@ enum {
 
 static int intel_lr_context_pin(struct intel_context *ctx,
 				struct intel_engine_cs *engine);
-static void lrc_setup_hardware_status_page(struct intel_engine_cs *engine,
-					   struct drm_i915_gem_object *default_ctx_obj);
-
 
 /**
  * intel_sanitize_enable_execlists() - sanitize i915.enable_execlists
@@ -1580,14 +1577,22 @@ out:
 	return ret;
 }
 
+static void lrc_init_hws(struct intel_engine_cs *engine)
+{
+	struct drm_i915_private *dev_priv = engine->dev->dev_private;
+
+	I915_WRITE(RING_HWS_PGA(engine->mmio_base),
+		   (u32)engine->status_page.gfx_addr);
+	POSTING_READ(RING_HWS_PGA(engine->mmio_base));
+}
+
 static int gen8_init_common_ring(struct intel_engine_cs *engine)
 {
 	struct drm_device *dev = engine->dev;
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	unsigned int next_context_status_buffer_hw;
 
-	lrc_setup_hardware_status_page(engine,
-				       dev_priv->kernel_context->engine[engine->id].state);
+	lrc_init_hws(engine);
 
 	I915_WRITE_IMR(engine,
 		       ~(engine->irq_enable_mask | engine->irq_keep_mask));
@@ -2087,6 +2092,20 @@ logical_ring_default_irqs(struct intel_engine_cs *engine, unsigned shift)
 	engine->irq_keep_mask = GT_CONTEXT_SWITCH_INTERRUPT << shift;
 }
 
+static void
+lrc_setup_hws(struct intel_engine_cs *engine,
+	      struct drm_i915_gem_object *dctx_obj)
+{
+	struct page *page;
+
+	/* The HWSP is part of the default context object in LRC mode. */
+	engine->status_page.gfx_addr = i915_gem_obj_ggtt_offset(dctx_obj) +
+				       LRC_PPHWSP_PN * PAGE_SIZE;
+	page = i915_gem_object_get_page(dctx_obj, LRC_PPHWSP_PN);
+	engine->status_page.page_addr = kmap(page);
+	engine->status_page.obj = dctx_obj;
+}
+
 static int
 logical_ring_init(struct drm_device *dev, struct intel_engine_cs *engine)
 {
@@ -2145,6 +2164,9 @@ logical_ring_init(struct drm_device *dev, struct intel_engine_cs *engine)
 		goto error;
 	}
 
+	/* And setup the hardware status page. */
+	lrc_setup_hws(engine, dctx->engine[engine->id].state);
+
 	return 0;
 
 error:
@@ -2605,24 +2627,6 @@ uint32_t intel_lr_context_size(struct intel_engine_cs *engine)
 	return ret;
 }
 
-static void lrc_setup_hardware_status_page(struct intel_engine_cs *engine,
-					   struct drm_i915_gem_object *default_ctx_obj)
-{
-	struct drm_i915_private *dev_priv = engine->dev->dev_private;
-	struct page *page;
-
-	/* The HWSP is part of the default context object in LRC mode. */
-	engine->status_page.gfx_addr = i915_gem_obj_ggtt_offset(default_ctx_obj)
-			+ LRC_PPHWSP_PN * PAGE_SIZE;
-	page = i915_gem_object_get_page(default_ctx_obj, LRC_PPHWSP_PN);
-	engine->status_page.page_addr = kmap(page);
-	engine->status_page.obj = default_ctx_obj;
-
-	I915_WRITE(RING_HWS_PGA(engine->mmio_base),
-			(u32)engine->status_page.gfx_addr);
-	POSTING_READ(RING_HWS_PGA(engine->mmio_base));
-}
-
 /**
  * intel_lr_context_deferred_alloc() - create the LRC specific bits of a context
  * @ctx: LR context to create.
Signature · 6 lines
1.9.1

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

PATCH 2/2 drm/i915: Use new i915_gem_object_pin_map for LRC

From: Tvrtko Ursulin <[email protected]>

We can use the new pin/lazy unpin API for simplicity and more performance in the execlist submission paths.

v2:
* Fix error handling and convert more users.
* Compact some names for readability.

v3:
* intel_lr_context_free was not unpinning.
* Special case for GPU reset which otherwise unbalances the HWS object pages pin count by running the engine initialization only (not destructors).

v4:
* Rebased on top of hws setup/init split.

---
 drivers/gpu/drm/i915/i915_gem_context.c |  2 +-
 drivers/gpu/drm/i915/intel_lrc.c        | 82 ++++++++++++++++++---------------
 drivers/gpu/drm/i915/intel_lrc.h        |  7 ++-
 3 files changed, 52 insertions(+), 39 deletions(-)
drivers/gpu/drm/i915/i915_gem_context.c +1 -1
index fe580cb9501a..91028d9c6269 100644
@@ -342,7 +342,7 @@ void i915_gem_context_reset(struct drm_device *dev)
 		struct intel_context *ctx;
 
 		list_for_each_entry(ctx, &dev_priv->context_list, link)
-			intel_lr_context_reset(dev, ctx);
+			intel_lr_context_reset(dev_priv, ctx);
 	}
 
 	for (i = 0; i < I915_NUM_ENGINES; i++) {
drivers/gpu/drm/i915/intel_lrc.c +46 -36

198 lines not on this page · raw message

drivers/gpu/drm/i915/intel_lrc.h +5 -2
index 8de1ea536ad4..9affda2c650c 100644
@@ -104,8 +104,11 @@ int intel_lr_context_deferred_alloc(struct intel_context *ctx,
 				    struct intel_engine_cs *engine);
 void intel_lr_context_unpin(struct intel_context *ctx,
 			    struct intel_engine_cs *engine);
-void intel_lr_context_reset(struct drm_device *dev,
-			struct intel_context *ctx);
+
+struct drm_i915_private;
+
+void intel_lr_context_reset(struct drm_i915_private *dev_priv,
+			    struct intel_context *ctx);
 uint64_t intel_lr_context_descriptor(struct intel_context *ctx,
 				     struct intel_engine_cs *engine);
 
Signature · 6 lines
1.9.1

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

Re: [PATCH 2/2] drm/i915: Use new i915_gem_object_pin_map for LRC

Quoted 15 lines · Tvrtko Ursulin

From: Tvrtko Ursulin <[email protected]>

We can use the new pin/lazy unpin API for simplicity and more performance in the execlist submission paths.

v2:
* Fix error handling and convert more users.
* Compact some names for readability.

v3:
* intel_lr_context_free was not unpinning.
* Special case for GPU reset which otherwise unbalances the HWS object pages pin count by running the engine initialization only (not destructors).

Quoted 5 lines

v4:
* Rebased on top of hws setup/init split.

Minor comments,
both Reviewed-by: Chris Wilson <[email protected]>

drivers/gpu/drm/i915/intel_lrc.c static int intel_lr_context_do_pin(struct intel_context *ctx, · line 1094

Quoted 11 lines
drivers/gpu/drm/i915/intel_lrc.c +1 -2
index 3fd2ae6ce8e7..b61f8da5d6f3 100644
@@ -1091,8 +1091,8 @@ static int intel_lr_context_do_pin(struct intel_context *ctx,
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	struct drm_i915_gem_object *ctx_obj = ctx->engine[engine->id].state;
 	struct intel_ringbuffer *ringbuf = ctx->engine[engine->id].ringbuf;
-	struct page *lrc_state_page;
-	uint32_t *lrc_reg_state;
+	void *obj_addr;

obj_addr, harking back to a time when it was an unsigned long? Even then it would be more traditionally be vaddr.

map, base, vaddr, obj_*

drivers/gpu/drm/i915/intel_lrc.c logical_ring_init(struct drm_device *dev, struct intel_engine_cs *engine) · line 2177

Quoted 5 lines
drivers/gpu/drm/i915/intel_lrc.c +3 -1
 	/* And setup the hardware status page. */
-	lrc_setup_hws(engine, dctx->engine[engine->id].state);
+	ret = lrc_setup_hws(engine, dctx->engine[engine->id].state);
+	if (ret) {
+		DRM_ERROR("Failed to set up hwd %s: %d\n", engine->name, ret);

s/hwd/hws/

I would have put this set of chunks in the previous patch for less churn. -Chris

Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#3 lore raw

✗ Fi.CI.BAT: failure for series starting with [1/2] drm/i915: Split execlists hardware status page initialisation from setup

In reply to Tvrtko Ursulin
== Series Details ==

== Series Details ==

Series: series starting with [1/2] drm/i915: Split execlists hardware status page initialisation from setup
URL : https://patchwork.freedesktop.org/series/5596/
State : failure

== Summary ==

Series 5596v1 Series without cover letter
http://patchwork.freedesktop.org/api/1.0/series/5596/revisions/1/mbox/

Test drv_module_reload_basic:

                pass       -> FAIL       (snb-dellxps)
Test kms_flip:
        Subgroup basic-flip-vs-wf_vblank:
                pass       -> FAIL       (ivb-t430s)
bdw-nuci7        total:203  pass:191  dwarn:0   dfail:0   fail:0   skip:12 
bdw-ultra        total:203  pass:180  dwarn:0   dfail:0   fail:0   skip:23 
bsw-nuc-2        total:202  pass:163  dwarn:0   dfail:0   fail:0   skip:39 
byt-nuc          total:202  pass:164  dwarn:0   dfail:0   fail:0   skip:38 
hsw-brixbox      total:203  pass:179  dwarn:0   dfail:0   fail:0   skip:24 
hsw-gt2          total:203  pass:184  dwarn:0   dfail:0   fail:0   skip:19 
ivb-t430s        total:203  pass:174  dwarn:0   dfail:0   fail:1   skip:28 
skl-i7k-2        total:203  pass:178  dwarn:0   dfail:0   fail:0   skip:25 
skl-nuci5        total:203  pass:192  dwarn:0   dfail:0   fail:0   skip:11 
snb-dellxps      total:203  pass:164  dwarn:0   dfail:0   fail:1   skip:38 
snb-x220t        total:203  pass:165  dwarn:0   dfail:0   fail:1   skip:37 

Results at /archive/results/CI_IGT_test/Patchwork_1875/

42189a46296988a9e16b57dca9e25c227458888b drm-intel-nightly: 2016y-04m-12d-14h-35m-43s UTC integration manifest 6d8f2e9 drm/i915: Use new i915_gem_object_pin_map for LRC
f1b4a09 drm/i915: Split execlists hardware status page initialisation from setup

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

#4 lore raw

Re: ✗ Fi.CI.BAT: failure for series starting with [1/2] drm/i915: Split execlists hardware status page initialisation from setup

Quoted 6 lines · Patchwork

== Series Details ==

Series: series starting with [1/2] drm/i915: Split execlists hardware status page initialisation from setup
URL : https://patchwork.freedesktop.org/series/5596/
State : failure

Quoted 7 lines

== Summary ==

Series 5596v1 Series without cover letter
http://patchwork.freedesktop.org/api/1.0/series/5596/revisions/1/mbox/

Test drv_module_reload_basic:

                 pass       -> FAIL       (snb-dellxps)

This hasn't been filed so far and it failed once already in CI_DRM_1194​.

Failure are assertions in gem_exec_store after driver reload.

Filed a new BZ: https://bugs.freedesktop.org/show_bug.cgi?id=94914

Quoted 3 lines

Test kms_flip:

         Subgroup basic-flip-vs-wf_vblank:
                 pass       -> FAIL       (ivb-t430s)

Old friend https://bugs.freedesktop.org/show_bug.cgi?id=94294

Quoted 13 lines
bdw-nuci7        total:203  pass:191  dwarn:0   dfail:0   fail:0   skip:12
bdw-ultra        total:203  pass:180  dwarn:0   dfail:0   fail:0   skip:23
bsw-nuc-2        total:202  pass:163  dwarn:0   dfail:0   fail:0   skip:39
byt-nuc          total:202  pass:164  dwarn:0   dfail:0   fail:0   skip:38
hsw-brixbox      total:203  pass:179  dwarn:0   dfail:0   fail:0   skip:24
hsw-gt2          total:203  pass:184  dwarn:0   dfail:0   fail:0   skip:19
ivb-t430s        total:203  pass:174  dwarn:0   dfail:0   fail:1   skip:28
skl-i7k-2        total:203  pass:178  dwarn:0   dfail:0   fail:0   skip:25
skl-nuci5        total:203  pass:192  dwarn:0   dfail:0   fail:0   skip:11
snb-dellxps      total:203  pass:164  dwarn:0   dfail:0   fail:1   skip:38
snb-x220t        total:203  pass:165  dwarn:0   dfail:0   fail:1   skip:37
Quoted 5 lines

Results at /archive/results/CI_IGT_test/Patchwork_1875/

42189a46296988a9e16b57dca9e25c227458888b drm-intel-nightly: 2016y-04m-12d-14h-35m-43s UTC integration manifest 6d8f2e9 drm/i915: Use new i915_gem_object_pin_map for LRC
f1b4a09 drm/i915: Split execlists hardware status page initialisation from setup

Merged - thanks for the review.

Regards,

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