1 2 /* 3 * SPDX-License-Identifier: MIT 4 * 5 * Copyright © 2019 Intel Corporation 6 */ 7 8 #include "selftest_llc.h" 9 10 static int live_gt_resume(void *arg) 11 { 12 struct intel_gt *gt = arg; 13 IGT_TIMEOUT(end_time); 14 int err; 15 16 /* Do several suspend/resume cycles to check we don't explode! */ 17 do { 18 intel_gt_suspend_prepare(gt); 19 intel_gt_suspend_late(gt); 20 21 if (gt->rc6.enabled) { 22 pr_err("rc6 still enabled after suspend!\n"); 23 intel_gt_set_wedged_on_init(gt); 24 err = -EINVAL; 25 break; 26 } 27 28 err = intel_gt_resume(gt); 29 if (err) 30 break; 31 32 if (gt->rc6.supported && !gt->rc6.enabled) { 33 pr_err("rc6 not enabled upon resume!\n"); 34 intel_gt_set_wedged_on_init(gt); 35 err = -EINVAL; 36 break; 37 } 38 39 err = st_llc_verify(>->llc); 40 if (err) { 41 pr_err("llc state not restored upon resume!\n"); 42 intel_gt_set_wedged_on_init(gt); 43 break; 44 } 45 } while (!__igt_timeout(end_time, NULL)); 46 47 return err; 48 } 49 50 int intel_gt_pm_live_selftests(struct drm_i915_private *i915) 51 { 52 static const struct i915_subtest tests[] = { 53 SUBTEST(live_gt_resume), 54 }; 55 56 if (intel_gt_is_wedged(&i915->gt)) 57 return 0; 58 59 return intel_gt_live_subtests(tests, &i915->gt); 60 } 61