Commit 7569a06d authored by Weinan Li's avatar Weinan Li Committed by Rodrigo Vivi

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: default avatarWeinan Li <weinan.z.li@intel.com>
Signed-off-by: default avatarZhenyu Wang <zhenyuw@linux.intel.com>
Signed-off-by: default avatarZhi Wang <zhi.a.wang@intel.com>
Signed-off-by: default avatarRodrigo Vivi <rodrigo.vivi@intel.com>
parent b8a89f53
...@@ -521,24 +521,23 @@ static void init_vgpu_execlist(struct intel_vgpu *vgpu, int ring_id) ...@@ -521,24 +521,23 @@ static void init_vgpu_execlist(struct intel_vgpu *vgpu, int ring_id)
ctx_status_ptr_reg = execlist_ring_mmio(vgpu->gvt, ring_id, ctx_status_ptr_reg = execlist_ring_mmio(vgpu->gvt, ring_id,
_EL_OFFSET_STATUS_PTR); _EL_OFFSET_STATUS_PTR);
ctx_status_ptr.dw = vgpu_vreg(vgpu, ctx_status_ptr_reg); ctx_status_ptr.dw = vgpu_vreg(vgpu, ctx_status_ptr_reg);
ctx_status_ptr.read_ptr = 0; ctx_status_ptr.read_ptr = 0;
ctx_status_ptr.write_ptr = 0x7; ctx_status_ptr.write_ptr = 0x7;
vgpu_vreg(vgpu, ctx_status_ptr_reg) = ctx_status_ptr.dw; vgpu_vreg(vgpu, ctx_status_ptr_reg) = ctx_status_ptr.dw;
} }
static void clean_execlist(struct intel_vgpu *vgpu) static void clean_execlist(struct intel_vgpu *vgpu, unsigned long engine_mask)
{ {
enum intel_engine_id i; unsigned int tmp;
struct drm_i915_private *dev_priv = vgpu->gvt->dev_priv;
struct intel_engine_cs *engine; struct intel_engine_cs *engine;
for_each_engine(engine, vgpu->gvt->dev_priv, i) {
struct intel_vgpu_submission *s = &vgpu->submission; struct intel_vgpu_submission *s = &vgpu->submission;
kfree(s->ring_scan_buffer[i]); for_each_engine_masked(engine, dev_priv, engine_mask, tmp) {
s->ring_scan_buffer[i] = NULL; kfree(s->ring_scan_buffer[engine->id]);
s->ring_scan_buffer_size[i] = 0; s->ring_scan_buffer[engine->id] = NULL;
s->ring_scan_buffer_size[engine->id] = 0;
} }
} }
...@@ -553,9 +552,10 @@ static void reset_execlist(struct intel_vgpu *vgpu, ...@@ -553,9 +552,10 @@ static void reset_execlist(struct intel_vgpu *vgpu,
init_vgpu_execlist(vgpu, engine->id); init_vgpu_execlist(vgpu, engine->id);
} }
static int init_execlist(struct intel_vgpu *vgpu) static int init_execlist(struct intel_vgpu *vgpu,
unsigned long engine_mask)
{ {
reset_execlist(vgpu, ALL_ENGINES); reset_execlist(vgpu, engine_mask);
return 0; return 0;
} }
......
...@@ -152,8 +152,8 @@ enum { ...@@ -152,8 +152,8 @@ enum {
struct intel_vgpu_submission_ops { struct intel_vgpu_submission_ops {
const char *name; const char *name;
int (*init)(struct intel_vgpu *vgpu); int (*init)(struct intel_vgpu *vgpu, unsigned long engine_mask);
void (*clean)(struct intel_vgpu *vgpu); void (*clean)(struct intel_vgpu *vgpu, unsigned long engine_mask);
void (*reset)(struct intel_vgpu *vgpu, unsigned long engine_mask); void (*reset)(struct intel_vgpu *vgpu, unsigned long engine_mask);
}; };
......
...@@ -1527,6 +1527,7 @@ static int ring_mode_mmio_write(struct intel_vgpu *vgpu, unsigned int offset, ...@@ -1527,6 +1527,7 @@ static int ring_mode_mmio_write(struct intel_vgpu *vgpu, unsigned int offset,
return 0; return 0;
ret = intel_vgpu_select_submission_ops(vgpu, ret = intel_vgpu_select_submission_ops(vgpu,
ALL_ENGINES,
INTEL_VGPU_EXECLIST_SUBMISSION); INTEL_VGPU_EXECLIST_SUBMISSION);
if (ret) if (ret)
return ret; return ret;
......
...@@ -991,7 +991,7 @@ void intel_vgpu_clean_submission(struct intel_vgpu *vgpu) ...@@ -991,7 +991,7 @@ void intel_vgpu_clean_submission(struct intel_vgpu *vgpu)
{ {
struct intel_vgpu_submission *s = &vgpu->submission; struct intel_vgpu_submission *s = &vgpu->submission;
intel_vgpu_select_submission_ops(vgpu, 0); intel_vgpu_select_submission_ops(vgpu, ALL_ENGINES, 0);
i915_gem_context_put(s->shadow_ctx); i915_gem_context_put(s->shadow_ctx);
kmem_cache_destroy(s->workloads); kmem_cache_destroy(s->workloads);
} }
...@@ -1079,6 +1079,7 @@ int intel_vgpu_setup_submission(struct intel_vgpu *vgpu) ...@@ -1079,6 +1079,7 @@ int intel_vgpu_setup_submission(struct intel_vgpu *vgpu)
* *
*/ */
int intel_vgpu_select_submission_ops(struct intel_vgpu *vgpu, int intel_vgpu_select_submission_ops(struct intel_vgpu *vgpu,
unsigned long engine_mask,
unsigned int interface) unsigned int interface)
{ {
struct intel_vgpu_submission *s = &vgpu->submission; struct intel_vgpu_submission *s = &vgpu->submission;
...@@ -1092,7 +1093,7 @@ int intel_vgpu_select_submission_ops(struct intel_vgpu *vgpu, ...@@ -1092,7 +1093,7 @@ int intel_vgpu_select_submission_ops(struct intel_vgpu *vgpu,
return -EINVAL; return -EINVAL;
if (s->active) { if (s->active) {
s->ops->clean(vgpu); s->ops->clean(vgpu, engine_mask);
s->active = false; s->active = false;
gvt_dbg_core("vgpu%d: de-select ops [ %s ] \n", gvt_dbg_core("vgpu%d: de-select ops [ %s ] \n",
vgpu->id, s->ops->name); vgpu->id, s->ops->name);
...@@ -1105,7 +1106,7 @@ int intel_vgpu_select_submission_ops(struct intel_vgpu *vgpu, ...@@ -1105,7 +1106,7 @@ int intel_vgpu_select_submission_ops(struct intel_vgpu *vgpu,
return 0; return 0;
} }
ret = ops[interface]->init(vgpu); ret = ops[interface]->init(vgpu, engine_mask);
if (ret) if (ret)
return ret; return ret;
......
...@@ -141,6 +141,7 @@ void intel_vgpu_reset_submission(struct intel_vgpu *vgpu, ...@@ -141,6 +141,7 @@ void intel_vgpu_reset_submission(struct intel_vgpu *vgpu,
void intel_vgpu_clean_submission(struct intel_vgpu *vgpu); void intel_vgpu_clean_submission(struct intel_vgpu *vgpu);
int intel_vgpu_select_submission_ops(struct intel_vgpu *vgpu, int intel_vgpu_select_submission_ops(struct intel_vgpu *vgpu,
unsigned long engine_mask,
unsigned int interface); unsigned int interface);
extern const struct intel_vgpu_submission_ops extern const struct intel_vgpu_submission_ops
......
...@@ -520,8 +520,7 @@ void intel_gvt_reset_vgpu_locked(struct intel_vgpu *vgpu, bool dmlr, ...@@ -520,8 +520,7 @@ void intel_gvt_reset_vgpu_locked(struct intel_vgpu *vgpu, bool dmlr,
intel_vgpu_reset_submission(vgpu, resetting_eng); intel_vgpu_reset_submission(vgpu, resetting_eng);
/* full GPU reset or device model level reset */ /* full GPU reset or device model level reset */
if (engine_mask == ALL_ENGINES || dmlr) { if (engine_mask == ALL_ENGINES || dmlr) {
intel_vgpu_select_submission_ops(vgpu, 0); intel_vgpu_select_submission_ops(vgpu, ALL_ENGINES, 0);
/*fence will not be reset during virtual reset */ /*fence will not be reset during virtual reset */
if (dmlr) { if (dmlr) {
intel_vgpu_reset_gtt(vgpu); intel_vgpu_reset_gtt(vgpu);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment