File: | dev/pci/drm/i915/i915_utils.c |
Warning: | line 20, column 17 Value stored to 'kdev' during its initialization is never read |
Press '?' to see keyboard shortcuts
Keyboard shortcuts:
1 | // SPDX-License-Identifier: MIT |
2 | /* |
3 | * Copyright © 2019 Intel Corporation |
4 | */ |
5 | |
6 | #include <drm/drm_drv.h> |
7 | |
8 | #include "i915_drv.h" |
9 | #include "i915_utils.h" |
10 | |
11 | #include <sys/syslog.h> |
12 | |
13 | #define FDO_BUG_MSG"Please file a bug on drm/i915; see " "https://gitlab.freedesktop.org/drm/intel/-/wikis/How-to-file-i915-bugs" " for details." "Please file a bug on drm/i915; see " FDO_BUG_URL"https://gitlab.freedesktop.org/drm/intel/-/wikis/How-to-file-i915-bugs" " for details." |
14 | |
15 | void |
16 | __i915_printk(struct drm_i915_privateinteldrm_softc *dev_priv, const char *level, |
17 | const char *fmt, ...) |
18 | { |
19 | static bool_Bool shown_bug_once; |
20 | struct device *kdev = dev_priv->drm.dev; |
Value stored to 'kdev' during its initialization is never read | |
21 | bool_Bool is_error = level[1] <= KERN_ERR"\0013"[1]; |
22 | bool_Bool is_debug = level[1] == KERN_DEBUG"\0017"[1]; |
23 | struct va_format vaf; |
24 | va_list args; |
25 | |
26 | if (is_debug && !drm_debug_enabled(DRM_UT_DRIVER)) |
27 | return; |
28 | |
29 | va_start(args, fmt)__builtin_va_start((args), fmt); |
30 | |
31 | vaf.fmt = fmt; |
32 | vaf.va = &args; |
33 | |
34 | #ifdef __linux__ |
35 | if (is_error) |
36 | dev_printk(level, kdev, "%pV", &vaf)printf("drm:pid%d:%s *PRINTK* " "%pV", ({struct cpu_info *__ci ; asm volatile("movq %%gs:%P1,%0" : "=r" (__ci) :"n" (__builtin_offsetof (struct cpu_info, ci_self))); __ci;})->ci_curproc->p_p-> ps_pid, __func__ , &vaf); |
37 | else |
38 | dev_printk(level, kdev, "[" DRM_NAME ":%ps] %pV",printf("drm:pid%d:%s *PRINTK* " "[" "drm" ":%ps] %pV", ({struct cpu_info *__ci; asm volatile("movq %%gs:%P1,%0" : "=r" (__ci ) :"n" (__builtin_offsetof(struct cpu_info, ci_self))); __ci; })->ci_curproc->p_p->ps_pid, __func__ , __builtin_return_address (0), &vaf) |
39 | __builtin_return_address(0), &vaf)printf("drm:pid%d:%s *PRINTK* " "[" "drm" ":%ps] %pV", ({struct cpu_info *__ci; asm volatile("movq %%gs:%P1,%0" : "=r" (__ci ) :"n" (__builtin_offsetof(struct cpu_info, ci_self))); __ci; })->ci_curproc->p_p->ps_pid, __func__ , __builtin_return_address (0), &vaf); |
40 | #else |
41 | if (!is_error) |
42 | printf("[" DRM_NAME"drm" "] "); |
43 | vprintf(fmt, args); |
44 | #endif |
45 | |
46 | va_end(args)__builtin_va_end((args)); |
47 | |
48 | if (is_error && !shown_bug_once) { |
49 | /* |
50 | * Ask the user to file a bug report for the error, except |
51 | * if they may have caused the bug by fiddling with unsafe |
52 | * module parameters. |
53 | */ |
54 | #ifdef __linux__ |
55 | if (!test_taint(TAINT_USER)) |
56 | dev_notice(kdev, "%s", FDO_BUG_MSG)printf("drm:pid%d:%s *NOTICE* " "%s", ({struct cpu_info *__ci ; asm volatile("movq %%gs:%P1,%0" : "=r" (__ci) :"n" (__builtin_offsetof (struct cpu_info, ci_self))); __ci;})->ci_curproc->p_p-> ps_pid, __func__ , "Please file a bug on drm/i915; see " "https://gitlab.freedesktop.org/drm/intel/-/wikis/How-to-file-i915-bugs" " for details."); |
57 | #endif |
58 | shown_bug_once = true1; |
59 | } |
60 | } |
61 | |
62 | void add_taint_for_CI(struct drm_i915_privateinteldrm_softc *i915, unsigned int taint) |
63 | { |
64 | __i915_printk(i915, KERN_NOTICE"\0015", "CI tainted:%#x by %pS\n", |
65 | taint, (void *)_RET_IP___builtin_return_address(0)); |
66 | |
67 | /* Failures that occur during fault injection testing are expected */ |
68 | if (!i915_error_injected()0) |
69 | __add_taint_for_CI(taint); |
70 | } |
71 | |
72 | #if IS_ENABLED(CONFIG_DRM_I915_DEBUG)0 |
73 | static unsigned int i915_probe_fail_count; |
74 | |
75 | int __i915_inject_probe_error(struct drm_i915_privateinteldrm_softc *i915, int err, |
76 | const char *func, int line) |
77 | { |
78 | if (i915_probe_fail_count >= i915_modparams.inject_probe_failure) |
79 | return 0; |
80 | |
81 | if (++i915_probe_fail_count < i915_modparams.inject_probe_failure) |
82 | return 0; |
83 | |
84 | __i915_printk(i915, KERN_INFO"\0016", |
85 | "Injecting failure %d at checkpoint %u [%s:%d]\n", |
86 | err, i915_modparams.inject_probe_failure, func, line); |
87 | i915_modparams.inject_probe_failure = 0; |
88 | return err; |
89 | } |
90 | |
91 | bool_Bool i915_error_injected(void) |
92 | { |
93 | return i915_probe_fail_count && !i915_modparams.inject_probe_failure; |
94 | } |
95 | |
96 | #endif |
97 | |
98 | void cancel_timer(struct timeout *t) |
99 | { |
100 | if (!READ_ONCE(t->to_time)({ typeof(t->to_time) __tmp = *(volatile typeof(t->to_time ) *)&(t->to_time); membar_datadep_consumer(); __tmp; } )) |
101 | return; |
102 | |
103 | del_timer(t)timeout_del((t)); |
104 | WRITE_ONCE(t->to_time, 0)({ typeof(t->to_time) __tmp = (0); *(volatile typeof(t-> to_time) *)&(t->to_time) = __tmp; __tmp; }); |
105 | } |
106 | |
107 | void set_timer_ms(struct timeout *t, unsigned long timeout) |
108 | { |
109 | if (!timeout) { |
110 | cancel_timer(t); |
111 | return; |
112 | } |
113 | |
114 | timeout = msecs_to_jiffies(timeout)(((uint64_t)(timeout)) * hz / 1000); |
115 | |
116 | /* |
117 | * Paranoia to make sure the compiler computes the timeout before |
118 | * loading 'jiffies' as jiffies is volatile and may be updated in |
119 | * the background by a timer tick. All to reduce the complexity |
120 | * of the addition and reduce the risk of losing a jiffie. |
121 | */ |
122 | barrier()__asm volatile("" : : : "memory"); |
123 | |
124 | /* Keep t->expires = 0 reserved to indicate a canceled timer. */ |
125 | mod_timer(t, jiffies + timeout ?: 1); |
126 | } |