#include "i915_drv.h"
#include "i915_params.h"
+#include "intel_context.h"
#include "intel_engine_pm.h"
#include "intel_gt.h"
#include "intel_gt_pm.h"
intel_engine_pm_get(engine);
ce = engine->kernel_context;
- if (ce)
+ if (ce) {
+ GEM_BUG_ON(!intel_context_is_pinned(ce));
+ mutex_acquire(&ce->pin_mutex.dep_map, 0, 0, _THIS_IP_);
ce->ops->reset(ce);
+ mutex_release(&ce->pin_mutex.dep_map, 0, _THIS_IP_);
+ }
engine->serial++; /* kernel context lost */
err = engine->resume(engine);
ce = rq->hw_context;
GEM_BUG_ON(i915_active_is_idle(&ce->active));
GEM_BUG_ON(!i915_vma_is_pinned(ce->state));
+
+ /* Proclaim we have exclusive access to the context image! */
+ GEM_BUG_ON(!intel_context_is_pinned(ce));
+ mutex_acquire(&ce->pin_mutex.dep_map, 2, 0, _THIS_IP_);
+
rq = active_request(rq);
if (!rq) {
ce->ring->head = ce->ring->tail;
engine->name, ce->ring->head, ce->ring->tail);
intel_ring_update_space(ce->ring);
__execlists_update_reg_state(ce, engine);
+ mutex_release(&ce->pin_mutex.dep_map, 0, _THIS_IP_);
unwind:
/* Push back any incomplete requests for replay after the reset. */
u32 head,
bool scrub)
{
+ GEM_BUG_ON(!intel_context_is_pinned(ce));
+ mutex_acquire(&ce->pin_mutex.dep_map, 2, 0, _THIS_IP_);
+
/*
* We want a simple context + ring to execute the breadcrumb update.
* We cannot rely on the context being intact across the GPU hang,
intel_ring_update_space(ce->ring);
__execlists_update_reg_state(ce, engine);
+ mutex_release(&ce->pin_mutex.dep_map, 0, _THIS_IP_);
}
#if IS_ENABLED(CONFIG_DRM_I915_SELFTEST)