drm/i915/gt: Prevent allocation on a banned context
authorChris Wilson <chris@chris-wilson.co.uk>
Tue, 3 Mar 2020 08:05:45 +0000 (08:05 +0000)
committerChris Wilson <chris@chris-wilson.co.uk>
Tue, 3 Mar 2020 17:30:20 +0000 (17:30 +0000)
If a context is banned even before we submit our first request to it,
report the failure before we attempt to allocate any resources for the
context.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Matthew Auld <matthew.auld@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200303080546.1140508-2-chris@chris-wilson.co.uk
drivers/gpu/drm/i915/gt/intel_context.c

index 8bb444cda14fa2c21c6be9a9e0422539a63f7109..01474d3a558be71d97191976683db610eccb8fd4 100644 (file)
@@ -51,6 +51,11 @@ int intel_context_alloc_state(struct intel_context *ce)
                return -EINTR;
 
        if (!test_bit(CONTEXT_ALLOC_BIT, &ce->flags)) {
+               if (intel_context_is_banned(ce)) {
+                       err = -EIO;
+                       goto unlock;
+               }
+
                err = ce->ops->alloc(ce);
                if (unlikely(err))
                        goto unlock;