When running the GuC the GPU can't be considered idle if the GuC still has contexts pinned. As such, a call has been added in intel_gt_wait_for_idle to idle the UC and in turn the GuC by waiting for the number of unpinned contexts to go to zero. v2: rtimeout -> remaining_timeout v3: Drop unnecessary includes, guc_submission_busy_loop -> guc_submission_send_busy_loop, drop negatie timeout trick, move a refactor of guc_context_unpin to earlier path (John H) v4: Add stddef.h back into intel_gt_requests.h, sort circuit idle function if not in GuC submission mode Cc: John Harrison <john.c.harrison@intel.com> Signed-off-by: Matthew Brost <matthew.brost@intel.com> Reviewed-by: John Harrison <John.C.Harrison@Intel.com> Signed-off-by: John Harrison <John.C.Harrison@Intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20210721215101.139794-16-matthew.brost@intel.com
73 lines
1.6 KiB
C
73 lines
1.6 KiB
C
/*
|
|
* SPDX-License-Identifier: MIT
|
|
*
|
|
* Copyright © 2018 Intel Corporation
|
|
*/
|
|
|
|
#include "i915_drv.h"
|
|
#include "gt/intel_gt.h"
|
|
|
|
#include "../i915_selftest.h"
|
|
#include "igt_flush_test.h"
|
|
#include "igt_live_test.h"
|
|
|
|
int igt_live_test_begin(struct igt_live_test *t,
|
|
struct drm_i915_private *i915,
|
|
const char *func,
|
|
const char *name)
|
|
{
|
|
struct intel_gt *gt = &i915->gt;
|
|
struct intel_engine_cs *engine;
|
|
enum intel_engine_id id;
|
|
int err;
|
|
|
|
t->i915 = i915;
|
|
t->func = func;
|
|
t->name = name;
|
|
|
|
err = intel_gt_wait_for_idle(gt, MAX_SCHEDULE_TIMEOUT);
|
|
if (err) {
|
|
pr_err("%s(%s): failed to idle before, with err=%d!",
|
|
func, name, err);
|
|
return err;
|
|
}
|
|
|
|
t->reset_global = i915_reset_count(&i915->gpu_error);
|
|
|
|
for_each_engine(engine, gt, id)
|
|
t->reset_engine[id] =
|
|
i915_reset_engine_count(&i915->gpu_error, engine);
|
|
|
|
return 0;
|
|
}
|
|
|
|
int igt_live_test_end(struct igt_live_test *t)
|
|
{
|
|
struct drm_i915_private *i915 = t->i915;
|
|
struct intel_engine_cs *engine;
|
|
enum intel_engine_id id;
|
|
|
|
if (igt_flush_test(i915))
|
|
return -EIO;
|
|
|
|
if (t->reset_global != i915_reset_count(&i915->gpu_error)) {
|
|
pr_err("%s(%s): GPU was reset %d times!\n",
|
|
t->func, t->name,
|
|
i915_reset_count(&i915->gpu_error) - t->reset_global);
|
|
return -EIO;
|
|
}
|
|
|
|
for_each_engine(engine, &i915->gt, id) {
|
|
if (t->reset_engine[id] ==
|
|
i915_reset_engine_count(&i915->gpu_error, engine))
|
|
continue;
|
|
|
|
pr_err("%s(%s): engine '%s' was reset %d times!\n",
|
|
t->func, t->name, engine->name,
|
|
i915_reset_engine_count(&i915->gpu_error, engine) -
|
|
t->reset_engine[id]);
|
|
return -EIO;
|
|
}
|
|
|
|
return 0;
|
|
}
|