Commit 6ea578a5 authored by Chris Wilson's avatar Chris Wilson

drm/i915/selftests: Err out on coherency if initialisation failed

If gt initialisation failed, we are left with no engines to use for
coherency testing. Currently we bug out, which makes the actual error,
so fail more gracefully instead.

Closes: https://gitlab.freedesktop.org/drm/intel/issues/896Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Acked-by: default avatarAndi Shyti <andi.shyti@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20191227103050.2715402-1-chris@chris-wilson.co.uk
parent b761a7b4
...@@ -325,7 +325,10 @@ static int igt_gem_coherency(void *arg) ...@@ -325,7 +325,10 @@ static int igt_gem_coherency(void *arg)
values = offsets + ncachelines; values = offsets + ncachelines;
ctx.engine = random_engine(i915, &prng); ctx.engine = random_engine(i915, &prng);
GEM_BUG_ON(!ctx.engine); if (!ctx.engine) {
err = -ENODEV;
goto out_free;
}
pr_info("%s: using %s\n", __func__, ctx.engine->name); pr_info("%s: using %s\n", __func__, ctx.engine->name);
intel_engine_pm_get(ctx.engine); intel_engine_pm_get(ctx.engine);
...@@ -354,7 +357,7 @@ static int igt_gem_coherency(void *arg) ...@@ -354,7 +357,7 @@ static int igt_gem_coherency(void *arg)
ctx.obj = i915_gem_object_create_internal(i915, PAGE_SIZE); ctx.obj = i915_gem_object_create_internal(i915, PAGE_SIZE);
if (IS_ERR(ctx.obj)) { if (IS_ERR(ctx.obj)) {
err = PTR_ERR(ctx.obj); err = PTR_ERR(ctx.obj);
goto free; goto out_pm;
} }
i915_random_reorder(offsets, ncachelines, &prng); i915_random_reorder(offsets, ncachelines, &prng);
...@@ -405,14 +408,15 @@ static int igt_gem_coherency(void *arg) ...@@ -405,14 +408,15 @@ static int igt_gem_coherency(void *arg)
} }
} }
} }
free: out_pm:
intel_engine_pm_put(ctx.engine); intel_engine_pm_put(ctx.engine);
out_free:
kfree(offsets); kfree(offsets);
return err; return err;
put_object: put_object:
i915_gem_object_put(ctx.obj); i915_gem_object_put(ctx.obj);
goto free; goto out_pm;
} }
int i915_gem_coherency_live_selftests(struct drm_i915_private *i915) int i915_gem_coherency_live_selftests(struct drm_i915_private *i915)
......
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