aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWeinan Li <weinan.z.li@intel.com>2018-01-26 02:09:07 -0500
committerRodrigo Vivi <rodrigo.vivi@intel.com>2018-02-06 14:40:59 -0500
commit7569a06dc80ec05c96783f541fa706ea3bebec79 (patch)
tree28f69dd7a6cd18ccbe6786662307c5dfba2a21c5
parentb8a89f530f5692c70778c965f0bc8f5a61fbe703 (diff)
drm/i915/gvt: refine intel_vgpu_submission_ops as per engine ops
Using per engine ops will be more flexible, here refine sub-ops(init, clean) as per engine operation align with reset operation. This change also will be used in next fix patch for VM engine reset. Cc: Fred Gao <fred.gao@intel.com> Cc: Zhi Wang <zhi.a.wang@intel.com> Signed-off-by: Weinan Li <weinan.z.li@intel.com> Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com> Signed-off-by: Zhi Wang <zhi.a.wang@intel.com> Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
-rw-r--r--drivers/gpu/drm/i915/gvt/execlist.c22
-rw-r--r--drivers/gpu/drm/i915/gvt/gvt.h4
-rw-r--r--drivers/gpu/drm/i915/gvt/handlers.c1
-rw-r--r--drivers/gpu/drm/i915/gvt/scheduler.c7
-rw-r--r--drivers/gpu/drm/i915/gvt/scheduler.h1
-rw-r--r--drivers/gpu/drm/i915/gvt/vgpu.c3
6 files changed, 20 insertions, 18 deletions
diff --git a/drivers/gpu/drm/i915/gvt/execlist.c b/drivers/gpu/drm/i915/gvt/execlist.c
index 769c1c24ae75..70494e394d2c 100644
--- a/drivers/gpu/drm/i915/gvt/execlist.c
+++ b/drivers/gpu/drm/i915/gvt/execlist.c
@@ -521,24 +521,23 @@ static void init_vgpu_execlist(struct intel_vgpu *vgpu, int ring_id)
521 521
522 ctx_status_ptr_reg = execlist_ring_mmio(vgpu->gvt, ring_id, 522 ctx_status_ptr_reg = execlist_ring_mmio(vgpu->gvt, ring_id,
523 _EL_OFFSET_STATUS_PTR); 523 _EL_OFFSET_STATUS_PTR);
524
525 ctx_status_ptr.dw = vgpu_vreg(vgpu, ctx_status_ptr_reg); 524 ctx_status_ptr.dw = vgpu_vreg(vgpu, ctx_status_ptr_reg);
526 ctx_status_ptr.read_ptr = 0; 525 ctx_status_ptr.read_ptr = 0;
527 ctx_status_ptr.write_ptr = 0x7; 526 ctx_status_ptr.write_ptr = 0x7;
528 vgpu_vreg(vgpu, ctx_status_ptr_reg) = ctx_status_ptr.dw; 527 vgpu_vreg(vgpu, ctx_status_ptr_reg) = ctx_status_ptr.dw;
529} 528}
530 529
531static void clean_execlist(struct intel_vgpu *vgpu) 530static void clean_execlist(struct intel_vgpu *vgpu, unsigned long engine_mask)
532{ 531{
533 enum intel_engine_id i; 532 unsigned int tmp;
533 struct drm_i915_private *dev_priv = vgpu->gvt->dev_priv;
534 struct intel_engine_cs *engine; 534 struct intel_engine_cs *engine;
535 struct intel_vgpu_submission *s = &vgpu->submission;
535 536
536 for_each_engine(engine, vgpu->gvt->dev_priv, i) { 537 for_each_engine_masked(engine, dev_priv, engine_mask, tmp) {
537 struct intel_vgpu_submission *s = &vgpu->submission; 538 kfree(s->ring_scan_buffer[engine->id]);
538 539 s->ring_scan_buffer[engine->id] = NULL;
539 kfree(s->ring_scan_buffer[i]); 540 s->ring_scan_buffer_size[engine->id] = 0;
540 s->ring_scan_buffer[i] = NULL;
541 s->ring_scan_buffer_size[i] = 0;
542 } 541 }
543} 542}
544 543
@@ -553,9 +552,10 @@ static void reset_execlist(struct intel_vgpu *vgpu,
553 init_vgpu_execlist(vgpu, engine->id); 552 init_vgpu_execlist(vgpu, engine->id);
554} 553}
555 554
556static int init_execlist(struct intel_vgpu *vgpu) 555static int init_execlist(struct intel_vgpu *vgpu,
556 unsigned long engine_mask)
557{ 557{
558 reset_execlist(vgpu, ALL_ENGINES); 558 reset_execlist(vgpu, engine_mask);
559 return 0; 559 return 0;
560} 560}
561 561
diff --git a/drivers/gpu/drm/i915/gvt/gvt.h b/drivers/gpu/drm/i915/gvt/gvt.h
index 7dc7a80213a8..c88c48989822 100644
--- a/drivers/gpu/drm/i915/gvt/gvt.h
+++ b/drivers/gpu/drm/i915/gvt/gvt.h
@@ -152,8 +152,8 @@ enum {
152 152
153struct intel_vgpu_submission_ops { 153struct intel_vgpu_submission_ops {
154 const char *name; 154 const char *name;
155 int (*init)(struct intel_vgpu *vgpu); 155 int (*init)(struct intel_vgpu *vgpu, unsigned long engine_mask);
156 void (*clean)(struct intel_vgpu *vgpu); 156 void (*clean)(struct intel_vgpu *vgpu, unsigned long engine_mask);
157 void (*reset)(struct intel_vgpu *vgpu, unsigned long engine_mask); 157 void (*reset)(struct intel_vgpu *vgpu, unsigned long engine_mask);
158}; 158};
159 159
diff --git a/drivers/gpu/drm/i915/gvt/handlers.c b/drivers/gpu/drm/i915/gvt/handlers.c
index 38f3b00d3a7a..befda75601ff 100644
--- a/drivers/gpu/drm/i915/gvt/handlers.c
+++ b/drivers/gpu/drm/i915/gvt/handlers.c
@@ -1527,6 +1527,7 @@ static int ring_mode_mmio_write(struct intel_vgpu *vgpu, unsigned int offset,
1527 return 0; 1527 return 0;
1528 1528
1529 ret = intel_vgpu_select_submission_ops(vgpu, 1529 ret = intel_vgpu_select_submission_ops(vgpu,
1530 ALL_ENGINES,
1530 INTEL_VGPU_EXECLIST_SUBMISSION); 1531 INTEL_VGPU_EXECLIST_SUBMISSION);
1531 if (ret) 1532 if (ret)
1532 return ret; 1533 return ret;
diff --git a/drivers/gpu/drm/i915/gvt/scheduler.c b/drivers/gpu/drm/i915/gvt/scheduler.c
index 0056638b0c16..f0997a2f0513 100644
--- a/drivers/gpu/drm/i915/gvt/scheduler.c
+++ b/drivers/gpu/drm/i915/gvt/scheduler.c
@@ -991,7 +991,7 @@ void intel_vgpu_clean_submission(struct intel_vgpu *vgpu)
991{ 991{
992 struct intel_vgpu_submission *s = &vgpu->submission; 992 struct intel_vgpu_submission *s = &vgpu->submission;
993 993
994 intel_vgpu_select_submission_ops(vgpu, 0); 994 intel_vgpu_select_submission_ops(vgpu, ALL_ENGINES, 0);
995 i915_gem_context_put(s->shadow_ctx); 995 i915_gem_context_put(s->shadow_ctx);
996 kmem_cache_destroy(s->workloads); 996 kmem_cache_destroy(s->workloads);
997} 997}
@@ -1079,6 +1079,7 @@ out_shadow_ctx:
1079 * 1079 *
1080 */ 1080 */
1081int intel_vgpu_select_submission_ops(struct intel_vgpu *vgpu, 1081int intel_vgpu_select_submission_ops(struct intel_vgpu *vgpu,
1082 unsigned long engine_mask,
1082 unsigned int interface) 1083 unsigned int interface)
1083{ 1084{
1084 struct intel_vgpu_submission *s = &vgpu->submission; 1085 struct intel_vgpu_submission *s = &vgpu->submission;
@@ -1092,7 +1093,7 @@ int intel_vgpu_select_submission_ops(struct intel_vgpu *vgpu,
1092 return -EINVAL; 1093 return -EINVAL;
1093 1094
1094 if (s->active) { 1095 if (s->active) {
1095 s->ops->clean(vgpu); 1096 s->ops->clean(vgpu, engine_mask);
1096 s->active = false; 1097 s->active = false;
1097 gvt_dbg_core("vgpu%d: de-select ops [ %s ] \n", 1098 gvt_dbg_core("vgpu%d: de-select ops [ %s ] \n",
1098 vgpu->id, s->ops->name); 1099 vgpu->id, s->ops->name);
@@ -1105,7 +1106,7 @@ int intel_vgpu_select_submission_ops(struct intel_vgpu *vgpu,
1105 return 0; 1106 return 0;
1106 } 1107 }
1107 1108
1108 ret = ops[interface]->init(vgpu); 1109 ret = ops[interface]->init(vgpu, engine_mask);
1109 if (ret) 1110 if (ret)
1110 return ret; 1111 return ret;
1111 1112
diff --git a/drivers/gpu/drm/i915/gvt/scheduler.h b/drivers/gpu/drm/i915/gvt/scheduler.h
index 3de77dfa7c59..ff175a98b19e 100644
--- a/drivers/gpu/drm/i915/gvt/scheduler.h
+++ b/drivers/gpu/drm/i915/gvt/scheduler.h
@@ -141,6 +141,7 @@ void intel_vgpu_reset_submission(struct intel_vgpu *vgpu,
141void intel_vgpu_clean_submission(struct intel_vgpu *vgpu); 141void intel_vgpu_clean_submission(struct intel_vgpu *vgpu);
142 142
143int intel_vgpu_select_submission_ops(struct intel_vgpu *vgpu, 143int intel_vgpu_select_submission_ops(struct intel_vgpu *vgpu,
144 unsigned long engine_mask,
144 unsigned int interface); 145 unsigned int interface);
145 146
146extern const struct intel_vgpu_submission_ops 147extern const struct intel_vgpu_submission_ops
diff --git a/drivers/gpu/drm/i915/gvt/vgpu.c b/drivers/gpu/drm/i915/gvt/vgpu.c
index a8784fa91289..b87b19d8443c 100644
--- a/drivers/gpu/drm/i915/gvt/vgpu.c
+++ b/drivers/gpu/drm/i915/gvt/vgpu.c
@@ -520,8 +520,7 @@ void intel_gvt_reset_vgpu_locked(struct intel_vgpu *vgpu, bool dmlr,
520 intel_vgpu_reset_submission(vgpu, resetting_eng); 520 intel_vgpu_reset_submission(vgpu, resetting_eng);
521 /* full GPU reset or device model level reset */ 521 /* full GPU reset or device model level reset */
522 if (engine_mask == ALL_ENGINES || dmlr) { 522 if (engine_mask == ALL_ENGINES || dmlr) {
523 intel_vgpu_select_submission_ops(vgpu, 0); 523 intel_vgpu_select_submission_ops(vgpu, ALL_ENGINES, 0);
524
525 /*fence will not be reset during virtual reset */ 524 /*fence will not be reset during virtual reset */
526 if (dmlr) { 525 if (dmlr) {
527 intel_vgpu_reset_gtt(vgpu); 526 intel_vgpu_reset_gtt(vgpu);