]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-5.1/drm-i915-gvt-emit-init-breadcrumb-for-gvt-request.patch
4.14-stable patches
[thirdparty/kernel/stable-queue.git] / queue-5.1 / drm-i915-gvt-emit-init-breadcrumb-for-gvt-request.patch
1 From a8c2d5ab9e71be3f9431c47bd45329a36e1fc650 Mon Sep 17 00:00:00 2001
2 From: Weinan <weinan.z.li@intel.com>
3 Date: Fri, 10 May 2019 15:57:20 +0800
4 Subject: drm/i915/gvt: emit init breadcrumb for gvt request
5
6 From: Weinan <weinan.z.li@intel.com>
7
8 commit a8c2d5ab9e71be3f9431c47bd45329a36e1fc650 upstream.
9
10 "To track whether a request has started on HW, we can emit a breadcrumb at
11 the beginning of the request and check its timeline's HWSP to see if the
12 breadcrumb has advanced past the start of this request." It means all the
13 request which timeline's has_init_breadcrumb is true, then the
14 emit_init_breadcrumb process must have before emitting the real commands,
15 otherwise, the scheduler might get a wrong state of this request during
16 reset. If the request is exactly the guilty one, the scheduler won't
17 terminate it with the wrong state. To avoid this, do emit_init_breadcrumb
18 for all the requests from gvt.
19
20 v2: cc to stable kernel
21
22 Fixes: 8547444137ec ("drm/i915: Identify active requests")
23 Cc: stable@vger.kernel.org
24 Acked-by: Zhenyu Wang <zhenyuw@linux.intel.com>
25 Signed-off-by: Weinan <weinan.z.li@intel.com>
26 Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
27 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
28
29 ---
30 drivers/gpu/drm/i915/gvt/scheduler.c | 19 +++++++++++++++++++
31 1 file changed, 19 insertions(+)
32
33 --- a/drivers/gpu/drm/i915/gvt/scheduler.c
34 +++ b/drivers/gpu/drm/i915/gvt/scheduler.c
35 @@ -298,12 +298,31 @@ static int copy_workload_to_ring_buffer(
36 struct i915_request *req = workload->req;
37 void *shadow_ring_buffer_va;
38 u32 *cs;
39 + int err;
40
41 if ((IS_KABYLAKE(req->i915) || IS_BROXTON(req->i915)
42 || IS_COFFEELAKE(req->i915))
43 && is_inhibit_context(req->hw_context))
44 intel_vgpu_restore_inhibit_context(vgpu, req);
45
46 + /*
47 + * To track whether a request has started on HW, we can emit a
48 + * breadcrumb at the beginning of the request and check its
49 + * timeline's HWSP to see if the breadcrumb has advanced past the
50 + * start of this request. Actually, the request must have the
51 + * init_breadcrumb if its timeline set has_init_bread_crumb, or the
52 + * scheduler might get a wrong state of it during reset. Since the
53 + * requests from gvt always set the has_init_breadcrumb flag, here
54 + * need to do the emit_init_breadcrumb for all the requests.
55 + */
56 + if (req->engine->emit_init_breadcrumb) {
57 + err = req->engine->emit_init_breadcrumb(req);
58 + if (err) {
59 + gvt_vgpu_err("fail to emit init breadcrumb\n");
60 + return err;
61 + }
62 + }
63 +
64 /* allocate shadow ring buffer */
65 cs = intel_ring_begin(workload->req, workload->rb_len / sizeof(u32));
66 if (IS_ERR(cs)) {