Skip to contentSkip to conversation

drm/i915/lrc: Clarify the format of the context image

PATCH In review Michel Thierry 4 participants 7 messages Jul 12, 2017

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

PATCH 1/2 drm/i915/lrc: Clarify the format of the context image

Not only the context image consist of two parts (the PPHWSP, and the logical context state), but we also allocate a header at the start of for sharing data with GuC. Thus every lrc looks like this:

  | [guc]          | [hwsp] [logical state] |
  |<- our header ->|<- context image      ->|

So far, we have oversimplified whenever we use each of these parts of the context, just because the GuC header happens to be in page 0, and the (PP)HWSP is in page 1. But this had led to using the same define for more than one meaning (as a page index in the lrc and as 1 page).

This patch adds defines for the GuC shared page, the PPHWSP page and the start of the logical state. It also updated the places where the old define was being used. Since we are not changing the size (or format) of the context, there are no functional changes.

Cc Chris Wilson <[email protected]>
Cc Daniele Ceraolo Spurio <[email protected]>
Cc Michal Wajdeczko <[email protected]>
Cc Oscar Mateo <[email protected]>
---
 drivers/gpu/drm/i915/gvt/scheduler.c       |  4 ++--
 drivers/gpu/drm/i915/i915_guc_submission.c |  4 ++--
 drivers/gpu/drm/i915/intel_lrc.c           | 11 +++++++----
 drivers/gpu/drm/i915/intel_lrc.h           | 25 ++++++++++++++++++++++---
 4 files changed, 33 insertions(+), 11 deletions(-)
drivers/gpu/drm/i915/gvt/scheduler.c +2 -2
index 0e2e36ad6196..8e9eeff156f6 100644
@@ -87,7 +87,7 @@ static int populate_shadow_context(struct intel_vgpu_workload *workload)
 			return -EINVAL;
 		}
 
-		page = i915_gem_object_get_page(ctx_obj, LRC_PPHWSP_PN + i);
+		page = i915_gem_object_get_page(ctx_obj, LRC_HEADER_PAGES + i);
 		dst = kmap(page);
 		intel_gvt_hypervisor_read_gpa(vgpu, context_gpa, dst,
 				GTT_PAGE_SIZE);
@@ -361,7 +361,7 @@ static void update_guest_context(struct intel_vgpu_workload *workload)
 			return;
 		}
 
-		page = i915_gem_object_get_page(ctx_obj, LRC_PPHWSP_PN + i);
+		page = i915_gem_object_get_page(ctx_obj, LRC_HEADER_PAGES + i);
 		src = kmap(page);
 		intel_gvt_hypervisor_write_gpa(vgpu, context_gpa, src,
 				GTT_PAGE_SIZE);
drivers/gpu/drm/i915/i915_guc_submission.c +2 -2
index 48a1e9349a2c..b7ca13860677 100644
@@ -1310,7 +1310,7 @@ int intel_guc_suspend(struct drm_i915_private *dev_priv)
 	/* any value greater than GUC_POWER_D0 */
 	data[1] = GUC_POWER_D1;
 	/* first page is shared data with GuC */
-	data[2] = guc_ggtt_offset(ctx->engine[RCS].state);
+	data[2] = guc_ggtt_offset(ctx->engine[RCS].state) + LRC_GUCSHR_PN * PAGE_SIZE;
 
 	return intel_guc_send(guc, data, ARRAY_SIZE(data));
 }
@@ -1336,7 +1336,7 @@ int intel_guc_resume(struct drm_i915_private *dev_priv)
 	data[0] = INTEL_GUC_ACTION_EXIT_S_STATE;
 	data[1] = GUC_POWER_D0;
 	/* first page is shared data with GuC */
-	data[2] = guc_ggtt_offset(ctx->engine[RCS].state);
+	data[2] = guc_ggtt_offset(ctx->engine[RCS].state) + LRC_GUCSHR_PN * PAGE_SIZE;
 
 	return intel_guc_send(guc, data, ARRAY_SIZE(data));
 }
drivers/gpu/drm/i915/intel_lrc.c +7 -4
index 699868d81de8..67a1187b0afe 100644
@@ -279,7 +279,7 @@ intel_lr_context_descriptor_update(struct i915_gem_context *ctx,
 	BUILD_BUG_ON(MAX_CONTEXT_HW_ID > (1<<GEN8_CTX_ID_WIDTH));
 
 	desc = ctx->desc_template;				/* bits  0-11 */
-	desc |= i915_ggtt_offset(ce->state) + LRC_PPHWSP_PN * PAGE_SIZE;
+	desc |= i915_ggtt_offset(ce->state) + LRC_HEADER_PAGES * PAGE_SIZE;
 								/* bits 12-31 */
 	desc |= (u64)ctx->hw_id << GEN8_CTX_ID_SHIFT;		/* bits 32-52 */
 
@@ -1695,7 +1695,7 @@ logical_ring_default_irqs(struct intel_engine_cs *engine)
 static int
 lrc_setup_hws(struct intel_engine_cs *engine, struct i915_vma *vma)
 {
-	const int hws_offset = LRC_PPHWSP_PN * PAGE_SIZE;
+	const int hws_offset = LRC_HEADER_PAGES * PAGE_SIZE;
 	void *hws;
 
 	/* The HWSP is part of the default context object in LRC mode. */
@@ -2015,8 +2015,11 @@ static int execlists_context_deferred_alloc(struct i915_gem_context *ctx,
 
 	context_size = round_up(engine->context_size, I915_GTT_PAGE_SIZE);
 
-	/* One extra page as the sharing data between driver and GuC */
-	context_size += PAGE_SIZE * LRC_PPHWSP_PN;
+	/*
+	 * Before the actual start of the context image, we insert a few pages
+	 * for our own use and for sharing with the GuC.
+	 */
+	context_size += LRC_HEADER_PAGES * PAGE_SIZE;
 
 	ctx_obj = i915_gem_object_create(ctx->i915, context_size);
 	if (IS_ERR(ctx_obj)) {
drivers/gpu/drm/i915/intel_lrc.h +22 -3
index 52b3a1fd4059..cc17cbf5afd1 100644
@@ -70,10 +70,29 @@ int logical_xcs_ring_init(struct intel_engine_cs *engine);
 
 /* Logical Ring Contexts */
 
-/* One extra page is added before LRC for GuC as shared data */
+/*
+ * We allocate a header at the start of the context image for our own
+ * use, therefore the actual location of the logical state is offset
+ * from the start of the VMA. The layout is
+ *
+ * | [guc]          | [hwsp] [logical state] |
+ * |<- our header ->|<- context image      ->|
+ *
+ */
+/* The first page is used for sharing data with the GuC */
 #define LRC_GUCSHR_PN	(0)
-#define LRC_PPHWSP_PN	(LRC_GUCSHR_PN + 1)
-#define LRC_STATE_PN	(LRC_PPHWSP_PN + 1)
+#define LRC_GUCSHR_SZ	(1)
+/* At the start of the context image is its per-process HWS page */
+#define LRC_PPHWSP_PN	(LRC_GUCSHR_PN + LRC_GUCSHR_SZ)
+#define LRC_PPHWSP_SZ	(1)
+/* Finally we have the logical state for the context */
+#define LRC_STATE_PN	(LRC_PPHWSP_PN + LRC_PPHWSP_SZ)
+
+/*
+ * Currently we include the PPHWSP in __intel_engine_context_size() so
+ * the size of the header is synonymous with the start of the PPHWSP.
+ */
+#define LRC_HEADER_PAGES LRC_PPHWSP_PN
 
 struct drm_i915_private;
 struct i915_gem_context;
Signature · 6 lines
2.13.0

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

PATCH 2/2 drm/i915/guc: Don't make assumptions while getting the lrca offset

Using the HWSP ggtt_offset to get the lrca offset is only correct if the HWSP happens to be before it (when we reuse the PPHWSP of the kernel context as the engine HWSP). Instead of making this assumption, get the lrca offset from the kernel_context engine state.

And while looking at this part of the GuC interaction, it was also noticed that the firmware expects the size of only the engine context (context minus the execlist part, i.e. don't include the first 80 dwords), so pass the right size.

v2: Use the new macros to prevent abusive overuse of the old ones (Chris).

Cc Chris Wilson <[email protected]>
Cc Daniele Ceraolo Spurio <[email protected]>
Cc Michal Wajdeczko <[email protected]>
Cc Oscar Mateo <[email protected]>
---
 drivers/gpu/drm/i915/i915_guc_submission.c | 21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/i915_guc_submission.c +18 -3
index b7ca13860677..8b96935cf96a 100644
@@ -1018,6 +1018,12 @@ static void guc_policies_init(struct guc_policies *policies)
 	policies->is_valid = 1;
 }
 
+/*
+ * The first 80 dwords of the register state context, containing the
+ * execlists and ppgtt registers.
+ */
+#define LR_HW_CONTEXT_SIZE	(80 * sizeof(u32))
+
 static int guc_ads_create(struct intel_guc *guc)
 {
 	struct drm_i915_private *dev_priv = guc_to_i915(guc);
@@ -1032,6 +1038,8 @@ static int guc_ads_create(struct intel_guc *guc)
 	} __packed *blob;
 	struct intel_engine_cs *engine;
 	enum intel_engine_id id;
+	const u32 skipped_offset = LRC_HEADER_PAGES * PAGE_SIZE;
+	const u32 skipped_size = LRC_PPHWSP_SZ * PAGE_SIZE + LR_HW_CONTEXT_SIZE;
 	u32 base;
 
 	GEM_BUG_ON(guc->ads_vma);
@@ -1062,13 +1070,20 @@ static int guc_ads_create(struct intel_guc *guc)
 	 * engines after a reset. Here we use the Render ring default
 	 * context, which must already exist and be pinned in the GGTT,
 	 * so its address won't change after we've told the GuC where
-	 * to find it.
+	 * to find it. Note that we have to skip our header (1 page),
+	 * because our GuC shared data is there.
 	 */
 	blob->ads.golden_context_lrca =
-		dev_priv->engine[RCS]->status_page.ggtt_offset;
+		guc_ggtt_offset(dev_priv->kernel_context->engine[RCS].state) + skipped_offset;
 
+	/*
+	 * The GuC expects us to exclude the portion of the context image that
+	 * it skips from the size it is to read. It starts reading from after
+	 * the execlist context (so skipping the first page [PPHWSP] and 80
+	 * dwords). Weird guc is weird.
+	 */
 	for_each_engine(engine, dev_priv, id)
-		blob->ads.eng_state_size[engine->guc_id] = engine->context_size;
+		blob->ads.eng_state_size[engine->guc_id] = engine->context_size - skipped_size;
 
 	base = guc_ggtt_offset(vma);
 	blob->ads.scheduler_policies = base + ptr_offset(blob, policies);
Signature · 6 lines
2.13.0

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

Re: [PATCH 2/2] drm/i915/guc: Don't make assumptions while getting the lrca offset

Quoting Michel Thierry (2017-07-12 20:30:32)

Quoted 40 lines

Using the HWSP ggtt_offset to get the lrca offset is only correct if the HWSP happens to be before it (when we reuse the PPHWSP of the kernel context as the engine HWSP). Instead of making this assumption, get the lrca offset from the kernel_context engine state.

And while looking at this part of the GuC interaction, it was also noticed that the firmware expects the size of only the engine context (context minus the execlist part, i.e. don't include the first 80 dwords), so pass the right size.

v2: Use the new macros to prevent abusive overuse of the old ones (Chris).

Cc Chris Wilson <[email protected]>
Cc Daniele Ceraolo Spurio <[email protected]>
Cc Michal Wajdeczko <[email protected]>
Cc Oscar Mateo <[email protected]>
---
 drivers/gpu/drm/i915/i915_guc_submission.c | 21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/i915_guc_submission.c +6 -0
index b7ca13860677..8b96935cf96a 100644
@@ -1018,6 +1018,12 @@ static void guc_policies_init(struct guc_policies *policies)
        policies->is_valid = 1;
 }
 
+/*
+ * The first 80 dwords of the register state context, containing the
+ * execlists and ppgtt registers.
+ */
+#define LR_HW_CONTEXT_SIZE     (80 * sizeof(u32))
+
 static int guc_ads_create(struct intel_guc *guc)
 {
        struct drm_i915_private *dev_priv = guc_to_i915(guc);

drivers/gpu/drm/i915/i915_guc_submission.c static int guc_ads_create(struct intel_guc *guc) · line 1042

Quoted 5 lines
drivers/gpu/drm/i915/i915_guc_submission.c +2 -0
@@ -1032,6 +1038,8 @@ static int guc_ads_create(struct intel_guc *guc)
        } __packed *blob;
        struct intel_engine_cs *engine;
        enum intel_engine_id id;
+       const u32 skipped_offset = LRC_HEADER_PAGES * PAGE_SIZE;
+       const u32 skipped_size = LRC_PPHWSP_SZ * PAGE_SIZE + LR_HW_CONTEXT_SIZE;

I think I preferred the constants rather than the variables, but that's a matter of taste. Since you confirmed the guc works the way you describe and now have a big warning in place,

Though I would get Daniele to confirm the interpretation. -Chris
_______________________________________________
Intel-gfx mailing list [email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#3 lore raw

Re: [PATCH 2/2] drm/i915/guc: Don't make assumptions while getting the lrca offset

Quoted 51 lines · Chris Wilson

Quoting Michel Thierry (2017-07-12 20:30:32)

Quoted 40 lines

Using the HWSP ggtt_offset to get the lrca offset is only correct if the HWSP happens to be before it (when we reuse the PPHWSP of the kernel context as the engine HWSP). Instead of making this assumption, get the lrca offset from the kernel_context engine state.

And while looking at this part of the GuC interaction, it was also noticed that the firmware expects the size of only the engine context (context minus the execlist part, i.e. don't include the first 80 dwords), so pass the right size.

v2: Use the new macros to prevent abusive overuse of the old ones (Chris).

Cc Chris Wilson <[email protected]>
Cc Daniele Ceraolo Spurio <[email protected]>
Cc Michal Wajdeczko <[email protected]>
Cc Oscar Mateo <[email protected]>
---
  drivers/gpu/drm/i915/i915_guc_submission.c | 21 ++++++++++++++++++---
  1 file changed, 18 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/i915_guc_submission.c +6 -0
index b7ca13860677..8b96935cf96a 100644
@@ -1018,6 +1018,12 @@ static void guc_policies_init(struct guc_policies *policies)
         policies->is_valid = 1;
  }
 
+/*
+ * The first 80 dwords of the register state context, containing the
+ * execlists and ppgtt registers.
+ */
+#define LR_HW_CONTEXT_SIZE     (80 * sizeof(u32))
+
  static int guc_ads_create(struct intel_guc *guc)
  {
         struct drm_i915_private *dev_priv = guc_to_i915(guc);

drivers/gpu/drm/i915/i915_guc_submission.c static int guc_ads_create(struct intel_guc *guc) · line 1042

Quoted 5 lines
drivers/gpu/drm/i915/i915_guc_submission.c +2 -0
@@ -1032,6 +1038,8 @@ static int guc_ads_create(struct intel_guc *guc)
         } __packed *blob;
         struct intel_engine_cs *engine;
         enum intel_engine_id id;
+       const u32 skipped_offset = LRC_HEADER_PAGES * PAGE_SIZE;
+       const u32 skipped_size = LRC_PPHWSP_SZ * PAGE_SIZE + LR_HW_CONTEXT_SIZE;

I think I preferred the constants rather than the variables, but that's a matter of taste. Since you confirmed the guc works the way you describe and now have a big warning in place,

Quoted 5 lines

Though I would get Daniele to confirm the interpretation. -Chris

LGTM.

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

Reviewed-by on v1 1/2
#4 lore raw
In reply to Michel Thierry

Quoting Michel Thierry (2017-07-12 20:30:31)

Quoted 36 lines

Not only the context image consist of two parts (the PPHWSP, and the logical context state), but we also allocate a header at the start of for sharing data with GuC. Thus every lrc looks like this:

  | [guc]          | [hwsp] [logical state] |
  |<- our header ->|<- context image      ->|

So far, we have oversimplified whenever we use each of these parts of the context, just because the GuC header happens to be in page 0, and the (PP)HWSP is in page 1. But this had led to using the same define for more than one meaning (as a page index in the lrc and as 1 page).

This patch adds defines for the GuC shared page, the PPHWSP page and the start of the logical state. It also updated the places where the old define was being used. Since we are not changing the size (or format) of the context, there are no functional changes.

Cc Chris Wilson <[email protected]>
Cc Daniele Ceraolo Spurio <[email protected]>
Cc Michal Wajdeczko <[email protected]>
Cc Oscar Mateo <[email protected]>
---
 drivers/gpu/drm/i915/gvt/scheduler.c       |  4 ++--
 drivers/gpu/drm/i915/i915_guc_submission.c |  4 ++--
 drivers/gpu/drm/i915/intel_lrc.c           | 11 +++++++----
 drivers/gpu/drm/i915/intel_lrc.h           | 25 ++++++++++++++++++++++---
 4 files changed, 33 insertions(+), 11 deletions(-)
drivers/gpu/drm/i915/gvt/scheduler.c +0 -0
index 0e2e36ad6196..8e9eeff156f6 100644

drivers/gpu/drm/i915/gvt/scheduler.c static int populate_shadow_context(struct intel_vgpu_workload *workload) · line 90

Quoted 5 lines
drivers/gpu/drm/i915/gvt/scheduler.c +1 -1
@@ -87,7 +87,7 @@ static int populate_shadow_context(struct intel_vgpu_workload *workload)
                        return -EINVAL;
                }
 
-               page = i915_gem_object_get_page(ctx_obj, LRC_PPHWSP_PN + i);
+               page = i915_gem_object_get_page(ctx_obj, LRC_HEADER_PAGES + i);

Ah, that makes much more sense.

Quoted 18 lines
drivers/gpu/drm/i915/gvt/scheduler.c +0 -0
                dst = kmap(page);
                intel_gvt_hypervisor_read_gpa(vgpu, context_gpa, dst,
                                GTT_PAGE_SIZE);
drivers/gpu/drm/i915/i915_guc_submission.c +1 -1
index 48a1e9349a2c..b7ca13860677 100644
@@ -1310,7 +1310,7 @@ int intel_guc_suspend(struct drm_i915_private *dev_priv)
        /* any value greater than GUC_POWER_D0 */
        data[1] = GUC_POWER_D1;
        /* first page is shared data with GuC */
-       data[2] = guc_ggtt_offset(ctx->engine[RCS].state);
+       data[2] = guc_ggtt_offset(ctx->engine[RCS].state) + LRC_GUCSHR_PN * PAGE_SIZE;
 
        return intel_guc_send(guc, data, ARRAY_SIZE(data));
 }

drivers/gpu/drm/i915/i915_guc_submission.c int intel_guc_resume(struct drm_i915_private *dev_priv) · line 1339

Quoted 5 lines
drivers/gpu/drm/i915/i915_guc_submission.c +1 -1
@@ -1336,7 +1336,7 @@ int intel_guc_resume(struct drm_i915_private *dev_priv)
        data[0] = INTEL_GUC_ACTION_EXIT_S_STATE;
        data[1] = GUC_POWER_D0;
        /* first page is shared data with GuC */
-       data[2] = guc_ggtt_offset(ctx->engine[RCS].state);
+       data[2] = guc_ggtt_offset(ctx->engine[RCS].state) + LRC_GUCSHR_PN * PAGE_SIZE;

Could spot any others, so lgtm.

drivers/gpu/drm/i915/intel_lrc.c intel_lr_context_descriptor_update(struct i915_gem_context *ctx, · line 282

Quoted 11 lines
drivers/gpu/drm/i915/i915_guc_submission.c +0 -0
        return intel_guc_send(guc, data, ARRAY_SIZE(data));
 }
drivers/gpu/drm/i915/intel_lrc.c +0 -1
index 699868d81de8..67a1187b0afe 100644
@@ -279,7 +279,7 @@ intel_lr_context_descriptor_update(struct i915_gem_context *ctx,
        BUILD_BUG_ON(MAX_CONTEXT_HW_ID > (1<<GEN8_CTX_ID_WIDTH));
 
        desc = ctx->desc_template;                              /* bits  0-11 */
-       desc |= i915_ggtt_offset(ce->state) + LRC_PPHWSP_PN * PAGE_SIZE;

Arguable that this could be PPHWSP since that is the start of the context image for execlists. HEADER is also an apt description, so 50/50. Actually favouring using HEADER, so keep the change.

drivers/gpu/drm/i915/intel_lrc.c logical_ring_default_irqs(struct intel_engine_cs *engine) · line 1698

Quoted 10 lines
drivers/gpu/drm/i915/intel_lrc.c +2 -1
+       desc |= i915_ggtt_offset(ce->state) + LRC_HEADER_PAGES * PAGE_SIZE;
                                                                /* bits 12-31 */
        desc |= (u64)ctx->hw_id << GEN8_CTX_ID_SHIFT;           /* bits 32-52 */
 
@@ -1695,7 +1695,7 @@ logical_ring_default_irqs(struct intel_engine_cs *engine)
 static int
 lrc_setup_hws(struct intel_engine_cs *engine, struct i915_vma *vma)
 {
-       const int hws_offset = LRC_PPHWSP_PN * PAGE_SIZE;
+       const int hws_offset = LRC_HEADER_PAGES * PAGE_SIZE;

This should be PPHWSP_PN since we explicitly want the pointer tot he pphwsp.

Quoted 4 lines
drivers/gpu/drm/i915/intel_lrc.c +0 -0
        void *hws;
 
        /* The HWSP is part of the default context object in LRC mode. */

drivers/gpu/drm/i915/intel_lrc.c static int execlists_context_deferred_alloc(struct i915_gem_context *ctx, · line 2022

Quoted 10 lines
drivers/gpu/drm/i915/intel_lrc.c +5 -2
@@ -2015,8 +2015,11 @@ static int execlists_context_deferred_alloc(struct i915_gem_context *ctx,
 
        context_size = round_up(engine->context_size, I915_GTT_PAGE_SIZE);
 
-       /* One extra page as the sharing data between driver and GuC */
-       context_size += PAGE_SIZE * LRC_PPHWSP_PN;
+       /*
+        * Before the actual start of the context image, we insert a few pages
+        * for our own use and for sharing with the GuC.
+        */
+       context_size += LRC_HEADER_PAGES * PAGE_SIZE;

Good riddance, that LRC_PPHWSP_PN has left me quite confused for some time.

With the change to lrc_setup_hws,

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

#5 lore raw
Quoted 32 lines · Chris Wilson

Quoting Michel Thierry (2017-07-12 20:30:31)

Quoted 31 lines

Not only the context image consist of two parts (the PPHWSP, and the logical context state), but we also allocate a header at the start of for sharing data with GuC. Thus every lrc looks like this:

   | [guc]          | [hwsp] [logical state] |
   |<- our header ->|<- context image      ->|

So far, we have oversimplified whenever we use each of these parts of the context, just because the GuC header happens to be in page 0, and the (PP)HWSP is in page 1. But this had led to using the same define for more than one meaning (as a page index in the lrc and as 1 page).

This patch adds defines for the GuC shared page, the PPHWSP page and the start of the logical state. It also updated the places where the old define was being used. Since we are not changing the size (or format) of the context, there are no functional changes.

Cc Chris Wilson <[email protected]>
Cc Daniele Ceraolo Spurio <[email protected]>
Cc Michal Wajdeczko <[email protected]>
Cc Oscar Mateo <[email protected]>
---
  drivers/gpu/drm/i915/gvt/scheduler.c       |  4 ++--
  drivers/gpu/drm/i915/i915_guc_submission.c |  4 ++--
  drivers/gpu/drm/i915/intel_lrc.c           | 11 +++++++----
  drivers/gpu/drm/i915/intel_lrc.h           | 25 ++++++++++++++++++++++---
  4 files changed, 33 insertions(+), 11 deletions(-)

...

Quoted 10 lines

drivers/gpu/drm/i915/intel_lrc.c logical_ring_default_irqs(struct intel_engine_cs *engine) · line 1698

Quoted 6 lines
drivers/gpu/drm/i915/intel_lrc.c +1 -1
@@ -1695,7 +1695,7 @@ logical_ring_default_irqs(struct intel_engine_cs *engine)
  static int
  lrc_setup_hws(struct intel_engine_cs *engine, struct i915_vma *vma)
  {
-       const int hws_offset = LRC_PPHWSP_PN * PAGE_SIZE;
+       const int hws_offset = LRC_HEADER_PAGES * PAGE_SIZE;

This should be PPHWSP_PN since we explicitly want the pointer tot he pphwsp.
Oh right, this was the only place where it was really correct.

I was about to resend it with this change, but then realised it just means the lrc_setup_hws chunk of the patch disappears... let me know if I should still resend it.

Thanks,

Quoted 18 lines
Quoted 4 lines
drivers/gpu/drm/i915/intel_lrc.c +0 -0
         void *hws;
 
         /* The HWSP is part of the default context object in LRC mode. */

drivers/gpu/drm/i915/intel_lrc.c static int execlists_context_deferred_alloc(struct i915_gem_context *ctx, · line 2022

Quoted 10 lines
drivers/gpu/drm/i915/intel_lrc.c +5 -2
@@ -2015,8 +2015,11 @@ static int execlists_context_deferred_alloc(struct i915_gem_context *ctx,
 
         context_size = round_up(engine->context_size, I915_GTT_PAGE_SIZE);
 
-       /* One extra page as the sharing data between driver and GuC */
-       context_size += PAGE_SIZE * LRC_PPHWSP_PN;
+       /*
+        * Before the actual start of the context image, we insert a few pages
+        * for our own use and for sharing with the GuC.
+        */
+       context_size += LRC_HEADER_PAGES * PAGE_SIZE;

Good riddance, that LRC_PPHWSP_PN has left me quite confused for some time.

Quoted 4 lines

With the change to lrc_setup_hws,

-Chris

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

#6 lore raw

✓ Fi.CI.BAT: success for series starting with [1/2] drm/i915/lrc: Clarify the format of the context image

In reply to Michel Thierry
== Series Details ==

== Series Details ==

Series: series starting with [1/2] drm/i915/lrc: Clarify the format of the context image
URL : https://patchwork.freedesktop.org/series/27196/
State : success

== Summary ==

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

Test kms_pipe_crc_basic:

        Subgroup hang-read-crc-pipe-b:
                dmesg-warn -> PASS       (fi-pnv-d510) fdo#101597

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

fi-bdw-5557u     total:279  pass:268  dwarn:0   dfail:0   fail:0   skip:11  time:441s
fi-bdw-gvtdvm    total:279  pass:265  dwarn:0   dfail:0   fail:0   skip:14  time:429s
fi-blb-e6850     total:279  pass:224  dwarn:1   dfail:0   fail:0   skip:54  time:362s
fi-bsw-n3050     total:279  pass:243  dwarn:0   dfail:0   fail:0   skip:36  time:528s
fi-bxt-j4205     total:279  pass:260  dwarn:0   dfail:0   fail:0   skip:19  time:502s
fi-byt-j1900     total:279  pass:254  dwarn:1   dfail:0   fail:0   skip:24  time:491s
fi-byt-n2820     total:279  pass:250  dwarn:1   dfail:0   fail:0   skip:28  time:483s
fi-glk-2a        total:279  pass:260  dwarn:0   dfail:0   fail:0   skip:19  time:593s
fi-hsw-4770      total:279  pass:263  dwarn:0   dfail:0   fail:0   skip:16  time:445s
fi-hsw-4770r     total:279  pass:263  dwarn:0   dfail:0   fail:0   skip:16  time:416s
fi-ilk-650       total:279  pass:229  dwarn:0   dfail:0   fail:0   skip:50  time:423s
fi-ivb-3520m     total:279  pass:261  dwarn:0   dfail:0   fail:0   skip:18  time:494s
fi-ivb-3770      total:279  pass:261  dwarn:0   dfail:0   fail:0   skip:18  time:472s
fi-kbl-7500u     total:279  pass:261  dwarn:0   dfail:0   fail:0   skip:18  time:462s
fi-kbl-7560u     total:279  pass:269  dwarn:0   dfail:0   fail:0   skip:10  time:572s
fi-kbl-r         total:279  pass:260  dwarn:1   dfail:0   fail:0   skip:18  time:588s
fi-pnv-d510      total:279  pass:223  dwarn:1   dfail:0   fail:0   skip:55  time:560s
fi-skl-6260u     total:279  pass:269  dwarn:0   dfail:0   fail:0   skip:10  time:457s
fi-skl-6700hq    total:279  pass:262  dwarn:0   dfail:0   fail:0   skip:17  time:586s
fi-skl-6700k     total:279  pass:257  dwarn:4   dfail:0   fail:0   skip:18  time:464s
fi-skl-6770hq    total:279  pass:269  dwarn:0   dfail:0   fail:0   skip:10  time:480s
fi-skl-gvtdvm    total:279  pass:266  dwarn:0   dfail:0   fail:0   skip:13  time:434s
fi-skl-x1585l    total:279  pass:269  dwarn:0   dfail:0   fail:0   skip:10  time:491s
fi-snb-2520m     total:279  pass:251  dwarn:0   dfail:0   fail:0   skip:28  time:534s
fi-snb-2600      total:279  pass:250  dwarn:0   dfail:0   fail:0   skip:29  time:406s

8ad9e19aafea47c272163c2cbf554e06ff7f9857 drm-tip: 2017y-07m-11d-19h-08m-20s UTC integration manifest ff6861a drm/i915/guc: Don't make assumptions while getting the lrca offset
75e0c32 drm/i915/lrc: Clarify the format of the context image

== Logs ==

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