@@ -1674,6 +1674,11 @@ void i915_gem_context_fini(struct drm_device *dev);
void i915_gem_context_close(struct drm_device *dev, struct drm_file *file);
int i915_switch_context(struct intel_ring_buffer *ring,
struct drm_file *file, int to_id);
+void i915_gem_context_free(struct kref *ctx_ref);
+int i915_gem_context_get_reset_stats(struct intel_ring_buffer *ring,
+ struct drm_file *file,
+ u32 id,
+ struct i915_reset_stats **rs);
int i915_gem_context_create_ioctl(struct drm_device *dev, void *data,
struct drm_file *file);
int i915_gem_context_destroy_ioctl(struct drm_device *dev, void *data,
@@ -299,6 +299,39 @@ static int context_idr_cleanup(int id, void *p, void *data)
return 0;
}
+int i915_gem_context_get_reset_stats(struct intel_ring_buffer *ring,
+ struct drm_file *file,
+ u32 id,
+ struct i915_reset_stats **rs)
+{
+ struct drm_i915_private *dev_priv = ring->dev->dev_private;
+ struct i915_hw_context *to;
+
+ if (dev_priv->hw_contexts_disabled)
+ return -ENOENT;
+
+ if (ring->id != RCS)
+ return -EINVAL;
+
+ /* No reset status for default context id, it is in file_priv */
+ if (id == DEFAULT_CONTEXT_ID)
+ return -EINVAL;
+
+ if (rs == NULL)
+ return -EINVAL;
+
+ if (file == NULL)
+ return -EINVAL;
+
+ to = i915_gem_context_get(file->driver_priv, id);
+ if (to == NULL)
+ return -ENOENT;
+
+ *rs = &to->reset_stats;
+
+ return 0;
+}
+
void i915_gem_context_close(struct drm_device *dev, struct drm_file *file)
{
struct drm_i915_file_private *file_priv = file->driver_priv;
For arb-robustness, every context needs to have it's own reset status. Default context will be handled in a identical way as the no-context case in further down in the patch set. For no-context case, the reset status will be stored in the file_priv part. Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com> --- drivers/gpu/drm/i915/i915_drv.h | 5 +++++ drivers/gpu/drm/i915/i915_gem_context.c | 33 +++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+)