Merge branch 'akpm' (patches from Andrew)
[linux/fpc-iii.git] / drivers / gpu / drm / i915 / gt / selftest_gt_pm.c
blob09ff8e4f88af8d76382213a0ea0283b38f62ab10
2 /*
3 * SPDX-License-Identifier: MIT
5 * Copyright © 2019 Intel Corporation
6 */
8 #include "selftest_llc.h"
9 #include "selftest_rc6.h"
11 static int live_gt_resume(void *arg)
13 struct intel_gt *gt = arg;
14 IGT_TIMEOUT(end_time);
15 int err;
17 /* Do several suspend/resume cycles to check we don't explode! */
18 do {
19 intel_gt_suspend_prepare(gt);
20 intel_gt_suspend_late(gt);
22 if (gt->rc6.enabled) {
23 pr_err("rc6 still enabled after suspend!\n");
24 intel_gt_set_wedged_on_init(gt);
25 err = -EINVAL;
26 break;
29 err = intel_gt_resume(gt);
30 if (err)
31 break;
33 if (gt->rc6.supported && !gt->rc6.enabled) {
34 pr_err("rc6 not enabled upon resume!\n");
35 intel_gt_set_wedged_on_init(gt);
36 err = -EINVAL;
37 break;
40 err = st_llc_verify(&gt->llc);
41 if (err) {
42 pr_err("llc state not restored upon resume!\n");
43 intel_gt_set_wedged_on_init(gt);
44 break;
46 } while (!__igt_timeout(end_time, NULL));
48 return err;
51 int intel_gt_pm_live_selftests(struct drm_i915_private *i915)
53 static const struct i915_subtest tests[] = {
54 SUBTEST(live_rc6_manual),
55 SUBTEST(live_gt_resume),
58 if (intel_gt_is_wedged(&i915->gt))
59 return 0;
61 return intel_gt_live_subtests(tests, &i915->gt);
64 int intel_gt_pm_late_selftests(struct drm_i915_private *i915)
66 static const struct i915_subtest tests[] = {
68 * These tests may leave the system in an undesirable state.
69 * They are intended to be run last in CI and the system
70 * rebooted afterwards.
72 SUBTEST(live_rc6_ctx_wa),
75 if (intel_gt_is_wedged(&i915->gt))
76 return 0;
78 return intel_gt_live_subtests(tests, &i915->gt);