2019-09-27 19:08:49 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
*
|
|
|
|
* Copyright © 2019 Intel Corporation
|
|
|
|
*/
|
|
|
|
|
2019-10-21 02:41:39 +08:00
|
|
|
#include "selftest_llc.h"
|
2019-11-19 23:47:23 +08:00
|
|
|
#include "selftest_rc6.h"
|
2019-10-21 02:41:39 +08:00
|
|
|
|
2019-09-27 19:08:49 +08:00
|
|
|
static int live_gt_resume(void *arg)
|
|
|
|
{
|
|
|
|
struct intel_gt *gt = arg;
|
|
|
|
IGT_TIMEOUT(end_time);
|
|
|
|
int err;
|
|
|
|
|
|
|
|
/* Do several suspend/resume cycles to check we don't explode! */
|
|
|
|
do {
|
2019-11-02 01:44:05 +08:00
|
|
|
intel_gt_suspend_prepare(gt);
|
2019-11-01 22:10:09 +08:00
|
|
|
intel_gt_suspend_late(gt);
|
2019-09-27 19:08:49 +08:00
|
|
|
|
|
|
|
if (gt->rc6.enabled) {
|
|
|
|
pr_err("rc6 still enabled after suspend!\n");
|
|
|
|
intel_gt_set_wedged_on_init(gt);
|
|
|
|
err = -EINVAL;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
err = intel_gt_resume(gt);
|
|
|
|
if (err)
|
|
|
|
break;
|
|
|
|
|
|
|
|
if (gt->rc6.supported && !gt->rc6.enabled) {
|
|
|
|
pr_err("rc6 not enabled upon resume!\n");
|
|
|
|
intel_gt_set_wedged_on_init(gt);
|
|
|
|
err = -EINVAL;
|
|
|
|
break;
|
|
|
|
}
|
2019-10-21 02:41:39 +08:00
|
|
|
|
|
|
|
err = st_llc_verify(>->llc);
|
|
|
|
if (err) {
|
|
|
|
pr_err("llc state not restored upon resume!\n");
|
|
|
|
intel_gt_set_wedged_on_init(gt);
|
|
|
|
break;
|
|
|
|
}
|
2019-09-27 19:08:49 +08:00
|
|
|
} while (!__igt_timeout(end_time, NULL));
|
|
|
|
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
|
|
|
int intel_gt_pm_live_selftests(struct drm_i915_private *i915)
|
|
|
|
{
|
|
|
|
static const struct i915_subtest tests[] = {
|
|
|
|
SUBTEST(live_gt_resume),
|
|
|
|
};
|
|
|
|
|
|
|
|
if (intel_gt_is_wedged(&i915->gt))
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
return intel_gt_live_subtests(tests, &i915->gt);
|
|
|
|
}
|
2019-11-19 23:47:23 +08:00
|
|
|
|
|
|
|
int intel_gt_pm_late_selftests(struct drm_i915_private *i915)
|
|
|
|
{
|
|
|
|
static const struct i915_subtest tests[] = {
|
|
|
|
/*
|
|
|
|
* These tests may leave the system in an undesirable state.
|
|
|
|
* They are intended to be run last in CI and the system
|
|
|
|
* rebooted afterwards.
|
|
|
|
*/
|
|
|
|
SUBTEST(live_rc6_ctx_wa),
|
|
|
|
};
|
|
|
|
|
|
|
|
if (intel_gt_is_wedged(&i915->gt))
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
return intel_gt_live_subtests(tests, &i915->gt);
|
|
|
|
}
|