| File: | dev/pci/drm/i915/i915_utils.c |
| Warning: | line 22, 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 <linux/device.h> |
| 7 | |
| 8 | #include <drm/drm_drv.h> |
| 9 | |
| 10 | #include "i915_drv.h" |
| 11 | #include "i915_utils.h" |
| 12 | |
| 13 | #include <sys/syslog.h> |
| 14 | |
| 15 | #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." |
| 16 | |
| 17 | void |
| 18 | __i915_printk(struct drm_i915_privateinteldrm_softc *dev_priv, const char *level, |
| 19 | const char *fmt, ...) |
| 20 | { |
| 21 | static bool_Bool shown_bug_once; |
| 22 | struct device *kdev = dev_priv->drm.dev; |
Value stored to 'kdev' during its initialization is never read | |
| 23 | bool_Bool is_error = level[1] <= KERN_ERR"\0013"[1]; |
| 24 | bool_Bool is_debug = level[1] == KERN_DEBUG"\0017"[1]; |
| 25 | struct va_format vaf; |
| 26 | va_list args; |
| 27 | |
| 28 | if (is_debug && !drm_debug_enabled(DRM_UT_DRIVER)drm_debug_enabled_raw(DRM_UT_DRIVER)) |
| 29 | return; |
| 30 | |
| 31 | va_start(args, fmt)__builtin_va_start((args), fmt); |
| 32 | |
| 33 | vaf.fmt = fmt; |
| 34 | vaf.va = &args; |
| 35 | |
| 36 | #ifdef __linux__ |
| 37 | if (is_error) |
| 38 | 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); |
| 39 | else |
| 40 | 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) |
| 41 | __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); |
| 42 | #else |
| 43 | if (!is_error) |
| 44 | printf("[" DRM_NAME"drm" "] "); |
| 45 | vprintf(fmt, args); |
| 46 | #endif |
| 47 | |
| 48 | va_end(args)__builtin_va_end((args)); |
| 49 | |
| 50 | if (is_error && !shown_bug_once) { |
| 51 | /* |
| 52 | * Ask the user to file a bug report for the error, except |
| 53 | * if they may have caused the bug by fiddling with unsafe |
| 54 | * module parameters. |
| 55 | */ |
| 56 | #ifdef __linux__ |
| 57 | if (!test_taint(TAINT_USER)) |
| 58 | 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."); |
| 59 | #endif |
| 60 | shown_bug_once = true1; |
| 61 | } |
| 62 | } |
| 63 | |
| 64 | void add_taint_for_CI(struct drm_i915_privateinteldrm_softc *i915, unsigned int taint) |
| 65 | { |
| 66 | __i915_printk(i915, KERN_NOTICE"\0015", "CI tainted:%#x by %pS\n", |
| 67 | taint, (void *)_RET_IP___builtin_return_address(0)); |
| 68 | |
| 69 | /* Failures that occur during fault injection testing are expected */ |
| 70 | if (!i915_error_injected()0) |
| 71 | __add_taint_for_CI(taint); |
| 72 | } |
| 73 | |
| 74 | #if IS_ENABLED(CONFIG_DRM_I915_DEBUG)0 |
| 75 | static unsigned int i915_probe_fail_count; |
| 76 | |
| 77 | int __i915_inject_probe_error(struct drm_i915_privateinteldrm_softc *i915, int err, |
| 78 | const char *func, int line) |
| 79 | { |
| 80 | if (i915_probe_fail_count >= i915_modparams.inject_probe_failure) |
| 81 | return 0; |
| 82 | |
| 83 | if (++i915_probe_fail_count < i915_modparams.inject_probe_failure) |
| 84 | return 0; |
| 85 | |
| 86 | __i915_printk(i915, KERN_INFO"\0016", |
| 87 | "Injecting failure %d at checkpoint %u [%s:%d]\n", |
| 88 | err, i915_modparams.inject_probe_failure, func, line); |
| 89 | i915_modparams.inject_probe_failure = 0; |
| 90 | return err; |
| 91 | } |
| 92 | |
| 93 | bool_Bool i915_error_injected(void) |
| 94 | { |
| 95 | return i915_probe_fail_count && !i915_modparams.inject_probe_failure; |
| 96 | } |
| 97 | |
| 98 | #endif |
| 99 | |
| 100 | void cancel_timer(struct timeout *t) |
| 101 | { |
| 102 | if (!timer_active(t)) |
| 103 | return; |
| 104 | |
| 105 | del_timer(t)timeout_del((t)); |
| 106 | WRITE_ONCE(t->to_time, 0)({ typeof(t->to_time) __tmp = (0); *(volatile typeof(t-> to_time) *)&(t->to_time) = __tmp; __tmp; }); |
| 107 | } |
| 108 | |
| 109 | void set_timer_ms(struct timeout *t, unsigned long timeout) |
| 110 | { |
| 111 | if (!timeout) { |
| 112 | cancel_timer(t); |
| 113 | return; |
| 114 | } |
| 115 | |
| 116 | timeout = msecs_to_jiffies(timeout)(((uint64_t)(timeout)) * hz / 1000); |
| 117 | |
| 118 | /* |
| 119 | * Paranoia to make sure the compiler computes the timeout before |
| 120 | * loading 'jiffies' as jiffies is volatile and may be updated in |
| 121 | * the background by a timer tick. All to reduce the complexity |
| 122 | * of the addition and reduce the risk of losing a jiffie. |
| 123 | */ |
| 124 | barrier()__asm volatile("" : : : "memory"); |
| 125 | |
| 126 | /* Keep t->expires = 0 reserved to indicate a canceled timer. */ |
| 127 | mod_timer(t, jiffies + timeout ?: 1); |
| 128 | } |
| 129 | |
| 130 | bool_Bool i915_vtd_active(struct drm_i915_privateinteldrm_softc *i915) |
| 131 | { |
| 132 | return false0; |
| 133 | #ifdef notyet |
| 134 | if (device_iommu_mapped(i915->drm.dev)) |
| 135 | return true1; |
| 136 | |
| 137 | /* Running as a guest, we assume the host is enforcing VT'd */ |
| 138 | return i915_run_as_guest(); |
| 139 | #endif |
| 140 | } |