This source file includes following definitions.
- i915_mock_selftests
- i915_live_selftests
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 #ifndef __I915_SELFTEST_H__
25 #define __I915_SELFTEST_H__
26
27 #include <linux/types.h>
28
29 struct pci_dev;
30 struct drm_i915_private;
31
32 struct i915_selftest {
33 unsigned long timeout_jiffies;
34 unsigned int timeout_ms;
35 unsigned int random_seed;
36 char *filter;
37 int mock;
38 int live;
39 };
40
41 #if IS_ENABLED(CONFIG_DRM_I915_SELFTEST)
42 #include <linux/fault-inject.h>
43
44 extern struct i915_selftest i915_selftest;
45
46 int i915_mock_selftests(void);
47 int i915_live_selftests(struct pci_dev *pdev);
48
49
50
51
52
53
54
55
56
57
58
59 #define selftest(name, func) int func(void);
60 #include "selftests/i915_mock_selftests.h"
61 #undef selftest
62 #define selftest(name, func) int func(struct drm_i915_private *i915);
63 #include "selftests/i915_live_selftests.h"
64 #undef selftest
65
66 struct i915_subtest {
67 int (*func)(void *data);
68 const char *name;
69 };
70
71 int __i915_nop_setup(void *data);
72 int __i915_nop_teardown(int err, void *data);
73
74 int __i915_live_setup(void *data);
75 int __i915_live_teardown(int err, void *data);
76
77 int __intel_gt_live_setup(void *data);
78 int __intel_gt_live_teardown(int err, void *data);
79
80 int __i915_subtests(const char *caller,
81 int (*setup)(void *data),
82 int (*teardown)(int err, void *data),
83 const struct i915_subtest *st,
84 unsigned int count,
85 void *data);
86 #define i915_subtests(T, data) \
87 __i915_subtests(__func__, \
88 __i915_nop_setup, __i915_nop_teardown, \
89 T, ARRAY_SIZE(T), data)
90 #define i915_live_subtests(T, data) ({ \
91 typecheck(struct drm_i915_private *, data); \
92 __i915_subtests(__func__, \
93 __i915_live_setup, __i915_live_teardown, \
94 T, ARRAY_SIZE(T), data); \
95 })
96 #define intel_gt_live_subtests(T, data) ({ \
97 typecheck(struct intel_gt *, data); \
98 __i915_subtests(__func__, \
99 __intel_gt_live_setup, __intel_gt_live_teardown, \
100 T, ARRAY_SIZE(T), data); \
101 })
102
103 #define SUBTEST(x) { x, #x }
104
105 #define I915_SELFTEST_DECLARE(x) x
106 #define I915_SELFTEST_ONLY(x) unlikely(x)
107
108 #else
109
110 static inline int i915_mock_selftests(void) { return 0; }
111 static inline int i915_live_selftests(struct pci_dev *pdev) { return 0; }
112
113 #define I915_SELFTEST_DECLARE(x)
114 #define I915_SELFTEST_ONLY(x) 0
115
116 #endif
117
118
119
120
121
122
123 #define IGT_TIMEOUT(name__) \
124 unsigned long name__ = jiffies + i915_selftest.timeout_jiffies
125
126 __printf(2, 3)
127 bool __igt_timeout(unsigned long timeout, const char *fmt, ...);
128
129 #define igt_timeout(t, fmt, ...) \
130 __igt_timeout((t), KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
131
132 #endif