This source file includes following definitions.
- __i915_printk
- __i915_inject_load_error
- i915_error_injected
1
2
3
4
5
6 #include <drm/drm_drv.h>
7
8 #include "i915_drv.h"
9 #include "i915_utils.h"
10
11 #define FDO_BUG_URL "https://gitlab.freedesktop.org/drm/intel/-/wikis/How-to-file-i915-bugs"
12 #define FDO_BUG_MSG "Please file a bug on drm/i915; see " FDO_BUG_URL " for details."
13
14 void
15 __i915_printk(struct drm_i915_private *dev_priv, const char *level,
16 const char *fmt, ...)
17 {
18 static bool shown_bug_once;
19 struct device *kdev = dev_priv->drm.dev;
20 bool is_error = level[1] <= KERN_ERR[1];
21 bool is_debug = level[1] == KERN_DEBUG[1];
22 struct va_format vaf;
23 va_list args;
24
25 if (is_debug && !(drm_debug & DRM_UT_DRIVER))
26 return;
27
28 va_start(args, fmt);
29
30 vaf.fmt = fmt;
31 vaf.va = &args;
32
33 if (is_error)
34 dev_printk(level, kdev, "%pV", &vaf);
35 else
36 dev_printk(level, kdev, "[" DRM_NAME ":%ps] %pV",
37 __builtin_return_address(0), &vaf);
38
39 va_end(args);
40
41 if (is_error && !shown_bug_once) {
42
43
44
45
46
47 if (!test_taint(TAINT_USER))
48 dev_notice(kdev, "%s", FDO_BUG_MSG);
49 shown_bug_once = true;
50 }
51 }
52
53 #if IS_ENABLED(CONFIG_DRM_I915_DEBUG)
54 static unsigned int i915_probe_fail_count;
55
56 int __i915_inject_load_error(struct drm_i915_private *i915, int err,
57 const char *func, int line)
58 {
59 if (i915_probe_fail_count >= i915_modparams.inject_load_failure)
60 return 0;
61
62 if (++i915_probe_fail_count < i915_modparams.inject_load_failure)
63 return 0;
64
65 __i915_printk(i915, KERN_INFO,
66 "Injecting failure %d at checkpoint %u [%s:%d]\n",
67 err, i915_modparams.inject_load_failure, func, line);
68 i915_modparams.inject_load_failure = 0;
69 return err;
70 }
71
72 bool i915_error_injected(void)
73 {
74 return i915_probe_fail_count && !i915_modparams.inject_load_failure;
75 }
76
77 #endif