1 2 /* 3 * SPDX-License-Identifier: MIT 4 * 5 * Copyright © 2019 Intel Corporation 6 */ 7 8 #include "selftest_llc.h" 9 #include "selftest_rc6.h" 10 11 static int live_gt_resume(void *arg) 12 { 13 struct intel_gt *gt = arg; 14 IGT_TIMEOUT(end_time); 15 int err; 16 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); 21 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; 27 } 28 29 err = intel_gt_resume(gt); 30 if (err) 31 break; 32 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; 38 } 39 40 err = st_llc_verify(>->llc); 41 if (err) { 42 pr_err("llc state not restored upon resume!\n"); 43 intel_gt_set_wedged_on_init(gt); 44 break; 45 } 46 } while (!__igt_timeout(end_time, NULL)); 47 48 return err; 49 } 50 51 int intel_gt_pm_live_selftests(struct drm_i915_private *i915) 52 { 53 static const struct i915_subtest tests[] = { 54 SUBTEST(live_rc6_manual), 55 SUBTEST(live_gt_resume), 56 }; 57 58 if (intel_gt_is_wedged(&i915->gt)) 59 return 0; 60 61 return intel_gt_live_subtests(tests, &i915->gt); 62 } 63 64 int intel_gt_pm_late_selftests(struct drm_i915_private *i915) 65 { 66 static const struct i915_subtest tests[] = { 67 /* 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. 71 */ 72 SUBTEST(live_rc6_ctx_wa), 73 }; 74 75 if (intel_gt_is_wedged(&i915->gt)) 76 return 0; 77 78 return intel_gt_live_subtests(tests, &i915->gt); 79 } 80