summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Gordon <david.s.gordon@intel.com>2015-07-31 12:16:43 +0100
committerJohn Harrison <John.C.Harrison@Intel.com>2016-06-28 17:19:15 +0100
commitfffda29ee47b353914e1a5ed68b2cde19ba48d82 (patch)
tree9a28595a861dcbac313e17cc97a338b5856a9af1
parent99354e82da8172eebb5f682481b7b4fdefe3c6c9 (diff)
drm/i915/guc: Add a second client, to be used for preemption
This second client is created with priority KMD_HIGH, and marked as preemptive. For: VIZ-2021 Signed-off-by: Dave Gordon <david.s.gordon@intel.com>
-rw-r--r--drivers/gpu/drm/i915/i915_debugfs.c6
-rw-r--r--drivers/gpu/drm/i915/i915_guc_submission.c14
-rw-r--r--drivers/gpu/drm/i915/intel_guc.h1
3 files changed, 20 insertions, 1 deletions
diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index 606d555489ac..e90ee473ec9b 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -2700,6 +2700,7 @@ static int i915_guc_info(struct seq_file *m, void *data)
struct drm_i915_private *dev_priv = dev->dev_private;
struct intel_guc guc;
struct i915_guc_client client = {};
+ struct i915_guc_client preempt = {};
struct intel_engine_cs *engine;
enum intel_engine_id i;
u64 total = 0;
@@ -2714,6 +2715,8 @@ static int i915_guc_info(struct seq_file *m, void *data)
guc = dev_priv->guc;
if (guc.execbuf_client)
client = *guc.execbuf_client;
+ if (guc.preempt_client)
+ preempt = *guc.preempt_client;
mutex_unlock(&dev->struct_mutex);
@@ -2735,6 +2738,9 @@ static int i915_guc_info(struct seq_file *m, void *data)
seq_printf(m, "\nGuC execbuf client @ %p:\n", guc.execbuf_client);
i915_guc_client_info(m, dev_priv, &client);
+ seq_printf(m, "\nGuC preempt client @ %p:\n", guc.preempt_client);
+ i915_guc_client_info(m, dev_priv, &preempt);
+
/* Add more as required ... */
return 0;
diff --git a/drivers/gpu/drm/i915/i915_guc_submission.c b/drivers/gpu/drm/i915/i915_guc_submission.c
index 67e6e88fa8df..157e55711959 100644
--- a/drivers/gpu/drm/i915/i915_guc_submission.c
+++ b/drivers/gpu/drm/i915/i915_guc_submission.c
@@ -386,6 +386,8 @@ static void guc_init_ctx_desc(struct intel_guc *guc,
memset(&desc, 0, sizeof(desc));
desc.attribute = GUC_CTX_DESC_ATTR_ACTIVE | GUC_CTX_DESC_ATTR_KERNEL;
+ if (client->priority <= GUC_CTX_PRIORITY_HIGH)
+ desc.attribute |= GUC_CTX_DESC_ATTR_PREEMPT;
desc.context_id = client->ctx_index;
desc.priority = client->priority;
desc.db_id = client->doorbell_id;
@@ -567,6 +569,9 @@ int i915_guc_submit(struct i915_guc_client *client,
unsigned int engine_id = rq->engine->guc_id;
int q_ret, b_ret;
+ if (WARN_ON(engine_id >= I915_NUM_ENGINES))
+ return -ENXIO;
+
q_ret = guc_add_workqueue_item(client, rq);
if (q_ret == 0)
b_ret = guc_ring_doorbell(client);
@@ -940,9 +945,14 @@ int i915_guc_submission_enable(struct drm_device *dev)
DRM_ERROR("Failed to create execbuf guc_client\n");
return -ENOMEM;
}
-
guc->execbuf_client = client;
+ /* 2nd client for preemptive submission */
+ client = guc_client_alloc(dev, GUC_CTX_PRIORITY_KMD_HIGH, ctx);
+ if (!client)
+ DRM_ERROR("Failed to create preemptive guc_client\n");
+ guc->preempt_client = client;
+
host2guc_sample_forcewake(guc, client);
return 0;
@@ -953,6 +963,8 @@ void i915_guc_submission_disable(struct drm_device *dev)
struct drm_i915_private *dev_priv = dev->dev_private;
struct intel_guc *guc = &dev_priv->guc;
+ guc_client_free(dev, guc->preempt_client);
+ guc->preempt_client = NULL;
guc_client_free(dev, guc->execbuf_client);
guc->execbuf_client = NULL;
}
diff --git a/drivers/gpu/drm/i915/intel_guc.h b/drivers/gpu/drm/i915/intel_guc.h
index 024907fec1a7..47658d2d4514 100644
--- a/drivers/gpu/drm/i915/intel_guc.h
+++ b/drivers/gpu/drm/i915/intel_guc.h
@@ -97,6 +97,7 @@ struct intel_guc {
struct ida ctx_ids;
struct i915_guc_client *execbuf_client;
+ struct i915_guc_client *preempt_client;
DECLARE_BITMAP(doorbell_bitmap, GUC_MAX_DOORBELLS);
uint32_t db_cacheline; /* Cyclic counter mod pagesize */