Skip to content

Commit

Permalink
drm/i915/selftests: Provide a mock GPU reset routine
Browse files Browse the repository at this point in the history
For those mock tests that may wish to pretend triggering a GPU reset and
processing the cleanup.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Andi Shyti <andi.shyti@intel.com>
Reviewed-by: Andi Shyti <andi.shyti@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190927211749.2181-3-chris@chris-wilson.co.uk
  • Loading branch information
Chris Wilson committed Sep 27, 2019
1 parent 4e18ca7 commit 4abc6e7
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion drivers/gpu/drm/i915/gt/intel_reset.c
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,13 @@ static int gen8_reset_engines(struct intel_gt *gt,
return ret;
}

static int mock_reset(struct intel_gt *gt,
intel_engine_mask_t mask,
unsigned int retry)
{
return 0;
}

typedef int (*reset_func)(struct intel_gt *,
intel_engine_mask_t engine_mask,
unsigned int retry);
Expand All @@ -550,7 +557,9 @@ static reset_func intel_get_gpu_reset(const struct intel_gt *gt)
{
struct drm_i915_private *i915 = gt->i915;

if (INTEL_GEN(i915) >= 8)
if (is_mock_gt(gt))
return mock_reset;
else if (INTEL_GEN(i915) >= 8)
return gen8_reset_engines;
else if (INTEL_GEN(i915) >= 6)
return gen6_reset_engines;
Expand Down

0 comments on commit 4abc6e7

Please sign in to comment.