Commit 0f43702a authored by fred gao's avatar fred gao Committed by Zhenyu Wang

drm/i915/gvt: Refine error handling in dispatch_workload

When an error occurs in dispatch_workload, this patch is to do the
proper cleanup and rollback to the original states before the workload
is abandoned.

v2:
- split the mixed several error paths for better review. (Zhenyu)

v3:
- original PTR_ERR(cs) is good and code cleanup. (Zhenyu)

v4:
- reuse the existing i915_add_request for error handling. (Zhenyu)

v5:
- remove the duplicate error handling release_shadow_wa_ctx and
  move the engine->context_unpin upper. (Zhenyu)

v6:
- keep the old label "out". (Zhenyu)
Signed-off-by: default avatarfred gao <fred.gao@intel.com>
Signed-off-by: default avatarZhenyu Wang <zhenyuw@linux.intel.com>
parent 46b441ef
...@@ -342,9 +342,11 @@ static int dispatch_workload(struct intel_vgpu_workload *workload) ...@@ -342,9 +342,11 @@ static int dispatch_workload(struct intel_vgpu_workload *workload)
if (workload->prepare) { if (workload->prepare) {
ret = workload->prepare(workload); ret = workload->prepare(workload);
if (ret) if (ret) {
engine->context_unpin(engine, shadow_ctx);
goto out; goto out;
} }
}
out: out:
if (ret) if (ret)
......
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