Merge tag 'drm-intel-next-2019-05-24' of git://anongit.freedesktop.org/drm/drm-intel...
[linux-2.6-microblaze.git] / drivers / gpu / drm / i915 / gvt / scheduler.c
index 7ae42f2..38897d2 100644 (file)
@@ -304,12 +304,29 @@ static int copy_workload_to_ring_buffer(struct intel_vgpu_workload *workload)
        struct i915_request *req = workload->req;
        void *shadow_ring_buffer_va;
        u32 *cs;
+       int err;
 
-       if ((IS_KABYLAKE(req->i915) || IS_BROXTON(req->i915)
-               || IS_COFFEELAKE(req->i915))
-               && is_inhibit_context(req->hw_context))
+       if (IS_GEN(req->i915, 9) && is_inhibit_context(req->hw_context))
                intel_vgpu_restore_inhibit_context(vgpu, req);
 
+       /*
+        * To track whether a request has started on HW, we can emit a
+        * breadcrumb at the beginning of the request and check its
+        * timeline's HWSP to see if the breadcrumb has advanced past the
+        * start of this request. Actually, the request must have the
+        * init_breadcrumb if its timeline set has_init_bread_crumb, or the
+        * scheduler might get a wrong state of it during reset. Since the
+        * requests from gvt always set the has_init_breadcrumb flag, here
+        * need to do the emit_init_breadcrumb for all the requests.
+        */
+       if (req->engine->emit_init_breadcrumb) {
+               err = req->engine->emit_init_breadcrumb(req);
+               if (err) {
+                       gvt_vgpu_err("fail to emit init breadcrumb\n");
+                       return err;
+               }
+       }
+
        /* allocate shadow ring buffer */
        cs = intel_ring_begin(workload->req, workload->rb_len / sizeof(u32));
        if (IS_ERR(cs)) {
@@ -1346,7 +1363,7 @@ static int prepare_mm(struct intel_vgpu_workload *workload)
        struct execlist_ctx_descriptor_format *desc = &workload->ctx_desc;
        struct intel_vgpu_mm *mm;
        struct intel_vgpu *vgpu = workload->vgpu;
-       intel_gvt_gtt_type_t root_entry_type;
+       enum intel_gvt_gtt_type root_entry_type;
        u64 pdps[GVT_RING_CTX_NR_PDPS];
 
        switch (desc->addressing_mode) {