Commit 09975b86 authored by Chris Wilson's avatar Chris Wilson

drm/i915/execlists: Disable preemption under GVT

Preempt-to-busy uses a GPU semaphore to enforce an idle-barrier across
preemption, but mediated gvt does not fully support semaphores.

v2: Fiddle around with the flags and settle on using has-semaphores for
the core bits so that we retain the ability to preempt our own
semaphores.
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Cc: Zhenyu Wang <zhenyuw@linux.intel.com>
Cc: Xiaolin Zhang <xiaolin.zhang@intel.com>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Acked-by: default avatarZhenyu Wang <zhenyuw@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190709091233.8573-1-chris@chris-wilson.co.uk
parent cfe7288c
...@@ -829,6 +829,8 @@ int intel_engine_init_common(struct intel_engine_cs *engine) ...@@ -829,6 +829,8 @@ int intel_engine_init_common(struct intel_engine_cs *engine)
struct drm_i915_private *i915 = engine->i915; struct drm_i915_private *i915 = engine->i915;
int ret; int ret;
engine->set_default_submission(engine);
/* We may need to do things with the shrinker which /* We may need to do things with the shrinker which
* require us to immediately switch back to the default * require us to immediately switch back to the default
* context. This can cause a problem as pinning the * context. This can cause a problem as pinning the
...@@ -847,8 +849,6 @@ int intel_engine_init_common(struct intel_engine_cs *engine) ...@@ -847,8 +849,6 @@ int intel_engine_init_common(struct intel_engine_cs *engine)
engine->emit_fini_breadcrumb_dw = ret; engine->emit_fini_breadcrumb_dw = ret;
engine->set_default_submission(engine);
return 0; return 0;
err_unpin: err_unpin:
......
...@@ -306,6 +306,9 @@ static inline bool need_preempt(const struct intel_engine_cs *engine, ...@@ -306,6 +306,9 @@ static inline bool need_preempt(const struct intel_engine_cs *engine,
{ {
int last_prio; int last_prio;
if (!intel_engine_has_semaphores(engine))
return false;
/* /*
* Check if the current priority hint merits a preemption attempt. * Check if the current priority hint merits a preemption attempt.
* *
...@@ -904,6 +907,9 @@ need_timeslice(struct intel_engine_cs *engine, const struct i915_request *rq) ...@@ -904,6 +907,9 @@ need_timeslice(struct intel_engine_cs *engine, const struct i915_request *rq)
{ {
int hint; int hint;
if (!intel_engine_has_semaphores(engine))
return false;
if (list_is_last(&rq->sched.link, &engine->active.requests)) if (list_is_last(&rq->sched.link, &engine->active.requests))
return false; return false;
...@@ -2656,7 +2662,8 @@ static u32 *gen8_emit_fini_breadcrumb(struct i915_request *request, u32 *cs) ...@@ -2656,7 +2662,8 @@ static u32 *gen8_emit_fini_breadcrumb(struct i915_request *request, u32 *cs)
*cs++ = MI_USER_INTERRUPT; *cs++ = MI_USER_INTERRUPT;
*cs++ = MI_ARB_ON_OFF | MI_ARB_ENABLE; *cs++ = MI_ARB_ON_OFF | MI_ARB_ENABLE;
cs = emit_preempt_busywait(request, cs); if (intel_engine_has_semaphores(request->engine))
cs = emit_preempt_busywait(request, cs);
request->tail = intel_ring_offset(request, cs); request->tail = intel_ring_offset(request, cs);
assert_ring_tail_valid(request->ring, request->tail); assert_ring_tail_valid(request->ring, request->tail);
...@@ -2680,7 +2687,8 @@ static u32 *gen8_emit_fini_breadcrumb_rcs(struct i915_request *request, u32 *cs) ...@@ -2680,7 +2687,8 @@ static u32 *gen8_emit_fini_breadcrumb_rcs(struct i915_request *request, u32 *cs)
*cs++ = MI_USER_INTERRUPT; *cs++ = MI_USER_INTERRUPT;
*cs++ = MI_ARB_ON_OFF | MI_ARB_ENABLE; *cs++ = MI_ARB_ON_OFF | MI_ARB_ENABLE;
cs = emit_preempt_busywait(request, cs); if (intel_engine_has_semaphores(request->engine))
cs = emit_preempt_busywait(request, cs);
request->tail = intel_ring_offset(request, cs); request->tail = intel_ring_offset(request, cs);
assert_ring_tail_valid(request->ring, request->tail); assert_ring_tail_valid(request->ring, request->tail);
...@@ -2728,10 +2736,11 @@ void intel_execlists_set_default_submission(struct intel_engine_cs *engine) ...@@ -2728,10 +2736,11 @@ void intel_execlists_set_default_submission(struct intel_engine_cs *engine)
engine->unpark = NULL; engine->unpark = NULL;
engine->flags |= I915_ENGINE_SUPPORTS_STATS; engine->flags |= I915_ENGINE_SUPPORTS_STATS;
if (!intel_vgpu_active(engine->i915)) if (!intel_vgpu_active(engine->i915)) {
engine->flags |= I915_ENGINE_HAS_SEMAPHORES; engine->flags |= I915_ENGINE_HAS_SEMAPHORES;
if (HAS_LOGICAL_RING_PREEMPTION(engine->i915)) if (HAS_LOGICAL_RING_PREEMPTION(engine->i915))
engine->flags |= I915_ENGINE_HAS_PREEMPTION; engine->flags |= I915_ENGINE_HAS_PREEMPTION;
}
} }
static void execlists_destroy(struct intel_engine_cs *engine) static void execlists_destroy(struct intel_engine_cs *engine)
...@@ -3419,7 +3428,6 @@ intel_execlists_create_virtual(struct i915_gem_context *ctx, ...@@ -3419,7 +3428,6 @@ intel_execlists_create_virtual(struct i915_gem_context *ctx,
ve->base.class = OTHER_CLASS; ve->base.class = OTHER_CLASS;
ve->base.uabi_class = I915_ENGINE_CLASS_INVALID; ve->base.uabi_class = I915_ENGINE_CLASS_INVALID;
ve->base.instance = I915_ENGINE_CLASS_INVALID_VIRTUAL; ve->base.instance = I915_ENGINE_CLASS_INVALID_VIRTUAL;
ve->base.flags = I915_ENGINE_IS_VIRTUAL;
/* /*
* The decision on whether to submit a request using semaphores * The decision on whether to submit a request using semaphores
...@@ -3516,8 +3524,12 @@ intel_execlists_create_virtual(struct i915_gem_context *ctx, ...@@ -3516,8 +3524,12 @@ intel_execlists_create_virtual(struct i915_gem_context *ctx,
ve->base.emit_fini_breadcrumb = sibling->emit_fini_breadcrumb; ve->base.emit_fini_breadcrumb = sibling->emit_fini_breadcrumb;
ve->base.emit_fini_breadcrumb_dw = ve->base.emit_fini_breadcrumb_dw =
sibling->emit_fini_breadcrumb_dw; sibling->emit_fini_breadcrumb_dw;
ve->base.flags = sibling->flags;
} }
ve->base.flags |= I915_ENGINE_IS_VIRTUAL;
return &ve->context; return &ve->context;
err_put: err_put:
......
...@@ -269,6 +269,9 @@ static int live_timeslice_preempt(void *arg) ...@@ -269,6 +269,9 @@ static int live_timeslice_preempt(void *arg)
enum intel_engine_id id; enum intel_engine_id id;
for_each_engine(engine, i915, id) { for_each_engine(engine, i915, id) {
if (!intel_engine_has_preemption(engine))
continue;
memset(vaddr, 0, PAGE_SIZE); memset(vaddr, 0, PAGE_SIZE);
err = slice_semaphore_queue(engine, vma, count); err = slice_semaphore_queue(engine, vma, count);
...@@ -354,6 +357,9 @@ static int live_busywait_preempt(void *arg) ...@@ -354,6 +357,9 @@ static int live_busywait_preempt(void *arg)
struct igt_live_test t; struct igt_live_test t;
u32 *cs; u32 *cs;
if (!intel_engine_has_preemption(engine))
continue;
if (!intel_engine_can_store_dword(engine)) if (!intel_engine_can_store_dword(engine))
continue; continue;
......
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