Commit 452420d2 authored by Tvrtko Ursulin's avatar Tvrtko Ursulin

drm/i915: Fuse per-context workaround handling with the common framework

Convert the per context workaround handling code to run against the newly
introduced common workaround framework and fuse the two to use the
existing smarter list add helper, the one which does the sorted insert and
merges registers where possible.

This completes migration of all four classes of workarounds onto the
common framework.

Existing macros are kept untouched for smaller code churn.

v2:
 * Rename to list name ctx_wa_list and move from dev_priv to engine.

v3:
 * API rename and parameters tweaking. (Chris Wilson)
Signed-off-by: default avatarTvrtko Ursulin <tvrtko.ursulin@intel.com>
Reviewed-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Link: https://patchwork.freedesktop.org/patch/msgid/20181203133357.10341-1-tvrtko.ursulin@linux.intel.com
parent 69bcdecf
...@@ -3375,13 +3375,15 @@ static int i915_shared_dplls_info(struct seq_file *m, void *unused) ...@@ -3375,13 +3375,15 @@ static int i915_shared_dplls_info(struct seq_file *m, void *unused)
static int i915_wa_registers(struct seq_file *m, void *unused) static int i915_wa_registers(struct seq_file *m, void *unused)
{ {
struct i915_workarounds *wa = &node_to_i915(m->private)->workarounds; struct drm_i915_private *i915 = node_to_i915(m->private);
int i; const struct i915_wa_list *wal = &i915->engine[RCS]->ctx_wa_list;
struct i915_wa *wa;
unsigned int i;
seq_printf(m, "Workarounds applied: %d\n", wa->count); seq_printf(m, "Workarounds applied: %u\n", wal->count);
for (i = 0; i < wa->count; ++i) for (i = 0, wa = wal->list; i < wal->count; i++, wa++)
seq_printf(m, "0x%X: 0x%08X, mask: 0x%08X\n", seq_printf(m, "0x%X: 0x%08X, mask: 0x%08X\n",
wa->reg[i].addr, wa->reg[i].value, wa->reg[i].mask); i915_mmio_reg_offset(wa->reg), wa->val, wa->mask);
return 0; return 0;
} }
......
...@@ -1190,20 +1190,6 @@ struct i915_frontbuffer_tracking { ...@@ -1190,20 +1190,6 @@ struct i915_frontbuffer_tracking {
unsigned flip_bits; unsigned flip_bits;
}; };
struct i915_wa_reg {
u32 addr;
u32 value;
/* bitmask representing WA bits */
u32 mask;
};
#define I915_MAX_WA_REGS 16
struct i915_workarounds {
struct i915_wa_reg reg[I915_MAX_WA_REGS];
u32 count;
};
struct i915_virtual_gpu { struct i915_virtual_gpu {
bool active; bool active;
u32 caps; u32 caps;
...@@ -1653,7 +1639,6 @@ struct drm_i915_private { ...@@ -1653,7 +1639,6 @@ struct drm_i915_private {
int dpio_phy_iosf_port[I915_NUM_PHYS_VLV]; int dpio_phy_iosf_port[I915_NUM_PHYS_VLV];
struct i915_workarounds workarounds;
struct i915_wa_list gt_wa_list; struct i915_wa_list gt_wa_list;
struct i915_frontbuffer_tracking fb_tracking; struct i915_frontbuffer_tracking fb_tracking;
......
...@@ -535,16 +535,12 @@ static bool needs_preempt_context(struct drm_i915_private *i915) ...@@ -535,16 +535,12 @@ static bool needs_preempt_context(struct drm_i915_private *i915)
int i915_gem_contexts_init(struct drm_i915_private *dev_priv) int i915_gem_contexts_init(struct drm_i915_private *dev_priv)
{ {
struct i915_gem_context *ctx; struct i915_gem_context *ctx;
int ret;
/* Reassure ourselves we are only called once */ /* Reassure ourselves we are only called once */
GEM_BUG_ON(dev_priv->kernel_context); GEM_BUG_ON(dev_priv->kernel_context);
GEM_BUG_ON(dev_priv->preempt_context); GEM_BUG_ON(dev_priv->preempt_context);
ret = intel_ctx_workarounds_init(dev_priv); intel_engine_init_ctx_wa(dev_priv->engine[RCS]);
if (ret)
return ret;
init_contexts(dev_priv); init_contexts(dev_priv);
/* lowest priority; idle task */ /* lowest priority; idle task */
......
...@@ -724,6 +724,7 @@ void intel_engine_cleanup_common(struct intel_engine_cs *engine) ...@@ -724,6 +724,7 @@ void intel_engine_cleanup_common(struct intel_engine_cs *engine)
i915_timeline_fini(&engine->timeline); i915_timeline_fini(&engine->timeline);
intel_wa_list_free(&engine->ctx_wa_list);
intel_wa_list_free(&engine->wa_list); intel_wa_list_free(&engine->wa_list);
intel_wa_list_free(&engine->whitelist); intel_wa_list_free(&engine->whitelist);
} }
......
...@@ -2087,7 +2087,7 @@ static int gen8_init_rcs_context(struct i915_request *rq) ...@@ -2087,7 +2087,7 @@ static int gen8_init_rcs_context(struct i915_request *rq)
{ {
int ret; int ret;
ret = intel_ctx_workarounds_emit(rq); ret = intel_engine_emit_ctx_wa(rq);
if (ret) if (ret)
return ret; return ret;
......
...@@ -656,7 +656,7 @@ static int intel_rcs_ctx_init(struct i915_request *rq) ...@@ -656,7 +656,7 @@ static int intel_rcs_ctx_init(struct i915_request *rq)
{ {
int ret; int ret;
ret = intel_ctx_workarounds_emit(rq); ret = intel_engine_emit_ctx_wa(rq);
if (ret != 0) if (ret != 0)
return ret; return ret;
......
...@@ -436,6 +436,7 @@ struct intel_engine_cs { ...@@ -436,6 +436,7 @@ struct intel_engine_cs {
struct intel_hw_status_page status_page; struct intel_hw_status_page status_page;
struct i915_ctx_workarounds wa_ctx; struct i915_ctx_workarounds wa_ctx;
struct i915_wa_list ctx_wa_list;
struct i915_wa_list wa_list; struct i915_wa_list wa_list;
struct i915_wa_list whitelist; struct i915_wa_list whitelist;
struct i915_vma *scratch; struct i915_vma *scratch;
......
This diff is collapsed.
...@@ -19,6 +19,7 @@ struct i915_wa_list { ...@@ -19,6 +19,7 @@ struct i915_wa_list {
const char *name; const char *name;
struct i915_wa *list; struct i915_wa *list;
unsigned int count; unsigned int count;
unsigned int wa_count;
}; };
static inline void intel_wa_list_free(struct i915_wa_list *wal) static inline void intel_wa_list_free(struct i915_wa_list *wal)
...@@ -27,8 +28,8 @@ static inline void intel_wa_list_free(struct i915_wa_list *wal) ...@@ -27,8 +28,8 @@ static inline void intel_wa_list_free(struct i915_wa_list *wal)
memset(wal, 0, sizeof(*wal)); memset(wal, 0, sizeof(*wal));
} }
int intel_ctx_workarounds_init(struct drm_i915_private *dev_priv); void intel_engine_init_ctx_wa(struct intel_engine_cs *engine);
int intel_ctx_workarounds_emit(struct i915_request *rq); int intel_engine_emit_ctx_wa(struct i915_request *rq);
void intel_gt_init_workarounds(struct drm_i915_private *dev_priv); void intel_gt_init_workarounds(struct drm_i915_private *dev_priv);
void intel_gt_apply_workarounds(struct drm_i915_private *dev_priv); void intel_gt_apply_workarounds(struct drm_i915_private *dev_priv);
......
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