|
@@ -131,6 +131,7 @@
|
|
|
* preemption, but just sampling the new tail pointer).
|
|
|
*
|
|
|
*/
|
|
|
+#include <linux/interrupt.h>
|
|
|
|
|
|
#include <drm/drmP.h>
|
|
|
#include <drm/i915_drm.h>
|
|
@@ -418,20 +419,18 @@ static void execlists_submit_requests(struct drm_i915_gem_request *rq0,
|
|
|
{
|
|
|
struct drm_i915_private *dev_priv = rq0->i915;
|
|
|
|
|
|
- /* BUG_ON(!irqs_disabled()); */
|
|
|
-
|
|
|
execlists_update_context(rq0);
|
|
|
|
|
|
if (rq1)
|
|
|
execlists_update_context(rq1);
|
|
|
|
|
|
- spin_lock(&dev_priv->uncore.lock);
|
|
|
+ spin_lock_irq(&dev_priv->uncore.lock);
|
|
|
intel_uncore_forcewake_get__locked(dev_priv, FORCEWAKE_ALL);
|
|
|
|
|
|
execlists_elsp_write(rq0, rq1);
|
|
|
|
|
|
intel_uncore_forcewake_put__locked(dev_priv, FORCEWAKE_ALL);
|
|
|
- spin_unlock(&dev_priv->uncore.lock);
|
|
|
+ spin_unlock_irq(&dev_priv->uncore.lock);
|
|
|
}
|
|
|
|
|
|
static void execlists_context_unqueue(struct intel_engine_cs *engine)
|
|
@@ -538,13 +537,14 @@ get_context_status(struct intel_engine_cs *engine, unsigned int read_pointer,
|
|
|
|
|
|
/**
|
|
|
* intel_lrc_irq_handler() - handle Context Switch interrupts
|
|
|
- * @ring: Engine Command Streamer to handle.
|
|
|
+ * @engine: Engine Command Streamer to handle.
|
|
|
*
|
|
|
* Check the unread Context Status Buffers and manage the submission of new
|
|
|
* contexts to the ELSP accordingly.
|
|
|
*/
|
|
|
-void intel_lrc_irq_handler(struct intel_engine_cs *engine)
|
|
|
+static void intel_lrc_irq_handler(unsigned long data)
|
|
|
{
|
|
|
+ struct intel_engine_cs *engine = (struct intel_engine_cs *)data;
|
|
|
struct drm_i915_private *dev_priv = engine->dev->dev_private;
|
|
|
u32 status_pointer;
|
|
|
unsigned int read_pointer, write_pointer;
|
|
@@ -552,8 +552,7 @@ void intel_lrc_irq_handler(struct intel_engine_cs *engine)
|
|
|
unsigned int csb_read = 0, i;
|
|
|
unsigned int submit_contexts = 0;
|
|
|
|
|
|
- spin_lock(&dev_priv->uncore.lock);
|
|
|
- intel_uncore_forcewake_get__locked(dev_priv, FORCEWAKE_ALL);
|
|
|
+ intel_uncore_forcewake_get(dev_priv, FORCEWAKE_ALL);
|
|
|
|
|
|
status_pointer = I915_READ_FW(RING_CONTEXT_STATUS_PTR(engine));
|
|
|
|
|
@@ -578,8 +577,7 @@ void intel_lrc_irq_handler(struct intel_engine_cs *engine)
|
|
|
_MASKED_FIELD(GEN8_CSB_READ_PTR_MASK,
|
|
|
engine->next_context_status_buffer << 8));
|
|
|
|
|
|
- intel_uncore_forcewake_put__locked(dev_priv, FORCEWAKE_ALL);
|
|
|
- spin_unlock(&dev_priv->uncore.lock);
|
|
|
+ intel_uncore_forcewake_put(dev_priv, FORCEWAKE_ALL);
|
|
|
|
|
|
spin_lock(&engine->execlist_lock);
|
|
|
|
|
@@ -621,7 +619,7 @@ static void execlists_context_queue(struct drm_i915_gem_request *request)
|
|
|
|
|
|
i915_gem_request_reference(request);
|
|
|
|
|
|
- spin_lock_irq(&engine->execlist_lock);
|
|
|
+ spin_lock_bh(&engine->execlist_lock);
|
|
|
|
|
|
list_for_each_entry(cursor, &engine->execlist_queue, execlist_link)
|
|
|
if (++num_elements > 2)
|
|
@@ -646,7 +644,7 @@ static void execlists_context_queue(struct drm_i915_gem_request *request)
|
|
|
if (num_elements == 0)
|
|
|
execlists_context_unqueue(engine);
|
|
|
|
|
|
- spin_unlock_irq(&engine->execlist_lock);
|
|
|
+ spin_unlock_bh(&engine->execlist_lock);
|
|
|
}
|
|
|
|
|
|
static int logical_ring_invalidate_all_caches(struct drm_i915_gem_request *req)
|
|
@@ -1033,9 +1031,9 @@ void intel_execlists_retire_requests(struct intel_engine_cs *engine)
|
|
|
return;
|
|
|
|
|
|
INIT_LIST_HEAD(&retired_list);
|
|
|
- spin_lock_irq(&engine->execlist_lock);
|
|
|
+ spin_lock_bh(&engine->execlist_lock);
|
|
|
list_replace_init(&engine->execlist_retired_req_list, &retired_list);
|
|
|
- spin_unlock_irq(&engine->execlist_lock);
|
|
|
+ spin_unlock_bh(&engine->execlist_lock);
|
|
|
|
|
|
list_for_each_entry_safe(req, tmp, &retired_list, execlist_link) {
|
|
|
struct intel_context *ctx = req->ctx;
|
|
@@ -2016,6 +2014,13 @@ void intel_logical_ring_cleanup(struct intel_engine_cs *engine)
|
|
|
if (!intel_engine_initialized(engine))
|
|
|
return;
|
|
|
|
|
|
+ /*
|
|
|
+ * Tasklet cannot be active at this point due intel_mark_active/idle
|
|
|
+ * so this is just for documentation.
|
|
|
+ */
|
|
|
+ if (WARN_ON(test_bit(TASKLET_STATE_SCHED, &engine->irq_tasklet.state)))
|
|
|
+ tasklet_kill(&engine->irq_tasklet);
|
|
|
+
|
|
|
dev_priv = engine->dev->dev_private;
|
|
|
|
|
|
if (engine->buffer) {
|
|
@@ -2089,6 +2094,9 @@ logical_ring_init(struct drm_device *dev, struct intel_engine_cs *engine)
|
|
|
INIT_LIST_HEAD(&engine->execlist_retired_req_list);
|
|
|
spin_lock_init(&engine->execlist_lock);
|
|
|
|
|
|
+ tasklet_init(&engine->irq_tasklet,
|
|
|
+ intel_lrc_irq_handler, (unsigned long)engine);
|
|
|
+
|
|
|
logical_ring_init_platform_invariants(engine);
|
|
|
|
|
|
ret = i915_cmd_parser_init_ring(engine);
|