Skip to contentSkip to conversation

drm/i915/scheduler: add gvt notification for guc submission

PATCH Superseded Chuanxiao Dong 7 participants 27 messages Mar 20, 2017 – Mar 27, 2017

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

PATCH 1/1 drm/i915/scheduler: add gvt notification for guc submission

GVT request needs a manual mmio load/restore. Before GuC submit a request, send notification to gvt for mmio loading. And after the GuC finished this GVT request, notify gvt again for mmio restore. This follows the usage when using execlists submission.

---
 drivers/gpu/drm/i915/i915_guc_submission.c | 13 +++++++++++++
 drivers/gpu/drm/i915/intel_lrc.c           | 15 ---------------
 drivers/gpu/drm/i915/intel_lrc.h           | 14 ++++++++++++++
 3 files changed, 27 insertions(+), 15 deletions(-)
drivers/gpu/drm/i915/i915_guc_submission.c +13 -0
index a3636b3..328b11c 100644
@@ -520,6 +520,12 @@ static void __i915_guc_submit(struct drm_i915_gem_request *rq)
 	unsigned long flags;
 	int b_ret;
 
+	/* Notify for the context status change schedule in
+	 * Currently only GVT care this notification for manually
+	 * context switch, like when using execlist mode submission
+	 */
+	execlists_context_status_change(rq, INTEL_CONTEXT_SCHEDULE_IN);
+
 	/* WA to flush out the pending GMADR writes to ring buffer. */
 	if (i915_vma_is_map_and_fenceable(rq->ring->vma))
 		POSTING_READ_FW(GUC_STATUS);
@@ -623,6 +629,13 @@ static void i915_guc_irq_handler(unsigned long data)
 		rq = port[0].request;
 		while (rq && i915_gem_request_completed(rq)) {
 			trace_i915_gem_request_out(rq);
+			/* Notify for the context status change schedule
+			 * out. Currently only GVT care this notification
+			 * for manually context switch, like when using
+			 * execlist mode submission
+			 */
+			execlists_context_status_change(rq,
+						INTEL_CONTEXT_SCHEDULE_OUT);
 			i915_gem_request_put(rq);
 			port[0].request = port[1].request;
 			port[1].request = NULL;
drivers/gpu/drm/i915/intel_lrc.c +0 -15
index becde55..4f5906b 100644
@@ -295,21 +295,6 @@ uint64_t intel_lr_context_descriptor(struct i915_gem_context *ctx,
 	return ctx->engine[engine->id].lrc_desc;
 }
 
-static inline void
-execlists_context_status_change(struct drm_i915_gem_request *rq,
-				unsigned long status)
-{
-	/*
-	 * Only used when GVT-g is enabled now. When GVT-g is disabled,
-	 * The compiler should eliminate this function as dead-code.
-	 */
-	if (!IS_ENABLED(CONFIG_DRM_I915_GVT))
-		return;
-
-	atomic_notifier_call_chain(&rq->engine->context_status_notifier,
-				   status, rq);
-}
-
 static void
 execlists_update_context_pdps(struct i915_hw_ppgtt *ppgtt, u32 *reg_state)
 {
drivers/gpu/drm/i915/intel_lrc.h +14 -0
index e8015e7..d3aa108 100644
@@ -87,5 +87,19 @@ uint64_t intel_lr_context_descriptor(struct i915_gem_context *ctx,
 /* Execlists */
 int intel_sanitize_enable_execlists(struct drm_i915_private *dev_priv,
 				    int enable_execlists);
+static inline void
+execlists_context_status_change(struct drm_i915_gem_request *rq,
+				unsigned long status)
+{
+	/*
+	 * Only used when GVT-g is enabled now. When GVT-g is disabled,
+	 * The compiler should eliminate this function as dead-code.
+	 */
+	if (!IS_ENABLED(CONFIG_DRM_I915_GVT))
+		return;
+
+	atomic_notifier_call_chain(&rq->engine->context_status_notifier,
+				   status, rq);
+}
 
 #endif /* _INTEL_LRC_H_ */
Signature · 6 lines
2.7.4

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

It may consider to change the function name: execlists_context_status_change to context_status_change_notify () instead. Otherwise confusing GUC submission path. Thanks.

Quoted 111 lines

-----Original Message-----
From: Intel-gfx [mailto:[email protected]] On Behalf Of Chuanxiao Dong
Sent: Monday, March 20, 2017 9:49 AM
To: [email protected]
Cc: [email protected]
Subject: [Intel-gfx] [PATCH] drm/i915/scheduler: add gvt notification for guc submission

GVT request needs a manual mmio load/restore. Before GuC submit a request, send notification to gvt for mmio loading. And after the GuC finished this GVT request, notify gvt again for mmio restore. This follows the usage when using execlists submission.

---
 drivers/gpu/drm/i915/i915_guc_submission.c | 13 +++++++++++++
 drivers/gpu/drm/i915/intel_lrc.c           | 15 ---------------
 drivers/gpu/drm/i915/intel_lrc.h           | 14 ++++++++++++++
 3 files changed, 27 insertions(+), 15 deletions(-)
drivers/gpu/drm/i915/i915_guc_submission.c +6 -0
index a3636b3..328b11c 100644
@@ -520,6 +520,12 @@ static void __i915_guc_submit(struct
 drm_i915_gem_request *rq)
 	unsigned long flags;
 	int b_ret;
 
+	/* Notify for the context status change schedule in
+	 * Currently only GVT care this notification for manually
+	 * context switch, like when using execlist mode submission
+	 */
+	execlists_context_status_change(rq,
 INTEL_CONTEXT_SCHEDULE_IN);
+
 	/* WA to flush out the pending GMADR writes to ring buffer. */
drivers/gpu/drm/i915/i915_guc_submission.c +7 -0
 	if (i915_vma_is_map_and_fenceable(rq->ring->vma))
 		POSTING_READ_FW(GUC_STATUS);
@@ -623,6 +629,13 @@ static void i915_guc_irq_handler(unsigned long data)
 		rq = port[0].request;
 		while (rq && i915_gem_request_completed(rq)) {
 			trace_i915_gem_request_out(rq);
+			/* Notify for the context status change schedule
+			 * out. Currently only GVT care this notification
+			 * for manually context switch, like when using
+			 * execlist mode submission
+			 */
+			execlists_context_status_change(rq,
+
 	INTEL_CONTEXT_SCHEDULE_OUT);
 			i915_gem_request_put(rq);
 			port[0].request = port[1].request;
drivers/gpu/drm/i915/i915_guc_submission.c +0 -0
 			port[1].request = NULL;
drivers/gpu/drm/i915/intel_lrc.c +0 -15
index becde55..4f5906b 100644
@@ -295,21 +295,6 @@ uint64_t intel_lr_context_descriptor(struct
 i915_gem_context *ctx,
 	return ctx->engine[engine->id].lrc_desc;  }
 
-static inline void
-execlists_context_status_change(struct drm_i915_gem_request *rq,
-				unsigned long status)
-{
-	/*
-	 * Only used when GVT-g is enabled now. When GVT-g is disabled,
-	 * The compiler should eliminate this function as dead-code.
-	 */
-	if (!IS_ENABLED(CONFIG_DRM_I915_GVT))
-		return;
-
-	atomic_notifier_call_chain(&rq->engine->context_status_notifier,
-				   status, rq);
-}
-
 static void
 execlists_update_context_pdps(struct i915_hw_ppgtt *ppgtt, u32
 *reg_state)  { diff --git a/drivers/gpu/drm/i915/intel_lrc.h

b/drivers/gpu/drm/i915/intel_lrc.h
index e8015e7..d3aa108 100644

drivers/gpu/drm/i915/intel_lrc.h +14 -0
@@ -87,5 +87,19 @@ uint64_t intel_lr_context_descriptor(struct
 i915_gem_context *ctx,
 /* Execlists */
 int intel_sanitize_enable_execlists(struct drm_i915_private *dev_priv,
 				    int enable_execlists);
+static inline void
+execlists_context_status_change(struct drm_i915_gem_request *rq,
+				unsigned long status)
+{
+	/*
+	 * Only used when GVT-g is enabled now. When GVT-g is disabled,
+	 * The compiler should eliminate this function as dead-code.
+	 */
+	if (!IS_ENABLED(CONFIG_DRM_I915_GVT))
+		return;
+
+	atomic_notifier_call_chain(&rq->engine->context_status_notifier,
+				   status, rq);
+}
 

#endif /* _INTEL_LRC_H_ */
--
2.7.4

Quoted 4 lines

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

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

#2 lore raw
Quoted 11 lines

-----Original Message-----
From: Zheng, Xiao
Sent: Monday, March 20, 2017 10:46 AM
To: Dong, Chuanxiao <[email protected]>; intel- [email protected]
Cc: [email protected]
Subject: RE: [Intel-gfx] [PATCH] drm/i915/scheduler: add gvt notification for guc submission

Quoted 4 lines

It may consider to change the function name:
execlists_context_status_change to context_status_change_notify () instead. Otherwise confusing GUC submission path.
Thanks.

Hi Xiao, I was considering to use the name of context_status_change_notify, but considering the guc submission is actually has an emulation of execlists on top, so back to use the original function name to align with execlists submission, as well as making the code change less. Is this explanation clear enough to use the original function name?

Thanks
Chuanxiao

Quoted 109 lines

drivers/gpu/drm/i915/i915_guc_submission.c static void i915_guc_irq_handler(unsigned long

Quoted 43 lines

-----Original Message-----
From: Intel-gfx [mailto:[email protected]] On Behalf Of Chuanxiao Dong
Sent: Monday, March 20, 2017 9:49 AM
To: [email protected]
Cc: [email protected]
Subject: [Intel-gfx] [PATCH] drm/i915/scheduler: add gvt notification for guc submission

GVT request needs a manual mmio load/restore. Before GuC submit a request, send notification to gvt for mmio loading. And after the GuC finished this GVT request, notify gvt again for mmio restore. This follows the usage when using execlists submission.

---
 drivers/gpu/drm/i915/i915_guc_submission.c | 13 +++++++++++++
 drivers/gpu/drm/i915/intel_lrc.c           | 15 ---------------
 drivers/gpu/drm/i915/intel_lrc.h           | 14 ++++++++++++++
 3 files changed, 27 insertions(+), 15 deletions(-)
drivers/gpu/drm/i915/i915_guc_submission.c +6 -0
index a3636b3..328b11c 100644
@@ -520,6 +520,12 @@ static void __i915_guc_submit(struct
 drm_i915_gem_request *rq)
 	unsigned long flags;
 	int b_ret;
 
+	/* Notify for the context status change schedule in
+	 * Currently only GVT care this notification for manually
+	 * context switch, like when using execlist mode submission
+	 */
+	execlists_context_status_change(rq,
 INTEL_CONTEXT_SCHEDULE_IN);
+
 	/* WA to flush out the pending GMADR writes to ring buffer. */
drivers/gpu/drm/i915/i915_guc_submission.c +0 -0
 	if (i915_vma_is_map_and_fenceable(rq->ring->vma))
 		POSTING_READ_FW(GUC_STATUS);
@@ -623,6 +629,13 @@ static void i915_guc_irq_handler(unsigned long

data)

Quoted 65 lines
drivers/gpu/drm/i915/i915_guc_submission.c +7 -0
 		rq = port[0].request;
 		while (rq && i915_gem_request_completed(rq)) {
 			trace_i915_gem_request_out(rq);
+			/* Notify for the context status change schedule
+			 * out. Currently only GVT care this notification
+			 * for manually context switch, like when using
+			 * execlist mode submission
+			 */
+			execlists_context_status_change(rq,
+
 	INTEL_CONTEXT_SCHEDULE_OUT);
 			i915_gem_request_put(rq);
 			port[0].request = port[1].request;
drivers/gpu/drm/i915/i915_guc_submission.c +0 -0
 			port[1].request = NULL;
drivers/gpu/drm/i915/intel_lrc.c +0 -15
index becde55..4f5906b 100644
@@ -295,21 +295,6 @@ uint64_t intel_lr_context_descriptor(struct
 i915_gem_context *ctx,
 	return ctx->engine[engine->id].lrc_desc;  }
 
-static inline void
-execlists_context_status_change(struct drm_i915_gem_request *rq,
-				unsigned long status)
-{
-	/*
-	 * Only used when GVT-g is enabled now. When GVT-g is disabled,
-	 * The compiler should eliminate this function as dead-code.
-	 */
-	if (!IS_ENABLED(CONFIG_DRM_I915_GVT))
-		return;
-
-	atomic_notifier_call_chain(&rq->engine->context_status_notifier,
-				   status, rq);
-}
-
 static void
 execlists_update_context_pdps(struct i915_hw_ppgtt *ppgtt, u32
 *reg_state)  { diff --git a/drivers/gpu/drm/i915/intel_lrc.h

b/drivers/gpu/drm/i915/intel_lrc.h
index e8015e7..d3aa108 100644

drivers/gpu/drm/i915/intel_lrc.h +14 -0
@@ -87,5 +87,19 @@ uint64_t intel_lr_context_descriptor(struct
 i915_gem_context *ctx,
 /* Execlists */
 int intel_sanitize_enable_execlists(struct drm_i915_private *dev_priv,
 				    int enable_execlists);
+static inline void
+execlists_context_status_change(struct drm_i915_gem_request *rq,
+				unsigned long status)
+{
+	/*
+	 * Only used when GVT-g is enabled now. When GVT-g is disabled,
+	 * The compiler should eliminate this function as dead-code.
+	 */
+	if (!IS_ENABLED(CONFIG_DRM_I915_GVT))
+		return;
+
+	atomic_notifier_call_chain(&rq->engine->context_status_notifier,
+				   status, rq);
+}
 
Quoted 8 lines
Quoted 8 lines

#endif /* _INTEL_LRC_H_ */
--
2.7.4

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

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

#3 lore raw

The new guc submission scheduler is not to emulation Execlist mode in driver. You can keep existing execlist_xx function name if insisted it is better.

Quoted 143 lines

-----Original Message-----
From: Dong, Chuanxiao
Sent: Monday, March 20, 2017 11:20 AM
To: Zheng, Xiao <[email protected]>; [email protected]
Cc: [email protected]
Subject: RE: [Intel-gfx] [PATCH] drm/i915/scheduler: add gvt notification for guc submission

Quoted 11 lines

-----Original Message-----
From: Zheng, Xiao
Sent: Monday, March 20, 2017 10:46 AM
To: Dong, Chuanxiao <[email protected]>; intel- [email protected]
Cc: [email protected]
Subject: RE: [Intel-gfx] [PATCH] drm/i915/scheduler: add gvt notification for guc submission

It may consider to change the function name:
execlists_context_status_change to context_status_change_notify ()

instead.

Quoted 2 lines

Otherwise confusing GUC submission path.
Thanks.

Hi Xiao, I was considering to use the name of context_status_change_notify, but considering the guc submission is actually has an emulation of execlists on top, so back to use the original function name to align with execlists submission, as well as making the code change less. Is this explanation clear enough to use the original function name?

Thanks
Chuanxiao

Quoted 109 lines

drivers/gpu/drm/i915/i915_guc_submission.c static void i915_guc_irq_handler(unsigned long

Quoted 43 lines

-----Original Message-----
From: Intel-gfx [mailto:[email protected]] On Behalf Of Chuanxiao Dong
Sent: Monday, March 20, 2017 9:49 AM
To: [email protected]
Cc: [email protected]
Subject: [Intel-gfx] [PATCH] drm/i915/scheduler: add gvt notification for guc submission

GVT request needs a manual mmio load/restore. Before GuC submit a request, send notification to gvt for mmio loading. And after the GuC finished this GVT request, notify gvt again for mmio restore. This follows the usage when using execlists submission.

---
 drivers/gpu/drm/i915/i915_guc_submission.c | 13 +++++++++++++
 drivers/gpu/drm/i915/intel_lrc.c           | 15 ---------------
 drivers/gpu/drm/i915/intel_lrc.h           | 14 ++++++++++++++
 3 files changed, 27 insertions(+), 15 deletions(-)
drivers/gpu/drm/i915/i915_guc_submission.c +6 -0
index a3636b3..328b11c 100644
@@ -520,6 +520,12 @@ static void __i915_guc_submit(struct
 drm_i915_gem_request *rq)
 	unsigned long flags;
 	int b_ret;
 
+	/* Notify for the context status change schedule in
+	 * Currently only GVT care this notification for manually
+	 * context switch, like when using execlist mode submission
+	 */
+	execlists_context_status_change(rq,
 INTEL_CONTEXT_SCHEDULE_IN);
+
 	/* WA to flush out the pending GMADR writes to ring buffer. */
drivers/gpu/drm/i915/i915_guc_submission.c +0 -0
 	if (i915_vma_is_map_and_fenceable(rq->ring->vma))
 		POSTING_READ_FW(GUC_STATUS);
@@ -623,6 +629,13 @@ static void i915_guc_irq_handler(unsigned long

data)

Quoted 65 lines
drivers/gpu/drm/i915/i915_guc_submission.c +7 -0
 		rq = port[0].request;
 		while (rq && i915_gem_request_completed(rq)) {
 			trace_i915_gem_request_out(rq);
+			/* Notify for the context status change schedule
+			 * out. Currently only GVT care this notification
+			 * for manually context switch, like when using
+			 * execlist mode submission
+			 */
+			execlists_context_status_change(rq,
+
 	INTEL_CONTEXT_SCHEDULE_OUT);
 			i915_gem_request_put(rq);
 			port[0].request = port[1].request;
drivers/gpu/drm/i915/i915_guc_submission.c +0 -0
 			port[1].request = NULL;
drivers/gpu/drm/i915/intel_lrc.c +0 -15
index becde55..4f5906b 100644
@@ -295,21 +295,6 @@ uint64_t intel_lr_context_descriptor(struct
 i915_gem_context *ctx,
 	return ctx->engine[engine->id].lrc_desc;  }
 
-static inline void
-execlists_context_status_change(struct drm_i915_gem_request *rq,
-				unsigned long status)
-{
-	/*
-	 * Only used when GVT-g is enabled now. When GVT-g is disabled,
-	 * The compiler should eliminate this function as dead-code.
-	 */
-	if (!IS_ENABLED(CONFIG_DRM_I915_GVT))
-		return;
-
-	atomic_notifier_call_chain(&rq->engine->context_status_notifier,
-				   status, rq);
-}
-
 static void
 execlists_update_context_pdps(struct i915_hw_ppgtt *ppgtt, u32
 *reg_state)  { diff --git a/drivers/gpu/drm/i915/intel_lrc.h

b/drivers/gpu/drm/i915/intel_lrc.h
index e8015e7..d3aa108 100644

drivers/gpu/drm/i915/intel_lrc.h +14 -0
@@ -87,5 +87,19 @@ uint64_t intel_lr_context_descriptor(struct
 i915_gem_context *ctx,
 /* Execlists */
 int intel_sanitize_enable_execlists(struct drm_i915_private *dev_priv,
 				    int enable_execlists);
+static inline void
+execlists_context_status_change(struct drm_i915_gem_request *rq,
+				unsigned long status)
+{
+	/*
+	 * Only used when GVT-g is enabled now. When GVT-g is disabled,
+	 * The compiler should eliminate this function as dead-code.
+	 */
+	if (!IS_ENABLED(CONFIG_DRM_I915_GVT))
+		return;
+
+	atomic_notifier_call_chain(&rq->engine->context_status_notifier,
+				   status, rq);
+}
 
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

#endif /* _INTEL_LRC_H_ */
--
2.7.4

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

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

#4 lore raw
Quoted 10 lines

-----Original Message-----
From: Zheng, Xiao
Sent: Tuesday, March 21, 2017 9:39 AM
To: Dong, Chuanxiao <[email protected]>; intel- [email protected]
Cc: [email protected]
Subject: RE: [Intel-gfx] [PATCH] drm/i915/scheduler: add gvt notification for guc submission

Quoted 2 lines

The new guc submission scheduler is not to emulation Execlist mode in driver. You can keep existing execlist_xx function name if insisted it is better.

ok got your point. The new guc submission emulate the execlists submission way, indeed it is not execlist mode. Will use a clear name in the next version.

Quoted 147 lines
Quoted 24 lines

-----Original Message-----
From: Dong, Chuanxiao
Sent: Monday, March 20, 2017 11:20 AM
To: Zheng, Xiao <[email protected]>; [email protected]
Cc: [email protected]
Subject: RE: [Intel-gfx] [PATCH] drm/i915/scheduler: add gvt notification for guc submission

Quoted 11 lines

-----Original Message-----
From: Zheng, Xiao
Sent: Monday, March 20, 2017 10:46 AM
To: Dong, Chuanxiao <[email protected]>; intel- [email protected]
Cc: [email protected]
Subject: RE: [Intel-gfx] [PATCH] drm/i915/scheduler: add gvt notification for guc submission

It may consider to change the function name:
execlists_context_status_change to context_status_change_notify ()

instead.

Quoted 8 lines
Quoted 2 lines

Otherwise confusing GUC submission path.
Thanks.

Hi Xiao, I was considering to use the name of context_status_change_notify, but considering the guc submission is actually has an emulation of execlists on top, so back to use the original function name to align with execlists submission, as well as making the code change less. Is this explanation clear enough to use the

original function name?

Quoted 114 lines

Thanks
Chuanxiao

Quoted 110 lines
Quoted 43 lines

-----Original Message-----
From: Intel-gfx [mailto:[email protected]] On Behalf Of Chuanxiao Dong
Sent: Monday, March 20, 2017 9:49 AM
To: [email protected]
Cc: [email protected]
Subject: [Intel-gfx] [PATCH] drm/i915/scheduler: add gvt notification for guc submission

GVT request needs a manual mmio load/restore. Before GuC submit a request, send notification to gvt for mmio loading. And after the GuC finished this GVT request, notify gvt again for mmio restore. This follows the usage when using execlists submission.

---
 drivers/gpu/drm/i915/i915_guc_submission.c | 13 +++++++++++++
 drivers/gpu/drm/i915/intel_lrc.c           | 15 ---------------
 drivers/gpu/drm/i915/intel_lrc.h           | 14 ++++++++++++++
 3 files changed, 27 insertions(+), 15 deletions(-)
drivers/gpu/drm/i915/i915_guc_submission.c +6 -0
index a3636b3..328b11c 100644
@@ -520,6 +520,12 @@ static void __i915_guc_submit(struct
 drm_i915_gem_request *rq)
 	unsigned long flags;
 	int b_ret;
 
+	/* Notify for the context status change schedule in
+	 * Currently only GVT care this notification for manually
+	 * context switch, like when using execlist mode submission
+	 */
+	execlists_context_status_change(rq,
 INTEL_CONTEXT_SCHEDULE_IN);
+
 	/* WA to flush out the pending GMADR writes to ring buffer. */
drivers/gpu/drm/i915/i915_guc_submission.c +0 -0
 	if (i915_vma_is_map_and_fenceable(rq->ring->vma))
 		POSTING_READ_FW(GUC_STATUS);
@@ -623,6 +629,13 @@ static void i915_guc_irq_handler(unsigned
Quoted 1 line

long

data)

Quoted 65 lines
drivers/gpu/drm/i915/i915_guc_submission.c +7 -0
 		rq = port[0].request;
 		while (rq && i915_gem_request_completed(rq)) {
 			trace_i915_gem_request_out(rq);
+			/* Notify for the context status change schedule
+			 * out. Currently only GVT care this notification
+			 * for manually context switch, like when using
+			 * execlist mode submission
+			 */
+			execlists_context_status_change(rq,
+
	INTEL_CONTEXT_SCHEDULE_OUT);
drivers/gpu/drm/i915/i915_guc_submission.c +0 -0
 			i915_gem_request_put(rq);
 			port[0].request = port[1].request;
 			port[1].request = NULL;
drivers/gpu/drm/i915/intel_lrc.c +0 -15
index becde55..4f5906b 100644
@@ -295,21 +295,6 @@ uint64_t intel_lr_context_descriptor(struct
 i915_gem_context *ctx,
 	return ctx->engine[engine->id].lrc_desc;  }
 
-static inline void
-execlists_context_status_change(struct drm_i915_gem_request *rq,
-				unsigned long status)
-{
-	/*
-	 * Only used when GVT-g is enabled now. When GVT-g is disabled,
-	 * The compiler should eliminate this function as dead-code.
-	 */
-	if (!IS_ENABLED(CONFIG_DRM_I915_GVT))
-		return;
-
-	atomic_notifier_call_chain(&rq->engine->context_status_notifier,
-				   status, rq);
-}
-
 static void
 execlists_update_context_pdps(struct i915_hw_ppgtt *ppgtt, u32
 *reg_state)  { diff --git a/drivers/gpu/drm/i915/intel_lrc.h

b/drivers/gpu/drm/i915/intel_lrc.h
index e8015e7..d3aa108 100644

drivers/gpu/drm/i915/intel_lrc.h +14 -0
@@ -87,5 +87,19 @@ uint64_t intel_lr_context_descriptor(struct
 i915_gem_context *ctx,
 /* Execlists */
 int intel_sanitize_enable_execlists(struct drm_i915_private *dev_priv,
 				    int enable_execlists);
+static inline void
+execlists_context_status_change(struct drm_i915_gem_request *rq,
+				unsigned long status)
+{
+	/*
+	 * Only used when GVT-g is enabled now. When GVT-g is disabled,
+	 * The compiler should eliminate this function as dead-code.
+	 */
+	if (!IS_ENABLED(CONFIG_DRM_I915_GVT))
+		return;
+
+	atomic_notifier_call_chain(&rq->engine->context_status_notifier,
+				   status, rq);
+}
 
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

#endif /* _INTEL_LRC_H_ */
--
2.7.4

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

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

#5 lore raw

PATCH v2 1/1 drm/i915/scheduler: add gvt notification for guc submission

In reply to Chuanxiao Dong

GVT request needs a manual mmio load/restore. Before GuC submit a request, send notification to gvt for mmio loading. And after the GuC finished this GVT request, notify gvt again for mmio restore. This follows the usage when using execlists submission.

v2: use context_status_change instead of execlists_context_status_change
for better understanding (ZhengXiao)

---
 drivers/gpu/drm/i915/i915_guc_submission.c | 12 ++++++++++++
 drivers/gpu/drm/i915/intel_lrc.c           | 21 +++------------------
 drivers/gpu/drm/i915/intel_lrc.h           | 13 +++++++++++++
 3 files changed, 28 insertions(+), 18 deletions(-)
drivers/gpu/drm/i915/i915_guc_submission.c +12 -0
index a3636b3..68c1e70 100644
@@ -520,6 +520,12 @@ static void __i915_guc_submit(struct drm_i915_gem_request *rq)
 	unsigned long flags;
 	int b_ret;
 
+	/* Notify for the context status change schedule in
+	 * Currently only GVT care this notification for manually
+	 * context switch, like when using execlist mode submission
+	 */
+	context_status_change(rq, INTEL_CONTEXT_SCHEDULE_IN);
+
 	/* WA to flush out the pending GMADR writes to ring buffer. */
 	if (i915_vma_is_map_and_fenceable(rq->ring->vma))
 		POSTING_READ_FW(GUC_STATUS);
@@ -623,6 +629,12 @@ static void i915_guc_irq_handler(unsigned long data)
 		rq = port[0].request;
 		while (rq && i915_gem_request_completed(rq)) {
 			trace_i915_gem_request_out(rq);
+			/* Notify for the context status change schedule
+			 * out. Currently only GVT care this notification
+			 * for manually context switch, like when using
+			 * execlist mode submission
+			 */
+			context_status_change(rq, INTEL_CONTEXT_SCHEDULE_OUT);
 			i915_gem_request_put(rq);
 			port[0].request = port[1].request;
 			port[1].request = NULL;
drivers/gpu/drm/i915/intel_lrc.c +3 -18
index becde55..3a5ed5c 100644
@@ -295,21 +295,6 @@ uint64_t intel_lr_context_descriptor(struct i915_gem_context *ctx,
 	return ctx->engine[engine->id].lrc_desc;
 }
 
-static inline void
-execlists_context_status_change(struct drm_i915_gem_request *rq,
-				unsigned long status)
-{
-	/*
-	 * Only used when GVT-g is enabled now. When GVT-g is disabled,
-	 * The compiler should eliminate this function as dead-code.
-	 */
-	if (!IS_ENABLED(CONFIG_DRM_I915_GVT))
-		return;
-
-	atomic_notifier_call_chain(&rq->engine->context_status_notifier,
-				   status, rq);
-}
-
 static void
 execlists_update_context_pdps(struct i915_hw_ppgtt *ppgtt, u32 *reg_state)
 {
@@ -350,7 +335,7 @@ static void execlists_submit_ports(struct intel_engine_cs *engine)
 
 	GEM_BUG_ON(port[0].count > 1);
 	if (!port[0].count)
-		execlists_context_status_change(port[0].request,
+		context_status_change(port[0].request,
 						INTEL_CONTEXT_SCHEDULE_IN);
 	desc[0] = execlists_update_context(port[0].request);
 	GEM_DEBUG_EXEC(port[0].context_id = upper_32_bits(desc[0]));
@@ -358,7 +343,7 @@ static void execlists_submit_ports(struct intel_engine_cs *engine)
 
 	if (port[1].request) {
 		GEM_BUG_ON(port[1].count);
-		execlists_context_status_change(port[1].request,
+		context_status_change(port[1].request,
 						INTEL_CONTEXT_SCHEDULE_IN);
 		desc[1] = execlists_update_context(port[1].request);
 		GEM_DEBUG_EXEC(port[1].context_id = upper_32_bits(desc[1]));
@@ -565,7 +550,7 @@ static void intel_lrc_irq_handler(unsigned long data)
 			if (--port[0].count == 0) {
 				GEM_BUG_ON(status & GEN8_CTX_STATUS_PREEMPTED);
 				GEM_BUG_ON(!i915_gem_request_completed(port[0].request));
-				execlists_context_status_change(port[0].request,
+				context_status_change(port[0].request,
 								INTEL_CONTEXT_SCHEDULE_OUT);
 
 				trace_i915_gem_request_out(port[0].request);
drivers/gpu/drm/i915/intel_lrc.h +13 -0
index e8015e7..51e1be9 100644
@@ -87,5 +87,18 @@ uint64_t intel_lr_context_descriptor(struct i915_gem_context *ctx,
 /* Execlists */
 int intel_sanitize_enable_execlists(struct drm_i915_private *dev_priv,
 				    int enable_execlists);
+static inline void
+context_status_change(struct drm_i915_gem_request *rq, unsigned long status)
+{
+	/*
+	 * Only used when GVT-g is enabled now. When GVT-g is disabled,
+	 * The compiler should eliminate this function as dead-code.
+	 */
+	if (!IS_ENABLED(CONFIG_DRM_I915_GVT))
+		return;
+
+	atomic_notifier_call_chain(&rq->engine->context_status_notifier,
+				   status, rq);
+}
 
 #endif /* _INTEL_LRC_H_ */
Signature · 6 lines
2.7.4

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

✓ Fi.CI.BAT: success for drm/i915/scheduler: add gvt notification for guc submission

In reply to Chuanxiao Dong
== Series Details ==

== Series Details ==

Series: drm/i915/scheduler: add gvt notification for guc submission
URL : https://patchwork.freedesktop.org/series/21514/
State : success

== Summary ==

Series 21514v1 drm/i915/scheduler: add gvt notification for guc submission
https://patchwork.freedesktop.org/api/1.0/series/21514/revisions/1/mbox/

Test kms_cursor_legacy:

        Subgroup basic-flip-before-cursor-atomic:
                incomplete -> SKIP       (fi-byt-j1900)
Test kms_flip:
        Subgroup basic-flip-vs-wf_vblank:
                notrun     -> INCOMPLETE (fi-byt-j1900)
                notrun     -> INCOMPLETE (fi-byt-n2820)
        Subgroup basic-plain-flip:
                incomplete -> PASS       (fi-byt-n2820)
Test kms_pipe_crc_basic:
        Subgroup hang-read-crc-pipe-b:
                incomplete -> PASS       (fi-snb-2520m)
                none       -> INCOMPLETE (fi-skl-6700hq)
                notrun     -> INCOMPLETE (fi-bxt-j4205)
        Subgroup hang-read-crc-pipe-c:
                notrun     -> INCOMPLETE (fi-ivb-3520m)
                incomplete -> PASS       (fi-bsw-n3050)
        Subgroup read-crc-pipe-b:
                incomplete -> PASS       (fi-bxt-j4205)
        Subgroup read-crc-pipe-c-frame-sequence:
                incomplete -> PASS       (fi-ivb-3520m)
Test kms_setmode:
        Subgroup basic:
                notrun     -> INCOMPLETE (fi-bsw-n3050)
Test prime_busy:
        Subgroup basic-after-default:
                notrun     -> INCOMPLETE (fi-snb-2520m)
Test prime_vgem:
        Subgroup basic-fence-wait-default:
                incomplete -> PASS       (fi-skl-6770hq)
fi-bdw-5557u     total:300  pass:284  dwarn:0   dfail:0   fail:0   skip:16  time: 621s
fi-bsw-n3050     total:300  pass:219  dwarn:0   dfail:0   fail:0   skip:45  time: 0s
fi-bxt-j4205     total:257  pass:234  dwarn:0   dfail:0   fail:3   skip:19  time: 0s
fi-byt-j1900     total:240  pass:212  dwarn:0   dfail:0   fail:0   skip:27  time: 0s
fi-byt-n2820     total:240  pass:208  dwarn:0   dfail:0   fail:0   skip:31  time: 0s
fi-hsw-4770      total:300  pass:279  dwarn:0   dfail:0   fail:1   skip:20  time: 666s
fi-ilk-650       total:300  pass:240  dwarn:0   dfail:0   fail:2   skip:58  time: 538s
fi-ivb-3520m     total:263  pass:238  dwarn:0   dfail:0   fail:5   skip:19  time: 0s
fi-kbl-7500u     total:300  pass:275  dwarn:1   dfail:0   fail:4   skip:20  time: 626s
fi-skl-6260u     total:300  pass:283  dwarn:1   dfail:0   fail:4   skip:12  time: 647s
fi-skl-6700hq    total:257  pass:235  dwarn:1   dfail:0   fail:3   skip:17  time: 0s
fi-skl-6700k     total:300  pass:271  dwarn:5   dfail:0   fail:4   skip:20  time: 664s
fi-skl-6770hq    total:300  pass:283  dwarn:1   dfail:0   fail:4   skip:12  time: 699s
fi-snb-2520m     total:300  pass:231  dwarn:0   dfail:0   fail:6   skip:35  time: 0s
fi-snb-2600      total:300  pass:259  dwarn:0   dfail:0   fail:5   skip:36  time: 602s

fi-hsw-4770r failed to connect after reboot

1e78eaf62e1d2fd47cf6fb974876610a5786d352 drm-tip: 2017y-03m-20d-21h-54m-26s UTC integration manifest e37ece2 drm/i915/scheduler: add gvt notification for guc submission

== Logs ==

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

#7 lore raw

✗ Fi.CI.BAT: failure for drm/i915/scheduler: add gvt notification for guc submission

In reply to Chuanxiao Dong
== Series Details ==

== Series Details ==

Series: drm/i915/scheduler: add gvt notification for guc submission
URL : https://patchwork.freedesktop.org/series/21514/
State : failure

== Summary ==

Series 21514v1 drm/i915/scheduler: add gvt notification for guc submission
https://patchwork.freedesktop.org/api/1.0/series/21514/revisions/1/mbox/

Test gem_exec_flush:

        Subgroup basic-batch-kernel-default-uc:
                fail       -> PASS       (fi-snb-2600) fdo#100007
Test kms_pipe_crc_basic:
        Subgroup nonblocking-crc-pipe-c-frame-sequence:
                pass       -> FAIL       (fi-skl-6700hq)

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

fi-bdw-5557u     total:278  pass:267  dwarn:0   dfail:0   fail:0   skip:11  time: 468s
fi-bsw-n3050     total:278  pass:239  dwarn:0   dfail:0   fail:0   skip:39  time: 581s
fi-bxt-j4205     total:278  pass:259  dwarn:0   dfail:0   fail:0   skip:19  time: 535s
fi-bxt-t5700     total:278  pass:258  dwarn:0   dfail:0   fail:0   skip:20  time: 544s
fi-byt-j1900     total:278  pass:251  dwarn:0   dfail:0   fail:0   skip:27  time: 507s
fi-byt-n2820     total:278  pass:247  dwarn:0   dfail:0   fail:0   skip:31  time: 502s
fi-hsw-4770      total:278  pass:262  dwarn:0   dfail:0   fail:0   skip:16  time: 440s
fi-hsw-4770r     total:278  pass:262  dwarn:0   dfail:0   fail:0   skip:16  time: 432s
fi-ilk-650       total:278  pass:228  dwarn:0   dfail:0   fail:0   skip:50  time: 437s
fi-ivb-3520m     total:278  pass:260  dwarn:0   dfail:0   fail:0   skip:18  time: 514s
fi-ivb-3770      total:278  pass:260  dwarn:0   dfail:0   fail:0   skip:18  time: 496s
fi-kbl-7500u     total:278  pass:260  dwarn:0   dfail:0   fail:0   skip:18  time: 489s
fi-skl-6260u     total:278  pass:268  dwarn:0   dfail:0   fail:0   skip:10  time: 493s
fi-skl-6700hq    total:278  pass:260  dwarn:0   dfail:0   fail:1   skip:17  time: 606s
fi-skl-6700k     total:278  pass:256  dwarn:4   dfail:0   fail:0   skip:18  time: 482s
fi-skl-6770hq    total:278  pass:268  dwarn:0   dfail:0   fail:0   skip:10  time: 527s
fi-snb-2520m     total:278  pass:250  dwarn:0   dfail:0   fail:0   skip:28  time: 545s
fi-snb-2600      total:278  pass:249  dwarn:0   dfail:0   fail:0   skip:29  time: 417s

5cde1df3c7da85cb45f45f9844741643f4d96470 drm-tip: 2017y-03m-21d-10h-23m-47s UTC integration manifest e749e89 drm/i915/scheduler: add gvt notification for guc submission

== Logs ==

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

#8 lore raw

PATCH v3 1/1 drm/i915/scheduler: add gvt notification for guc submission

In reply to Chuanxiao Dong

GVT request needs a manual mmio load/restore. Before GuC submit a request, send notification to gvt for mmio loading. And after the GuC finished this GVT request, notify gvt again for mmio restore. This follows the usage when using execlists submission.

v2: use context_status_change instead of execlists_context_status_change
for better understanding (ZhengXiao)
v3: remove the comment as it is obvious and not friendly to
the caller (Kevin)

---
 drivers/gpu/drm/i915/i915_guc_submission.c |  3 +++
 drivers/gpu/drm/i915/intel_lrc.c           | 21 +++------------------
 drivers/gpu/drm/i915/intel_lrc.h           | 13 +++++++++++++
 3 files changed, 19 insertions(+), 18 deletions(-)
drivers/gpu/drm/i915/i915_guc_submission.c +3 -0
index 055467a..0195547 100644
@@ -520,6 +520,8 @@ static void __i915_guc_submit(struct drm_i915_gem_request *rq)
 	unsigned long flags;
 	int b_ret;
 
+	context_status_change(rq, INTEL_CONTEXT_SCHEDULE_IN);
+
 	/* WA to flush out the pending GMADR writes to ring buffer. */
 	if (i915_vma_is_map_and_fenceable(rq->ring->vma))
 		POSTING_READ_FW(GUC_STATUS);
@@ -634,6 +636,7 @@ static void i915_guc_irq_handler(unsigned long data)
 		rq = port[0].request;
 		while (rq && i915_gem_request_completed(rq)) {
 			trace_i915_gem_request_out(rq);
+			context_status_change(rq, INTEL_CONTEXT_SCHEDULE_OUT);
 			i915_gem_request_put(rq);
 			port[0].request = port[1].request;
 			port[1].request = NULL;
drivers/gpu/drm/i915/intel_lrc.c +3 -18
index eec1e71..24c69b5 100644
@@ -295,21 +295,6 @@ uint64_t intel_lr_context_descriptor(struct i915_gem_context *ctx,
 	return ctx->engine[engine->id].lrc_desc;
 }
 
-static inline void
-execlists_context_status_change(struct drm_i915_gem_request *rq,
-				unsigned long status)
-{
-	/*
-	 * Only used when GVT-g is enabled now. When GVT-g is disabled,
-	 * The compiler should eliminate this function as dead-code.
-	 */
-	if (!IS_ENABLED(CONFIG_DRM_I915_GVT))
-		return;
-
-	atomic_notifier_call_chain(&rq->engine->context_status_notifier,
-				   status, rq);
-}
-
 static void
 execlists_update_context_pdps(struct i915_hw_ppgtt *ppgtt, u32 *reg_state)
 {
@@ -350,7 +335,7 @@ static void execlists_submit_ports(struct intel_engine_cs *engine)
 
 	GEM_BUG_ON(port[0].count > 1);
 	if (!port[0].count)
-		execlists_context_status_change(port[0].request,
+		context_status_change(port[0].request,
 						INTEL_CONTEXT_SCHEDULE_IN);
 	desc[0] = execlists_update_context(port[0].request);
 	GEM_DEBUG_EXEC(port[0].context_id = upper_32_bits(desc[0]));
@@ -358,7 +343,7 @@ static void execlists_submit_ports(struct intel_engine_cs *engine)
 
 	if (port[1].request) {
 		GEM_BUG_ON(port[1].count);
-		execlists_context_status_change(port[1].request,
+		context_status_change(port[1].request,
 						INTEL_CONTEXT_SCHEDULE_IN);
 		desc[1] = execlists_update_context(port[1].request);
 		GEM_DEBUG_EXEC(port[1].context_id = upper_32_bits(desc[1]));
@@ -581,7 +566,7 @@ static void intel_lrc_irq_handler(unsigned long data)
 			if (--port[0].count == 0) {
 				GEM_BUG_ON(status & GEN8_CTX_STATUS_PREEMPTED);
 				GEM_BUG_ON(!i915_gem_request_completed(port[0].request));
-				execlists_context_status_change(port[0].request,
+				context_status_change(port[0].request,
 								INTEL_CONTEXT_SCHEDULE_OUT);
 
 				trace_i915_gem_request_out(port[0].request);
drivers/gpu/drm/i915/intel_lrc.h +13 -0
index e8015e7..51e1be9 100644
@@ -87,5 +87,18 @@ uint64_t intel_lr_context_descriptor(struct i915_gem_context *ctx,
 /* Execlists */
 int intel_sanitize_enable_execlists(struct drm_i915_private *dev_priv,
 				    int enable_execlists);
+static inline void
+context_status_change(struct drm_i915_gem_request *rq, unsigned long status)
+{
+	/*
+	 * Only used when GVT-g is enabled now. When GVT-g is disabled,
+	 * The compiler should eliminate this function as dead-code.
+	 */
+	if (!IS_ENABLED(CONFIG_DRM_I915_GVT))
+		return;
+
+	atomic_notifier_call_chain(&rq->engine->context_status_notifier,
+				   status, rq);
+}
 
 #endif /* _INTEL_LRC_H_ */
Signature · 6 lines
2.7.4

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

Ping for review. GVT relies on the notification before a request submitted and after a request completed, just like when using execlist mode submission.

Quoted 140 lines

-----Original Message-----
From: Dong, Chuanxiao
Sent: Wednesday, March 22, 2017 2:35 PM
To: [email protected]
Cc: [email protected]; Dong, Chuanxiao <[email protected]>; Zheng, Xiao <[email protected]>; Tian, Kevin <[email protected]>
Subject: [PATCH v3] drm/i915/scheduler: add gvt notification for guc submission

GVT request needs a manual mmio load/restore. Before GuC submit a request, send notification to gvt for mmio loading. And after the GuC finished this GVT request, notify gvt again for mmio restore. This follows the usage when using execlists submission.

v2: use context_status_change instead of execlists_context_status_change
for better understanding (ZhengXiao)
v3: remove the comment as it is obvious and not friendly to
the caller (Kevin)

---
 drivers/gpu/drm/i915/i915_guc_submission.c |  3 +++
 drivers/gpu/drm/i915/intel_lrc.c           | 21 +++------------------
 drivers/gpu/drm/i915/intel_lrc.h           | 13 +++++++++++++
 3 files changed, 19 insertions(+), 18 deletions(-)
drivers/gpu/drm/i915/i915_guc_submission.c +2 -0
index 055467a..0195547 100644
@@ -520,6 +520,8 @@ static void __i915_guc_submit(struct
 drm_i915_gem_request *rq)
 	unsigned long flags;
 	int b_ret;
 
+	context_status_change(rq, INTEL_CONTEXT_SCHEDULE_IN);
+
 	/* WA to flush out the pending GMADR writes to ring buffer. */
 	if (i915_vma_is_map_and_fenceable(rq->ring->vma))
drivers/gpu/drm/i915/i915_guc_submission.c +1 -0
 		POSTING_READ_FW(GUC_STATUS);
@@ -634,6 +636,7 @@ static void i915_guc_irq_handler(unsigned long data)
 		rq = port[0].request;
 		while (rq && i915_gem_request_completed(rq)) {
 			trace_i915_gem_request_out(rq);
+			context_status_change(rq,
 INTEL_CONTEXT_SCHEDULE_OUT);
 			i915_gem_request_put(rq);
 			port[0].request = port[1].request;
drivers/gpu/drm/i915/i915_guc_submission.c +0 -0
 			port[1].request = NULL;
drivers/gpu/drm/i915/intel_lrc.c +0 -15
index eec1e71..24c69b5 100644
@@ -295,21 +295,6 @@ uint64_t intel_lr_context_descriptor(struct
 i915_gem_context *ctx,
 	return ctx->engine[engine->id].lrc_desc;  }
 
-static inline void
-execlists_context_status_change(struct drm_i915_gem_request *rq,
-				unsigned long status)
-{
-	/*
-	 * Only used when GVT-g is enabled now. When GVT-g is disabled,
-	 * The compiler should eliminate this function as dead-code.
-	 */
-	if (!IS_ENABLED(CONFIG_DRM_I915_GVT))
-		return;
-
-	atomic_notifier_call_chain(&rq->engine->context_status_notifier,
-				   status, rq);
-}
-
 static void
 execlists_update_context_pdps(struct i915_hw_ppgtt *ppgtt, u32
 *reg_state)  { @@ -350,7 +335,7 @@ static void

execlists_submit_ports(struct intel_engine_cs *engine)

drivers/gpu/drm/i915/intel_lrc.c +1 -1
 	GEM_BUG_ON(port[0].count > 1);
 	if (!port[0].count)
-		execlists_context_status_change(port[0].request,
+		context_status_change(port[0].request,
	INTEL_CONTEXT_SCHEDULE_IN);
drivers/gpu/drm/i915/intel_lrc.c +1 -1
 	desc[0] = execlists_update_context(port[0].request);
 	GEM_DEBUG_EXEC(port[0].context_id = upper_32_bits(desc[0]));
@@ -358,7 +343,7 @@ static void execlists_submit_ports(struct
 intel_engine_cs *engine)
 
 	if (port[1].request) {
 		GEM_BUG_ON(port[1].count);
-		execlists_context_status_change(port[1].request,
+		context_status_change(port[1].request,
 
 	INTEL_CONTEXT_SCHEDULE_IN);
drivers/gpu/drm/i915/intel_lrc.c +0 -0
 		desc[1] = execlists_update_context(port[1].request);
 		GEM_DEBUG_EXEC(port[1].context_id =

upper_32_bits(desc[1])); @@ -581,7 +566,7 @@ static void intel_lrc_irq_handler(unsigned long data)

drivers/gpu/drm/i915/intel_lrc.c +0 -0
 			if (--port[0].count == 0) {
 				GEM_BUG_ON(status &

GEN8_CTX_STATUS_PREEMPTED);

	GEM_BUG_ON(!i915_gem_request_completed(port[0].request));

-
execlists_context_status_change(port[0].request,

drivers/gpu/drm/i915/intel_lrc.c +1 -0
+				context_status_change(port[0].request,
	INTEL_CONTEXT_SCHEDULE_OUT);


	trace_i915_gem_request_out(port[0].request);
drivers/gpu/drm/i915/intel_lrc.h +13 -0
index e8015e7..51e1be9 100644
@@ -87,5 +87,18 @@ uint64_t intel_lr_context_descriptor(struct
 i915_gem_context *ctx,
 /* Execlists */
 int intel_sanitize_enable_execlists(struct drm_i915_private *dev_priv,
 				    int enable_execlists);
+static inline void
+context_status_change(struct drm_i915_gem_request *rq, unsigned long
+status) {
+	/*
+	 * Only used when GVT-g is enabled now. When GVT-g is disabled,
+	 * The compiler should eliminate this function as dead-code.
+	 */
+	if (!IS_ENABLED(CONFIG_DRM_I915_GVT))
+		return;
+
+	atomic_notifier_call_chain(&rq->engine->context_status_notifier,
+				   status, rq);
+}
 
Quoted 3 lines

#endif /* _INTEL_LRC_H_ */
--
2.7.4

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

Reviewed-by
#10 lore raw
Quoted 29 lines

From: Dong, Chuanxiao
Sent: Thursday, March 23, 2017 1:29 PM

Ping for review. GVT relies on the notification before a request submitted and after a request completed, just like when using execlist mode submission.

Quoted 23 lines

-----Original Message-----
From: Dong, Chuanxiao
Sent: Wednesday, March 22, 2017 2:35 PM
To: [email protected]
Cc: [email protected]; Dong, Chuanxiao <[email protected]>; Zheng, Xiao <[email protected]>; Tian, Kevin <[email protected]>
Subject: [PATCH v3] drm/i915/scheduler: add gvt notification for guc submission

GVT request needs a manual mmio load/restore. Before GuC submit a request, send notification to gvt for mmio loading. And after the GuC finished this GVT request, notify gvt again for mmio restore. This follows the usage when using execlists submission.

v2: use context_status_change instead of execlists_context_status_change
for better understanding (ZhengXiao)
v3: remove the comment as it is obvious and not friendly to
the caller (Kevin)

Quoted 119 lines

drivers/gpu/drm/i915/i915_guc_submission.c static void i915_guc_irq_handler(unsigned long

Quoted 22 lines
---
 drivers/gpu/drm/i915/i915_guc_submission.c |  3 +++
 drivers/gpu/drm/i915/intel_lrc.c           | 21 +++------------------
 drivers/gpu/drm/i915/intel_lrc.h           | 13 +++++++++++++
 3 files changed, 19 insertions(+), 18 deletions(-)
drivers/gpu/drm/i915/i915_guc_submission.c +2 -0
index 055467a..0195547 100644
@@ -520,6 +520,8 @@ static void __i915_guc_submit(struct
 drm_i915_gem_request *rq)
 	unsigned long flags;
 	int b_ret;
 
+	context_status_change(rq, INTEL_CONTEXT_SCHEDULE_IN);
+
 	/* WA to flush out the pending GMADR writes to ring buffer. */
 	if (i915_vma_is_map_and_fenceable(rq->ring->vma))
drivers/gpu/drm/i915/i915_guc_submission.c +0 -0
 		POSTING_READ_FW(GUC_STATUS);
@@ -634,6 +636,7 @@ static void i915_guc_irq_handler(unsigned long

data)

Quoted 43 lines
drivers/gpu/drm/i915/i915_guc_submission.c +1 -0
 		rq = port[0].request;
 		while (rq && i915_gem_request_completed(rq)) {
 			trace_i915_gem_request_out(rq);
+			context_status_change(rq,
 INTEL_CONTEXT_SCHEDULE_OUT);
 			i915_gem_request_put(rq);
 			port[0].request = port[1].request;
drivers/gpu/drm/i915/i915_guc_submission.c +0 -0
 			port[1].request = NULL;
drivers/gpu/drm/i915/intel_lrc.c +0 -15
index eec1e71..24c69b5 100644
@@ -295,21 +295,6 @@ uint64_t intel_lr_context_descriptor(struct
 i915_gem_context *ctx,
 	return ctx->engine[engine->id].lrc_desc;  }
 
-static inline void
-execlists_context_status_change(struct drm_i915_gem_request *rq,
-				unsigned long status)
-{
-	/*
-	 * Only used when GVT-g is enabled now. When GVT-g is disabled,
-	 * The compiler should eliminate this function as dead-code.
-	 */
-	if (!IS_ENABLED(CONFIG_DRM_I915_GVT))
-		return;
-
-	atomic_notifier_call_chain(&rq->engine->context_status_notifier,
-				   status, rq);
-}
-
 static void
 execlists_update_context_pdps(struct i915_hw_ppgtt *ppgtt, u32
 *reg_state)  { @@ -350,7 +335,7 @@ static void

execlists_submit_ports(struct intel_engine_cs *engine)

drivers/gpu/drm/i915/intel_lrc.c +1 -1
 	GEM_BUG_ON(port[0].count > 1);
 	if (!port[0].count)
-		execlists_context_status_change(port[0].request,
+		context_status_change(port[0].request,
	INTEL_CONTEXT_SCHEDULE_IN);

drivers/gpu/drm/i915/intel_lrc.c static void execlists_submit_ports(struct intel_engine_cs *engine) · line 341

Quoted 2 lines
drivers/gpu/drm/i915/intel_lrc.c +0 -0
 	desc[0] = execlists_update_context(port[0].request);
 	GEM_DEBUG_EXEC(port[0].context_id = upper_32_bits(desc[0]));

@@

drivers/gpu/drm/i915/intel_lrc.c

Quoted 11 lines

-358,7 +343,7 @@ static void execlists_submit_ports(struct intel_engine_cs *engine)

drivers/gpu/drm/i915/intel_lrc.c +1 -1
 	if (port[1].request) {
 		GEM_BUG_ON(port[1].count);
-		execlists_context_status_change(port[1].request,
+		context_status_change(port[1].request,
	INTEL_CONTEXT_SCHEDULE_IN);
drivers/gpu/drm/i915/intel_lrc.c +0 -0
 		desc[1] = execlists_update_context(port[1].request);
 		GEM_DEBUG_EXEC(port[1].context_id =

upper_32_bits(desc[1])); @@

Quoted 38 lines

-581,7 +566,7 @@ static void intel_lrc_irq_handler(unsigned long data)

drivers/gpu/drm/i915/intel_lrc.c +0 -0
 			if (--port[0].count == 0) {
 				GEM_BUG_ON(status &

GEN8_CTX_STATUS_PREEMPTED);

	GEM_BUG_ON(!i915_gem_request_completed(port[0].request));

-
execlists_context_status_change(port[0].request,

drivers/gpu/drm/i915/intel_lrc.c +1 -0
+				context_status_change(port[0].request,
	INTEL_CONTEXT_SCHEDULE_OUT);


	trace_i915_gem_request_out(port[0].request);
drivers/gpu/drm/i915/intel_lrc.h +13 -0
index e8015e7..51e1be9 100644
@@ -87,5 +87,18 @@ uint64_t intel_lr_context_descriptor(struct
 i915_gem_context *ctx,
 /* Execlists */
 int intel_sanitize_enable_execlists(struct drm_i915_private *dev_priv,
 				    int enable_execlists);
+static inline void
+context_status_change(struct drm_i915_gem_request *rq, unsigned long
+status) {
+	/*
+	 * Only used when GVT-g is enabled now. When GVT-g is disabled,
+	 * The compiler should eliminate this function as dead-code.
+	 */
+	if (!IS_ENABLED(CONFIG_DRM_I915_GVT))
+		return;
+
+	atomic_notifier_call_chain(&rq->engine->context_status_notifier,
+				   status, rq);
+}
 
Quoted 3 lines
Quoted 3 lines

#endif /* _INTEL_LRC_H_ */
--
2.7.4

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

maintainer Reviewed-by on v3 1/1
#11 lore raw
In reply to Chuanxiao Dong
Quoted 13 lines · Chuanxiao Dong

GVT request needs a manual mmio load/restore. Before GuC submit a request, send notification to gvt for mmio loading. And after the GuC finished this GVT request, notify gvt again for mmio restore. This follows the usage when using execlists submission.

v2: use context_status_change instead of execlists_context_status_change for better understanding (ZhengXiao)
v3: remove the comment as it is obvious and not friendly to the caller (Kevin)

<SNIP>

Quoted 7 lines
(quoted diff) +0 -0
@@ -350,7 +335,7 @@ static void execlists_submit_ports(struct intel_engine_cs *engine)


  GEM_BUG_ON(port[0].count > 1);
  if (!port[0].count)

(quoted diff) +1 -1
-		execlists_context_status_change(port[0].request,
+		context_status_change(port[0].request,

  INTEL_CONTEXT_SCHEDULE_IN);

Fix indent.

Quoted 9 lines

  desc[0] = execlists_update_context(port[0].request); GEM_DEBUG_EXEC(port[0].context_id = upper_32_bits(desc[0]));

(quoted diff) +0 -0
@@ -358,7 +343,7 @@ static void execlists_submit_ports(struct intel_engine_cs *engine)


  if (port[1].request) {
  GEM_BUG_ON(port[1].count);

drivers/gpu/drm/i915/intel_lrc.c +1 -1
-		execlists_context_status_change(port[1].request,
+		context_status_change(port[1].request,

  INTEL_CONTEXT_SCHEDULE_IN);

Ditto.

drivers/gpu/drm/i915/intel_lrc.c static void intel_lrc_irq_handler(unsigned long data) · line 570

Quoted 7 lines
drivers/gpu/drm/i915/intel_lrc.c +1 -1
@@ -581,7 +566,7 @@ static void intel_lrc_irq_handler(unsigned long data)
  			if (--port[0].count == 0) {
  				GEM_BUG_ON(status & GEN8_CTX_STATUS_PREEMPTED);
  				GEM_BUG_ON(!i915_gem_request_completed(port[0].request));
-				execlists_context_status_change(port[0].request,
+				context_status_change(port[0].request,
  								INTEL_CONTEXT_SCHEDULE_OUT);

Ditto.

drivers/gpu/drm/i915/intel_lrc.h uint64_t intel_lr_context_descriptor(struct i915_gem_context *ctx, · line 91

Quoted 6 lines
drivers/gpu/drm/i915/intel_lrc.h +2 -0
@@ -87,5 +87,18 @@ uint64_t intel_lr_context_descriptor(struct i915_gem_context *ctx,
  /* Execlists */
  int intel_sanitize_enable_execlists(struct drm_i915_private *dev_priv,
  				    int enable_execlists);
+static inline void
+context_status_change(struct drm_i915_gem_request *rq, unsigned long status)

This needs intel_lr_ prefix now that it's in .h file.

With those changes (make sure context_status_change doesn't become over character 80 line), this is;

Regards, Joonas

Signature · 7 lines
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#12 lore raw
Quoted 9 lines · Joonas Lahtinen

drivers/gpu/drm/i915/intel_lrc.h uint64_t intel_lr_context_descriptor(struct i915_gem_context *ctx, · line 91

Quoted 6 lines · Chuanxiao Dong
drivers/gpu/drm/i915/intel_lrc.h +2 -0
@@ -87,5 +87,18 @@ uint64_t intel_lr_context_descriptor(struct i915_gem_context *ctx,
  /* Execlists */
  int intel_sanitize_enable_execlists(struct drm_i915_private *dev_priv,
  				    int enable_execlists);
+static inline void
+context_status_change(struct drm_i915_gem_request *rq, unsigned long status)

This needs intel_lr_ prefix now that it's in .h file.

But not in this header. The event is not strictly tied to execlists, it consumes request for starters - but on the other hand it is gvt specific.

I'm tempted to say intel_gvt_notify_context_status(). -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
#13 lore raw
Quoted 25 lines

-----Original Message-----
From: intel-gvt-dev [mailto:[email protected]] On Behalf Of Chris Wilson
Sent: Thursday, March 23, 2017 5:43 PM
To: Joonas Lahtinen
Cc: [email protected]; [email protected]; Dong, Chuanxiao
Subject: Re: [Intel-gfx] [PATCH v3] drm/i915/scheduler: add gvt notification for guc submission

Quoted 11 lines · Joonas Lahtinen

drivers/gpu/drm/i915/intel_lrc.h uint64_t intel_lr_context_descriptor(struct · line 93

Quoted 8 lines · Chuanxiao Dong
drivers/gpu/drm/i915/intel_lrc.h +3 -0
@@ -87,5 +87,18 @@ uint64_t intel_lr_context_descriptor(struct
 i915_gem_context *ctx,
  /* Execlists */
  int intel_sanitize_enable_execlists(struct drm_i915_private *dev_priv,
  				    int enable_execlists);
+static inline void
+context_status_change(struct drm_i915_gem_request *rq, unsigned
+long status)

This needs intel_lr_ prefix now that it's in .h file.

Quoted 4 lines

But not in this header. The event is not strictly tied to execlists, it consumes request for starters - but on the other hand it is gvt specific.

I'm tempted to say intel_gvt_notify_context_status().

It makes sense. Will change the name in the next version.

Thanks
Chuanxiao

Quoted 8 lines

-Chris

--
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
intel-gvt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gvt-dev

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

#14 lore raw
In reply to Joonas Lahtinen
Quoted 80 lines

-----Original Message-----
From: Joonas Lahtinen [mailto:[email protected]]
Sent: Thursday, March 23, 2017 5:38 PM
To: Dong, Chuanxiao; [email protected]
Cc: [email protected]
Subject: Re: [Intel-gfx] [PATCH v3] drm/i915/scheduler: add gvt notification for guc submission

Quoted 14 lines · Chuanxiao Dong

GVT request needs a manual mmio load/restore. Before GuC submit a request, send notification to gvt for mmio loading. And after the GuC finished this GVT request, notify gvt again for mmio restore. This follows the usage when using execlists submission.

v2: use context_status_change instead of execlists_context_status_change
    for better understanding (ZhengXiao)
v3: remove the comment as it is obvious and not friendly to the caller (Kevin)

<SNIP>

drivers/gpu/drm/i915/intel_lrc.c static void execlists_submit_ports(struct · line 340

Quoted 8 lines
drivers/gpu/drm/i915/intel_lrc.c +1 -1
@@ -350,7 +335,7 @@ static void execlists_submit_ports(struct
 intel_engine_cs *engine)
 
  	GEM_BUG_ON(port[0].count > 1);
  	if (!port[0].count)
-		execlists_context_status_change(port[0].request,
+		context_status_change(port[0].request,
 
	INTEL_CONTEXT_SCHEDULE_IN);

Fix indent.

Quoted 2 lines
drivers/gpu/drm/i915/intel_lrc.c +0 -0
  	desc[0] = execlists_update_context(port[0].request);

  GEM_DEBUG_EXEC(port[0].context_id = upper_32_bits(desc[0]));

@@

drivers/gpu/drm/i915/intel_lrc.c static void execlists_submit_ports(struct intel_engine_cs *engine) · line 346

Quoted 8 lines

-358,7 +343,7 @@ static void execlists_submit_ports(struct intel_engine_cs *engine)

  if (port[1].request) {
  GEM_BUG_ON(port[1].count);

drivers/gpu/drm/i915/intel_lrc.c +1 -1
-		execlists_context_status_change(port[1].request,
+		context_status_change(port[1].request,
	INTEL_CONTEXT_SCHEDULE_IN);

Ditto.

Quoted 3 lines
drivers/gpu/drm/i915/intel_lrc.c +0 -0
@@ -581,7 +566,7 @@ static void intel_lrc_irq_handler(unsigned long data)
  			if (--port[0].count == 0) {

  GEM_BUG_ON(status &

GEN8_CTX_STATUS_PREEMPTED);

Quoted 1 line
	GEM_BUG_ON(!i915_gem_request_completed(port[0].request));
Quoted 1 line

-

execlists_context_status_change(port[0].request,

Review

Quoted 2 lines
(quoted diff) +1 -0
+				context_status_change(port[0].request,
	INTEL_CONTEXT_SCHEDULE_OUT);

Ditto.

drivers/gpu/drm/i915/intel_lrc.h uint64_t intel_lr_context_descriptor(struct · line 93

Quoted 8 lines
drivers/gpu/drm/i915/intel_lrc.h +3 -0
@@ -87,5 +87,18 @@ uint64_t intel_lr_context_descriptor(struct
 i915_gem_context *ctx,
  /* Execlists */
  int intel_sanitize_enable_execlists(struct drm_i915_private *dev_priv,
  				    int enable_execlists);
+static inline void
+context_status_change(struct drm_i915_gem_request *rq, unsigned long
+status)

This needs intel_lr_ prefix now that it's in .h file.

Quoted 2 lines

With those changes (make sure context_status_change doesn't become over character 80 line), this is;

Sure. Will fix in the next version.

Thanks
Chuanxiao

Quoted 8 lines

Regards, Joonas
--
Joonas Lahtinen
Open Source Technology Center
Intel Corporation

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

#15 lore raw
In reply to Chuanxiao Dong
Quoted 33 lines · Chuanxiao Dong

GVT request needs a manual mmio load/restore. Before GuC submit a request, send notification to gvt for mmio loading. And after the GuC finished this GVT request, notify gvt again for mmio restore. This follows the usage when using execlists submission.

v2: use context_status_change instead of execlists_context_status_change
for better understanding (ZhengXiao)
v3: remove the comment as it is obvious and not friendly to
the caller (Kevin)

---
 drivers/gpu/drm/i915/i915_guc_submission.c |  3 +++
 drivers/gpu/drm/i915/intel_lrc.c           | 21 +++------------------
 drivers/gpu/drm/i915/intel_lrc.h           | 13 +++++++++++++
 3 files changed, 19 insertions(+), 18 deletions(-)
drivers/gpu/drm/i915/i915_guc_submission.c +2 -0
index 055467a..0195547 100644
@@ -520,6 +520,8 @@ static void __i915_guc_submit(struct drm_i915_gem_request *rq)
 	unsigned long flags;
 	int b_ret;
 
+	context_status_change(rq, INTEL_CONTEXT_SCHEDULE_IN);
+
 	/* WA to flush out the pending GMADR writes to ring buffer. */
 	if (i915_vma_is_map_and_fenceable(rq->ring->vma))
 		POSTING_READ_FW(GUC_STATUS);

drivers/gpu/drm/i915/i915_guc_submission.c static void i915_guc_irq_handler(unsigned long data) · line 639

Quoted 4 lines
drivers/gpu/drm/i915/i915_guc_submission.c +1 -0
@@ -634,6 +636,7 @@ static void i915_guc_irq_handler(unsigned long data)
 		rq = port[0].request;
 		while (rq && i915_gem_request_completed(rq)) {
 			trace_i915_gem_request_out(rq);
+			context_status_change(rq, INTEL_CONTEXT_SCHEDULE_OUT);

Does GVT care that the context will still be active on the GPU for a small window after this notification? (User interrupt happens before context complete, which GuC hides from the driver.)

Regards,

Tvrtko

Quoted 70 lines
drivers/gpu/drm/i915/i915_guc_submission.c +0 -0
 			i915_gem_request_put(rq);
 			port[0].request = port[1].request;
 			port[1].request = NULL;
drivers/gpu/drm/i915/intel_lrc.c +3 -18
index eec1e71..24c69b5 100644
@@ -295,21 +295,6 @@ uint64_t intel_lr_context_descriptor(struct i915_gem_context *ctx,
 	return ctx->engine[engine->id].lrc_desc;
 }
 
-static inline void
-execlists_context_status_change(struct drm_i915_gem_request *rq,
-				unsigned long status)
-{
-	/*
-	 * Only used when GVT-g is enabled now. When GVT-g is disabled,
-	 * The compiler should eliminate this function as dead-code.
-	 */
-	if (!IS_ENABLED(CONFIG_DRM_I915_GVT))
-		return;
-
-	atomic_notifier_call_chain(&rq->engine->context_status_notifier,
-				   status, rq);
-}
-
 static void
 execlists_update_context_pdps(struct i915_hw_ppgtt *ppgtt, u32 *reg_state)
 {
@@ -350,7 +335,7 @@ static void execlists_submit_ports(struct intel_engine_cs *engine)
 
 	GEM_BUG_ON(port[0].count > 1);
 	if (!port[0].count)
-		execlists_context_status_change(port[0].request,
+		context_status_change(port[0].request,
 						INTEL_CONTEXT_SCHEDULE_IN);
 	desc[0] = execlists_update_context(port[0].request);
 	GEM_DEBUG_EXEC(port[0].context_id = upper_32_bits(desc[0]));
@@ -358,7 +343,7 @@ static void execlists_submit_ports(struct intel_engine_cs *engine)
 
 	if (port[1].request) {
 		GEM_BUG_ON(port[1].count);
-		execlists_context_status_change(port[1].request,
+		context_status_change(port[1].request,
 						INTEL_CONTEXT_SCHEDULE_IN);
 		desc[1] = execlists_update_context(port[1].request);
 		GEM_DEBUG_EXEC(port[1].context_id = upper_32_bits(desc[1]));
@@ -581,7 +566,7 @@ static void intel_lrc_irq_handler(unsigned long data)
 			if (--port[0].count == 0) {
 				GEM_BUG_ON(status & GEN8_CTX_STATUS_PREEMPTED);
 				GEM_BUG_ON(!i915_gem_request_completed(port[0].request));
-				execlists_context_status_change(port[0].request,
+				context_status_change(port[0].request,
 								INTEL_CONTEXT_SCHEDULE_OUT);
 
 				trace_i915_gem_request_out(port[0].request);
drivers/gpu/drm/i915/intel_lrc.h +5 -0
index e8015e7..51e1be9 100644
@@ -87,5 +87,18 @@ uint64_t intel_lr_context_descriptor(struct i915_gem_context *ctx,
 /* Execlists */
 int intel_sanitize_enable_execlists(struct drm_i915_private *dev_priv,
 				    int enable_execlists);
+static inline void
+context_status_change(struct drm_i915_gem_request *rq, unsigned long status)
+{
+	/*
+	 * Only used when GVT-g is enabled now. When GVT-g is disabled,

drivers/gpu/drm/i915/intel_lrc.h uint64_t intel_lr_context_descriptor(struct i915_gem_context *ctx, · line 104

Quoted 10 lines
drivers/gpu/drm/i915/intel_lrc.h +8 -0
+	 * The compiler should eliminate this function as dead-code.
+	 */
+	if (!IS_ENABLED(CONFIG_DRM_I915_GVT))
+		return;
+
+	atomic_notifier_call_chain(&rq->engine->context_status_notifier,
+				   status, rq);
+}
 
 #endif /* _INTEL_LRC_H_ */

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

#16 lore raw
Quoted 54 lines

-----Original Message-----
From: Tvrtko Ursulin [mailto:[email protected]]
Sent: Thursday, March 23, 2017 5:52 PM
To: Dong, Chuanxiao; [email protected]
Cc: [email protected]
Subject: Re: [Intel-gfx] [PATCH v3] drm/i915/scheduler: add gvt notification for guc submission

Quoted 6 lines · Chuanxiao Dong

GVT request needs a manual mmio load/restore. Before GuC submit a request, send notification to gvt for mmio loading. And after the GuC finished this GVT request, notify gvt again for mmio restore. This follows the usage when using execlists submission.

v2: use context_status_change instead of

execlists_context_status_change

drivers/gpu/drm/i915/i915_guc_submission.c static void __i915_guc_submit(struct

Quoted 19 lines

for better understanding (ZhengXiao)
v3: remove the comment as it is obvious and not friendly to
the caller (Kevin)

---
 drivers/gpu/drm/i915/i915_guc_submission.c |  3 +++
 drivers/gpu/drm/i915/intel_lrc.c           | 21 +++------------------
 drivers/gpu/drm/i915/intel_lrc.h           | 13 +++++++++++++
 3 files changed, 19 insertions(+), 18 deletions(-)
drivers/gpu/drm/i915/i915_guc_submission.c +0 -0
index 055467a..0195547 100644
@@ -520,6 +520,8 @@ static void __i915_guc_submit(struct

drm_i915_gem_request *rq)

drivers/gpu/drm/i915/i915_guc_submission.c static void i915_guc_irq_handler(unsigned long data) · line 639

Quoted 13 lines
drivers/gpu/drm/i915/i915_guc_submission.c +3 -0
 	unsigned long flags;
 	int b_ret;
 
+	context_status_change(rq, INTEL_CONTEXT_SCHEDULE_IN);
+
 	/* WA to flush out the pending GMADR writes to ring buffer. */
 	if (i915_vma_is_map_and_fenceable(rq->ring->vma))
 		POSTING_READ_FW(GUC_STATUS);
@@ -634,6 +636,7 @@ static void i915_guc_irq_handler(unsigned long data)
 		rq = port[0].request;
 		while (rq && i915_gem_request_completed(rq)) {
 			trace_i915_gem_request_out(rq);
+			context_status_change(rq,

INTEL_CONTEXT_SCHEDULE_OUT);

Quoted 3 lines

Does GVT care that the context will still be active on the GPU for a small window after this notification? (User interrupt happens before context complete, which GuC hides from the driver.)

Actually GVT cares. GVT driver will check the context status register to make sure the status is ACTIVE_IDLE in this notification before manually doing the context switch out for the GuC submission case.

Thanks
Chuanxiao

Quoted 96 lines

Regards,

Tvrtko

drivers/gpu/drm/i915/intel_lrc.c uint64_t intel_lr_context_descriptor(struct

Quoted 9 lines
drivers/gpu/drm/i915/i915_guc_submission.c +0 -0
 			i915_gem_request_put(rq);
 			port[0].request = port[1].request;
 			port[1].request = NULL;
drivers/gpu/drm/i915/intel_lrc.c +0 -0
index eec1e71..24c69b5 100644
@@ -295,21 +295,6 @@ uint64_t intel_lr_context_descriptor(struct

i915_gem_context *ctx,

Quoted 23 lines
drivers/gpu/drm/i915/intel_lrc.c +0 -15
 	return ctx->engine[engine->id].lrc_desc;  }
 
-static inline void
-execlists_context_status_change(struct drm_i915_gem_request *rq,
-				unsigned long status)
-{
-	/*
-	 * Only used when GVT-g is enabled now. When GVT-g is disabled,
-	 * The compiler should eliminate this function as dead-code.
-	 */
-	if (!IS_ENABLED(CONFIG_DRM_I915_GVT))
-		return;
-
-	atomic_notifier_call_chain(&rq->engine->context_status_notifier,
-				   status, rq);
-}
-
 static void
 execlists_update_context_pdps(struct i915_hw_ppgtt *ppgtt, u32
 *reg_state)  { @@ -350,7 +335,7 @@ static void
 execlists_submit_ports(struct intel_engine_cs *engine)

drivers/gpu/drm/i915/intel_lrc.c static void execlists_submit_ports(struct intel_engine_cs *engine) · line 338

Quoted 4 lines
drivers/gpu/drm/i915/intel_lrc.c +1 -1
 	GEM_BUG_ON(port[0].count > 1);
 	if (!port[0].count)
-		execlists_context_status_change(port[0].request,
+		context_status_change(port[0].request,
	INTEL_CONTEXT_SCHEDULE_IN);

drivers/gpu/drm/i915/intel_lrc.c static void execlists_submit_ports(struct intel_engine_cs *engine) · line 341

Quoted 2 lines
drivers/gpu/drm/i915/intel_lrc.c +0 -0
 	desc[0] = execlists_update_context(port[0].request);
 	GEM_DEBUG_EXEC(port[0].context_id = upper_32_bits(desc[0]));

@@

drivers/gpu/drm/i915/intel_lrc.c static void execlists_submit_ports(struct intel_engine_cs *engine) · line 346

Quoted 8 lines

-358,7 +343,7 @@ static void execlists_submit_ports(struct intel_engine_cs *engine)

drivers/gpu/drm/i915/intel_lrc.c +1 -1
 	if (port[1].request) {
 		GEM_BUG_ON(port[1].count);
-		execlists_context_status_change(port[1].request,
+		context_status_change(port[1].request,
	INTEL_CONTEXT_SCHEDULE_IN);

drivers/gpu/drm/i915/intel_lrc.c

Quoted 2 lines
drivers/gpu/drm/i915/intel_lrc.c +0 -0
 		desc[1] = execlists_update_context(port[1].request);
 		GEM_DEBUG_EXEC(port[1].context_id =

upper_32_bits(desc[1])); @@

drivers/gpu/drm/i915/intel_lrc.c

Quoted 3 lines

-581,7 +566,7 @@ static void intel_lrc_irq_handler(unsigned long data)

drivers/gpu/drm/i915/intel_lrc.c +0 -0
 			if (--port[0].count == 0) {
 				GEM_BUG_ON(status &

GEN8_CTX_STATUS_PREEMPTED);

Quoted 1 line
	GEM_BUG_ON(!i915_gem_request_completed(port[0].request));
Quoted 1 line

-

execlists_context_status_change(port[0].request,

drivers/gpu/drm/i915/intel_lrc.c

Quoted 2 lines
drivers/gpu/drm/i915/intel_lrc.c +1 -0
+				context_status_change(port[0].request,
	INTEL_CONTEXT_SCHEDULE_OUT);
Quoted 2 lines
	trace_i915_gem_request_out(port[0].request);
Quoted 24 lines
drivers/gpu/drm/i915/intel_lrc.h +13 -0
index e8015e7..51e1be9 100644
@@ -87,5 +87,18 @@ uint64_t intel_lr_context_descriptor(struct
 i915_gem_context *ctx,
 /* Execlists */
 int intel_sanitize_enable_execlists(struct drm_i915_private *dev_priv,
 				    int enable_execlists);
+static inline void
+context_status_change(struct drm_i915_gem_request *rq, unsigned long
+status) {
+	/*
+	 * Only used when GVT-g is enabled now. When GVT-g is disabled,
+	 * The compiler should eliminate this function as dead-code.
+	 */
+	if (!IS_ENABLED(CONFIG_DRM_I915_GVT))
+		return;
+
+	atomic_notifier_call_chain(&rq->engine->context_status_notifier,
+				   status, rq);
+}
 
Quoted 2 lines
Quoted 2 lines

#endif /* _INTEL_LRC_H_ */

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

#17 lore raw

PATCH v4 1/1 drm/i915/scheduler: add gvt notification for guc submission

In reply to Chuanxiao Dong

GVT request needs a manual mmio load/restore. Before GuC submit a request, send notification to gvt for mmio loading. And after the GuC finished this GVT request, notify gvt again for mmio restore. This follows the usage when using execlists submission.

v2: use context_status_change instead of execlists_context_status_change
for better understanding (ZhengXiao)
v3: remove the comment as it is obvious and not friendly to
the caller (Kevin)
v4: fix indent issues (Joonas)
rename the context_status_change to intel_gvt_notify_context_status (Chris)

---
 drivers/gpu/drm/i915/i915_guc_submission.c |  4 ++++
 drivers/gpu/drm/i915/intel_lrc.c           | 27 ++++++---------------------
 drivers/gpu/drm/i915/intel_lrc.h           | 14 ++++++++++++++
 3 files changed, 24 insertions(+), 21 deletions(-)
drivers/gpu/drm/i915/i915_guc_submission.c +4 -0
index 055467a..91a567d 100644
@@ -520,6 +520,8 @@ static void __i915_guc_submit(struct drm_i915_gem_request *rq)
 	unsigned long flags;
 	int b_ret;
 
+	intel_gvt_notify_context_status(rq, INTEL_CONTEXT_SCHEDULE_IN);
+
 	/* WA to flush out the pending GMADR writes to ring buffer. */
 	if (i915_vma_is_map_and_fenceable(rq->ring->vma))
 		POSTING_READ_FW(GUC_STATUS);
@@ -634,6 +636,8 @@ static void i915_guc_irq_handler(unsigned long data)
 		rq = port[0].request;
 		while (rq && i915_gem_request_completed(rq)) {
 			trace_i915_gem_request_out(rq);
+			intel_gvt_notify_context_status(rq,
+					INTEL_CONTEXT_SCHEDULE_OUT);
 			i915_gem_request_put(rq);
 			port[0].request = port[1].request;
 			port[1].request = NULL;
drivers/gpu/drm/i915/intel_lrc.c +6 -21
index eec1e71..8b0c937 100644
@@ -295,21 +295,6 @@ uint64_t intel_lr_context_descriptor(struct i915_gem_context *ctx,
 	return ctx->engine[engine->id].lrc_desc;
 }
 
-static inline void
-execlists_context_status_change(struct drm_i915_gem_request *rq,
-				unsigned long status)
-{
-	/*
-	 * Only used when GVT-g is enabled now. When GVT-g is disabled,
-	 * The compiler should eliminate this function as dead-code.
-	 */
-	if (!IS_ENABLED(CONFIG_DRM_I915_GVT))
-		return;
-
-	atomic_notifier_call_chain(&rq->engine->context_status_notifier,
-				   status, rq);
-}
-
 static void
 execlists_update_context_pdps(struct i915_hw_ppgtt *ppgtt, u32 *reg_state)
 {
@@ -350,16 +335,16 @@ static void execlists_submit_ports(struct intel_engine_cs *engine)
 
 	GEM_BUG_ON(port[0].count > 1);
 	if (!port[0].count)
-		execlists_context_status_change(port[0].request,
-						INTEL_CONTEXT_SCHEDULE_IN);
+		intel_gvt_notify_context_status(port[0].request,
+				INTEL_CONTEXT_SCHEDULE_IN);
 	desc[0] = execlists_update_context(port[0].request);
 	GEM_DEBUG_EXEC(port[0].context_id = upper_32_bits(desc[0]));
 	port[0].count++;
 
 	if (port[1].request) {
 		GEM_BUG_ON(port[1].count);
-		execlists_context_status_change(port[1].request,
-						INTEL_CONTEXT_SCHEDULE_IN);
+		intel_gvt_notify_context_status(port[1].request,
+				INTEL_CONTEXT_SCHEDULE_IN);
 		desc[1] = execlists_update_context(port[1].request);
 		GEM_DEBUG_EXEC(port[1].context_id = upper_32_bits(desc[1]));
 		port[1].count = 1;
@@ -581,8 +566,8 @@ static void intel_lrc_irq_handler(unsigned long data)
 			if (--port[0].count == 0) {
 				GEM_BUG_ON(status & GEN8_CTX_STATUS_PREEMPTED);
 				GEM_BUG_ON(!i915_gem_request_completed(port[0].request));
-				execlists_context_status_change(port[0].request,
-								INTEL_CONTEXT_SCHEDULE_OUT);
+				intel_gvt_notify_context_status(port[0].request,
+						INTEL_CONTEXT_SCHEDULE_OUT);
 
 				trace_i915_gem_request_out(port[0].request);
 				i915_gem_request_put(port[0].request);
drivers/gpu/drm/i915/intel_lrc.h +14 -0
index e8015e7..304e9f6 100644
@@ -87,5 +87,19 @@ uint64_t intel_lr_context_descriptor(struct i915_gem_context *ctx,
 /* Execlists */
 int intel_sanitize_enable_execlists(struct drm_i915_private *dev_priv,
 				    int enable_execlists);
+static inline void
+intel_gvt_notify_context_status(struct drm_i915_gem_request *rq,
+				unsigned long status)
+{
+	/*
+	 * Only used when GVT-g is enabled now. When GVT-g is disabled,
+	 * The compiler should eliminate this function as dead-code.
+	 */
+	if (!IS_ENABLED(CONFIG_DRM_I915_GVT))
+		return;
+
+	atomic_notifier_call_chain(&rq->engine->context_status_notifier,
+				   status, rq);
+}
 
 #endif /* _INTEL_LRC_H_ */
Signature · 6 lines
2.7.4

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

Hello, ping for review v4. It fixed the comments from Joonas and Chris. Would like to know if this patch can be applied in i915 to unblock the GVT in GuC mode. :)

Thanks
Chuanxiao

Quoted 153 lines

-----Original Message-----
From: Dong, Chuanxiao
Sent: Friday, March 24, 2017 9:49 AM
To: [email protected]
Cc: [email protected]; Dong, Chuanxiao <[email protected]>; Zheng, Xiao <[email protected]>; Tian, Kevin <[email protected]>; [email protected]; chris@chris- wilson.co.uk
Subject: [PATCH v4] drm/i915/scheduler: add gvt notification for guc submission

GVT request needs a manual mmio load/restore. Before GuC submit a request, send notification to gvt for mmio loading. And after the GuC finished this GVT request, notify gvt again for mmio restore. This follows the usage when using execlists submission.

v2: use context_status_change instead of execlists_context_status_change
for better understanding (ZhengXiao)
v3: remove the comment as it is obvious and not friendly to
the caller (Kevin)
v4: fix indent issues (Joonas)
rename the context_status_change to intel_gvt_notify_context_status
(Chris)

---
 drivers/gpu/drm/i915/i915_guc_submission.c |  4 ++++
 drivers/gpu/drm/i915/intel_lrc.c           | 27 ++++++---------------------
 drivers/gpu/drm/i915/intel_lrc.h           | 14 ++++++++++++++
 3 files changed, 24 insertions(+), 21 deletions(-)
drivers/gpu/drm/i915/i915_guc_submission.c +2 -0
index 055467a..91a567d 100644
@@ -520,6 +520,8 @@ static void __i915_guc_submit(struct
 drm_i915_gem_request *rq)
 	unsigned long flags;
 	int b_ret;
 
+	intel_gvt_notify_context_status(rq, INTEL_CONTEXT_SCHEDULE_IN);
+
 	/* WA to flush out the pending GMADR writes to ring buffer. */
 	if (i915_vma_is_map_and_fenceable(rq->ring->vma))
drivers/gpu/drm/i915/i915_guc_submission.c +2 -0
 		POSTING_READ_FW(GUC_STATUS);
@@ -634,6 +636,8 @@ static void i915_guc_irq_handler(unsigned long data)
 		rq = port[0].request;
 		while (rq && i915_gem_request_completed(rq)) {
 			trace_i915_gem_request_out(rq);
+			intel_gvt_notify_context_status(rq,
+					INTEL_CONTEXT_SCHEDULE_OUT);
 			i915_gem_request_put(rq);
 			port[0].request = port[1].request;
 			port[1].request = NULL;
drivers/gpu/drm/i915/intel_lrc.c +0 -15
index eec1e71..8b0c937 100644
@@ -295,21 +295,6 @@ uint64_t intel_lr_context_descriptor(struct
 i915_gem_context *ctx,
 	return ctx->engine[engine->id].lrc_desc;  }
 
-static inline void
-execlists_context_status_change(struct drm_i915_gem_request *rq,
-				unsigned long status)
-{
-	/*
-	 * Only used when GVT-g is enabled now. When GVT-g is disabled,
-	 * The compiler should eliminate this function as dead-code.
-	 */
-	if (!IS_ENABLED(CONFIG_DRM_I915_GVT))
-		return;
-
-	atomic_notifier_call_chain(&rq->engine->context_status_notifier,
-				   status, rq);
-}
-
 static void
 execlists_update_context_pdps(struct i915_hw_ppgtt *ppgtt, u32
 *reg_state)  { @@ -350,16 +335,16 @@ static void

execlists_submit_ports(struct intel_engine_cs *engine)

drivers/gpu/drm/i915/intel_lrc.c +0 -2
 	GEM_BUG_ON(port[0].count > 1);
 	if (!port[0].count)
-		execlists_context_status_change(port[0].request,
-
	INTEL_CONTEXT_SCHEDULE_IN);
drivers/gpu/drm/i915/intel_lrc.c +2 -2
+		intel_gvt_notify_context_status(port[0].request,
+				INTEL_CONTEXT_SCHEDULE_IN);
 	desc[0] = execlists_update_context(port[0].request);
 	GEM_DEBUG_EXEC(port[0].context_id = upper_32_bits(desc[0]));
 	port[0].count++;
 
 	if (port[1].request) {
 		GEM_BUG_ON(port[1].count);
-		execlists_context_status_change(port[1].request,
-
	INTEL_CONTEXT_SCHEDULE_IN);
drivers/gpu/drm/i915/intel_lrc.c +2 -0
+		intel_gvt_notify_context_status(port[1].request,
+				INTEL_CONTEXT_SCHEDULE_IN);
 		desc[1] = execlists_update_context(port[1].request);
 		GEM_DEBUG_EXEC(port[1].context_id =

upper_32_bits(desc[1]));

drivers/gpu/drm/i915/intel_lrc.c +0 -2
 		port[1].count = 1;
@@ -581,8 +566,8 @@ static void intel_lrc_irq_handler(unsigned long data)
 			if (--port[0].count == 0) {
 				GEM_BUG_ON(status &
 GEN8_CTX_STATUS_PREEMPTED);
 
 	GEM_BUG_ON(!i915_gem_request_completed(port[0].request));
-
 	execlists_context_status_change(port[0].request,
-
	INTEL_CONTEXT_SCHEDULE_OUT);
+
	intel_gvt_notify_context_status(port[0].request,
+
	INTEL_CONTEXT_SCHEDULE_OUT);


	trace_i915_gem_request_out(port[0].request);
drivers/gpu/drm/i915/intel_lrc.c +0 -0
 				i915_gem_request_put(port[0].request);
drivers/gpu/drm/i915/intel_lrc.h +14 -0
index e8015e7..304e9f6 100644
@@ -87,5 +87,19 @@ uint64_t intel_lr_context_descriptor(struct
 i915_gem_context *ctx,
 /* Execlists */
 int intel_sanitize_enable_execlists(struct drm_i915_private *dev_priv,
 				    int enable_execlists);
+static inline void
+intel_gvt_notify_context_status(struct drm_i915_gem_request *rq,
+				unsigned long status)
+{
+	/*
+	 * Only used when GVT-g is enabled now. When GVT-g is disabled,
+	 * The compiler should eliminate this function as dead-code.
+	 */
+	if (!IS_ENABLED(CONFIG_DRM_I915_GVT))
+		return;
+
+	atomic_notifier_call_chain(&rq->engine->context_status_notifier,
+				   status, rq);
+}
 
Quoted 3 lines

#endif /* _INTEL_LRC_H_ */
--
2.7.4

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

maintainer
#19 lore raw
In reply to Chuanxiao Dong
Quoted 17 lines · Chuanxiao Dong

GVT request needs a manual mmio load/restore. Before GuC submit a request, send notification to gvt for mmio loading. And after the GuC finished this GVT request, notify gvt again for mmio restore. This follows the usage when using execlists submission.

v2: use context_status_change instead of execlists_context_status_change for better understanding (ZhengXiao)
v3: remove the comment as it is obvious and not friendly to
    the caller (Kevin)
v4: fix indent issues (Joonas)
    rename the context_status_change to intel_gvt_notify_context_status (Chris)

<SNIP>

drivers/gpu/drm/i915/i915_guc_submission.c static void i915_guc_irq_handler(unsigned long data) · line 640

Quoted 6 lines
drivers/gpu/drm/i915/i915_guc_submission.c +2 -0
@@ -634,6 +636,8 @@ static void i915_guc_irq_handler(unsigned long data)
  		rq = port[0].request;
  		while (rq && i915_gem_request_completed(rq)) {
  			trace_i915_gem_request_out(rq);
+			intel_gvt_notify_context_status(rq,
+					INTEL_CONTEXT_SCHEDULE_OUT);

Code indent is still broken.

drivers/gpu/drm/i915/intel_lrc.h uint64_t intel_lr_context_descriptor(struct i915_gem_context *ctx, · line 92

Quoted 7 lines
drivers/gpu/drm/i915/intel_lrc.h +3 -0
@@ -87,5 +87,19 @@ uint64_t intel_lr_context_descriptor(struct i915_gem_context *ctx,
  /* Execlists */
  int intel_sanitize_enable_execlists(struct drm_i915_private *dev_priv,
  				    int enable_execlists);
+static inline void
+intel_gvt_notify_context_status(struct drm_i915_gem_request *rq,
+				unsigned long status)

With that prefix, this needs to go to intel_gvt.h, where you can take advantage of the existing #ifdef block (which should really be #if IS_ENABLED() too).

Regards, Joonas

Signature · 7 lines
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#20 lore raw
Quoted 38 lines

-----Original Message-----
From: Joonas Lahtinen [mailto:[email protected]]
Sent: Monday, March 27, 2017 6:14 PM
To: Dong, Chuanxiao <[email protected]>; intel- [email protected]
Cc: [email protected]; Zheng, Xiao <[email protected]>; Tian, Kevin <[email protected]>; chris@chris- wilson.co.uk
Subject: Re: [PATCH v4] drm/i915/scheduler: add gvt notification for guc submission

Quoted 19 lines · Chuanxiao Dong

GVT request needs a manual mmio load/restore. Before GuC submit a request, send notification to gvt for mmio loading. And after the GuC finished this GVT request, notify gvt again for mmio restore. This follows the usage when using execlists submission.

v2: use context_status_change instead of execlists_context_status_change
    for better understanding (ZhengXiao)
v3: remove the comment as it is obvious and not friendly to the caller (Kevin)
v4: fix indent issues (Joonas)
    rename the context_status_change to intel_gvt_notify_context_status (Chris)

<SNIP>

Review static void i915_guc_irq_handler(unsigned long

Quoted 1 line
(quoted diff) +0 -0
@@ -634,6 +636,8 @@ static void i915_guc_irq_handler(unsigned long

data)

Quoted 7 lines

drivers/gpu/drm/i915/i915_guc_submission.c static void i915_guc_irq_handler(unsigned long data) · line 640

Quoted 5 lines
drivers/gpu/drm/i915/i915_guc_submission.c +2 -0
  		rq = port[0].request;
  		while (rq && i915_gem_request_completed(rq)) {
  			trace_i915_gem_request_out(rq);
+			intel_gvt_notify_context_status(rq,
+					INTEL_CONTEXT_SCHEDULE_OUT);

Code indent is still broken.

Hi Joonas, I am sorry for not getting this code indent issue. The above code is just split by typing an enter due to longer than 80 characters. Are you expecting to see the code like below? The 2nd line will be longer than 80 characters in below case. If this is fine then I will change this in the next version.

			intel_gvt_notify_context_status(rq,
							INTEL_CONTEXT_SCHEDULE_OUT);
Quoted 13 lines

drivers/gpu/drm/i915/intel_lrc.h uint64_t intel_lr_context_descriptor(struct · line 93

Quoted 9 lines
drivers/gpu/drm/i915/intel_lrc.h +3 -0
@@ -87,5 +87,19 @@ uint64_t intel_lr_context_descriptor(struct
 i915_gem_context *ctx,
  /* Execlists */
  int intel_sanitize_enable_execlists(struct drm_i915_private *dev_priv,
  				    int enable_execlists);
+static inline void
+intel_gvt_notify_context_status(struct drm_i915_gem_request *rq,
+				unsigned long status)

With that prefix, this needs to go to intel_gvt.h, where you can take advantage of the existing #ifdef block (which should really be #if IS_ENABLED() too).

Sure. Will move to intel_gvt.h in the next version.

Thanks
Chuanxiao

Quoted 6 lines

Regards, Joonas
--
Joonas Lahtinen
Open Source Technology Center
Intel Corporation

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

maintainer
#21 lore raw
Quoted 10 lines · Chuanxiao
Quoted 10 lines

drivers/gpu/drm/i915/i915_guc_submission.c static void i915_guc_irq_handler(unsigned long data) · line 641

Quoted 8 lines
drivers/gpu/drm/i915/i915_guc_submission.c +2 -0
@@ -634,6 +636,8 @@ static void i915_guc_irq_handler(unsigned long data)
 
  		rq = port[0].request;
  		while (rq && i915_gem_request_completed(rq)) {
  			trace_i915_gem_request_out(rq);
+			intel_gvt_notify_context_status(rq,
+					INTEL_CONTEXT_SCHEDULE_OUT);

Code indent is still broken.

Quoted 8 lines

Hi Joonas, I am sorry for not getting this code indent issue. The above code is just split by typing an enter due to longer than 80 characters. Are you expecting to see the code like below? The 2nd line will be longer than 80 characters in below case. If this is fine then I will change this in the next version.

Quoted 2 lines
			intel_gvt_notify_context_status(rq,
							INTEL_CONTEXT_SCHEDULE_OUT);

My bad, I missed one tab.

Regards, Joonas

Signature · 7 lines
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#22 lore raw

PATCH v5 1/1 drm/i915/scheduler: add gvt notification for guc submission

In reply to Chuanxiao Dong

GVT request needs a manual mmio load/restore. Before GuC submit a request, send notification to gvt for mmio loading. And after the GuC finished this GVT request, notify gvt again for mmio restore. This follows the usage when using execlists submission.

v2: use context_status_change instead of execlists_context_status_change
for better understanding (ZhengXiao)
v3: remove the comment as it is obvious and not friendly to
the caller (Kevin)
v4: fix indent issues (Joonas)
rename the context_status_change to intel_gvt_notify_context_status (Chris)
v5: move intel_gvt_notify_context_status to intel_gvt.h (Joonas)

---
 drivers/gpu/drm/i915/i915_guc_submission.c |  4 ++++
 drivers/gpu/drm/i915/intel_gvt.h           | 13 +++++++++++++
 drivers/gpu/drm/i915/intel_lrc.c           | 21 +++------------------
 3 files changed, 20 insertions(+), 18 deletions(-)
drivers/gpu/drm/i915/i915_guc_submission.c +4 -0
index 991e76e..1223169 100644
@@ -606,6 +606,8 @@ static void __i915_guc_submit(struct drm_i915_gem_request *rq)
 	unsigned long flags;
 	int b_ret;
 
+	intel_gvt_notify_context_status(rq, INTEL_CONTEXT_SCHEDULE_IN);
+
 	/* WA to flush out the pending GMADR writes to ring buffer. */
 	if (i915_vma_is_map_and_fenceable(rq->ring->vma))
 		POSTING_READ_FW(GUC_STATUS);
@@ -720,6 +722,8 @@ static void i915_guc_irq_handler(unsigned long data)
 		rq = port[0].request;
 		while (rq && i915_gem_request_completed(rq)) {
 			trace_i915_gem_request_out(rq);
+			intel_gvt_notify_context_status(rq,
+					INTEL_CONTEXT_SCHEDULE_OUT);
 			i915_gem_request_put(rq);
 			port[0].request = port[1].request;
 			port[1].request = NULL;
drivers/gpu/drm/i915/intel_gvt.h +13 -0
index 25df2d6..9175018 100644
@@ -32,6 +32,14 @@ void intel_gvt_cleanup(struct drm_i915_private *dev_priv);
 int intel_gvt_init_device(struct drm_i915_private *dev_priv);
 void intel_gvt_clean_device(struct drm_i915_private *dev_priv);
 int intel_gvt_init_host(void);
+
+static inline void
+intel_gvt_notify_context_status(struct drm_i915_gem_request *rq,
+				unsigned long status)
+{
+	atomic_notifier_call_chain(&rq->engine->context_status_notifier,
+				   status, rq);
+}
 #else
 static inline int intel_gvt_init(struct drm_i915_private *dev_priv)
 {
@@ -40,6 +48,11 @@ static inline int intel_gvt_init(struct drm_i915_private *dev_priv)
 static inline void intel_gvt_cleanup(struct drm_i915_private *dev_priv)
 {
 }
+static inline void
+intel_gvt_notify_context_status(struct drm_i915_gem_request *rq,
+				unsigned long status)
+{
+}
 #endif
 
 #endif /* _INTEL_GVT_H_ */
drivers/gpu/drm/i915/intel_lrc.c +3 -18
index dd0e9d587..8708515 100644
@@ -295,21 +295,6 @@ uint64_t intel_lr_context_descriptor(struct i915_gem_context *ctx,
 	return ctx->engine[engine->id].lrc_desc;
 }
 
-static inline void
-execlists_context_status_change(struct drm_i915_gem_request *rq,
-				unsigned long status)
-{
-	/*
-	 * Only used when GVT-g is enabled now. When GVT-g is disabled,
-	 * The compiler should eliminate this function as dead-code.
-	 */
-	if (!IS_ENABLED(CONFIG_DRM_I915_GVT))
-		return;
-
-	atomic_notifier_call_chain(&rq->engine->context_status_notifier,
-				   status, rq);
-}
-
 static void
 execlists_update_context_pdps(struct i915_hw_ppgtt *ppgtt, u32 *reg_state)
 {
@@ -350,7 +335,7 @@ static void execlists_submit_ports(struct intel_engine_cs *engine)
 
 	GEM_BUG_ON(port[0].count > 1);
 	if (!port[0].count)
-		execlists_context_status_change(port[0].request,
+		intel_gvt_notify_context_status(port[0].request,
 						INTEL_CONTEXT_SCHEDULE_IN);
 	desc[0] = execlists_update_context(port[0].request);
 	GEM_DEBUG_EXEC(port[0].context_id = upper_32_bits(desc[0]));
@@ -358,7 +343,7 @@ static void execlists_submit_ports(struct intel_engine_cs *engine)
 
 	if (port[1].request) {
 		GEM_BUG_ON(port[1].count);
-		execlists_context_status_change(port[1].request,
+		intel_gvt_notify_context_status(port[1].request,
 						INTEL_CONTEXT_SCHEDULE_IN);
 		desc[1] = execlists_update_context(port[1].request);
 		GEM_DEBUG_EXEC(port[1].context_id = upper_32_bits(desc[1]));
@@ -591,7 +576,7 @@ static void intel_lrc_irq_handler(unsigned long data)
 			if (--port[0].count == 0) {
 				GEM_BUG_ON(status & GEN8_CTX_STATUS_PREEMPTED);
 				GEM_BUG_ON(!i915_gem_request_completed(port[0].request));
-				execlists_context_status_change(port[0].request,
+				intel_gvt_notify_context_status(port[0].request,
 								INTEL_CONTEXT_SCHEDULE_OUT);
 
 				trace_i915_gem_request_out(port[0].request);
Signature · 6 lines
2.7.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#23 lore raw
Quoted 29 lines · Chuanxiao Dong

GVT request needs a manual mmio load/restore. Before GuC submit a request, send notification to gvt for mmio loading. And after the GuC finished this GVT request, notify gvt again for mmio restore. This follows the usage when using execlists submission.

v2: use context_status_change instead of execlists_context_status_change
for better understanding (ZhengXiao)
v3: remove the comment as it is obvious and not friendly to
the caller (Kevin)
v4: fix indent issues (Joonas)
rename the context_status_change to intel_gvt_notify_context_status (Chris)
v5: move intel_gvt_notify_context_status to intel_gvt.h (Joonas)

---
 drivers/gpu/drm/i915/i915_guc_submission.c |  4 ++++
 drivers/gpu/drm/i915/intel_gvt.h           | 13 +++++++++++++
 drivers/gpu/drm/i915/intel_lrc.c           | 21 +++------------------
 3 files changed, 20 insertions(+), 18 deletions(-)
drivers/gpu/drm/i915/i915_guc_submission.c +0 -0
index 991e76e..1223169 100644

drivers/gpu/drm/i915/i915_guc_submission.c static void __i915_guc_submit(struct drm_i915_gem_request *rq) · line 609

Quoted 4 lines
drivers/gpu/drm/i915/i915_guc_submission.c +1 -0
@@ -606,6 +606,8 @@ static void __i915_guc_submit(struct drm_i915_gem_request *rq)
 	unsigned long flags;
 	int b_ret;
 
+	intel_gvt_notify_context_status(rq, INTEL_CONTEXT_SCHEDULE_IN);

So this gets called for every request, rather than at the context switch boundaries, and we only once signal the SCHEDULE_OUT. Does that matter?

Hmm, shouldn't happen in execlists due to force-single-submission.

Does it matter to gvt that we repeat the SCHEDULE_IN after reset (happens for execlists as well)?
-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
#24 lore raw
Quoted 45 lines

-----Original Message-----
From: Chris Wilson [mailto:[email protected]]
Sent: Monday, March 27, 2017 9:50 PM
To: Dong, Chuanxiao
Cc: [email protected]; [email protected]; Zheng, Xiao; Tian, Kevin; [email protected]
Subject: Re: [PATCH v5] drm/i915/scheduler: add gvt notification for guc submission

Quoted 6 lines · Chuanxiao Dong

GVT request needs a manual mmio load/restore. Before GuC submit a request, send notification to gvt for mmio loading. And after the GuC finished this GVT request, notify gvt again for mmio restore. This follows the usage when using execlists submission.

v2: use context_status_change instead of

execlists_context_status_change

drivers/gpu/drm/i915/i915_guc_submission.c static void __i915_guc_submit(struct

Quoted 25 lines

for better understanding (ZhengXiao)
v3: remove the comment as it is obvious and not friendly to
the caller (Kevin)
v4: fix indent issues (Joonas)
rename the context_status_change to
intel_gvt_notify_context_status (Chris)
v5: move intel_gvt_notify_context_status to intel_gvt.h (Joonas)

---
 drivers/gpu/drm/i915/i915_guc_submission.c |  4 ++++
 drivers/gpu/drm/i915/intel_gvt.h           | 13 +++++++++++++
 drivers/gpu/drm/i915/intel_lrc.c           | 21 +++------------------
 3 files changed, 20 insertions(+), 18 deletions(-)
drivers/gpu/drm/i915/i915_guc_submission.c +0 -0
index 991e76e..1223169 100644
@@ -606,6 +606,8 @@ static void __i915_guc_submit(struct

drm_i915_gem_request *rq)

Quoted 7 lines

drivers/gpu/drm/i915/i915_guc_submission.c static void __i915_guc_submit(struct drm_i915_gem_request *rq) · line 609

Quoted 4 lines
drivers/gpu/drm/i915/i915_guc_submission.c +1 -0
 	unsigned long flags;
 	int b_ret;
 
+	intel_gvt_notify_context_status(rq, INTEL_CONTEXT_SCHEDULE_IN);

So this gets called for every request, rather than at the context switch boundaries, and we only once signal the SCHEDULE_OUT. Does that matter?

Hi Chris, each request submitted by Guc should have a SCHEDULE_OUT in i915_guc_irq_handler to match with this SCHEDULE_IN. Any possible reason for this OUT/IN not mached?

Quoted 2 lines

Hmm, shouldn't happen in execlists due to force-single-submission.

GuC should also use force-single-submission for GVT request as execlists does. I have another patch to add this. Do you think if I should combine that patch with this one?

Quoted 3 lines

Does it matter to gvt that we repeat the SCHEDULE_IN after reset (happens for execlists as well)?

This should be fine.

Thanks
Chuanxiao

Quoted 4 lines

-Chris

--
Chris Wilson, Intel Open Source Technology Centre

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

#25 lore raw
Quoted 50 lines · Chuanxiao
Quoted 43 lines

-----Original Message-----
From: Chris Wilson [mailto:[email protected]]
Sent: Monday, March 27, 2017 9:50 PM
To: Dong, Chuanxiao
Cc: [email protected]; [email protected]; Zheng, Xiao; Tian, Kevin; [email protected]
Subject: Re: [PATCH v5] drm/i915/scheduler: add gvt notification for guc submission

Quoted 6 lines · Chuanxiao Dong

GVT request needs a manual mmio load/restore. Before GuC submit a request, send notification to gvt for mmio loading. And after the GuC finished this GVT request, notify gvt again for mmio restore. This follows the usage when using execlists submission.

v2: use context_status_change instead of

execlists_context_status_change

drivers/gpu/drm/i915/i915_guc_submission.c static void __i915_guc_submit(struct

Quoted 25 lines

for better understanding (ZhengXiao)
v3: remove the comment as it is obvious and not friendly to
the caller (Kevin)
v4: fix indent issues (Joonas)
rename the context_status_change to
intel_gvt_notify_context_status (Chris)
v5: move intel_gvt_notify_context_status to intel_gvt.h (Joonas)

---
 drivers/gpu/drm/i915/i915_guc_submission.c |  4 ++++
 drivers/gpu/drm/i915/intel_gvt.h           | 13 +++++++++++++
 drivers/gpu/drm/i915/intel_lrc.c           | 21 +++------------------
 3 files changed, 20 insertions(+), 18 deletions(-)
drivers/gpu/drm/i915/i915_guc_submission.c +0 -0
index 991e76e..1223169 100644
@@ -606,6 +606,8 @@ static void __i915_guc_submit(struct

drm_i915_gem_request *rq)

Quoted 7 lines

drivers/gpu/drm/i915/i915_guc_submission.c static void __i915_guc_submit(struct drm_i915_gem_request *rq) · line 609

Quoted 4 lines
drivers/gpu/drm/i915/i915_guc_submission.c +1 -0
 	unsigned long flags;
 	int b_ret;
 
+	intel_gvt_notify_context_status(rq, INTEL_CONTEXT_SCHEDULE_IN);

So this gets called for every request, rather than at the context switch boundaries, and we only once signal the SCHEDULE_OUT. Does that matter?

Quoted 5 lines

Hi Chris, each request submitted by Guc should have a SCHEDULE_OUT in i915_guc_irq_handler to match with this SCHEDULE_IN. Any possible reason for this OUT/IN not mached?

Quoted 2 lines

Hmm, shouldn't happen in execlists due to force-single-submission.

GuC should also use force-single-submission for GVT request as execlists does. I have another patch to add this. Do you think if I should combine that patch with this one?

Currently, each request is emitting SCHEDULE_IN, but then being amalgamated if in the same context as the earlier. Then we only see SCHEDULE_OUT from the final request in the context batch. It sounds like you need to apply the force-single-submission patch first, and then the context status notifier. Please send them in a single series, in the order they need to be applied.
-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
#26 lore raw
Quoted 76 lines

-----Original Message-----
From: intel-gvt-dev [mailto:[email protected]] On Behalf Of Chris Wilson
Sent: Monday, March 27, 2017 10:33 PM
To: Dong, Chuanxiao
Cc: Zheng, Xiao; [email protected]; [email protected]; [email protected]; Tian, Kevin
Subject: Re: [PATCH v5] drm/i915/scheduler: add gvt notification for guc submission

Quoted 44 lines · Chuanxiao
Quoted 44 lines

-----Original Message-----
From: Chris Wilson [mailto:[email protected]]
Sent: Monday, March 27, 2017 9:50 PM
To: Dong, Chuanxiao
Cc: [email protected]; [email protected];
Zheng, Xiao; Tian, Kevin; [email protected]
Subject: Re: [PATCH v5] drm/i915/scheduler: add gvt notification for guc submission

Quoted 6 lines · Chuanxiao Dong

GVT request needs a manual mmio load/restore. Before GuC submit a request, send notification to gvt for mmio loading. And after the GuC finished this GVT request, notify gvt again for mmio restore. This follows the usage when using execlists submission.

v2: use context_status_change instead of

execlists_context_status_change

drivers/gpu/drm/i915/i915_guc_submission.c static void __i915_guc_submit(struct

Quoted 25 lines

for better understanding (ZhengXiao)
v3: remove the comment as it is obvious and not friendly to
the caller (Kevin)
v4: fix indent issues (Joonas)
rename the context_status_change to
intel_gvt_notify_context_status (Chris)
v5: move intel_gvt_notify_context_status to intel_gvt.h (Joonas)

---
 drivers/gpu/drm/i915/i915_guc_submission.c |  4 ++++
 drivers/gpu/drm/i915/intel_gvt.h           | 13 +++++++++++++
 drivers/gpu/drm/i915/intel_lrc.c           | 21 +++------------------
 3 files changed, 20 insertions(+), 18 deletions(-)
drivers/gpu/drm/i915/i915_guc_submission.c +0 -0
index 991e76e..1223169 100644
@@ -606,6 +606,8 @@ static void __i915_guc_submit(struct

drm_i915_gem_request *rq)

Quoted 7 lines
Quoted 7 lines

drivers/gpu/drm/i915/i915_guc_submission.c static void __i915_guc_submit(struct drm_i915_gem_request *rq) · line 609

Quoted 4 lines
drivers/gpu/drm/i915/i915_guc_submission.c +1 -0
 	unsigned long flags;
 	int b_ret;
 
+	intel_gvt_notify_context_status(rq, INTEL_CONTEXT_SCHEDULE_IN);

So this gets called for every request, rather than at the context switch boundaries, and we only once signal the SCHEDULE_OUT. Does

that matter?

Quoted 1 line

Hi Chris, each request submitted by Guc should have a SCHEDULE_OUT in

i915_guc_irq_handler to match with this SCHEDULE_IN. Any possible reason for this OUT/IN not mached?

Quoted 4 lines
Quoted 3 lines

Hmm, shouldn't happen in execlists due to force-single-submission.

GuC should also use force-single-submission for GVT request as execlists

does. I have another patch to add this. Do you think if I should combine that patch with this one?

Quoted 6 lines

Currently, each request is emitting SCHEDULE_IN, but then being amalgamated if in the same context as the earlier. Then we only see SCHEDULE_OUT from the final request in the context batch. It sounds like you need to apply the force-single-submission patch first, and then the context status notifier. Please send them in a single series, in the order they need to be applied.

I see. Thanks Chris. I will drop this one and send out a new serial patches.

Thanks
Chuanxiao

Quoted 8 lines

-Chris

--
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
intel-gvt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gvt-dev

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