| .. | .. |
|---|
| 24 | 24 | #ifndef __I915_SELFTEST_H__ |
|---|
| 25 | 25 | #define __I915_SELFTEST_H__ |
|---|
| 26 | 26 | |
|---|
| 27 | +#include <linux/types.h> |
|---|
| 28 | + |
|---|
| 27 | 29 | struct pci_dev; |
|---|
| 28 | 30 | struct drm_i915_private; |
|---|
| 29 | 31 | |
|---|
| .. | .. |
|---|
| 31 | 33 | unsigned long timeout_jiffies; |
|---|
| 32 | 34 | unsigned int timeout_ms; |
|---|
| 33 | 35 | unsigned int random_seed; |
|---|
| 36 | + char *filter; |
|---|
| 34 | 37 | int mock; |
|---|
| 35 | 38 | int live; |
|---|
| 39 | + int perf; |
|---|
| 36 | 40 | }; |
|---|
| 37 | 41 | |
|---|
| 38 | 42 | #if IS_ENABLED(CONFIG_DRM_I915_SELFTEST) |
|---|
| .. | .. |
|---|
| 42 | 46 | |
|---|
| 43 | 47 | int i915_mock_selftests(void); |
|---|
| 44 | 48 | int i915_live_selftests(struct pci_dev *pdev); |
|---|
| 49 | +int i915_perf_selftests(struct pci_dev *pdev); |
|---|
| 45 | 50 | |
|---|
| 46 | 51 | /* We extract the function declarations from i915_mock_selftests.h and |
|---|
| 47 | 52 | * i915_live_selftests.h Add your unit test declarations there! |
|---|
| .. | .. |
|---|
| 58 | 63 | #undef selftest |
|---|
| 59 | 64 | #define selftest(name, func) int func(struct drm_i915_private *i915); |
|---|
| 60 | 65 | #include "selftests/i915_live_selftests.h" |
|---|
| 66 | +#include "selftests/i915_perf_selftests.h" |
|---|
| 61 | 67 | #undef selftest |
|---|
| 62 | 68 | |
|---|
| 63 | 69 | struct i915_subtest { |
|---|
| .. | .. |
|---|
| 65 | 71 | const char *name; |
|---|
| 66 | 72 | }; |
|---|
| 67 | 73 | |
|---|
| 74 | +int __i915_nop_setup(void *data); |
|---|
| 75 | +int __i915_nop_teardown(int err, void *data); |
|---|
| 76 | + |
|---|
| 77 | +int __i915_live_setup(void *data); |
|---|
| 78 | +int __i915_live_teardown(int err, void *data); |
|---|
| 79 | + |
|---|
| 80 | +int __intel_gt_live_setup(void *data); |
|---|
| 81 | +int __intel_gt_live_teardown(int err, void *data); |
|---|
| 82 | + |
|---|
| 68 | 83 | int __i915_subtests(const char *caller, |
|---|
| 84 | + int (*setup)(void *data), |
|---|
| 85 | + int (*teardown)(int err, void *data), |
|---|
| 69 | 86 | const struct i915_subtest *st, |
|---|
| 70 | 87 | unsigned int count, |
|---|
| 71 | 88 | void *data); |
|---|
| 72 | 89 | #define i915_subtests(T, data) \ |
|---|
| 73 | | - __i915_subtests(__func__, T, ARRAY_SIZE(T), data) |
|---|
| 90 | + __i915_subtests(__func__, \ |
|---|
| 91 | + __i915_nop_setup, __i915_nop_teardown, \ |
|---|
| 92 | + T, ARRAY_SIZE(T), data) |
|---|
| 93 | +#define i915_live_subtests(T, data) ({ \ |
|---|
| 94 | + typecheck(struct drm_i915_private *, data); \ |
|---|
| 95 | + __i915_subtests(__func__, \ |
|---|
| 96 | + __i915_live_setup, __i915_live_teardown, \ |
|---|
| 97 | + T, ARRAY_SIZE(T), data); \ |
|---|
| 98 | +}) |
|---|
| 99 | +#define intel_gt_live_subtests(T, data) ({ \ |
|---|
| 100 | + typecheck(struct intel_gt *, data); \ |
|---|
| 101 | + __i915_subtests(__func__, \ |
|---|
| 102 | + __intel_gt_live_setup, __intel_gt_live_teardown, \ |
|---|
| 103 | + T, ARRAY_SIZE(T), data); \ |
|---|
| 104 | +}) |
|---|
| 74 | 105 | |
|---|
| 75 | 106 | #define SUBTEST(x) { x, #x } |
|---|
| 76 | 107 | |
|---|
| .. | .. |
|---|
| 81 | 112 | |
|---|
| 82 | 113 | static inline int i915_mock_selftests(void) { return 0; } |
|---|
| 83 | 114 | static inline int i915_live_selftests(struct pci_dev *pdev) { return 0; } |
|---|
| 115 | +static inline int i915_perf_selftests(struct pci_dev *pdev) { return 0; } |
|---|
| 84 | 116 | |
|---|
| 85 | 117 | #define I915_SELFTEST_DECLARE(x) |
|---|
| 86 | 118 | #define I915_SELFTEST_ONLY(x) 0 |
|---|
| .. | .. |
|---|
| 101 | 133 | #define igt_timeout(t, fmt, ...) \ |
|---|
| 102 | 134 | __igt_timeout((t), KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) |
|---|
| 103 | 135 | |
|---|
| 136 | +void igt_hexdump(const void *buf, size_t len); |
|---|
| 137 | + |
|---|
| 104 | 138 | #endif /* !__I915_SELFTEST_H__ */ |
|---|