This source file includes following definitions.
- live_engine_pm
- live_engine_pm_selftests
1
2
3
4
5
6
7 #include "i915_selftest.h"
8 #include "selftest_engine.h"
9 #include "selftests/igt_atomic.h"
10
11 static int live_engine_pm(void *arg)
12 {
13 struct intel_gt *gt = arg;
14 struct intel_engine_cs *engine;
15 enum intel_engine_id id;
16
17
18
19
20
21
22 if (intel_gt_pm_wait_for_idle(gt)) {
23 pr_err("Unable to flush GT pm before test\n");
24 return -EBUSY;
25 }
26
27 GEM_BUG_ON(intel_gt_pm_is_awake(gt));
28 for_each_engine(engine, gt->i915, id) {
29 const typeof(*igt_atomic_phases) *p;
30
31 for (p = igt_atomic_phases; p->name; p++) {
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46 GEM_BUG_ON(intel_engine_pm_is_awake(engine));
47 intel_engine_pm_get(engine);
48
49 p->critical_section_begin();
50 if (!intel_engine_pm_get_if_awake(engine))
51 pr_err("intel_engine_pm_get_if_awake(%s) failed under %s\n",
52 engine->name, p->name);
53 else
54 intel_engine_pm_put(engine);
55 intel_engine_pm_put(engine);
56 p->critical_section_end();
57
58
59 if (intel_engine_pm_is_awake(engine)) {
60 pr_err("%s is still awake after flushing pm\n",
61 engine->name);
62 return -EINVAL;
63 }
64
65
66 if (intel_gt_pm_wait_for_idle(gt)) {
67 pr_err("GT failed to idle\n");
68 return -EINVAL;
69 }
70 }
71 }
72
73 return 0;
74 }
75
76 int live_engine_pm_selftests(struct intel_gt *gt)
77 {
78 static const struct i915_subtest tests[] = {
79 SUBTEST(live_engine_pm),
80 };
81
82 return intel_gt_live_subtests(tests, gt);
83 }