drm/i915: Prevent user context creation while wedged
authorChris Wilson <chris@chris-wilson.co.uk>
Wed, 20 Feb 2019 22:55:56 +0000 (22:55 +0000)
committerChris Wilson <chris@chris-wilson.co.uk>
Wed, 20 Feb 2019 23:39:13 +0000 (23:39 +0000)
commit9ce25e72cc7794d2428ff0d5730731496a02fbb7
tree35bf7e53bb00b82a1adf77e691e125d1cac69dcb
parent207a815d8603946d1196296c102b3b6884b07c28
drm/i915: Prevent user context creation while wedged

Introduce a new ABI method for detecting a wedged driver by reporting
-EIO from DRM_IOCTL_I915_GEM_CONTEXT_CREATE.

This came up in considering how to handle context recovery from
userspace. There we wish to create a new context after the original is
banned (the clients opts into the no recovery after reset strategy) in
order to rebuild the mesa context from scratch. In doing so, if the
device was wedged and not the context banned, we would fall into a loop
of permanently trying to recreate the context and never making forward
progress. This patch would inform the client that we are no longer able
to create a context, and the client would have no choice but to abort
(or at least inform its callers about the lost device for anv).

References: https://lists.freedesktop.org/archives/mesa-dev/2019-February/215469.html
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Reviewed-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190220225556.28715-1-chris@chris-wilson.co.uk
drivers/gpu/drm/i915/i915_gem_context.c