Ben Gamari | 2017263 | 2009-02-17 20:08:50 -0500 | [diff] [blame] | 1 | /* |
| 2 | * Copyright © 2008 Intel Corporation |
| 3 | * |
| 4 | * Permission is hereby granted, free of charge, to any person obtaining a |
| 5 | * copy of this software and associated documentation files (the "Software"), |
| 6 | * to deal in the Software without restriction, including without limitation |
| 7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 8 | * and/or sell copies of the Software, and to permit persons to whom the |
| 9 | * Software is furnished to do so, subject to the following conditions: |
| 10 | * |
| 11 | * The above copyright notice and this permission notice (including the next |
| 12 | * paragraph) shall be included in all copies or substantial portions of the |
| 13 | * Software. |
| 14 | * |
| 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| 18 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
| 20 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS |
| 21 | * IN THE SOFTWARE. |
| 22 | * |
| 23 | * Authors: |
| 24 | * Eric Anholt <eric@anholt.net> |
| 25 | * Keith Packard <keithp@keithp.com> |
| 26 | * |
| 27 | */ |
| 28 | |
Peter Zijlstra | d92a8cf | 2017-03-03 10:13:38 +0100 | [diff] [blame] | 29 | #include <linux/sched/mm.h> |
Jani Nikula | 98afa31 | 2019-04-05 14:00:08 +0300 | [diff] [blame] | 30 | #include <linux/sort.h> |
| 31 | |
Daniel Vetter | fcd70cd | 2019-01-17 22:03:34 +0100 | [diff] [blame] | 32 | #include <drm/drm_debugfs.h> |
| 33 | #include <drm/drm_fourcc.h> |
Ben Gamari | 2017263 | 2009-02-17 20:08:50 -0500 | [diff] [blame] | 34 | |
Jani Nikula | 1d455f8 | 2019-08-06 14:39:33 +0300 | [diff] [blame] | 35 | #include "display/intel_display_types.h" |
Jani Nikula | 379bc10 | 2019-06-13 11:44:15 +0300 | [diff] [blame] | 36 | #include "display/intel_dp.h" |
Jani Nikula | df0566a | 2019-06-13 11:44:16 +0300 | [diff] [blame] | 37 | #include "display/intel_fbc.h" |
| 38 | #include "display/intel_hdcp.h" |
Jani Nikula | 379bc10 | 2019-06-13 11:44:15 +0300 | [diff] [blame] | 39 | #include "display/intel_hdmi.h" |
Jani Nikula | df0566a | 2019-06-13 11:44:16 +0300 | [diff] [blame] | 40 | #include "display/intel_psr.h" |
Jani Nikula | 379bc10 | 2019-06-13 11:44:15 +0300 | [diff] [blame] | 41 | |
Chris Wilson | 10be98a | 2019-05-28 10:29:49 +0100 | [diff] [blame] | 42 | #include "gem/i915_gem_context.h" |
Chris Wilson | c7302f2 | 2019-08-08 21:27:58 +0100 | [diff] [blame] | 43 | #include "gt/intel_gt_pm.h" |
Chris Wilson | 112ed2d | 2019-04-24 18:48:39 +0100 | [diff] [blame] | 44 | #include "gt/intel_reset.h" |
Daniele Ceraolo Spurio | 0f261b2 | 2019-07-13 11:00:11 +0100 | [diff] [blame] | 45 | #include "gt/uc/intel_guc_submission.h" |
Chris Wilson | 112ed2d | 2019-04-24 18:48:39 +0100 | [diff] [blame] | 46 | |
Jani Nikula | 2126d3e | 2019-05-02 18:02:43 +0300 | [diff] [blame] | 47 | #include "i915_debugfs.h" |
Jani Nikula | 440e2b3 | 2019-04-29 15:29:27 +0300 | [diff] [blame] | 48 | #include "i915_irq.h" |
Jani Nikula | a09d9a8 | 2019-08-06 13:07:28 +0300 | [diff] [blame] | 49 | #include "i915_trace.h" |
Jani Nikula | 6176490 | 2019-05-02 18:02:39 +0300 | [diff] [blame] | 50 | #include "intel_csr.h" |
Jani Nikula | 696173b | 2019-04-05 14:00:15 +0300 | [diff] [blame] | 51 | #include "intel_pm.h" |
Chris Wilson | 56c5098 | 2019-04-26 09:17:22 +0100 | [diff] [blame] | 52 | #include "intel_sideband.h" |
Chris Wilson | 9f58892 | 2019-01-16 15:33:04 +0000 | [diff] [blame] | 53 | |
David Weinehall | 36cdd01 | 2016-08-22 13:59:31 +0300 | [diff] [blame] | 54 | static inline struct drm_i915_private *node_to_i915(struct drm_info_node *node) |
| 55 | { |
| 56 | return to_i915(node->minor->dev); |
| 57 | } |
| 58 | |
Chris Wilson | 70d39fe | 2010-08-25 16:03:34 +0100 | [diff] [blame] | 59 | static int i915_capabilities(struct seq_file *m, void *data) |
| 60 | { |
David Weinehall | 36cdd01 | 2016-08-22 13:59:31 +0300 | [diff] [blame] | 61 | struct drm_i915_private *dev_priv = node_to_i915(m->private); |
| 62 | const struct intel_device_info *info = INTEL_INFO(dev_priv); |
Michal Wajdeczko | a8c9b84 | 2017-12-19 11:43:44 +0000 | [diff] [blame] | 63 | struct drm_printer p = drm_seq_file_printer(m); |
Chris Wilson | 70d39fe | 2010-08-25 16:03:34 +0100 | [diff] [blame] | 64 | |
David Weinehall | 36cdd01 | 2016-08-22 13:59:31 +0300 | [diff] [blame] | 65 | seq_printf(m, "gen: %d\n", INTEL_GEN(dev_priv)); |
Jani Nikula | 2e0d26f | 2016-12-01 14:49:55 +0200 | [diff] [blame] | 66 | seq_printf(m, "platform: %s\n", intel_platform_name(info->platform)); |
David Weinehall | 36cdd01 | 2016-08-22 13:59:31 +0300 | [diff] [blame] | 67 | seq_printf(m, "pch: %d\n", INTEL_PCH_TYPE(dev_priv)); |
Chris Wilson | 418e3cd | 2017-02-06 21:36:08 +0000 | [diff] [blame] | 68 | |
Michal Wajdeczko | a8c9b84 | 2017-12-19 11:43:44 +0000 | [diff] [blame] | 69 | intel_device_info_dump_flags(info, &p); |
Jani Nikula | 0258404 | 2018-12-31 16:56:41 +0200 | [diff] [blame] | 70 | intel_device_info_dump_runtime(RUNTIME_INFO(dev_priv), &p); |
Chris Wilson | 3fed180 | 2018-02-07 21:05:43 +0000 | [diff] [blame] | 71 | intel_driver_caps_print(&dev_priv->caps, &p); |
Chris Wilson | 70d39fe | 2010-08-25 16:03:34 +0100 | [diff] [blame] | 72 | |
Chris Wilson | 418e3cd | 2017-02-06 21:36:08 +0000 | [diff] [blame] | 73 | kernel_param_lock(THIS_MODULE); |
Michal Wajdeczko | acfb997 | 2017-12-19 11:43:46 +0000 | [diff] [blame] | 74 | i915_params_dump(&i915_modparams, &p); |
Chris Wilson | 418e3cd | 2017-02-06 21:36:08 +0000 | [diff] [blame] | 75 | kernel_param_unlock(THIS_MODULE); |
| 76 | |
Chris Wilson | 70d39fe | 2010-08-25 16:03:34 +0100 | [diff] [blame] | 77 | return 0; |
| 78 | } |
Ben Gamari | 433e12f | 2009-02-17 20:08:51 -0500 | [diff] [blame] | 79 | |
Imre Deak | a7363de | 2016-05-12 16:18:52 +0300 | [diff] [blame] | 80 | static char get_pin_flag(struct drm_i915_gem_object *obj) |
Tvrtko Ursulin | be12a86 | 2016-04-15 11:34:52 +0100 | [diff] [blame] | 81 | { |
Chris Wilson | bd3d225 | 2017-10-13 21:26:14 +0100 | [diff] [blame] | 82 | return obj->pin_global ? 'p' : ' '; |
Tvrtko Ursulin | be12a86 | 2016-04-15 11:34:52 +0100 | [diff] [blame] | 83 | } |
| 84 | |
Imre Deak | a7363de | 2016-05-12 16:18:52 +0300 | [diff] [blame] | 85 | static char get_tiling_flag(struct drm_i915_gem_object *obj) |
Chris Wilson | a6172a8 | 2009-02-11 14:26:38 +0000 | [diff] [blame] | 86 | { |
Chris Wilson | 3e510a8 | 2016-08-05 10:14:23 +0100 | [diff] [blame] | 87 | switch (i915_gem_object_get_tiling(obj)) { |
Akshay Joshi | 0206e35 | 2011-08-16 15:34:10 -0400 | [diff] [blame] | 88 | default: |
Tvrtko Ursulin | be12a86 | 2016-04-15 11:34:52 +0100 | [diff] [blame] | 89 | case I915_TILING_NONE: return ' '; |
| 90 | case I915_TILING_X: return 'X'; |
| 91 | case I915_TILING_Y: return 'Y'; |
Akshay Joshi | 0206e35 | 2011-08-16 15:34:10 -0400 | [diff] [blame] | 92 | } |
Chris Wilson | a6172a8 | 2009-02-11 14:26:38 +0000 | [diff] [blame] | 93 | } |
| 94 | |
Imre Deak | a7363de | 2016-05-12 16:18:52 +0300 | [diff] [blame] | 95 | static char get_global_flag(struct drm_i915_gem_object *obj) |
Ben Widawsky | 1d693bc | 2013-07-31 17:00:00 -0700 | [diff] [blame] | 96 | { |
Chris Wilson | a65adaf | 2017-10-09 09:43:57 +0100 | [diff] [blame] | 97 | return obj->userfault_count ? 'g' : ' '; |
Tvrtko Ursulin | be12a86 | 2016-04-15 11:34:52 +0100 | [diff] [blame] | 98 | } |
| 99 | |
Imre Deak | a7363de | 2016-05-12 16:18:52 +0300 | [diff] [blame] | 100 | static char get_pin_mapped_flag(struct drm_i915_gem_object *obj) |
Tvrtko Ursulin | be12a86 | 2016-04-15 11:34:52 +0100 | [diff] [blame] | 101 | { |
Chris Wilson | a4f5ea6 | 2016-10-28 13:58:35 +0100 | [diff] [blame] | 102 | return obj->mm.mapping ? 'M' : ' '; |
Ben Widawsky | 1d693bc | 2013-07-31 17:00:00 -0700 | [diff] [blame] | 103 | } |
| 104 | |
Matthew Auld | 7393b7e | 2017-10-06 23:18:28 +0100 | [diff] [blame] | 105 | static const char * |
| 106 | stringify_page_sizes(unsigned int page_sizes, char *buf, size_t len) |
| 107 | { |
| 108 | size_t x = 0; |
| 109 | |
| 110 | switch (page_sizes) { |
| 111 | case 0: |
| 112 | return ""; |
| 113 | case I915_GTT_PAGE_SIZE_4K: |
| 114 | return "4K"; |
| 115 | case I915_GTT_PAGE_SIZE_64K: |
| 116 | return "64K"; |
| 117 | case I915_GTT_PAGE_SIZE_2M: |
| 118 | return "2M"; |
| 119 | default: |
| 120 | if (!buf) |
| 121 | return "M"; |
| 122 | |
| 123 | if (page_sizes & I915_GTT_PAGE_SIZE_2M) |
| 124 | x += snprintf(buf + x, len - x, "2M, "); |
| 125 | if (page_sizes & I915_GTT_PAGE_SIZE_64K) |
| 126 | x += snprintf(buf + x, len - x, "64K, "); |
| 127 | if (page_sizes & I915_GTT_PAGE_SIZE_4K) |
| 128 | x += snprintf(buf + x, len - x, "4K, "); |
| 129 | buf[x-2] = '\0'; |
| 130 | |
| 131 | return buf; |
| 132 | } |
| 133 | } |
| 134 | |
Chris Wilson | 37811fc | 2010-08-25 22:45:57 +0100 | [diff] [blame] | 135 | static void |
| 136 | describe_obj(struct seq_file *m, struct drm_i915_gem_object *obj) |
| 137 | { |
Chris Wilson | b471618 | 2015-04-27 13:41:17 +0100 | [diff] [blame] | 138 | struct drm_i915_private *dev_priv = to_i915(obj->base.dev); |
Tvrtko Ursulin | e2f8039 | 2016-03-16 11:00:36 +0000 | [diff] [blame] | 139 | struct intel_engine_cs *engine; |
Ben Widawsky | 1d693bc | 2013-07-31 17:00:00 -0700 | [diff] [blame] | 140 | struct i915_vma *vma; |
Chris Wilson | faf5bf0 | 2016-08-04 16:32:37 +0100 | [diff] [blame] | 141 | unsigned int frontbuffer_bits; |
Ben Widawsky | d7f46fc | 2013-12-06 14:10:55 -0800 | [diff] [blame] | 142 | int pin_count = 0; |
| 143 | |
Chris Wilson | a93615f | 2019-06-21 19:37:59 +0100 | [diff] [blame] | 144 | seq_printf(m, "%pK: %c%c%c%c %8zdKiB %02x %02x %s%s%s", |
Chris Wilson | 37811fc | 2010-08-25 22:45:57 +0100 | [diff] [blame] | 145 | &obj->base, |
| 146 | get_pin_flag(obj), |
| 147 | get_tiling_flag(obj), |
Ben Widawsky | 1d693bc | 2013-07-31 17:00:00 -0700 | [diff] [blame] | 148 | get_global_flag(obj), |
Tvrtko Ursulin | be12a86 | 2016-04-15 11:34:52 +0100 | [diff] [blame] | 149 | get_pin_mapped_flag(obj), |
Eric Anholt | a05a586 | 2011-12-20 08:54:15 -0800 | [diff] [blame] | 150 | obj->base.size / 1024, |
Christian König | c0a51fd | 2018-02-16 13:43:38 +0100 | [diff] [blame] | 151 | obj->read_domains, |
| 152 | obj->write_domain, |
David Weinehall | 36cdd01 | 2016-08-22 13:59:31 +0300 | [diff] [blame] | 153 | i915_cache_level_str(dev_priv, obj->cache_level), |
Chris Wilson | a4f5ea6 | 2016-10-28 13:58:35 +0100 | [diff] [blame] | 154 | obj->mm.dirty ? " dirty" : "", |
| 155 | obj->mm.madv == I915_MADV_DONTNEED ? " purgeable" : ""); |
Chris Wilson | 37811fc | 2010-08-25 22:45:57 +0100 | [diff] [blame] | 156 | if (obj->base.name) |
| 157 | seq_printf(m, " (name: %d)", obj->base.name); |
Chris Wilson | 0cf289b | 2019-06-13 08:32:54 +0100 | [diff] [blame] | 158 | |
| 159 | spin_lock(&obj->vma.lock); |
Chris Wilson | 528cbd1 | 2019-01-28 10:23:54 +0000 | [diff] [blame] | 160 | list_for_each_entry(vma, &obj->vma.list, obj_link) { |
Chris Wilson | 15717de | 2016-08-04 07:52:26 +0100 | [diff] [blame] | 161 | if (!drm_mm_node_allocated(&vma->node)) |
| 162 | continue; |
| 163 | |
Chris Wilson | 0cf289b | 2019-06-13 08:32:54 +0100 | [diff] [blame] | 164 | spin_unlock(&obj->vma.lock); |
| 165 | |
| 166 | if (i915_vma_is_pinned(vma)) |
| 167 | pin_count++; |
| 168 | |
Matthew Auld | 7393b7e | 2017-10-06 23:18:28 +0100 | [diff] [blame] | 169 | seq_printf(m, " (%sgtt offset: %08llx, size: %08llx, pages: %s", |
Chris Wilson | 3272db5 | 2016-08-04 16:32:32 +0100 | [diff] [blame] | 170 | i915_vma_is_ggtt(vma) ? "g" : "pp", |
Matthew Auld | 7393b7e | 2017-10-06 23:18:28 +0100 | [diff] [blame] | 171 | vma->node.start, vma->node.size, |
| 172 | stringify_page_sizes(vma->page_sizes.gtt, NULL, 0)); |
Chris Wilson | 2197685 | 2017-01-12 11:21:08 +0000 | [diff] [blame] | 173 | if (i915_vma_is_ggtt(vma)) { |
| 174 | switch (vma->ggtt_view.type) { |
| 175 | case I915_GGTT_VIEW_NORMAL: |
| 176 | seq_puts(m, ", normal"); |
| 177 | break; |
| 178 | |
| 179 | case I915_GGTT_VIEW_PARTIAL: |
| 180 | seq_printf(m, ", partial [%08llx+%x]", |
Chris Wilson | 8bab1193 | 2017-01-14 00:28:25 +0000 | [diff] [blame] | 181 | vma->ggtt_view.partial.offset << PAGE_SHIFT, |
| 182 | vma->ggtt_view.partial.size << PAGE_SHIFT); |
Chris Wilson | 2197685 | 2017-01-12 11:21:08 +0000 | [diff] [blame] | 183 | break; |
| 184 | |
| 185 | case I915_GGTT_VIEW_ROTATED: |
| 186 | seq_printf(m, ", rotated [(%ux%u, stride=%u, offset=%u), (%ux%u, stride=%u, offset=%u)]", |
Chris Wilson | 8bab1193 | 2017-01-14 00:28:25 +0000 | [diff] [blame] | 187 | vma->ggtt_view.rotated.plane[0].width, |
| 188 | vma->ggtt_view.rotated.plane[0].height, |
| 189 | vma->ggtt_view.rotated.plane[0].stride, |
| 190 | vma->ggtt_view.rotated.plane[0].offset, |
| 191 | vma->ggtt_view.rotated.plane[1].width, |
| 192 | vma->ggtt_view.rotated.plane[1].height, |
| 193 | vma->ggtt_view.rotated.plane[1].stride, |
| 194 | vma->ggtt_view.rotated.plane[1].offset); |
Chris Wilson | 2197685 | 2017-01-12 11:21:08 +0000 | [diff] [blame] | 195 | break; |
| 196 | |
Ville Syrjälä | 1a74fc0 | 2019-05-09 15:21:52 +0300 | [diff] [blame] | 197 | case I915_GGTT_VIEW_REMAPPED: |
| 198 | seq_printf(m, ", remapped [(%ux%u, stride=%u, offset=%u), (%ux%u, stride=%u, offset=%u)]", |
| 199 | vma->ggtt_view.remapped.plane[0].width, |
| 200 | vma->ggtt_view.remapped.plane[0].height, |
| 201 | vma->ggtt_view.remapped.plane[0].stride, |
| 202 | vma->ggtt_view.remapped.plane[0].offset, |
| 203 | vma->ggtt_view.remapped.plane[1].width, |
| 204 | vma->ggtt_view.remapped.plane[1].height, |
| 205 | vma->ggtt_view.remapped.plane[1].stride, |
| 206 | vma->ggtt_view.remapped.plane[1].offset); |
| 207 | break; |
| 208 | |
Chris Wilson | 2197685 | 2017-01-12 11:21:08 +0000 | [diff] [blame] | 209 | default: |
| 210 | MISSING_CASE(vma->ggtt_view.type); |
| 211 | break; |
| 212 | } |
| 213 | } |
Chris Wilson | 49ef529 | 2016-08-18 17:17:00 +0100 | [diff] [blame] | 214 | if (vma->fence) |
Chris Wilson | 3d6792c | 2019-08-12 18:48:03 +0100 | [diff] [blame] | 215 | seq_printf(m, " , fence: %d", vma->fence->id); |
Chris Wilson | 596c592 | 2016-02-26 11:03:20 +0000 | [diff] [blame] | 216 | seq_puts(m, ")"); |
Chris Wilson | 0cf289b | 2019-06-13 08:32:54 +0100 | [diff] [blame] | 217 | |
| 218 | spin_lock(&obj->vma.lock); |
Ben Widawsky | 1d693bc | 2013-07-31 17:00:00 -0700 | [diff] [blame] | 219 | } |
Chris Wilson | 0cf289b | 2019-06-13 08:32:54 +0100 | [diff] [blame] | 220 | spin_unlock(&obj->vma.lock); |
| 221 | |
| 222 | seq_printf(m, " (pinned x %d)", pin_count); |
Chris Wilson | c1ad11f | 2012-11-15 11:32:21 +0000 | [diff] [blame] | 223 | if (obj->stolen) |
Thierry Reding | 440fd52 | 2015-01-23 09:05:06 +0100 | [diff] [blame] | 224 | seq_printf(m, " (stolen: %08llx)", obj->stolen->start); |
Chris Wilson | 0cf289b | 2019-06-13 08:32:54 +0100 | [diff] [blame] | 225 | if (obj->pin_global) |
| 226 | seq_printf(m, " (global)"); |
Chris Wilson | 27c01aa | 2016-08-04 07:52:30 +0100 | [diff] [blame] | 227 | |
Chris Wilson | d07f0e5 | 2016-10-28 13:58:44 +0100 | [diff] [blame] | 228 | engine = i915_gem_object_last_write_engine(obj); |
Chris Wilson | 27c01aa | 2016-08-04 07:52:30 +0100 | [diff] [blame] | 229 | if (engine) |
| 230 | seq_printf(m, " (%s)", engine->name); |
| 231 | |
Chris Wilson | faf5bf0 | 2016-08-04 16:32:37 +0100 | [diff] [blame] | 232 | frontbuffer_bits = atomic_read(&obj->frontbuffer_bits); |
| 233 | if (frontbuffer_bits) |
| 234 | seq_printf(m, " (frontbuffer: 0x%03x)", frontbuffer_bits); |
Chris Wilson | 37811fc | 2010-08-25 22:45:57 +0100 | [diff] [blame] | 235 | } |
| 236 | |
Chris Wilson | 2db8e9d | 2013-06-04 23:49:08 +0100 | [diff] [blame] | 237 | struct file_stats { |
Chris Wilson | f6e8aa3 | 2019-01-07 11:54:25 +0000 | [diff] [blame] | 238 | struct i915_address_space *vm; |
Mika Kuoppala | c44ef60 | 2015-06-25 18:35:05 +0300 | [diff] [blame] | 239 | unsigned long count; |
| 240 | u64 total, unbound; |
Mika Kuoppala | c44ef60 | 2015-06-25 18:35:05 +0300 | [diff] [blame] | 241 | u64 active, inactive; |
Chris Wilson | f6e8aa3 | 2019-01-07 11:54:25 +0000 | [diff] [blame] | 242 | u64 closed; |
Chris Wilson | 2db8e9d | 2013-06-04 23:49:08 +0100 | [diff] [blame] | 243 | }; |
| 244 | |
| 245 | static int per_file_stats(int id, void *ptr, void *data) |
| 246 | { |
| 247 | struct drm_i915_gem_object *obj = ptr; |
| 248 | struct file_stats *stats = data; |
Chris Wilson | 6313c20 | 2014-03-19 13:45:45 +0000 | [diff] [blame] | 249 | struct i915_vma *vma; |
Chris Wilson | 2db8e9d | 2013-06-04 23:49:08 +0100 | [diff] [blame] | 250 | |
| 251 | stats->count++; |
| 252 | stats->total += obj->base.size; |
Chris Wilson | ecab9be | 2019-06-12 11:57:20 +0100 | [diff] [blame] | 253 | if (!atomic_read(&obj->bind_count)) |
Chris Wilson | 15717de | 2016-08-04 07:52:26 +0100 | [diff] [blame] | 254 | stats->unbound += obj->base.size; |
Chris Wilson | c67a17e | 2014-03-19 13:45:46 +0000 | [diff] [blame] | 255 | |
Chris Wilson | 5b5efdf | 2019-08-08 17:24:07 +0100 | [diff] [blame] | 256 | spin_lock(&obj->vma.lock); |
| 257 | if (!stats->vm) { |
| 258 | for_each_ggtt_vma(vma, obj) { |
| 259 | if (!drm_mm_node_allocated(&vma->node)) |
Chris Wilson | 6313c20 | 2014-03-19 13:45:45 +0000 | [diff] [blame] | 260 | continue; |
Chris Wilson | 5b5efdf | 2019-08-08 17:24:07 +0100 | [diff] [blame] | 261 | |
| 262 | if (i915_vma_is_active(vma)) |
| 263 | stats->active += vma->node.size; |
| 264 | else |
| 265 | stats->inactive += vma->node.size; |
| 266 | |
| 267 | if (i915_vma_is_closed(vma)) |
| 268 | stats->closed += vma->node.size; |
Chris Wilson | 6313c20 | 2014-03-19 13:45:45 +0000 | [diff] [blame] | 269 | } |
Chris Wilson | 5b5efdf | 2019-08-08 17:24:07 +0100 | [diff] [blame] | 270 | } else { |
| 271 | struct rb_node *p = obj->vma.tree.rb_node; |
Chris Wilson | 894eeec | 2016-08-04 07:52:20 +0100 | [diff] [blame] | 272 | |
Chris Wilson | 5b5efdf | 2019-08-08 17:24:07 +0100 | [diff] [blame] | 273 | while (p) { |
| 274 | long cmp; |
Chris Wilson | f6e8aa3 | 2019-01-07 11:54:25 +0000 | [diff] [blame] | 275 | |
Chris Wilson | 5b5efdf | 2019-08-08 17:24:07 +0100 | [diff] [blame] | 276 | vma = rb_entry(p, typeof(*vma), obj_node); |
| 277 | cmp = i915_vma_compare(vma, stats->vm, NULL); |
| 278 | if (cmp == 0) { |
| 279 | if (drm_mm_node_allocated(&vma->node)) { |
| 280 | if (i915_vma_is_active(vma)) |
| 281 | stats->active += vma->node.size; |
| 282 | else |
| 283 | stats->inactive += vma->node.size; |
| 284 | |
| 285 | if (i915_vma_is_closed(vma)) |
| 286 | stats->closed += vma->node.size; |
| 287 | } |
| 288 | break; |
| 289 | } |
| 290 | if (cmp < 0) |
| 291 | p = p->rb_right; |
| 292 | else |
| 293 | p = p->rb_left; |
| 294 | } |
Chris Wilson | 2db8e9d | 2013-06-04 23:49:08 +0100 | [diff] [blame] | 295 | } |
Chris Wilson | 5b5efdf | 2019-08-08 17:24:07 +0100 | [diff] [blame] | 296 | spin_unlock(&obj->vma.lock); |
Chris Wilson | 2db8e9d | 2013-06-04 23:49:08 +0100 | [diff] [blame] | 297 | |
| 298 | return 0; |
| 299 | } |
| 300 | |
Chris Wilson | b0da1b7 | 2015-04-07 16:20:40 +0100 | [diff] [blame] | 301 | #define print_file_stats(m, name, stats) do { \ |
| 302 | if (stats.count) \ |
Chris Wilson | 5b5efdf | 2019-08-08 17:24:07 +0100 | [diff] [blame] | 303 | seq_printf(m, "%s: %lu objects, %llu bytes (%llu active, %llu inactive, %llu unbound, %llu closed)\n", \ |
Chris Wilson | b0da1b7 | 2015-04-07 16:20:40 +0100 | [diff] [blame] | 304 | name, \ |
| 305 | stats.count, \ |
| 306 | stats.total, \ |
| 307 | stats.active, \ |
| 308 | stats.inactive, \ |
Chris Wilson | f6e8aa3 | 2019-01-07 11:54:25 +0000 | [diff] [blame] | 309 | stats.unbound, \ |
| 310 | stats.closed); \ |
Chris Wilson | b0da1b7 | 2015-04-07 16:20:40 +0100 | [diff] [blame] | 311 | } while (0) |
Brad Volkin | 493018d | 2014-12-11 12:13:08 -0800 | [diff] [blame] | 312 | |
Chris Wilson | 15da956 | 2016-05-24 14:53:43 +0100 | [diff] [blame] | 313 | static void print_context_stats(struct seq_file *m, |
Chris Wilson | f6e8aa3 | 2019-01-07 11:54:25 +0000 | [diff] [blame] | 314 | struct drm_i915_private *i915) |
Chris Wilson | 15da956 | 2016-05-24 14:53:43 +0100 | [diff] [blame] | 315 | { |
Chris Wilson | f6e8aa3 | 2019-01-07 11:54:25 +0000 | [diff] [blame] | 316 | struct file_stats kstats = {}; |
| 317 | struct i915_gem_context *ctx; |
Chris Wilson | 15da956 | 2016-05-24 14:53:43 +0100 | [diff] [blame] | 318 | |
Chris Wilson | f6e8aa3 | 2019-01-07 11:54:25 +0000 | [diff] [blame] | 319 | list_for_each_entry(ctx, &i915->contexts.list, link) { |
Chris Wilson | 0268444 | 2019-04-26 17:33:35 +0100 | [diff] [blame] | 320 | struct i915_gem_engines_iter it; |
Chris Wilson | 7e3d9a5 | 2019-03-08 13:25:16 +0000 | [diff] [blame] | 321 | struct intel_context *ce; |
Chris Wilson | 15da956 | 2016-05-24 14:53:43 +0100 | [diff] [blame] | 322 | |
Chris Wilson | 0268444 | 2019-04-26 17:33:35 +0100 | [diff] [blame] | 323 | for_each_gem_engine(ce, |
| 324 | i915_gem_context_lock_engines(ctx), it) { |
Chris Wilson | 48ae397 | 2019-08-09 19:25:17 +0100 | [diff] [blame] | 325 | intel_context_lock_pinned(ce); |
| 326 | if (intel_context_is_pinned(ce)) { |
| 327 | if (ce->state) |
| 328 | per_file_stats(0, |
| 329 | ce->state->obj, &kstats); |
Chris Wilson | f6e8aa3 | 2019-01-07 11:54:25 +0000 | [diff] [blame] | 330 | per_file_stats(0, ce->ring->vma->obj, &kstats); |
Chris Wilson | 48ae397 | 2019-08-09 19:25:17 +0100 | [diff] [blame] | 331 | } |
| 332 | intel_context_unlock_pinned(ce); |
Chris Wilson | f6e8aa3 | 2019-01-07 11:54:25 +0000 | [diff] [blame] | 333 | } |
Chris Wilson | 0268444 | 2019-04-26 17:33:35 +0100 | [diff] [blame] | 334 | i915_gem_context_unlock_engines(ctx); |
Chris Wilson | f6e8aa3 | 2019-01-07 11:54:25 +0000 | [diff] [blame] | 335 | |
| 336 | if (!IS_ERR_OR_NULL(ctx->file_priv)) { |
Chris Wilson | e568ac3 | 2019-06-11 10:12:37 +0100 | [diff] [blame] | 337 | struct file_stats stats = { .vm = ctx->vm, }; |
Chris Wilson | f6e8aa3 | 2019-01-07 11:54:25 +0000 | [diff] [blame] | 338 | struct drm_file *file = ctx->file_priv->file; |
| 339 | struct task_struct *task; |
| 340 | char name[80]; |
| 341 | |
| 342 | spin_lock(&file->table_lock); |
| 343 | idr_for_each(&file->object_idr, per_file_stats, &stats); |
| 344 | spin_unlock(&file->table_lock); |
| 345 | |
| 346 | rcu_read_lock(); |
| 347 | task = pid_task(ctx->pid ?: file->pid, PIDTYPE_PID); |
Chris Wilson | 3e05531 | 2019-03-21 14:07:10 +0000 | [diff] [blame] | 348 | snprintf(name, sizeof(name), "%s", |
| 349 | task ? task->comm : "<unknown>"); |
Chris Wilson | f6e8aa3 | 2019-01-07 11:54:25 +0000 | [diff] [blame] | 350 | rcu_read_unlock(); |
| 351 | |
| 352 | print_file_stats(m, name, stats); |
| 353 | } |
Chris Wilson | 15da956 | 2016-05-24 14:53:43 +0100 | [diff] [blame] | 354 | } |
Chris Wilson | 15da956 | 2016-05-24 14:53:43 +0100 | [diff] [blame] | 355 | |
Chris Wilson | f6e8aa3 | 2019-01-07 11:54:25 +0000 | [diff] [blame] | 356 | print_file_stats(m, "[k]contexts", kstats); |
Chris Wilson | 15da956 | 2016-05-24 14:53:43 +0100 | [diff] [blame] | 357 | } |
| 358 | |
David Weinehall | 36cdd01 | 2016-08-22 13:59:31 +0300 | [diff] [blame] | 359 | static int i915_gem_object_info(struct seq_file *m, void *data) |
Chris Wilson | 73aa808 | 2010-09-30 11:46:12 +0100 | [diff] [blame] | 360 | { |
Chris Wilson | ecab9be | 2019-06-12 11:57:20 +0100 | [diff] [blame] | 361 | struct drm_i915_private *i915 = node_to_i915(m->private); |
Chris Wilson | 73aa808 | 2010-09-30 11:46:12 +0100 | [diff] [blame] | 362 | int ret; |
| 363 | |
Chris Wilson | 1aff190 | 2019-08-02 22:21:36 +0100 | [diff] [blame] | 364 | seq_printf(m, "%u shrinkable [%u free] objects, %llu bytes\n", |
Chris Wilson | ecab9be | 2019-06-12 11:57:20 +0100 | [diff] [blame] | 365 | i915->mm.shrink_count, |
Chris Wilson | 1aff190 | 2019-08-02 22:21:36 +0100 | [diff] [blame] | 366 | atomic_read(&i915->mm.free_count), |
Chris Wilson | ecab9be | 2019-06-12 11:57:20 +0100 | [diff] [blame] | 367 | i915->mm.shrink_memory); |
Chris Wilson | 73aa808 | 2010-09-30 11:46:12 +0100 | [diff] [blame] | 368 | |
Damien Lespiau | 267f0c9 | 2013-06-24 22:59:48 +0100 | [diff] [blame] | 369 | seq_putc(m, '\n'); |
Chris Wilson | f6e8aa3 | 2019-01-07 11:54:25 +0000 | [diff] [blame] | 370 | |
Chris Wilson | ecab9be | 2019-06-12 11:57:20 +0100 | [diff] [blame] | 371 | ret = mutex_lock_interruptible(&i915->drm.struct_mutex); |
Chris Wilson | f6e8aa3 | 2019-01-07 11:54:25 +0000 | [diff] [blame] | 372 | if (ret) |
| 373 | return ret; |
| 374 | |
Chris Wilson | ecab9be | 2019-06-12 11:57:20 +0100 | [diff] [blame] | 375 | print_context_stats(m, i915); |
| 376 | mutex_unlock(&i915->drm.struct_mutex); |
Chris Wilson | 73aa808 | 2010-09-30 11:46:12 +0100 | [diff] [blame] | 377 | |
| 378 | return 0; |
| 379 | } |
| 380 | |
Tvrtko Ursulin | 80d8935 | 2018-02-20 17:37:53 +0200 | [diff] [blame] | 381 | static void gen8_display_interrupt_info(struct seq_file *m) |
| 382 | { |
| 383 | struct drm_i915_private *dev_priv = node_to_i915(m->private); |
| 384 | int pipe; |
| 385 | |
| 386 | for_each_pipe(dev_priv, pipe) { |
| 387 | enum intel_display_power_domain power_domain; |
Chris Wilson | 0e6e0be | 2019-01-14 14:21:24 +0000 | [diff] [blame] | 388 | intel_wakeref_t wakeref; |
Tvrtko Ursulin | 80d8935 | 2018-02-20 17:37:53 +0200 | [diff] [blame] | 389 | |
| 390 | power_domain = POWER_DOMAIN_PIPE(pipe); |
Chris Wilson | 0e6e0be | 2019-01-14 14:21:24 +0000 | [diff] [blame] | 391 | wakeref = intel_display_power_get_if_enabled(dev_priv, |
| 392 | power_domain); |
| 393 | if (!wakeref) { |
Tvrtko Ursulin | 80d8935 | 2018-02-20 17:37:53 +0200 | [diff] [blame] | 394 | seq_printf(m, "Pipe %c power disabled\n", |
| 395 | pipe_name(pipe)); |
| 396 | continue; |
| 397 | } |
| 398 | seq_printf(m, "Pipe %c IMR:\t%08x\n", |
| 399 | pipe_name(pipe), |
| 400 | I915_READ(GEN8_DE_PIPE_IMR(pipe))); |
| 401 | seq_printf(m, "Pipe %c IIR:\t%08x\n", |
| 402 | pipe_name(pipe), |
| 403 | I915_READ(GEN8_DE_PIPE_IIR(pipe))); |
| 404 | seq_printf(m, "Pipe %c IER:\t%08x\n", |
| 405 | pipe_name(pipe), |
| 406 | I915_READ(GEN8_DE_PIPE_IER(pipe))); |
| 407 | |
Chris Wilson | 0e6e0be | 2019-01-14 14:21:24 +0000 | [diff] [blame] | 408 | intel_display_power_put(dev_priv, power_domain, wakeref); |
Tvrtko Ursulin | 80d8935 | 2018-02-20 17:37:53 +0200 | [diff] [blame] | 409 | } |
| 410 | |
| 411 | seq_printf(m, "Display Engine port interrupt mask:\t%08x\n", |
| 412 | I915_READ(GEN8_DE_PORT_IMR)); |
| 413 | seq_printf(m, "Display Engine port interrupt identity:\t%08x\n", |
| 414 | I915_READ(GEN8_DE_PORT_IIR)); |
| 415 | seq_printf(m, "Display Engine port interrupt enable:\t%08x\n", |
| 416 | I915_READ(GEN8_DE_PORT_IER)); |
| 417 | |
| 418 | seq_printf(m, "Display Engine misc interrupt mask:\t%08x\n", |
| 419 | I915_READ(GEN8_DE_MISC_IMR)); |
| 420 | seq_printf(m, "Display Engine misc interrupt identity:\t%08x\n", |
| 421 | I915_READ(GEN8_DE_MISC_IIR)); |
| 422 | seq_printf(m, "Display Engine misc interrupt enable:\t%08x\n", |
| 423 | I915_READ(GEN8_DE_MISC_IER)); |
| 424 | |
| 425 | seq_printf(m, "PCU interrupt mask:\t%08x\n", |
| 426 | I915_READ(GEN8_PCU_IMR)); |
| 427 | seq_printf(m, "PCU interrupt identity:\t%08x\n", |
| 428 | I915_READ(GEN8_PCU_IIR)); |
| 429 | seq_printf(m, "PCU interrupt enable:\t%08x\n", |
| 430 | I915_READ(GEN8_PCU_IER)); |
| 431 | } |
| 432 | |
Ben Gamari | 2017263 | 2009-02-17 20:08:50 -0500 | [diff] [blame] | 433 | static int i915_interrupt_info(struct seq_file *m, void *data) |
| 434 | { |
David Weinehall | 36cdd01 | 2016-08-22 13:59:31 +0300 | [diff] [blame] | 435 | struct drm_i915_private *dev_priv = node_to_i915(m->private); |
Tvrtko Ursulin | e2f8039 | 2016-03-16 11:00:36 +0000 | [diff] [blame] | 436 | struct intel_engine_cs *engine; |
Chris Wilson | a037121 | 2019-01-14 14:21:14 +0000 | [diff] [blame] | 437 | intel_wakeref_t wakeref; |
Chris Wilson | 4bb0504 | 2016-09-03 07:53:43 +0100 | [diff] [blame] | 438 | int i, pipe; |
Chris Wilson | de227ef | 2010-07-03 07:58:38 +0100 | [diff] [blame] | 439 | |
Daniele Ceraolo Spurio | d858d56 | 2019-06-13 16:21:54 -0700 | [diff] [blame] | 440 | wakeref = intel_runtime_pm_get(&dev_priv->runtime_pm); |
Ben Gamari | 2017263 | 2009-02-17 20:08:50 -0500 | [diff] [blame] | 441 | |
David Weinehall | 36cdd01 | 2016-08-22 13:59:31 +0300 | [diff] [blame] | 442 | if (IS_CHERRYVIEW(dev_priv)) { |
Chris Wilson | 0e6e0be | 2019-01-14 14:21:24 +0000 | [diff] [blame] | 443 | intel_wakeref_t pref; |
| 444 | |
Ville Syrjälä | 74e1ca8 | 2014-04-09 13:28:09 +0300 | [diff] [blame] | 445 | seq_printf(m, "Master Interrupt Control:\t%08x\n", |
| 446 | I915_READ(GEN8_MASTER_IRQ)); |
| 447 | |
| 448 | seq_printf(m, "Display IER:\t%08x\n", |
| 449 | I915_READ(VLV_IER)); |
| 450 | seq_printf(m, "Display IIR:\t%08x\n", |
| 451 | I915_READ(VLV_IIR)); |
| 452 | seq_printf(m, "Display IIR_RW:\t%08x\n", |
| 453 | I915_READ(VLV_IIR_RW)); |
| 454 | seq_printf(m, "Display IMR:\t%08x\n", |
| 455 | I915_READ(VLV_IMR)); |
Chris Wilson | 9c870d0 | 2016-10-24 13:42:15 +0100 | [diff] [blame] | 456 | for_each_pipe(dev_priv, pipe) { |
| 457 | enum intel_display_power_domain power_domain; |
| 458 | |
| 459 | power_domain = POWER_DOMAIN_PIPE(pipe); |
Chris Wilson | 0e6e0be | 2019-01-14 14:21:24 +0000 | [diff] [blame] | 460 | pref = intel_display_power_get_if_enabled(dev_priv, |
| 461 | power_domain); |
| 462 | if (!pref) { |
Chris Wilson | 9c870d0 | 2016-10-24 13:42:15 +0100 | [diff] [blame] | 463 | seq_printf(m, "Pipe %c power disabled\n", |
| 464 | pipe_name(pipe)); |
| 465 | continue; |
| 466 | } |
| 467 | |
Ville Syrjälä | 74e1ca8 | 2014-04-09 13:28:09 +0300 | [diff] [blame] | 468 | seq_printf(m, "Pipe %c stat:\t%08x\n", |
| 469 | pipe_name(pipe), |
| 470 | I915_READ(PIPESTAT(pipe))); |
| 471 | |
Chris Wilson | 0e6e0be | 2019-01-14 14:21:24 +0000 | [diff] [blame] | 472 | intel_display_power_put(dev_priv, power_domain, pref); |
Chris Wilson | 9c870d0 | 2016-10-24 13:42:15 +0100 | [diff] [blame] | 473 | } |
| 474 | |
Chris Wilson | 0e6e0be | 2019-01-14 14:21:24 +0000 | [diff] [blame] | 475 | pref = intel_display_power_get(dev_priv, POWER_DOMAIN_INIT); |
Ville Syrjälä | 74e1ca8 | 2014-04-09 13:28:09 +0300 | [diff] [blame] | 476 | seq_printf(m, "Port hotplug:\t%08x\n", |
| 477 | I915_READ(PORT_HOTPLUG_EN)); |
| 478 | seq_printf(m, "DPFLIPSTAT:\t%08x\n", |
| 479 | I915_READ(VLV_DPFLIPSTAT)); |
| 480 | seq_printf(m, "DPINVGTT:\t%08x\n", |
| 481 | I915_READ(DPINVGTT)); |
Chris Wilson | 0e6e0be | 2019-01-14 14:21:24 +0000 | [diff] [blame] | 482 | intel_display_power_put(dev_priv, POWER_DOMAIN_INIT, pref); |
Ville Syrjälä | 74e1ca8 | 2014-04-09 13:28:09 +0300 | [diff] [blame] | 483 | |
| 484 | for (i = 0; i < 4; i++) { |
| 485 | seq_printf(m, "GT Interrupt IMR %d:\t%08x\n", |
| 486 | i, I915_READ(GEN8_GT_IMR(i))); |
| 487 | seq_printf(m, "GT Interrupt IIR %d:\t%08x\n", |
| 488 | i, I915_READ(GEN8_GT_IIR(i))); |
| 489 | seq_printf(m, "GT Interrupt IER %d:\t%08x\n", |
| 490 | i, I915_READ(GEN8_GT_IER(i))); |
| 491 | } |
| 492 | |
| 493 | seq_printf(m, "PCU interrupt mask:\t%08x\n", |
| 494 | I915_READ(GEN8_PCU_IMR)); |
| 495 | seq_printf(m, "PCU interrupt identity:\t%08x\n", |
| 496 | I915_READ(GEN8_PCU_IIR)); |
| 497 | seq_printf(m, "PCU interrupt enable:\t%08x\n", |
| 498 | I915_READ(GEN8_PCU_IER)); |
Tvrtko Ursulin | 80d8935 | 2018-02-20 17:37:53 +0200 | [diff] [blame] | 499 | } else if (INTEL_GEN(dev_priv) >= 11) { |
| 500 | seq_printf(m, "Master Interrupt Control: %08x\n", |
| 501 | I915_READ(GEN11_GFX_MSTR_IRQ)); |
| 502 | |
| 503 | seq_printf(m, "Render/Copy Intr Enable: %08x\n", |
| 504 | I915_READ(GEN11_RENDER_COPY_INTR_ENABLE)); |
| 505 | seq_printf(m, "VCS/VECS Intr Enable: %08x\n", |
| 506 | I915_READ(GEN11_VCS_VECS_INTR_ENABLE)); |
| 507 | seq_printf(m, "GUC/SG Intr Enable:\t %08x\n", |
| 508 | I915_READ(GEN11_GUC_SG_INTR_ENABLE)); |
| 509 | seq_printf(m, "GPM/WGBOXPERF Intr Enable: %08x\n", |
| 510 | I915_READ(GEN11_GPM_WGBOXPERF_INTR_ENABLE)); |
| 511 | seq_printf(m, "Crypto Intr Enable:\t %08x\n", |
| 512 | I915_READ(GEN11_CRYPTO_RSVD_INTR_ENABLE)); |
| 513 | seq_printf(m, "GUnit/CSME Intr Enable:\t %08x\n", |
| 514 | I915_READ(GEN11_GUNIT_CSME_INTR_ENABLE)); |
| 515 | |
| 516 | seq_printf(m, "Display Interrupt Control:\t%08x\n", |
| 517 | I915_READ(GEN11_DISPLAY_INT_CTL)); |
| 518 | |
| 519 | gen8_display_interrupt_info(m); |
David Weinehall | 36cdd01 | 2016-08-22 13:59:31 +0300 | [diff] [blame] | 520 | } else if (INTEL_GEN(dev_priv) >= 8) { |
Ben Widawsky | a123f15 | 2013-11-02 21:07:10 -0700 | [diff] [blame] | 521 | seq_printf(m, "Master Interrupt Control:\t%08x\n", |
| 522 | I915_READ(GEN8_MASTER_IRQ)); |
| 523 | |
| 524 | for (i = 0; i < 4; i++) { |
| 525 | seq_printf(m, "GT Interrupt IMR %d:\t%08x\n", |
| 526 | i, I915_READ(GEN8_GT_IMR(i))); |
| 527 | seq_printf(m, "GT Interrupt IIR %d:\t%08x\n", |
| 528 | i, I915_READ(GEN8_GT_IIR(i))); |
| 529 | seq_printf(m, "GT Interrupt IER %d:\t%08x\n", |
| 530 | i, I915_READ(GEN8_GT_IER(i))); |
| 531 | } |
| 532 | |
Tvrtko Ursulin | 80d8935 | 2018-02-20 17:37:53 +0200 | [diff] [blame] | 533 | gen8_display_interrupt_info(m); |
David Weinehall | 36cdd01 | 2016-08-22 13:59:31 +0300 | [diff] [blame] | 534 | } else if (IS_VALLEYVIEW(dev_priv)) { |
Jesse Barnes | 7e231dbe | 2012-03-28 13:39:38 -0700 | [diff] [blame] | 535 | seq_printf(m, "Display IER:\t%08x\n", |
| 536 | I915_READ(VLV_IER)); |
| 537 | seq_printf(m, "Display IIR:\t%08x\n", |
| 538 | I915_READ(VLV_IIR)); |
| 539 | seq_printf(m, "Display IIR_RW:\t%08x\n", |
| 540 | I915_READ(VLV_IIR_RW)); |
| 541 | seq_printf(m, "Display IMR:\t%08x\n", |
| 542 | I915_READ(VLV_IMR)); |
Chris Wilson | 4f4631a | 2017-02-10 13:36:32 +0000 | [diff] [blame] | 543 | for_each_pipe(dev_priv, pipe) { |
| 544 | enum intel_display_power_domain power_domain; |
Chris Wilson | 0e6e0be | 2019-01-14 14:21:24 +0000 | [diff] [blame] | 545 | intel_wakeref_t pref; |
Chris Wilson | 4f4631a | 2017-02-10 13:36:32 +0000 | [diff] [blame] | 546 | |
| 547 | power_domain = POWER_DOMAIN_PIPE(pipe); |
Chris Wilson | 0e6e0be | 2019-01-14 14:21:24 +0000 | [diff] [blame] | 548 | pref = intel_display_power_get_if_enabled(dev_priv, |
| 549 | power_domain); |
| 550 | if (!pref) { |
Chris Wilson | 4f4631a | 2017-02-10 13:36:32 +0000 | [diff] [blame] | 551 | seq_printf(m, "Pipe %c power disabled\n", |
| 552 | pipe_name(pipe)); |
| 553 | continue; |
| 554 | } |
| 555 | |
Jesse Barnes | 7e231dbe | 2012-03-28 13:39:38 -0700 | [diff] [blame] | 556 | seq_printf(m, "Pipe %c stat:\t%08x\n", |
| 557 | pipe_name(pipe), |
| 558 | I915_READ(PIPESTAT(pipe))); |
Chris Wilson | 0e6e0be | 2019-01-14 14:21:24 +0000 | [diff] [blame] | 559 | intel_display_power_put(dev_priv, power_domain, pref); |
Chris Wilson | 4f4631a | 2017-02-10 13:36:32 +0000 | [diff] [blame] | 560 | } |
Jesse Barnes | 7e231dbe | 2012-03-28 13:39:38 -0700 | [diff] [blame] | 561 | |
| 562 | seq_printf(m, "Master IER:\t%08x\n", |
| 563 | I915_READ(VLV_MASTER_IER)); |
| 564 | |
| 565 | seq_printf(m, "Render IER:\t%08x\n", |
| 566 | I915_READ(GTIER)); |
| 567 | seq_printf(m, "Render IIR:\t%08x\n", |
| 568 | I915_READ(GTIIR)); |
| 569 | seq_printf(m, "Render IMR:\t%08x\n", |
| 570 | I915_READ(GTIMR)); |
| 571 | |
| 572 | seq_printf(m, "PM IER:\t\t%08x\n", |
| 573 | I915_READ(GEN6_PMIER)); |
| 574 | seq_printf(m, "PM IIR:\t\t%08x\n", |
| 575 | I915_READ(GEN6_PMIIR)); |
| 576 | seq_printf(m, "PM IMR:\t\t%08x\n", |
| 577 | I915_READ(GEN6_PMIMR)); |
| 578 | |
| 579 | seq_printf(m, "Port hotplug:\t%08x\n", |
| 580 | I915_READ(PORT_HOTPLUG_EN)); |
| 581 | seq_printf(m, "DPFLIPSTAT:\t%08x\n", |
| 582 | I915_READ(VLV_DPFLIPSTAT)); |
| 583 | seq_printf(m, "DPINVGTT:\t%08x\n", |
| 584 | I915_READ(DPINVGTT)); |
| 585 | |
David Weinehall | 36cdd01 | 2016-08-22 13:59:31 +0300 | [diff] [blame] | 586 | } else if (!HAS_PCH_SPLIT(dev_priv)) { |
Zhenyu Wang | 5f6a169 | 2009-08-10 21:37:24 +0800 | [diff] [blame] | 587 | seq_printf(m, "Interrupt enable: %08x\n", |
Paulo Zanoni | 9d9523d | 2019-04-10 16:53:42 -0700 | [diff] [blame] | 588 | I915_READ(GEN2_IER)); |
Zhenyu Wang | 5f6a169 | 2009-08-10 21:37:24 +0800 | [diff] [blame] | 589 | seq_printf(m, "Interrupt identity: %08x\n", |
Paulo Zanoni | 9d9523d | 2019-04-10 16:53:42 -0700 | [diff] [blame] | 590 | I915_READ(GEN2_IIR)); |
Zhenyu Wang | 5f6a169 | 2009-08-10 21:37:24 +0800 | [diff] [blame] | 591 | seq_printf(m, "Interrupt mask: %08x\n", |
Paulo Zanoni | 9d9523d | 2019-04-10 16:53:42 -0700 | [diff] [blame] | 592 | I915_READ(GEN2_IMR)); |
Damien Lespiau | 055e393 | 2014-08-18 13:49:10 +0100 | [diff] [blame] | 593 | for_each_pipe(dev_priv, pipe) |
Jesse Barnes | 9db4a9c | 2011-02-07 12:26:52 -0800 | [diff] [blame] | 594 | seq_printf(m, "Pipe %c stat: %08x\n", |
| 595 | pipe_name(pipe), |
| 596 | I915_READ(PIPESTAT(pipe))); |
Zhenyu Wang | 5f6a169 | 2009-08-10 21:37:24 +0800 | [diff] [blame] | 597 | } else { |
| 598 | seq_printf(m, "North Display Interrupt enable: %08x\n", |
| 599 | I915_READ(DEIER)); |
| 600 | seq_printf(m, "North Display Interrupt identity: %08x\n", |
| 601 | I915_READ(DEIIR)); |
| 602 | seq_printf(m, "North Display Interrupt mask: %08x\n", |
| 603 | I915_READ(DEIMR)); |
| 604 | seq_printf(m, "South Display Interrupt enable: %08x\n", |
| 605 | I915_READ(SDEIER)); |
| 606 | seq_printf(m, "South Display Interrupt identity: %08x\n", |
| 607 | I915_READ(SDEIIR)); |
| 608 | seq_printf(m, "South Display Interrupt mask: %08x\n", |
| 609 | I915_READ(SDEIMR)); |
| 610 | seq_printf(m, "Graphics Interrupt enable: %08x\n", |
| 611 | I915_READ(GTIER)); |
| 612 | seq_printf(m, "Graphics Interrupt identity: %08x\n", |
| 613 | I915_READ(GTIIR)); |
| 614 | seq_printf(m, "Graphics Interrupt mask: %08x\n", |
| 615 | I915_READ(GTIMR)); |
| 616 | } |
Tvrtko Ursulin | 80d8935 | 2018-02-20 17:37:53 +0200 | [diff] [blame] | 617 | |
| 618 | if (INTEL_GEN(dev_priv) >= 11) { |
| 619 | seq_printf(m, "RCS Intr Mask:\t %08x\n", |
| 620 | I915_READ(GEN11_RCS0_RSVD_INTR_MASK)); |
| 621 | seq_printf(m, "BCS Intr Mask:\t %08x\n", |
| 622 | I915_READ(GEN11_BCS_RSVD_INTR_MASK)); |
| 623 | seq_printf(m, "VCS0/VCS1 Intr Mask:\t %08x\n", |
| 624 | I915_READ(GEN11_VCS0_VCS1_INTR_MASK)); |
| 625 | seq_printf(m, "VCS2/VCS3 Intr Mask:\t %08x\n", |
| 626 | I915_READ(GEN11_VCS2_VCS3_INTR_MASK)); |
| 627 | seq_printf(m, "VECS0/VECS1 Intr Mask:\t %08x\n", |
| 628 | I915_READ(GEN11_VECS0_VECS1_INTR_MASK)); |
| 629 | seq_printf(m, "GUC/SG Intr Mask:\t %08x\n", |
| 630 | I915_READ(GEN11_GUC_SG_INTR_MASK)); |
| 631 | seq_printf(m, "GPM/WGBOXPERF Intr Mask: %08x\n", |
| 632 | I915_READ(GEN11_GPM_WGBOXPERF_INTR_MASK)); |
| 633 | seq_printf(m, "Crypto Intr Mask:\t %08x\n", |
| 634 | I915_READ(GEN11_CRYPTO_RSVD_INTR_MASK)); |
| 635 | seq_printf(m, "Gunit/CSME Intr Mask:\t %08x\n", |
| 636 | I915_READ(GEN11_GUNIT_CSME_INTR_MASK)); |
| 637 | |
| 638 | } else if (INTEL_GEN(dev_priv) >= 6) { |
Chris Wilson | 750e76b | 2019-08-06 13:43:00 +0100 | [diff] [blame] | 639 | for_each_uabi_engine(engine, dev_priv) { |
Chris Wilson | a2c7f6f | 2012-09-01 20:51:22 +0100 | [diff] [blame] | 640 | seq_printf(m, |
| 641 | "Graphics Interrupt mask (%s): %08x\n", |
Daniele Ceraolo Spurio | baba6e5 | 2019-03-25 14:49:40 -0700 | [diff] [blame] | 642 | engine->name, ENGINE_READ(engine, RING_IMR)); |
Chris Wilson | 9862e60 | 2011-01-04 22:22:17 +0000 | [diff] [blame] | 643 | } |
Chris Wilson | 9862e60 | 2011-01-04 22:22:17 +0000 | [diff] [blame] | 644 | } |
Tvrtko Ursulin | 80d8935 | 2018-02-20 17:37:53 +0200 | [diff] [blame] | 645 | |
Daniele Ceraolo Spurio | d858d56 | 2019-06-13 16:21:54 -0700 | [diff] [blame] | 646 | intel_runtime_pm_put(&dev_priv->runtime_pm, wakeref); |
Chris Wilson | de227ef | 2010-07-03 07:58:38 +0100 | [diff] [blame] | 647 | |
Ben Gamari | 2017263 | 2009-02-17 20:08:50 -0500 | [diff] [blame] | 648 | return 0; |
| 649 | } |
| 650 | |
Chris Wilson | a6172a8 | 2009-02-11 14:26:38 +0000 | [diff] [blame] | 651 | static int i915_gem_fence_regs_info(struct seq_file *m, void *data) |
| 652 | { |
Chris Wilson | 0cf289b | 2019-06-13 08:32:54 +0100 | [diff] [blame] | 653 | struct drm_i915_private *i915 = node_to_i915(m->private); |
| 654 | unsigned int i; |
Chris Wilson | de227ef | 2010-07-03 07:58:38 +0100 | [diff] [blame] | 655 | |
Chris Wilson | 0cf289b | 2019-06-13 08:32:54 +0100 | [diff] [blame] | 656 | seq_printf(m, "Total fences = %d\n", i915->ggtt.num_fences); |
Chris Wilson | a6172a8 | 2009-02-11 14:26:38 +0000 | [diff] [blame] | 657 | |
Chris Wilson | 0cf289b | 2019-06-13 08:32:54 +0100 | [diff] [blame] | 658 | rcu_read_lock(); |
| 659 | for (i = 0; i < i915->ggtt.num_fences; i++) { |
| 660 | struct i915_vma *vma = i915->ggtt.fence_regs[i].vma; |
Chris Wilson | a6172a8 | 2009-02-11 14:26:38 +0000 | [diff] [blame] | 661 | |
Chris Wilson | 6c085a7 | 2012-08-20 11:40:46 +0200 | [diff] [blame] | 662 | seq_printf(m, "Fence %d, pin count = %d, object = ", |
Chris Wilson | 0cf289b | 2019-06-13 08:32:54 +0100 | [diff] [blame] | 663 | i, i915->ggtt.fence_regs[i].pin_count); |
Chris Wilson | 49ef529 | 2016-08-18 17:17:00 +0100 | [diff] [blame] | 664 | if (!vma) |
Damien Lespiau | 267f0c9 | 2013-06-24 22:59:48 +0100 | [diff] [blame] | 665 | seq_puts(m, "unused"); |
Chris Wilson | c2c347a9 | 2010-10-27 15:11:53 +0100 | [diff] [blame] | 666 | else |
Chris Wilson | 49ef529 | 2016-08-18 17:17:00 +0100 | [diff] [blame] | 667 | describe_obj(m, vma->obj); |
Damien Lespiau | 267f0c9 | 2013-06-24 22:59:48 +0100 | [diff] [blame] | 668 | seq_putc(m, '\n'); |
Chris Wilson | a6172a8 | 2009-02-11 14:26:38 +0000 | [diff] [blame] | 669 | } |
Chris Wilson | 0cf289b | 2019-06-13 08:32:54 +0100 | [diff] [blame] | 670 | rcu_read_unlock(); |
Chris Wilson | a6172a8 | 2009-02-11 14:26:38 +0000 | [diff] [blame] | 671 | |
| 672 | return 0; |
| 673 | } |
| 674 | |
Chris Wilson | 98a2f41 | 2016-10-12 10:05:18 +0100 | [diff] [blame] | 675 | #if IS_ENABLED(CONFIG_DRM_I915_CAPTURE_ERROR) |
Chris Wilson | 5a4c6f1 | 2017-02-14 16:46:11 +0000 | [diff] [blame] | 676 | static ssize_t gpu_state_read(struct file *file, char __user *ubuf, |
| 677 | size_t count, loff_t *pos) |
| 678 | { |
Chris Wilson | 0e39037 | 2018-11-23 13:23:25 +0000 | [diff] [blame] | 679 | struct i915_gpu_state *error; |
Chris Wilson | 5a4c6f1 | 2017-02-14 16:46:11 +0000 | [diff] [blame] | 680 | ssize_t ret; |
Chris Wilson | 0e39037 | 2018-11-23 13:23:25 +0000 | [diff] [blame] | 681 | void *buf; |
Chris Wilson | 5a4c6f1 | 2017-02-14 16:46:11 +0000 | [diff] [blame] | 682 | |
Chris Wilson | 0e39037 | 2018-11-23 13:23:25 +0000 | [diff] [blame] | 683 | error = file->private_data; |
Chris Wilson | 5a4c6f1 | 2017-02-14 16:46:11 +0000 | [diff] [blame] | 684 | if (!error) |
| 685 | return 0; |
| 686 | |
Chris Wilson | 0e39037 | 2018-11-23 13:23:25 +0000 | [diff] [blame] | 687 | /* Bounce buffer required because of kernfs __user API convenience. */ |
| 688 | buf = kmalloc(count, GFP_KERNEL); |
| 689 | if (!buf) |
| 690 | return -ENOMEM; |
Chris Wilson | 5a4c6f1 | 2017-02-14 16:46:11 +0000 | [diff] [blame] | 691 | |
Chris Wilson | 0e39037 | 2018-11-23 13:23:25 +0000 | [diff] [blame] | 692 | ret = i915_gpu_state_copy_to_buffer(error, buf, *pos, count); |
| 693 | if (ret <= 0) |
Chris Wilson | 5a4c6f1 | 2017-02-14 16:46:11 +0000 | [diff] [blame] | 694 | goto out; |
| 695 | |
Chris Wilson | 0e39037 | 2018-11-23 13:23:25 +0000 | [diff] [blame] | 696 | if (!copy_to_user(ubuf, buf, ret)) |
| 697 | *pos += ret; |
| 698 | else |
| 699 | ret = -EFAULT; |
Chris Wilson | 5a4c6f1 | 2017-02-14 16:46:11 +0000 | [diff] [blame] | 700 | |
Chris Wilson | 5a4c6f1 | 2017-02-14 16:46:11 +0000 | [diff] [blame] | 701 | out: |
Chris Wilson | 0e39037 | 2018-11-23 13:23:25 +0000 | [diff] [blame] | 702 | kfree(buf); |
Chris Wilson | 5a4c6f1 | 2017-02-14 16:46:11 +0000 | [diff] [blame] | 703 | return ret; |
| 704 | } |
| 705 | |
| 706 | static int gpu_state_release(struct inode *inode, struct file *file) |
| 707 | { |
| 708 | i915_gpu_state_put(file->private_data); |
| 709 | return 0; |
| 710 | } |
| 711 | |
| 712 | static int i915_gpu_info_open(struct inode *inode, struct file *file) |
| 713 | { |
Chris Wilson | 090e5fe | 2017-03-28 14:14:07 +0100 | [diff] [blame] | 714 | struct drm_i915_private *i915 = inode->i_private; |
Chris Wilson | 5a4c6f1 | 2017-02-14 16:46:11 +0000 | [diff] [blame] | 715 | struct i915_gpu_state *gpu; |
Chris Wilson | a037121 | 2019-01-14 14:21:14 +0000 | [diff] [blame] | 716 | intel_wakeref_t wakeref; |
Chris Wilson | 5a4c6f1 | 2017-02-14 16:46:11 +0000 | [diff] [blame] | 717 | |
Chris Wilson | d4225a5 | 2019-01-14 14:21:23 +0000 | [diff] [blame] | 718 | gpu = NULL; |
Daniele Ceraolo Spurio | c447ff7 | 2019-06-13 16:21:55 -0700 | [diff] [blame] | 719 | with_intel_runtime_pm(&i915->runtime_pm, wakeref) |
Chris Wilson | d4225a5 | 2019-01-14 14:21:23 +0000 | [diff] [blame] | 720 | gpu = i915_capture_gpu_state(i915); |
Chris Wilson | e6154e4 | 2018-12-07 11:05:54 +0000 | [diff] [blame] | 721 | if (IS_ERR(gpu)) |
| 722 | return PTR_ERR(gpu); |
Chris Wilson | 5a4c6f1 | 2017-02-14 16:46:11 +0000 | [diff] [blame] | 723 | |
| 724 | file->private_data = gpu; |
| 725 | return 0; |
| 726 | } |
| 727 | |
| 728 | static const struct file_operations i915_gpu_info_fops = { |
| 729 | .owner = THIS_MODULE, |
| 730 | .open = i915_gpu_info_open, |
| 731 | .read = gpu_state_read, |
| 732 | .llseek = default_llseek, |
| 733 | .release = gpu_state_release, |
| 734 | }; |
Chris Wilson | 98a2f41 | 2016-10-12 10:05:18 +0100 | [diff] [blame] | 735 | |
Daniel Vetter | d544230 | 2012-04-27 15:17:40 +0200 | [diff] [blame] | 736 | static ssize_t |
| 737 | i915_error_state_write(struct file *filp, |
| 738 | const char __user *ubuf, |
| 739 | size_t cnt, |
| 740 | loff_t *ppos) |
| 741 | { |
Chris Wilson | 5a4c6f1 | 2017-02-14 16:46:11 +0000 | [diff] [blame] | 742 | struct i915_gpu_state *error = filp->private_data; |
| 743 | |
| 744 | if (!error) |
| 745 | return 0; |
Daniel Vetter | d544230 | 2012-04-27 15:17:40 +0200 | [diff] [blame] | 746 | |
| 747 | DRM_DEBUG_DRIVER("Resetting error state\n"); |
Chris Wilson | 5a4c6f1 | 2017-02-14 16:46:11 +0000 | [diff] [blame] | 748 | i915_reset_error_state(error->i915); |
Daniel Vetter | d544230 | 2012-04-27 15:17:40 +0200 | [diff] [blame] | 749 | |
| 750 | return cnt; |
| 751 | } |
| 752 | |
| 753 | static int i915_error_state_open(struct inode *inode, struct file *file) |
| 754 | { |
Chris Wilson | e6154e4 | 2018-12-07 11:05:54 +0000 | [diff] [blame] | 755 | struct i915_gpu_state *error; |
| 756 | |
| 757 | error = i915_first_error_state(inode->i_private); |
| 758 | if (IS_ERR(error)) |
| 759 | return PTR_ERR(error); |
| 760 | |
| 761 | file->private_data = error; |
Mika Kuoppala | edc3d88 | 2013-05-23 13:55:35 +0300 | [diff] [blame] | 762 | return 0; |
Daniel Vetter | d544230 | 2012-04-27 15:17:40 +0200 | [diff] [blame] | 763 | } |
| 764 | |
Daniel Vetter | d544230 | 2012-04-27 15:17:40 +0200 | [diff] [blame] | 765 | static const struct file_operations i915_error_state_fops = { |
| 766 | .owner = THIS_MODULE, |
| 767 | .open = i915_error_state_open, |
Chris Wilson | 5a4c6f1 | 2017-02-14 16:46:11 +0000 | [diff] [blame] | 768 | .read = gpu_state_read, |
Daniel Vetter | d544230 | 2012-04-27 15:17:40 +0200 | [diff] [blame] | 769 | .write = i915_error_state_write, |
| 770 | .llseek = default_llseek, |
Chris Wilson | 5a4c6f1 | 2017-02-14 16:46:11 +0000 | [diff] [blame] | 771 | .release = gpu_state_release, |
Daniel Vetter | d544230 | 2012-04-27 15:17:40 +0200 | [diff] [blame] | 772 | }; |
Chris Wilson | 98a2f41 | 2016-10-12 10:05:18 +0100 | [diff] [blame] | 773 | #endif |
| 774 | |
Deepak S | adb4bd1 | 2014-03-31 11:30:02 +0530 | [diff] [blame] | 775 | static int i915_frequency_info(struct seq_file *m, void *unused) |
Jesse Barnes | f97108d | 2010-01-29 11:27:07 -0800 | [diff] [blame] | 776 | { |
David Weinehall | 36cdd01 | 2016-08-22 13:59:31 +0300 | [diff] [blame] | 777 | struct drm_i915_private *dev_priv = node_to_i915(m->private); |
Tvrtko Ursulin | 4f5fd91 | 2019-06-11 11:45:48 +0100 | [diff] [blame] | 778 | struct intel_uncore *uncore = &dev_priv->uncore; |
Sagar Arun Kamble | 562d9ba | 2017-10-10 22:30:06 +0100 | [diff] [blame] | 779 | struct intel_rps *rps = &dev_priv->gt_pm.rps; |
Chris Wilson | a037121 | 2019-01-14 14:21:14 +0000 | [diff] [blame] | 780 | intel_wakeref_t wakeref; |
Paulo Zanoni | c8c8fb3 | 2013-11-27 18:21:54 -0200 | [diff] [blame] | 781 | int ret = 0; |
| 782 | |
Daniele Ceraolo Spurio | d858d56 | 2019-06-13 16:21:54 -0700 | [diff] [blame] | 783 | wakeref = intel_runtime_pm_get(&dev_priv->runtime_pm); |
Jesse Barnes | f97108d | 2010-01-29 11:27:07 -0800 | [diff] [blame] | 784 | |
Lucas De Marchi | cf819ef | 2018-12-12 10:10:43 -0800 | [diff] [blame] | 785 | if (IS_GEN(dev_priv, 5)) { |
Tvrtko Ursulin | 4f5fd91 | 2019-06-11 11:45:48 +0100 | [diff] [blame] | 786 | u16 rgvswctl = intel_uncore_read16(uncore, MEMSWCTL); |
| 787 | u16 rgvstat = intel_uncore_read16(uncore, MEMSTAT_ILK); |
Jesse Barnes | 3b8d8d9 | 2010-12-17 14:19:02 -0800 | [diff] [blame] | 788 | |
| 789 | seq_printf(m, "Requested P-state: %d\n", (rgvswctl >> 8) & 0xf); |
| 790 | seq_printf(m, "Requested VID: %d\n", rgvswctl & 0x3f); |
| 791 | seq_printf(m, "Current VID: %d\n", (rgvstat & MEMSTAT_VID_MASK) >> |
| 792 | MEMSTAT_VID_SHIFT); |
| 793 | seq_printf(m, "Current P-state: %d\n", |
| 794 | (rgvstat & MEMSTAT_PSTATE_MASK) >> MEMSTAT_PSTATE_SHIFT); |
David Weinehall | 36cdd01 | 2016-08-22 13:59:31 +0300 | [diff] [blame] | 795 | } else if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) { |
Sagar Arun Kamble | 0d6fc92 | 2017-10-10 22:30:02 +0100 | [diff] [blame] | 796 | u32 rpmodectl, freq_sts; |
Wayne Boyer | 666a453 | 2015-12-09 12:29:35 -0800 | [diff] [blame] | 797 | |
Sagar Arun Kamble | 0d6fc92 | 2017-10-10 22:30:02 +0100 | [diff] [blame] | 798 | rpmodectl = I915_READ(GEN6_RP_CONTROL); |
| 799 | seq_printf(m, "Video Turbo Mode: %s\n", |
| 800 | yesno(rpmodectl & GEN6_RP_MEDIA_TURBO)); |
| 801 | seq_printf(m, "HW control enabled: %s\n", |
| 802 | yesno(rpmodectl & GEN6_RP_ENABLE)); |
| 803 | seq_printf(m, "SW control enabled: %s\n", |
| 804 | yesno((rpmodectl & GEN6_RP_MEDIA_MODE_MASK) == |
| 805 | GEN6_RP_MEDIA_SW_MODE)); |
| 806 | |
Chris Wilson | 337fa6e | 2019-04-26 09:17:20 +0100 | [diff] [blame] | 807 | vlv_punit_get(dev_priv); |
Wayne Boyer | 666a453 | 2015-12-09 12:29:35 -0800 | [diff] [blame] | 808 | freq_sts = vlv_punit_read(dev_priv, PUNIT_REG_GPU_FREQ_STS); |
Chris Wilson | 337fa6e | 2019-04-26 09:17:20 +0100 | [diff] [blame] | 809 | vlv_punit_put(dev_priv); |
| 810 | |
Wayne Boyer | 666a453 | 2015-12-09 12:29:35 -0800 | [diff] [blame] | 811 | seq_printf(m, "PUNIT_REG_GPU_FREQ_STS: 0x%08x\n", freq_sts); |
| 812 | seq_printf(m, "DDR freq: %d MHz\n", dev_priv->mem_freq); |
| 813 | |
| 814 | seq_printf(m, "actual GPU freq: %d MHz\n", |
| 815 | intel_gpu_freq(dev_priv, (freq_sts >> 8) & 0xff)); |
| 816 | |
| 817 | seq_printf(m, "current GPU freq: %d MHz\n", |
Sagar Arun Kamble | 562d9ba | 2017-10-10 22:30:06 +0100 | [diff] [blame] | 818 | intel_gpu_freq(dev_priv, rps->cur_freq)); |
Wayne Boyer | 666a453 | 2015-12-09 12:29:35 -0800 | [diff] [blame] | 819 | |
| 820 | seq_printf(m, "max GPU freq: %d MHz\n", |
Sagar Arun Kamble | 562d9ba | 2017-10-10 22:30:06 +0100 | [diff] [blame] | 821 | intel_gpu_freq(dev_priv, rps->max_freq)); |
Wayne Boyer | 666a453 | 2015-12-09 12:29:35 -0800 | [diff] [blame] | 822 | |
| 823 | seq_printf(m, "min GPU freq: %d MHz\n", |
Sagar Arun Kamble | 562d9ba | 2017-10-10 22:30:06 +0100 | [diff] [blame] | 824 | intel_gpu_freq(dev_priv, rps->min_freq)); |
Wayne Boyer | 666a453 | 2015-12-09 12:29:35 -0800 | [diff] [blame] | 825 | |
| 826 | seq_printf(m, "idle GPU freq: %d MHz\n", |
Sagar Arun Kamble | 562d9ba | 2017-10-10 22:30:06 +0100 | [diff] [blame] | 827 | intel_gpu_freq(dev_priv, rps->idle_freq)); |
Wayne Boyer | 666a453 | 2015-12-09 12:29:35 -0800 | [diff] [blame] | 828 | |
| 829 | seq_printf(m, |
| 830 | "efficient (RPe) frequency: %d MHz\n", |
Sagar Arun Kamble | 562d9ba | 2017-10-10 22:30:06 +0100 | [diff] [blame] | 831 | intel_gpu_freq(dev_priv, rps->efficient_freq)); |
David Weinehall | 36cdd01 | 2016-08-22 13:59:31 +0300 | [diff] [blame] | 832 | } else if (INTEL_GEN(dev_priv) >= 6) { |
Bob Paauwe | 3504056 | 2015-06-25 14:54:07 -0700 | [diff] [blame] | 833 | u32 rp_state_limits; |
| 834 | u32 gt_perf_status; |
| 835 | u32 rp_state_cap; |
Chris Wilson | 0d8f949 | 2014-03-27 09:06:14 +0000 | [diff] [blame] | 836 | u32 rpmodectl, rpinclimit, rpdeclimit; |
Chris Wilson | 8e8c06c | 2013-08-26 19:51:01 -0300 | [diff] [blame] | 837 | u32 rpstat, cagf, reqf; |
Jesse Barnes | ccab5c8 | 2011-01-18 15:49:25 -0800 | [diff] [blame] | 838 | u32 rpupei, rpcurup, rpprevup; |
| 839 | u32 rpdownei, rpcurdown, rpprevdown; |
Paulo Zanoni | 9dd3c60 | 2014-08-01 18:14:48 -0300 | [diff] [blame] | 840 | u32 pm_ier, pm_imr, pm_isr, pm_iir, pm_mask; |
Jesse Barnes | 3b8d8d9 | 2010-12-17 14:19:02 -0800 | [diff] [blame] | 841 | int max_freq; |
| 842 | |
Bob Paauwe | 3504056 | 2015-06-25 14:54:07 -0700 | [diff] [blame] | 843 | rp_state_limits = I915_READ(GEN6_RP_STATE_LIMITS); |
Ander Conselvan de Oliveira | cc3f90f | 2016-12-02 10:23:49 +0200 | [diff] [blame] | 844 | if (IS_GEN9_LP(dev_priv)) { |
Bob Paauwe | 3504056 | 2015-06-25 14:54:07 -0700 | [diff] [blame] | 845 | rp_state_cap = I915_READ(BXT_RP_STATE_CAP); |
| 846 | gt_perf_status = I915_READ(BXT_GT_PERF_STATUS); |
| 847 | } else { |
| 848 | rp_state_cap = I915_READ(GEN6_RP_STATE_CAP); |
| 849 | gt_perf_status = I915_READ(GEN6_GT_PERF_STATUS); |
| 850 | } |
| 851 | |
Jesse Barnes | 3b8d8d9 | 2010-12-17 14:19:02 -0800 | [diff] [blame] | 852 | /* RPSTAT1 is in the GT power well */ |
Daniele Ceraolo Spurio | 3ceea6a | 2019-03-19 11:35:36 -0700 | [diff] [blame] | 853 | intel_uncore_forcewake_get(&dev_priv->uncore, FORCEWAKE_ALL); |
Jesse Barnes | 3b8d8d9 | 2010-12-17 14:19:02 -0800 | [diff] [blame] | 854 | |
Chris Wilson | 8e8c06c | 2013-08-26 19:51:01 -0300 | [diff] [blame] | 855 | reqf = I915_READ(GEN6_RPNSWREQ); |
Rodrigo Vivi | 35ceabf | 2017-07-06 13:41:13 -0700 | [diff] [blame] | 856 | if (INTEL_GEN(dev_priv) >= 9) |
Akash Goel | 60260a5 | 2015-03-06 11:07:21 +0530 | [diff] [blame] | 857 | reqf >>= 23; |
| 858 | else { |
| 859 | reqf &= ~GEN6_TURBO_DISABLE; |
David Weinehall | 36cdd01 | 2016-08-22 13:59:31 +0300 | [diff] [blame] | 860 | if (IS_HASWELL(dev_priv) || IS_BROADWELL(dev_priv)) |
Akash Goel | 60260a5 | 2015-03-06 11:07:21 +0530 | [diff] [blame] | 861 | reqf >>= 24; |
| 862 | else |
| 863 | reqf >>= 25; |
| 864 | } |
Ville Syrjälä | 7c59a9c1 | 2015-01-23 21:04:26 +0200 | [diff] [blame] | 865 | reqf = intel_gpu_freq(dev_priv, reqf); |
Chris Wilson | 8e8c06c | 2013-08-26 19:51:01 -0300 | [diff] [blame] | 866 | |
Chris Wilson | 0d8f949 | 2014-03-27 09:06:14 +0000 | [diff] [blame] | 867 | rpmodectl = I915_READ(GEN6_RP_CONTROL); |
| 868 | rpinclimit = I915_READ(GEN6_RP_UP_THRESHOLD); |
| 869 | rpdeclimit = I915_READ(GEN6_RP_DOWN_THRESHOLD); |
| 870 | |
Jesse Barnes | ccab5c8 | 2011-01-18 15:49:25 -0800 | [diff] [blame] | 871 | rpstat = I915_READ(GEN6_RPSTAT1); |
Akash Goel | d6cda9c | 2016-04-23 00:05:46 +0530 | [diff] [blame] | 872 | rpupei = I915_READ(GEN6_RP_CUR_UP_EI) & GEN6_CURICONT_MASK; |
| 873 | rpcurup = I915_READ(GEN6_RP_CUR_UP) & GEN6_CURBSYTAVG_MASK; |
| 874 | rpprevup = I915_READ(GEN6_RP_PREV_UP) & GEN6_CURBSYTAVG_MASK; |
| 875 | rpdownei = I915_READ(GEN6_RP_CUR_DOWN_EI) & GEN6_CURIAVG_MASK; |
| 876 | rpcurdown = I915_READ(GEN6_RP_CUR_DOWN) & GEN6_CURBSYTAVG_MASK; |
| 877 | rpprevdown = I915_READ(GEN6_RP_PREV_DOWN) & GEN6_CURBSYTAVG_MASK; |
Tvrtko Ursulin | c84b270 | 2017-11-21 18:18:44 +0000 | [diff] [blame] | 878 | cagf = intel_gpu_freq(dev_priv, |
| 879 | intel_get_cagf(dev_priv, rpstat)); |
Jesse Barnes | ccab5c8 | 2011-01-18 15:49:25 -0800 | [diff] [blame] | 880 | |
Daniele Ceraolo Spurio | 3ceea6a | 2019-03-19 11:35:36 -0700 | [diff] [blame] | 881 | intel_uncore_forcewake_put(&dev_priv->uncore, FORCEWAKE_ALL); |
Ben Widawsky | d1ebd816 | 2011-04-25 20:11:50 +0100 | [diff] [blame] | 882 | |
Oscar Mateo | 6b7a6a7 | 2018-05-10 14:59:55 -0700 | [diff] [blame] | 883 | if (INTEL_GEN(dev_priv) >= 11) { |
| 884 | pm_ier = I915_READ(GEN11_GPM_WGBOXPERF_INTR_ENABLE); |
| 885 | pm_imr = I915_READ(GEN11_GPM_WGBOXPERF_INTR_MASK); |
| 886 | /* |
| 887 | * The equivalent to the PM ISR & IIR cannot be read |
| 888 | * without affecting the current state of the system |
| 889 | */ |
| 890 | pm_isr = 0; |
| 891 | pm_iir = 0; |
| 892 | } else if (INTEL_GEN(dev_priv) >= 8) { |
Paulo Zanoni | 9dd3c60 | 2014-08-01 18:14:48 -0300 | [diff] [blame] | 893 | pm_ier = I915_READ(GEN8_GT_IER(2)); |
| 894 | pm_imr = I915_READ(GEN8_GT_IMR(2)); |
| 895 | pm_isr = I915_READ(GEN8_GT_ISR(2)); |
| 896 | pm_iir = I915_READ(GEN8_GT_IIR(2)); |
Oscar Mateo | 6b7a6a7 | 2018-05-10 14:59:55 -0700 | [diff] [blame] | 897 | } else { |
| 898 | pm_ier = I915_READ(GEN6_PMIER); |
| 899 | pm_imr = I915_READ(GEN6_PMIMR); |
| 900 | pm_isr = I915_READ(GEN6_PMISR); |
| 901 | pm_iir = I915_READ(GEN6_PMIIR); |
Paulo Zanoni | 9dd3c60 | 2014-08-01 18:14:48 -0300 | [diff] [blame] | 902 | } |
Oscar Mateo | 6b7a6a7 | 2018-05-10 14:59:55 -0700 | [diff] [blame] | 903 | pm_mask = I915_READ(GEN6_PMINTRMSK); |
| 904 | |
Sagar Arun Kamble | 960e546 | 2017-10-10 22:29:59 +0100 | [diff] [blame] | 905 | seq_printf(m, "Video Turbo Mode: %s\n", |
| 906 | yesno(rpmodectl & GEN6_RP_MEDIA_TURBO)); |
| 907 | seq_printf(m, "HW control enabled: %s\n", |
| 908 | yesno(rpmodectl & GEN6_RP_ENABLE)); |
| 909 | seq_printf(m, "SW control enabled: %s\n", |
| 910 | yesno((rpmodectl & GEN6_RP_MEDIA_MODE_MASK) == |
| 911 | GEN6_RP_MEDIA_SW_MODE)); |
Oscar Mateo | 6b7a6a7 | 2018-05-10 14:59:55 -0700 | [diff] [blame] | 912 | |
| 913 | seq_printf(m, "PM IER=0x%08x IMR=0x%08x, MASK=0x%08x\n", |
| 914 | pm_ier, pm_imr, pm_mask); |
| 915 | if (INTEL_GEN(dev_priv) <= 10) |
| 916 | seq_printf(m, "PM ISR=0x%08x IIR=0x%08x\n", |
| 917 | pm_isr, pm_iir); |
Sagar Arun Kamble | 5dd0455 | 2017-03-11 08:07:00 +0530 | [diff] [blame] | 918 | seq_printf(m, "pm_intrmsk_mbz: 0x%08x\n", |
Sagar Arun Kamble | 562d9ba | 2017-10-10 22:30:06 +0100 | [diff] [blame] | 919 | rps->pm_intrmsk_mbz); |
Jesse Barnes | 3b8d8d9 | 2010-12-17 14:19:02 -0800 | [diff] [blame] | 920 | seq_printf(m, "GT_PERF_STATUS: 0x%08x\n", gt_perf_status); |
Jesse Barnes | 3b8d8d9 | 2010-12-17 14:19:02 -0800 | [diff] [blame] | 921 | seq_printf(m, "Render p-state ratio: %d\n", |
Rodrigo Vivi | 35ceabf | 2017-07-06 13:41:13 -0700 | [diff] [blame] | 922 | (gt_perf_status & (INTEL_GEN(dev_priv) >= 9 ? 0x1ff00 : 0xff00)) >> 8); |
Jesse Barnes | 3b8d8d9 | 2010-12-17 14:19:02 -0800 | [diff] [blame] | 923 | seq_printf(m, "Render p-state VID: %d\n", |
| 924 | gt_perf_status & 0xff); |
| 925 | seq_printf(m, "Render p-state limit: %d\n", |
| 926 | rp_state_limits & 0xff); |
Chris Wilson | 0d8f949 | 2014-03-27 09:06:14 +0000 | [diff] [blame] | 927 | seq_printf(m, "RPSTAT1: 0x%08x\n", rpstat); |
| 928 | seq_printf(m, "RPMODECTL: 0x%08x\n", rpmodectl); |
| 929 | seq_printf(m, "RPINCLIMIT: 0x%08x\n", rpinclimit); |
| 930 | seq_printf(m, "RPDECLIMIT: 0x%08x\n", rpdeclimit); |
Chris Wilson | 8e8c06c | 2013-08-26 19:51:01 -0300 | [diff] [blame] | 931 | seq_printf(m, "RPNSWREQ: %dMHz\n", reqf); |
Ben Widawsky | f82855d | 2013-01-29 12:00:15 -0800 | [diff] [blame] | 932 | seq_printf(m, "CAGF: %dMHz\n", cagf); |
Akash Goel | d6cda9c | 2016-04-23 00:05:46 +0530 | [diff] [blame] | 933 | seq_printf(m, "RP CUR UP EI: %d (%dus)\n", |
| 934 | rpupei, GT_PM_INTERVAL_TO_US(dev_priv, rpupei)); |
| 935 | seq_printf(m, "RP CUR UP: %d (%dus)\n", |
| 936 | rpcurup, GT_PM_INTERVAL_TO_US(dev_priv, rpcurup)); |
| 937 | seq_printf(m, "RP PREV UP: %d (%dus)\n", |
| 938 | rpprevup, GT_PM_INTERVAL_TO_US(dev_priv, rpprevup)); |
Chris Wilson | 60548c5 | 2018-07-31 14:26:29 +0100 | [diff] [blame] | 939 | seq_printf(m, "Up threshold: %d%%\n", |
| 940 | rps->power.up_threshold); |
Chris Wilson | d86ed34 | 2015-04-27 13:41:19 +0100 | [diff] [blame] | 941 | |
Akash Goel | d6cda9c | 2016-04-23 00:05:46 +0530 | [diff] [blame] | 942 | seq_printf(m, "RP CUR DOWN EI: %d (%dus)\n", |
| 943 | rpdownei, GT_PM_INTERVAL_TO_US(dev_priv, rpdownei)); |
| 944 | seq_printf(m, "RP CUR DOWN: %d (%dus)\n", |
| 945 | rpcurdown, GT_PM_INTERVAL_TO_US(dev_priv, rpcurdown)); |
| 946 | seq_printf(m, "RP PREV DOWN: %d (%dus)\n", |
| 947 | rpprevdown, GT_PM_INTERVAL_TO_US(dev_priv, rpprevdown)); |
Chris Wilson | 60548c5 | 2018-07-31 14:26:29 +0100 | [diff] [blame] | 948 | seq_printf(m, "Down threshold: %d%%\n", |
| 949 | rps->power.down_threshold); |
Jesse Barnes | 3b8d8d9 | 2010-12-17 14:19:02 -0800 | [diff] [blame] | 950 | |
Ander Conselvan de Oliveira | cc3f90f | 2016-12-02 10:23:49 +0200 | [diff] [blame] | 951 | max_freq = (IS_GEN9_LP(dev_priv) ? rp_state_cap >> 0 : |
Bob Paauwe | 3504056 | 2015-06-25 14:54:07 -0700 | [diff] [blame] | 952 | rp_state_cap >> 16) & 0xff; |
Rodrigo Vivi | 35ceabf | 2017-07-06 13:41:13 -0700 | [diff] [blame] | 953 | max_freq *= (IS_GEN9_BC(dev_priv) || |
Oscar Mateo | 2b2874e | 2018-04-05 17:00:52 +0300 | [diff] [blame] | 954 | INTEL_GEN(dev_priv) >= 10 ? GEN9_FREQ_SCALER : 1); |
Jesse Barnes | 3b8d8d9 | 2010-12-17 14:19:02 -0800 | [diff] [blame] | 955 | seq_printf(m, "Lowest (RPN) frequency: %dMHz\n", |
Ville Syrjälä | 7c59a9c1 | 2015-01-23 21:04:26 +0200 | [diff] [blame] | 956 | intel_gpu_freq(dev_priv, max_freq)); |
Jesse Barnes | 3b8d8d9 | 2010-12-17 14:19:02 -0800 | [diff] [blame] | 957 | |
| 958 | max_freq = (rp_state_cap & 0xff00) >> 8; |
Rodrigo Vivi | 35ceabf | 2017-07-06 13:41:13 -0700 | [diff] [blame] | 959 | max_freq *= (IS_GEN9_BC(dev_priv) || |
Oscar Mateo | 2b2874e | 2018-04-05 17:00:52 +0300 | [diff] [blame] | 960 | INTEL_GEN(dev_priv) >= 10 ? GEN9_FREQ_SCALER : 1); |
Jesse Barnes | 3b8d8d9 | 2010-12-17 14:19:02 -0800 | [diff] [blame] | 961 | seq_printf(m, "Nominal (RP1) frequency: %dMHz\n", |
Ville Syrjälä | 7c59a9c1 | 2015-01-23 21:04:26 +0200 | [diff] [blame] | 962 | intel_gpu_freq(dev_priv, max_freq)); |
Jesse Barnes | 3b8d8d9 | 2010-12-17 14:19:02 -0800 | [diff] [blame] | 963 | |
Ander Conselvan de Oliveira | cc3f90f | 2016-12-02 10:23:49 +0200 | [diff] [blame] | 964 | max_freq = (IS_GEN9_LP(dev_priv) ? rp_state_cap >> 16 : |
Bob Paauwe | 3504056 | 2015-06-25 14:54:07 -0700 | [diff] [blame] | 965 | rp_state_cap >> 0) & 0xff; |
Rodrigo Vivi | 35ceabf | 2017-07-06 13:41:13 -0700 | [diff] [blame] | 966 | max_freq *= (IS_GEN9_BC(dev_priv) || |
Oscar Mateo | 2b2874e | 2018-04-05 17:00:52 +0300 | [diff] [blame] | 967 | INTEL_GEN(dev_priv) >= 10 ? GEN9_FREQ_SCALER : 1); |
Jesse Barnes | 3b8d8d9 | 2010-12-17 14:19:02 -0800 | [diff] [blame] | 968 | seq_printf(m, "Max non-overclocked (RP0) frequency: %dMHz\n", |
Ville Syrjälä | 7c59a9c1 | 2015-01-23 21:04:26 +0200 | [diff] [blame] | 969 | intel_gpu_freq(dev_priv, max_freq)); |
Ben Widawsky | 31c7738 | 2013-04-05 14:29:22 -0700 | [diff] [blame] | 970 | seq_printf(m, "Max overclocked frequency: %dMHz\n", |
Sagar Arun Kamble | 562d9ba | 2017-10-10 22:30:06 +0100 | [diff] [blame] | 971 | intel_gpu_freq(dev_priv, rps->max_freq)); |
Chris Wilson | aed242f | 2015-03-18 09:48:21 +0000 | [diff] [blame] | 972 | |
Chris Wilson | d86ed34 | 2015-04-27 13:41:19 +0100 | [diff] [blame] | 973 | seq_printf(m, "Current freq: %d MHz\n", |
Sagar Arun Kamble | 562d9ba | 2017-10-10 22:30:06 +0100 | [diff] [blame] | 974 | intel_gpu_freq(dev_priv, rps->cur_freq)); |
Chris Wilson | d86ed34 | 2015-04-27 13:41:19 +0100 | [diff] [blame] | 975 | seq_printf(m, "Actual freq: %d MHz\n", cagf); |
Chris Wilson | aed242f | 2015-03-18 09:48:21 +0000 | [diff] [blame] | 976 | seq_printf(m, "Idle freq: %d MHz\n", |
Sagar Arun Kamble | 562d9ba | 2017-10-10 22:30:06 +0100 | [diff] [blame] | 977 | intel_gpu_freq(dev_priv, rps->idle_freq)); |
Chris Wilson | d86ed34 | 2015-04-27 13:41:19 +0100 | [diff] [blame] | 978 | seq_printf(m, "Min freq: %d MHz\n", |
Sagar Arun Kamble | 562d9ba | 2017-10-10 22:30:06 +0100 | [diff] [blame] | 979 | intel_gpu_freq(dev_priv, rps->min_freq)); |
Chris Wilson | 29ecd78d | 2016-07-13 09:10:35 +0100 | [diff] [blame] | 980 | seq_printf(m, "Boost freq: %d MHz\n", |
Sagar Arun Kamble | 562d9ba | 2017-10-10 22:30:06 +0100 | [diff] [blame] | 981 | intel_gpu_freq(dev_priv, rps->boost_freq)); |
Chris Wilson | d86ed34 | 2015-04-27 13:41:19 +0100 | [diff] [blame] | 982 | seq_printf(m, "Max freq: %d MHz\n", |
Sagar Arun Kamble | 562d9ba | 2017-10-10 22:30:06 +0100 | [diff] [blame] | 983 | intel_gpu_freq(dev_priv, rps->max_freq)); |
Chris Wilson | d86ed34 | 2015-04-27 13:41:19 +0100 | [diff] [blame] | 984 | seq_printf(m, |
| 985 | "efficient (RPe) frequency: %d MHz\n", |
Sagar Arun Kamble | 562d9ba | 2017-10-10 22:30:06 +0100 | [diff] [blame] | 986 | intel_gpu_freq(dev_priv, rps->efficient_freq)); |
Jesse Barnes | 3b8d8d9 | 2010-12-17 14:19:02 -0800 | [diff] [blame] | 987 | } else { |
Damien Lespiau | 267f0c9 | 2013-06-24 22:59:48 +0100 | [diff] [blame] | 988 | seq_puts(m, "no P-state info available\n"); |
Jesse Barnes | 3b8d8d9 | 2010-12-17 14:19:02 -0800 | [diff] [blame] | 989 | } |
Jesse Barnes | f97108d | 2010-01-29 11:27:07 -0800 | [diff] [blame] | 990 | |
Ville Syrjälä | 49cd97a | 2017-02-07 20:33:45 +0200 | [diff] [blame] | 991 | seq_printf(m, "Current CD clock frequency: %d kHz\n", dev_priv->cdclk.hw.cdclk); |
Mika Kahola | 1170f28 | 2015-09-25 14:00:32 +0300 | [diff] [blame] | 992 | seq_printf(m, "Max CD clock frequency: %d kHz\n", dev_priv->max_cdclk_freq); |
| 993 | seq_printf(m, "Max pixel clock frequency: %d kHz\n", dev_priv->max_dotclk_freq); |
| 994 | |
Daniele Ceraolo Spurio | d858d56 | 2019-06-13 16:21:54 -0700 | [diff] [blame] | 995 | intel_runtime_pm_put(&dev_priv->runtime_pm, wakeref); |
Paulo Zanoni | c8c8fb3 | 2013-11-27 18:21:54 -0200 | [diff] [blame] | 996 | return ret; |
Jesse Barnes | f97108d | 2010-01-29 11:27:07 -0800 | [diff] [blame] | 997 | } |
| 998 | |
Ben Widawsky | d636951 | 2016-09-20 16:54:32 +0300 | [diff] [blame] | 999 | static void i915_instdone_info(struct drm_i915_private *dev_priv, |
| 1000 | struct seq_file *m, |
| 1001 | struct intel_instdone *instdone) |
| 1002 | { |
Ben Widawsky | f9e6137 | 2016-09-20 16:54:33 +0300 | [diff] [blame] | 1003 | int slice; |
| 1004 | int subslice; |
| 1005 | |
Ben Widawsky | d636951 | 2016-09-20 16:54:32 +0300 | [diff] [blame] | 1006 | seq_printf(m, "\t\tINSTDONE: 0x%08x\n", |
| 1007 | instdone->instdone); |
| 1008 | |
| 1009 | if (INTEL_GEN(dev_priv) <= 3) |
| 1010 | return; |
| 1011 | |
| 1012 | seq_printf(m, "\t\tSC_INSTDONE: 0x%08x\n", |
| 1013 | instdone->slice_common); |
| 1014 | |
| 1015 | if (INTEL_GEN(dev_priv) <= 6) |
| 1016 | return; |
| 1017 | |
Jani Nikula | a10f361 | 2019-05-29 11:21:50 +0300 | [diff] [blame] | 1018 | for_each_instdone_slice_subslice(dev_priv, slice, subslice) |
Ben Widawsky | f9e6137 | 2016-09-20 16:54:33 +0300 | [diff] [blame] | 1019 | seq_printf(m, "\t\tSAMPLER_INSTDONE[%d][%d]: 0x%08x\n", |
| 1020 | slice, subslice, instdone->sampler[slice][subslice]); |
| 1021 | |
Jani Nikula | a10f361 | 2019-05-29 11:21:50 +0300 | [diff] [blame] | 1022 | for_each_instdone_slice_subslice(dev_priv, slice, subslice) |
Ben Widawsky | f9e6137 | 2016-09-20 16:54:33 +0300 | [diff] [blame] | 1023 | seq_printf(m, "\t\tROW_INSTDONE[%d][%d]: 0x%08x\n", |
| 1024 | slice, subslice, instdone->row[slice][subslice]); |
Ben Widawsky | d636951 | 2016-09-20 16:54:32 +0300 | [diff] [blame] | 1025 | } |
| 1026 | |
Chris Wilson | f654449 | 2015-01-26 18:03:04 +0200 | [diff] [blame] | 1027 | static int i915_hangcheck_info(struct seq_file *m, void *unused) |
| 1028 | { |
Chris Wilson | cb823ed | 2019-07-12 20:29:53 +0100 | [diff] [blame] | 1029 | struct drm_i915_private *i915 = node_to_i915(m->private); |
| 1030 | struct intel_gt *gt = &i915->gt; |
Tvrtko Ursulin | e2f8039 | 2016-03-16 11:00:36 +0000 | [diff] [blame] | 1031 | struct intel_engine_cs *engine; |
Chris Wilson | a037121 | 2019-01-14 14:21:14 +0000 | [diff] [blame] | 1032 | intel_wakeref_t wakeref; |
Dave Gordon | c3232b1 | 2016-03-23 18:19:53 +0000 | [diff] [blame] | 1033 | enum intel_engine_id id; |
Chris Wilson | f654449 | 2015-01-26 18:03:04 +0200 | [diff] [blame] | 1034 | |
Chris Wilson | cb823ed | 2019-07-12 20:29:53 +0100 | [diff] [blame] | 1035 | seq_printf(m, "Reset flags: %lx\n", gt->reset.flags); |
| 1036 | if (test_bit(I915_WEDGED, >->reset.flags)) |
Chris Wilson | 2caffbf | 2019-02-08 15:37:03 +0000 | [diff] [blame] | 1037 | seq_puts(m, "\tWedged\n"); |
Chris Wilson | cb823ed | 2019-07-12 20:29:53 +0100 | [diff] [blame] | 1038 | if (test_bit(I915_RESET_BACKOFF, >->reset.flags)) |
Chris Wilson | 2caffbf | 2019-02-08 15:37:03 +0000 | [diff] [blame] | 1039 | seq_puts(m, "\tDevice (global) reset in progress\n"); |
Chris Wilson | 8af29b0 | 2016-09-09 14:11:47 +0100 | [diff] [blame] | 1040 | |
Michal Wajdeczko | 4f044a8 | 2017-09-19 19:38:44 +0000 | [diff] [blame] | 1041 | if (!i915_modparams.enable_hangcheck) { |
Chris Wilson | 8c185ec | 2017-03-16 17:13:02 +0000 | [diff] [blame] | 1042 | seq_puts(m, "Hangcheck disabled\n"); |
Chris Wilson | f654449 | 2015-01-26 18:03:04 +0200 | [diff] [blame] | 1043 | return 0; |
| 1044 | } |
| 1045 | |
Chris Wilson | cb823ed | 2019-07-12 20:29:53 +0100 | [diff] [blame] | 1046 | if (timer_pending(>->hangcheck.work.timer)) |
Chris Wilson | 8352aea | 2017-03-03 09:00:56 +0000 | [diff] [blame] | 1047 | seq_printf(m, "Hangcheck active, timer fires in %dms\n", |
Chris Wilson | cb823ed | 2019-07-12 20:29:53 +0100 | [diff] [blame] | 1048 | jiffies_to_msecs(gt->hangcheck.work.timer.expires - |
Chris Wilson | f654449 | 2015-01-26 18:03:04 +0200 | [diff] [blame] | 1049 | jiffies)); |
Chris Wilson | cb823ed | 2019-07-12 20:29:53 +0100 | [diff] [blame] | 1050 | else if (delayed_work_pending(>->hangcheck.work)) |
Chris Wilson | 8352aea | 2017-03-03 09:00:56 +0000 | [diff] [blame] | 1051 | seq_puts(m, "Hangcheck active, work pending\n"); |
| 1052 | else |
| 1053 | seq_puts(m, "Hangcheck inactive\n"); |
Chris Wilson | f654449 | 2015-01-26 18:03:04 +0200 | [diff] [blame] | 1054 | |
Chris Wilson | cb823ed | 2019-07-12 20:29:53 +0100 | [diff] [blame] | 1055 | seq_printf(m, "GT active? %s\n", yesno(gt->awake)); |
Chris Wilson | f73b567 | 2017-03-02 15:03:56 +0000 | [diff] [blame] | 1056 | |
Chris Wilson | cb823ed | 2019-07-12 20:29:53 +0100 | [diff] [blame] | 1057 | with_intel_runtime_pm(&i915->runtime_pm, wakeref) { |
| 1058 | for_each_engine(engine, i915, id) { |
Chris Wilson | b8cade5 | 2019-07-04 21:04:55 +0100 | [diff] [blame] | 1059 | struct intel_instdone instdone; |
Mika Kuoppala | 3fe3b03 | 2016-11-18 15:09:04 +0200 | [diff] [blame] | 1060 | |
Chris Wilson | b8cade5 | 2019-07-04 21:04:55 +0100 | [diff] [blame] | 1061 | seq_printf(m, "%s: %d ms ago\n", |
| 1062 | engine->name, |
| 1063 | jiffies_to_msecs(jiffies - |
| 1064 | engine->hangcheck.action_timestamp)); |
Mika Kuoppala | 61642ff | 2015-12-01 17:56:12 +0200 | [diff] [blame] | 1065 | |
Chris Wilson | b8cade5 | 2019-07-04 21:04:55 +0100 | [diff] [blame] | 1066 | seq_printf(m, "\tACTHD = 0x%08llx [current 0x%08llx]\n", |
| 1067 | (long long)engine->hangcheck.acthd, |
| 1068 | intel_engine_get_active_head(engine)); |
| 1069 | |
| 1070 | intel_engine_get_instdone(engine, &instdone); |
| 1071 | |
Ben Widawsky | d636951 | 2016-09-20 16:54:32 +0300 | [diff] [blame] | 1072 | seq_puts(m, "\tinstdone read =\n"); |
Chris Wilson | cb823ed | 2019-07-12 20:29:53 +0100 | [diff] [blame] | 1073 | i915_instdone_info(i915, m, &instdone); |
Mika Kuoppala | 61642ff | 2015-12-01 17:56:12 +0200 | [diff] [blame] | 1074 | |
Ben Widawsky | d636951 | 2016-09-20 16:54:32 +0300 | [diff] [blame] | 1075 | seq_puts(m, "\tinstdone accu =\n"); |
Chris Wilson | cb823ed | 2019-07-12 20:29:53 +0100 | [diff] [blame] | 1076 | i915_instdone_info(i915, m, |
Ben Widawsky | d636951 | 2016-09-20 16:54:32 +0300 | [diff] [blame] | 1077 | &engine->hangcheck.instdone); |
Mika Kuoppala | 61642ff | 2015-12-01 17:56:12 +0200 | [diff] [blame] | 1078 | } |
Chris Wilson | f654449 | 2015-01-26 18:03:04 +0200 | [diff] [blame] | 1079 | } |
| 1080 | |
| 1081 | return 0; |
| 1082 | } |
| 1083 | |
Ben Widawsky | 4d85529 | 2011-12-12 19:34:16 -0800 | [diff] [blame] | 1084 | static int ironlake_drpc_info(struct seq_file *m) |
Jesse Barnes | f97108d | 2010-01-29 11:27:07 -0800 | [diff] [blame] | 1085 | { |
Tvrtko Ursulin | 4f5fd91 | 2019-06-11 11:45:48 +0100 | [diff] [blame] | 1086 | struct drm_i915_private *i915 = node_to_i915(m->private); |
| 1087 | struct intel_uncore *uncore = &i915->uncore; |
Ben Widawsky | 616fdb5 | 2011-10-05 11:44:54 -0700 | [diff] [blame] | 1088 | u32 rgvmodectl, rstdbyctl; |
| 1089 | u16 crstandvid; |
Ben Widawsky | 616fdb5 | 2011-10-05 11:44:54 -0700 | [diff] [blame] | 1090 | |
Tvrtko Ursulin | 4f5fd91 | 2019-06-11 11:45:48 +0100 | [diff] [blame] | 1091 | rgvmodectl = intel_uncore_read(uncore, MEMMODECTL); |
| 1092 | rstdbyctl = intel_uncore_read(uncore, RSTDBYCTL); |
| 1093 | crstandvid = intel_uncore_read16(uncore, CRSTANDVID); |
Ben Widawsky | 616fdb5 | 2011-10-05 11:44:54 -0700 | [diff] [blame] | 1094 | |
Jani Nikula | 742f491 | 2015-09-03 11:16:09 +0300 | [diff] [blame] | 1095 | seq_printf(m, "HD boost: %s\n", yesno(rgvmodectl & MEMMODE_BOOST_EN)); |
Jesse Barnes | f97108d | 2010-01-29 11:27:07 -0800 | [diff] [blame] | 1096 | seq_printf(m, "Boost freq: %d\n", |
| 1097 | (rgvmodectl & MEMMODE_BOOST_FREQ_MASK) >> |
| 1098 | MEMMODE_BOOST_FREQ_SHIFT); |
| 1099 | seq_printf(m, "HW control enabled: %s\n", |
Jani Nikula | 742f491 | 2015-09-03 11:16:09 +0300 | [diff] [blame] | 1100 | yesno(rgvmodectl & MEMMODE_HWIDLE_EN)); |
Jesse Barnes | f97108d | 2010-01-29 11:27:07 -0800 | [diff] [blame] | 1101 | seq_printf(m, "SW control enabled: %s\n", |
Jani Nikula | 742f491 | 2015-09-03 11:16:09 +0300 | [diff] [blame] | 1102 | yesno(rgvmodectl & MEMMODE_SWMODE_EN)); |
Jesse Barnes | f97108d | 2010-01-29 11:27:07 -0800 | [diff] [blame] | 1103 | seq_printf(m, "Gated voltage change: %s\n", |
Jani Nikula | 742f491 | 2015-09-03 11:16:09 +0300 | [diff] [blame] | 1104 | yesno(rgvmodectl & MEMMODE_RCLK_GATE)); |
Jesse Barnes | f97108d | 2010-01-29 11:27:07 -0800 | [diff] [blame] | 1105 | seq_printf(m, "Starting frequency: P%d\n", |
| 1106 | (rgvmodectl & MEMMODE_FSTART_MASK) >> MEMMODE_FSTART_SHIFT); |
Jesse Barnes | 7648fa9 | 2010-05-20 14:28:11 -0700 | [diff] [blame] | 1107 | seq_printf(m, "Max P-state: P%d\n", |
Jesse Barnes | f97108d | 2010-01-29 11:27:07 -0800 | [diff] [blame] | 1108 | (rgvmodectl & MEMMODE_FMAX_MASK) >> MEMMODE_FMAX_SHIFT); |
Jesse Barnes | 7648fa9 | 2010-05-20 14:28:11 -0700 | [diff] [blame] | 1109 | seq_printf(m, "Min P-state: P%d\n", (rgvmodectl & MEMMODE_FMIN_MASK)); |
| 1110 | seq_printf(m, "RS1 VID: %d\n", (crstandvid & 0x3f)); |
| 1111 | seq_printf(m, "RS2 VID: %d\n", ((crstandvid >> 8) & 0x3f)); |
| 1112 | seq_printf(m, "Render standby enabled: %s\n", |
Jani Nikula | 742f491 | 2015-09-03 11:16:09 +0300 | [diff] [blame] | 1113 | yesno(!(rstdbyctl & RCX_SW_EXIT))); |
Damien Lespiau | 267f0c9 | 2013-06-24 22:59:48 +0100 | [diff] [blame] | 1114 | seq_puts(m, "Current RS state: "); |
Jesse Barnes | 88271da | 2011-01-05 12:01:24 -0800 | [diff] [blame] | 1115 | switch (rstdbyctl & RSX_STATUS_MASK) { |
| 1116 | case RSX_STATUS_ON: |
Damien Lespiau | 267f0c9 | 2013-06-24 22:59:48 +0100 | [diff] [blame] | 1117 | seq_puts(m, "on\n"); |
Jesse Barnes | 88271da | 2011-01-05 12:01:24 -0800 | [diff] [blame] | 1118 | break; |
| 1119 | case RSX_STATUS_RC1: |
Damien Lespiau | 267f0c9 | 2013-06-24 22:59:48 +0100 | [diff] [blame] | 1120 | seq_puts(m, "RC1\n"); |
Jesse Barnes | 88271da | 2011-01-05 12:01:24 -0800 | [diff] [blame] | 1121 | break; |
| 1122 | case RSX_STATUS_RC1E: |
Damien Lespiau | 267f0c9 | 2013-06-24 22:59:48 +0100 | [diff] [blame] | 1123 | seq_puts(m, "RC1E\n"); |
Jesse Barnes | 88271da | 2011-01-05 12:01:24 -0800 | [diff] [blame] | 1124 | break; |
| 1125 | case RSX_STATUS_RS1: |
Damien Lespiau | 267f0c9 | 2013-06-24 22:59:48 +0100 | [diff] [blame] | 1126 | seq_puts(m, "RS1\n"); |
Jesse Barnes | 88271da | 2011-01-05 12:01:24 -0800 | [diff] [blame] | 1127 | break; |
| 1128 | case RSX_STATUS_RS2: |
Damien Lespiau | 267f0c9 | 2013-06-24 22:59:48 +0100 | [diff] [blame] | 1129 | seq_puts(m, "RS2 (RC6)\n"); |
Jesse Barnes | 88271da | 2011-01-05 12:01:24 -0800 | [diff] [blame] | 1130 | break; |
| 1131 | case RSX_STATUS_RS3: |
Damien Lespiau | 267f0c9 | 2013-06-24 22:59:48 +0100 | [diff] [blame] | 1132 | seq_puts(m, "RC3 (RC6+)\n"); |
Jesse Barnes | 88271da | 2011-01-05 12:01:24 -0800 | [diff] [blame] | 1133 | break; |
| 1134 | default: |
Damien Lespiau | 267f0c9 | 2013-06-24 22:59:48 +0100 | [diff] [blame] | 1135 | seq_puts(m, "unknown\n"); |
Jesse Barnes | 88271da | 2011-01-05 12:01:24 -0800 | [diff] [blame] | 1136 | break; |
| 1137 | } |
Jesse Barnes | f97108d | 2010-01-29 11:27:07 -0800 | [diff] [blame] | 1138 | |
| 1139 | return 0; |
| 1140 | } |
| 1141 | |
Mika Kuoppala | f65367b | 2015-01-16 11:34:42 +0200 | [diff] [blame] | 1142 | static int i915_forcewake_domains(struct seq_file *m, void *data) |
Chris Wilson | b2cff0d | 2015-01-16 11:34:37 +0200 | [diff] [blame] | 1143 | { |
Chris Wilson | 233ebf5 | 2017-03-23 10:19:44 +0000 | [diff] [blame] | 1144 | struct drm_i915_private *i915 = node_to_i915(m->private); |
Daniele Ceraolo Spurio | f568eee | 2019-03-19 11:35:35 -0700 | [diff] [blame] | 1145 | struct intel_uncore *uncore = &i915->uncore; |
Chris Wilson | b2cff0d | 2015-01-16 11:34:37 +0200 | [diff] [blame] | 1146 | struct intel_uncore_forcewake_domain *fw_domain; |
Chris Wilson | d2dc94b | 2017-03-23 10:19:41 +0000 | [diff] [blame] | 1147 | unsigned int tmp; |
Chris Wilson | b2cff0d | 2015-01-16 11:34:37 +0200 | [diff] [blame] | 1148 | |
Chris Wilson | d7a133d | 2017-09-07 14:44:41 +0100 | [diff] [blame] | 1149 | seq_printf(m, "user.bypass_count = %u\n", |
Daniele Ceraolo Spurio | 0a9b263 | 2019-08-09 07:31:16 +0100 | [diff] [blame] | 1150 | uncore->user_forcewake_count); |
Chris Wilson | d7a133d | 2017-09-07 14:44:41 +0100 | [diff] [blame] | 1151 | |
Daniele Ceraolo Spurio | f568eee | 2019-03-19 11:35:35 -0700 | [diff] [blame] | 1152 | for_each_fw_domain(fw_domain, uncore, tmp) |
Chris Wilson | b2cff0d | 2015-01-16 11:34:37 +0200 | [diff] [blame] | 1153 | seq_printf(m, "%s.wake_count = %u\n", |
Tvrtko Ursulin | 33c582c | 2016-04-07 17:04:33 +0100 | [diff] [blame] | 1154 | intel_uncore_forcewake_domain_to_str(fw_domain->id), |
Chris Wilson | 233ebf5 | 2017-03-23 10:19:44 +0000 | [diff] [blame] | 1155 | READ_ONCE(fw_domain->wake_count)); |
Chris Wilson | b2cff0d | 2015-01-16 11:34:37 +0200 | [diff] [blame] | 1156 | |
| 1157 | return 0; |
| 1158 | } |
| 1159 | |
Mika Kuoppala | 1362877 | 2017-03-15 17:43:02 +0200 | [diff] [blame] | 1160 | static void print_rc6_res(struct seq_file *m, |
| 1161 | const char *title, |
| 1162 | const i915_reg_t reg) |
| 1163 | { |
| 1164 | struct drm_i915_private *dev_priv = node_to_i915(m->private); |
| 1165 | |
| 1166 | seq_printf(m, "%s %u (%llu us)\n", |
| 1167 | title, I915_READ(reg), |
| 1168 | intel_rc6_residency_us(dev_priv, reg)); |
| 1169 | } |
| 1170 | |
Deepak S | 669ab5a | 2014-01-10 15:18:26 +0530 | [diff] [blame] | 1171 | static int vlv_drpc_info(struct seq_file *m) |
| 1172 | { |
David Weinehall | 36cdd01 | 2016-08-22 13:59:31 +0300 | [diff] [blame] | 1173 | struct drm_i915_private *dev_priv = node_to_i915(m->private); |
Sagar Arun Kamble | 0d6fc92 | 2017-10-10 22:30:02 +0100 | [diff] [blame] | 1174 | u32 rcctl1, pw_status; |
Deepak S | 669ab5a | 2014-01-10 15:18:26 +0530 | [diff] [blame] | 1175 | |
Ville Syrjälä | 6b312cd | 2014-11-19 20:07:42 +0200 | [diff] [blame] | 1176 | pw_status = I915_READ(VLV_GTLC_PW_STATUS); |
Deepak S | 669ab5a | 2014-01-10 15:18:26 +0530 | [diff] [blame] | 1177 | rcctl1 = I915_READ(GEN6_RC_CONTROL); |
| 1178 | |
Deepak S | 669ab5a | 2014-01-10 15:18:26 +0530 | [diff] [blame] | 1179 | seq_printf(m, "RC6 Enabled: %s\n", |
| 1180 | yesno(rcctl1 & (GEN7_RC_CTL_TO_MODE | |
| 1181 | GEN6_RC_CTL_EI_MODE(1)))); |
| 1182 | seq_printf(m, "Render Power Well: %s\n", |
Ville Syrjälä | 6b312cd | 2014-11-19 20:07:42 +0200 | [diff] [blame] | 1183 | (pw_status & VLV_GTLC_PW_RENDER_STATUS_MASK) ? "Up" : "Down"); |
Deepak S | 669ab5a | 2014-01-10 15:18:26 +0530 | [diff] [blame] | 1184 | seq_printf(m, "Media Power Well: %s\n", |
Ville Syrjälä | 6b312cd | 2014-11-19 20:07:42 +0200 | [diff] [blame] | 1185 | (pw_status & VLV_GTLC_PW_MEDIA_STATUS_MASK) ? "Up" : "Down"); |
Deepak S | 669ab5a | 2014-01-10 15:18:26 +0530 | [diff] [blame] | 1186 | |
Mika Kuoppala | 1362877 | 2017-03-15 17:43:02 +0200 | [diff] [blame] | 1187 | print_rc6_res(m, "Render RC6 residency since boot:", VLV_GT_RENDER_RC6); |
| 1188 | print_rc6_res(m, "Media RC6 residency since boot:", VLV_GT_MEDIA_RC6); |
Imre Deak | 9cc19be | 2014-04-14 20:24:24 +0300 | [diff] [blame] | 1189 | |
Mika Kuoppala | f65367b | 2015-01-16 11:34:42 +0200 | [diff] [blame] | 1190 | return i915_forcewake_domains(m, NULL); |
Deepak S | 669ab5a | 2014-01-10 15:18:26 +0530 | [diff] [blame] | 1191 | } |
| 1192 | |
Ben Widawsky | 4d85529 | 2011-12-12 19:34:16 -0800 | [diff] [blame] | 1193 | static int gen6_drpc_info(struct seq_file *m) |
| 1194 | { |
David Weinehall | 36cdd01 | 2016-08-22 13:59:31 +0300 | [diff] [blame] | 1195 | struct drm_i915_private *dev_priv = node_to_i915(m->private); |
Sagar Arun Kamble | 960e546 | 2017-10-10 22:29:59 +0100 | [diff] [blame] | 1196 | u32 gt_core_status, rcctl1, rc6vids = 0; |
Akash Goel | f2dd757 | 2016-06-27 20:10:01 +0530 | [diff] [blame] | 1197 | u32 gen9_powergate_enable = 0, gen9_powergate_status = 0; |
Ben Widawsky | 4d85529 | 2011-12-12 19:34:16 -0800 | [diff] [blame] | 1198 | |
Ville Syrjälä | 75aa3f6 | 2015-10-22 15:34:56 +0300 | [diff] [blame] | 1199 | gt_core_status = I915_READ_FW(GEN6_GT_CORE_STATUS); |
Chris Wilson | ed71f1b | 2013-07-19 20:36:56 +0100 | [diff] [blame] | 1200 | trace_i915_reg_rw(false, GEN6_GT_CORE_STATUS, gt_core_status, 4, true); |
Ben Widawsky | 4d85529 | 2011-12-12 19:34:16 -0800 | [diff] [blame] | 1201 | |
Ben Widawsky | 4d85529 | 2011-12-12 19:34:16 -0800 | [diff] [blame] | 1202 | rcctl1 = I915_READ(GEN6_RC_CONTROL); |
David Weinehall | 36cdd01 | 2016-08-22 13:59:31 +0300 | [diff] [blame] | 1203 | if (INTEL_GEN(dev_priv) >= 9) { |
Akash Goel | f2dd757 | 2016-06-27 20:10:01 +0530 | [diff] [blame] | 1204 | gen9_powergate_enable = I915_READ(GEN9_PG_ENABLE); |
| 1205 | gen9_powergate_status = I915_READ(GEN9_PWRGT_DOMAIN_STATUS); |
| 1206 | } |
Chris Wilson | cf632bd | 2017-03-13 09:56:17 +0000 | [diff] [blame] | 1207 | |
Chris Wilson | ebb5eb7 | 2019-04-26 09:17:21 +0100 | [diff] [blame] | 1208 | if (INTEL_GEN(dev_priv) <= 7) |
Imre Deak | 51cc9ad | 2018-02-08 19:41:02 +0200 | [diff] [blame] | 1209 | sandybridge_pcode_read(dev_priv, GEN6_PCODE_READ_RC6VIDS, |
Ville Syrjälä | d284d51 | 2019-05-21 19:40:24 +0300 | [diff] [blame] | 1210 | &rc6vids, NULL); |
Ben Widawsky | 4d85529 | 2011-12-12 19:34:16 -0800 | [diff] [blame] | 1211 | |
Eric Anholt | fff24e2 | 2012-01-23 16:14:05 -0800 | [diff] [blame] | 1212 | seq_printf(m, "RC1e Enabled: %s\n", |
Ben Widawsky | 4d85529 | 2011-12-12 19:34:16 -0800 | [diff] [blame] | 1213 | yesno(rcctl1 & GEN6_RC_CTL_RC1e_ENABLE)); |
| 1214 | seq_printf(m, "RC6 Enabled: %s\n", |
| 1215 | yesno(rcctl1 & GEN6_RC_CTL_RC6_ENABLE)); |
David Weinehall | 36cdd01 | 2016-08-22 13:59:31 +0300 | [diff] [blame] | 1216 | if (INTEL_GEN(dev_priv) >= 9) { |
Akash Goel | f2dd757 | 2016-06-27 20:10:01 +0530 | [diff] [blame] | 1217 | seq_printf(m, "Render Well Gating Enabled: %s\n", |
| 1218 | yesno(gen9_powergate_enable & GEN9_RENDER_PG_ENABLE)); |
| 1219 | seq_printf(m, "Media Well Gating Enabled: %s\n", |
| 1220 | yesno(gen9_powergate_enable & GEN9_MEDIA_PG_ENABLE)); |
| 1221 | } |
Ben Widawsky | 4d85529 | 2011-12-12 19:34:16 -0800 | [diff] [blame] | 1222 | seq_printf(m, "Deep RC6 Enabled: %s\n", |
| 1223 | yesno(rcctl1 & GEN6_RC_CTL_RC6p_ENABLE)); |
| 1224 | seq_printf(m, "Deepest RC6 Enabled: %s\n", |
| 1225 | yesno(rcctl1 & GEN6_RC_CTL_RC6pp_ENABLE)); |
Damien Lespiau | 267f0c9 | 2013-06-24 22:59:48 +0100 | [diff] [blame] | 1226 | seq_puts(m, "Current RC state: "); |
Ben Widawsky | 4d85529 | 2011-12-12 19:34:16 -0800 | [diff] [blame] | 1227 | switch (gt_core_status & GEN6_RCn_MASK) { |
| 1228 | case GEN6_RC0: |
| 1229 | if (gt_core_status & GEN6_CORE_CPD_STATE_MASK) |
Damien Lespiau | 267f0c9 | 2013-06-24 22:59:48 +0100 | [diff] [blame] | 1230 | seq_puts(m, "Core Power Down\n"); |
Ben Widawsky | 4d85529 | 2011-12-12 19:34:16 -0800 | [diff] [blame] | 1231 | else |
Damien Lespiau | 267f0c9 | 2013-06-24 22:59:48 +0100 | [diff] [blame] | 1232 | seq_puts(m, "on\n"); |
Ben Widawsky | 4d85529 | 2011-12-12 19:34:16 -0800 | [diff] [blame] | 1233 | break; |
| 1234 | case GEN6_RC3: |
Damien Lespiau | 267f0c9 | 2013-06-24 22:59:48 +0100 | [diff] [blame] | 1235 | seq_puts(m, "RC3\n"); |
Ben Widawsky | 4d85529 | 2011-12-12 19:34:16 -0800 | [diff] [blame] | 1236 | break; |
| 1237 | case GEN6_RC6: |
Damien Lespiau | 267f0c9 | 2013-06-24 22:59:48 +0100 | [diff] [blame] | 1238 | seq_puts(m, "RC6\n"); |
Ben Widawsky | 4d85529 | 2011-12-12 19:34:16 -0800 | [diff] [blame] | 1239 | break; |
| 1240 | case GEN6_RC7: |
Damien Lespiau | 267f0c9 | 2013-06-24 22:59:48 +0100 | [diff] [blame] | 1241 | seq_puts(m, "RC7\n"); |
Ben Widawsky | 4d85529 | 2011-12-12 19:34:16 -0800 | [diff] [blame] | 1242 | break; |
| 1243 | default: |
Damien Lespiau | 267f0c9 | 2013-06-24 22:59:48 +0100 | [diff] [blame] | 1244 | seq_puts(m, "Unknown\n"); |
Ben Widawsky | 4d85529 | 2011-12-12 19:34:16 -0800 | [diff] [blame] | 1245 | break; |
| 1246 | } |
| 1247 | |
| 1248 | seq_printf(m, "Core Power Down: %s\n", |
| 1249 | yesno(gt_core_status & GEN6_CORE_CPD_STATE_MASK)); |
David Weinehall | 36cdd01 | 2016-08-22 13:59:31 +0300 | [diff] [blame] | 1250 | if (INTEL_GEN(dev_priv) >= 9) { |
Akash Goel | f2dd757 | 2016-06-27 20:10:01 +0530 | [diff] [blame] | 1251 | seq_printf(m, "Render Power Well: %s\n", |
| 1252 | (gen9_powergate_status & |
| 1253 | GEN9_PWRGT_RENDER_STATUS_MASK) ? "Up" : "Down"); |
| 1254 | seq_printf(m, "Media Power Well: %s\n", |
| 1255 | (gen9_powergate_status & |
| 1256 | GEN9_PWRGT_MEDIA_STATUS_MASK) ? "Up" : "Down"); |
| 1257 | } |
Ben Widawsky | cce66a2 | 2012-03-27 18:59:38 -0700 | [diff] [blame] | 1258 | |
| 1259 | /* Not exactly sure what this is */ |
Mika Kuoppala | 1362877 | 2017-03-15 17:43:02 +0200 | [diff] [blame] | 1260 | print_rc6_res(m, "RC6 \"Locked to RPn\" residency since boot:", |
| 1261 | GEN6_GT_GFX_RC6_LOCKED); |
| 1262 | print_rc6_res(m, "RC6 residency since boot:", GEN6_GT_GFX_RC6); |
| 1263 | print_rc6_res(m, "RC6+ residency since boot:", GEN6_GT_GFX_RC6p); |
| 1264 | print_rc6_res(m, "RC6++ residency since boot:", GEN6_GT_GFX_RC6pp); |
Ben Widawsky | cce66a2 | 2012-03-27 18:59:38 -0700 | [diff] [blame] | 1265 | |
Imre Deak | 51cc9ad | 2018-02-08 19:41:02 +0200 | [diff] [blame] | 1266 | if (INTEL_GEN(dev_priv) <= 7) { |
| 1267 | seq_printf(m, "RC6 voltage: %dmV\n", |
| 1268 | GEN6_DECODE_RC6_VID(((rc6vids >> 0) & 0xff))); |
| 1269 | seq_printf(m, "RC6+ voltage: %dmV\n", |
| 1270 | GEN6_DECODE_RC6_VID(((rc6vids >> 8) & 0xff))); |
| 1271 | seq_printf(m, "RC6++ voltage: %dmV\n", |
| 1272 | GEN6_DECODE_RC6_VID(((rc6vids >> 16) & 0xff))); |
| 1273 | } |
| 1274 | |
Akash Goel | f2dd757 | 2016-06-27 20:10:01 +0530 | [diff] [blame] | 1275 | return i915_forcewake_domains(m, NULL); |
Ben Widawsky | 4d85529 | 2011-12-12 19:34:16 -0800 | [diff] [blame] | 1276 | } |
| 1277 | |
| 1278 | static int i915_drpc_info(struct seq_file *m, void *unused) |
| 1279 | { |
David Weinehall | 36cdd01 | 2016-08-22 13:59:31 +0300 | [diff] [blame] | 1280 | struct drm_i915_private *dev_priv = node_to_i915(m->private); |
Chris Wilson | a037121 | 2019-01-14 14:21:14 +0000 | [diff] [blame] | 1281 | intel_wakeref_t wakeref; |
Chris Wilson | d4225a5 | 2019-01-14 14:21:23 +0000 | [diff] [blame] | 1282 | int err = -ENODEV; |
Chris Wilson | cf632bd | 2017-03-13 09:56:17 +0000 | [diff] [blame] | 1283 | |
Daniele Ceraolo Spurio | c447ff7 | 2019-06-13 16:21:55 -0700 | [diff] [blame] | 1284 | with_intel_runtime_pm(&dev_priv->runtime_pm, wakeref) { |
Chris Wilson | d4225a5 | 2019-01-14 14:21:23 +0000 | [diff] [blame] | 1285 | if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) |
| 1286 | err = vlv_drpc_info(m); |
| 1287 | else if (INTEL_GEN(dev_priv) >= 6) |
| 1288 | err = gen6_drpc_info(m); |
| 1289 | else |
| 1290 | err = ironlake_drpc_info(m); |
| 1291 | } |
Chris Wilson | cf632bd | 2017-03-13 09:56:17 +0000 | [diff] [blame] | 1292 | |
| 1293 | return err; |
Ben Widawsky | 4d85529 | 2011-12-12 19:34:16 -0800 | [diff] [blame] | 1294 | } |
| 1295 | |
Daniel Vetter | 9a85178 | 2015-06-18 10:30:22 +0200 | [diff] [blame] | 1296 | static int i915_frontbuffer_tracking(struct seq_file *m, void *unused) |
| 1297 | { |
David Weinehall | 36cdd01 | 2016-08-22 13:59:31 +0300 | [diff] [blame] | 1298 | struct drm_i915_private *dev_priv = node_to_i915(m->private); |
Daniel Vetter | 9a85178 | 2015-06-18 10:30:22 +0200 | [diff] [blame] | 1299 | |
| 1300 | seq_printf(m, "FB tracking busy bits: 0x%08x\n", |
| 1301 | dev_priv->fb_tracking.busy_bits); |
| 1302 | |
| 1303 | seq_printf(m, "FB tracking flip bits: 0x%08x\n", |
| 1304 | dev_priv->fb_tracking.flip_bits); |
| 1305 | |
| 1306 | return 0; |
| 1307 | } |
| 1308 | |
Jesse Barnes | b5e50c3 | 2010-02-05 12:42:41 -0800 | [diff] [blame] | 1309 | static int i915_fbc_status(struct seq_file *m, void *unused) |
| 1310 | { |
David Weinehall | 36cdd01 | 2016-08-22 13:59:31 +0300 | [diff] [blame] | 1311 | struct drm_i915_private *dev_priv = node_to_i915(m->private); |
Chris Wilson | 3138872 | 2017-12-20 20:58:48 +0000 | [diff] [blame] | 1312 | struct intel_fbc *fbc = &dev_priv->fbc; |
Chris Wilson | a037121 | 2019-01-14 14:21:14 +0000 | [diff] [blame] | 1313 | intel_wakeref_t wakeref; |
Jesse Barnes | b5e50c3 | 2010-02-05 12:42:41 -0800 | [diff] [blame] | 1314 | |
Michal Wajdeczko | ab309a6 | 2017-12-15 14:36:35 +0000 | [diff] [blame] | 1315 | if (!HAS_FBC(dev_priv)) |
| 1316 | return -ENODEV; |
Jesse Barnes | b5e50c3 | 2010-02-05 12:42:41 -0800 | [diff] [blame] | 1317 | |
Daniele Ceraolo Spurio | d858d56 | 2019-06-13 16:21:54 -0700 | [diff] [blame] | 1318 | wakeref = intel_runtime_pm_get(&dev_priv->runtime_pm); |
Chris Wilson | 3138872 | 2017-12-20 20:58:48 +0000 | [diff] [blame] | 1319 | mutex_lock(&fbc->lock); |
Paulo Zanoni | 36623ef | 2014-02-21 13:52:23 -0300 | [diff] [blame] | 1320 | |
Paulo Zanoni | 0e631ad | 2015-10-14 17:45:36 -0300 | [diff] [blame] | 1321 | if (intel_fbc_is_active(dev_priv)) |
Damien Lespiau | 267f0c9 | 2013-06-24 22:59:48 +0100 | [diff] [blame] | 1322 | seq_puts(m, "FBC enabled\n"); |
Paulo Zanoni | 2e8144a | 2015-06-12 14:36:20 -0300 | [diff] [blame] | 1323 | else |
Chris Wilson | 3138872 | 2017-12-20 20:58:48 +0000 | [diff] [blame] | 1324 | seq_printf(m, "FBC disabled: %s\n", fbc->no_fbc_reason); |
| 1325 | |
Ville Syrjälä | 3fd5d1e | 2017-06-06 15:43:18 +0300 | [diff] [blame] | 1326 | if (intel_fbc_is_active(dev_priv)) { |
| 1327 | u32 mask; |
| 1328 | |
| 1329 | if (INTEL_GEN(dev_priv) >= 8) |
| 1330 | mask = I915_READ(IVB_FBC_STATUS2) & BDW_FBC_COMP_SEG_MASK; |
| 1331 | else if (INTEL_GEN(dev_priv) >= 7) |
| 1332 | mask = I915_READ(IVB_FBC_STATUS2) & IVB_FBC_COMP_SEG_MASK; |
| 1333 | else if (INTEL_GEN(dev_priv) >= 5) |
| 1334 | mask = I915_READ(ILK_DPFC_STATUS) & ILK_DPFC_COMP_SEG_MASK; |
| 1335 | else if (IS_G4X(dev_priv)) |
| 1336 | mask = I915_READ(DPFC_STATUS) & DPFC_COMP_SEG_MASK; |
| 1337 | else |
| 1338 | mask = I915_READ(FBC_STATUS) & (FBC_STAT_COMPRESSING | |
| 1339 | FBC_STAT_COMPRESSED); |
| 1340 | |
| 1341 | seq_printf(m, "Compressing: %s\n", yesno(mask)); |
Paulo Zanoni | 0fc6a9d | 2016-10-21 13:55:46 -0200 | [diff] [blame] | 1342 | } |
Paulo Zanoni | 31b9df1 | 2015-06-12 14:36:18 -0300 | [diff] [blame] | 1343 | |
Chris Wilson | 3138872 | 2017-12-20 20:58:48 +0000 | [diff] [blame] | 1344 | mutex_unlock(&fbc->lock); |
Daniele Ceraolo Spurio | d858d56 | 2019-06-13 16:21:54 -0700 | [diff] [blame] | 1345 | intel_runtime_pm_put(&dev_priv->runtime_pm, wakeref); |
Paulo Zanoni | 36623ef | 2014-02-21 13:52:23 -0300 | [diff] [blame] | 1346 | |
Jesse Barnes | b5e50c3 | 2010-02-05 12:42:41 -0800 | [diff] [blame] | 1347 | return 0; |
| 1348 | } |
| 1349 | |
Ville Syrjälä | 4127dc4 | 2017-06-06 15:44:12 +0300 | [diff] [blame] | 1350 | static int i915_fbc_false_color_get(void *data, u64 *val) |
Rodrigo Vivi | da46f93 | 2014-08-01 02:04:45 -0700 | [diff] [blame] | 1351 | { |
David Weinehall | 36cdd01 | 2016-08-22 13:59:31 +0300 | [diff] [blame] | 1352 | struct drm_i915_private *dev_priv = data; |
Rodrigo Vivi | da46f93 | 2014-08-01 02:04:45 -0700 | [diff] [blame] | 1353 | |
David Weinehall | 36cdd01 | 2016-08-22 13:59:31 +0300 | [diff] [blame] | 1354 | if (INTEL_GEN(dev_priv) < 7 || !HAS_FBC(dev_priv)) |
Rodrigo Vivi | da46f93 | 2014-08-01 02:04:45 -0700 | [diff] [blame] | 1355 | return -ENODEV; |
| 1356 | |
Rodrigo Vivi | da46f93 | 2014-08-01 02:04:45 -0700 | [diff] [blame] | 1357 | *val = dev_priv->fbc.false_color; |
Rodrigo Vivi | da46f93 | 2014-08-01 02:04:45 -0700 | [diff] [blame] | 1358 | |
| 1359 | return 0; |
| 1360 | } |
| 1361 | |
Ville Syrjälä | 4127dc4 | 2017-06-06 15:44:12 +0300 | [diff] [blame] | 1362 | static int i915_fbc_false_color_set(void *data, u64 val) |
Rodrigo Vivi | da46f93 | 2014-08-01 02:04:45 -0700 | [diff] [blame] | 1363 | { |
David Weinehall | 36cdd01 | 2016-08-22 13:59:31 +0300 | [diff] [blame] | 1364 | struct drm_i915_private *dev_priv = data; |
Rodrigo Vivi | da46f93 | 2014-08-01 02:04:45 -0700 | [diff] [blame] | 1365 | u32 reg; |
| 1366 | |
David Weinehall | 36cdd01 | 2016-08-22 13:59:31 +0300 | [diff] [blame] | 1367 | if (INTEL_GEN(dev_priv) < 7 || !HAS_FBC(dev_priv)) |
Rodrigo Vivi | da46f93 | 2014-08-01 02:04:45 -0700 | [diff] [blame] | 1368 | return -ENODEV; |
| 1369 | |
Paulo Zanoni | 25ad93f | 2015-07-02 19:25:10 -0300 | [diff] [blame] | 1370 | mutex_lock(&dev_priv->fbc.lock); |
Rodrigo Vivi | da46f93 | 2014-08-01 02:04:45 -0700 | [diff] [blame] | 1371 | |
| 1372 | reg = I915_READ(ILK_DPFC_CONTROL); |
| 1373 | dev_priv->fbc.false_color = val; |
| 1374 | |
| 1375 | I915_WRITE(ILK_DPFC_CONTROL, val ? |
| 1376 | (reg | FBC_CTL_FALSE_COLOR) : |
| 1377 | (reg & ~FBC_CTL_FALSE_COLOR)); |
| 1378 | |
Paulo Zanoni | 25ad93f | 2015-07-02 19:25:10 -0300 | [diff] [blame] | 1379 | mutex_unlock(&dev_priv->fbc.lock); |
Rodrigo Vivi | da46f93 | 2014-08-01 02:04:45 -0700 | [diff] [blame] | 1380 | return 0; |
| 1381 | } |
| 1382 | |
Ville Syrjälä | 4127dc4 | 2017-06-06 15:44:12 +0300 | [diff] [blame] | 1383 | DEFINE_SIMPLE_ATTRIBUTE(i915_fbc_false_color_fops, |
| 1384 | i915_fbc_false_color_get, i915_fbc_false_color_set, |
Rodrigo Vivi | da46f93 | 2014-08-01 02:04:45 -0700 | [diff] [blame] | 1385 | "%llu\n"); |
| 1386 | |
Paulo Zanoni | 92d4462 | 2013-05-31 16:33:24 -0300 | [diff] [blame] | 1387 | static int i915_ips_status(struct seq_file *m, void *unused) |
| 1388 | { |
David Weinehall | 36cdd01 | 2016-08-22 13:59:31 +0300 | [diff] [blame] | 1389 | struct drm_i915_private *dev_priv = node_to_i915(m->private); |
Chris Wilson | a037121 | 2019-01-14 14:21:14 +0000 | [diff] [blame] | 1390 | intel_wakeref_t wakeref; |
Paulo Zanoni | 92d4462 | 2013-05-31 16:33:24 -0300 | [diff] [blame] | 1391 | |
Michal Wajdeczko | ab309a6 | 2017-12-15 14:36:35 +0000 | [diff] [blame] | 1392 | if (!HAS_IPS(dev_priv)) |
| 1393 | return -ENODEV; |
Paulo Zanoni | 92d4462 | 2013-05-31 16:33:24 -0300 | [diff] [blame] | 1394 | |
Daniele Ceraolo Spurio | d858d56 | 2019-06-13 16:21:54 -0700 | [diff] [blame] | 1395 | wakeref = intel_runtime_pm_get(&dev_priv->runtime_pm); |
Paulo Zanoni | 36623ef | 2014-02-21 13:52:23 -0300 | [diff] [blame] | 1396 | |
Rodrigo Vivi | 0eaa53f | 2014-06-30 04:45:01 -0700 | [diff] [blame] | 1397 | seq_printf(m, "Enabled by kernel parameter: %s\n", |
Michal Wajdeczko | 4f044a8 | 2017-09-19 19:38:44 +0000 | [diff] [blame] | 1398 | yesno(i915_modparams.enable_ips)); |
Rodrigo Vivi | 0eaa53f | 2014-06-30 04:45:01 -0700 | [diff] [blame] | 1399 | |
David Weinehall | 36cdd01 | 2016-08-22 13:59:31 +0300 | [diff] [blame] | 1400 | if (INTEL_GEN(dev_priv) >= 8) { |
Rodrigo Vivi | 0eaa53f | 2014-06-30 04:45:01 -0700 | [diff] [blame] | 1401 | seq_puts(m, "Currently: unknown\n"); |
| 1402 | } else { |
| 1403 | if (I915_READ(IPS_CTL) & IPS_ENABLE) |
| 1404 | seq_puts(m, "Currently: enabled\n"); |
| 1405 | else |
| 1406 | seq_puts(m, "Currently: disabled\n"); |
| 1407 | } |
Paulo Zanoni | 92d4462 | 2013-05-31 16:33:24 -0300 | [diff] [blame] | 1408 | |
Daniele Ceraolo Spurio | d858d56 | 2019-06-13 16:21:54 -0700 | [diff] [blame] | 1409 | intel_runtime_pm_put(&dev_priv->runtime_pm, wakeref); |
Paulo Zanoni | 36623ef | 2014-02-21 13:52:23 -0300 | [diff] [blame] | 1410 | |
Paulo Zanoni | 92d4462 | 2013-05-31 16:33:24 -0300 | [diff] [blame] | 1411 | return 0; |
| 1412 | } |
| 1413 | |
Jesse Barnes | 4a9bef3 | 2010-02-05 12:47:35 -0800 | [diff] [blame] | 1414 | static int i915_sr_status(struct seq_file *m, void *unused) |
| 1415 | { |
David Weinehall | 36cdd01 | 2016-08-22 13:59:31 +0300 | [diff] [blame] | 1416 | struct drm_i915_private *dev_priv = node_to_i915(m->private); |
Chris Wilson | a037121 | 2019-01-14 14:21:14 +0000 | [diff] [blame] | 1417 | intel_wakeref_t wakeref; |
Jesse Barnes | 4a9bef3 | 2010-02-05 12:47:35 -0800 | [diff] [blame] | 1418 | bool sr_enabled = false; |
| 1419 | |
Chris Wilson | 0e6e0be | 2019-01-14 14:21:24 +0000 | [diff] [blame] | 1420 | wakeref = intel_display_power_get(dev_priv, POWER_DOMAIN_INIT); |
Paulo Zanoni | 36623ef | 2014-02-21 13:52:23 -0300 | [diff] [blame] | 1421 | |
Chris Wilson | 7342a72 | 2017-03-09 14:20:49 +0000 | [diff] [blame] | 1422 | if (INTEL_GEN(dev_priv) >= 9) |
| 1423 | /* no global SR status; inspect per-plane WM */; |
| 1424 | else if (HAS_PCH_SPLIT(dev_priv)) |
Chris Wilson | 5ba2aaa | 2010-08-19 18:04:08 +0100 | [diff] [blame] | 1425 | sr_enabled = I915_READ(WM1_LP_ILK) & WM1_LP_SR_EN; |
Jani Nikula | c0f8683 | 2016-12-07 12:13:04 +0200 | [diff] [blame] | 1426 | else if (IS_I965GM(dev_priv) || IS_G4X(dev_priv) || |
David Weinehall | 36cdd01 | 2016-08-22 13:59:31 +0300 | [diff] [blame] | 1427 | IS_I945G(dev_priv) || IS_I945GM(dev_priv)) |
Jesse Barnes | 4a9bef3 | 2010-02-05 12:47:35 -0800 | [diff] [blame] | 1428 | sr_enabled = I915_READ(FW_BLC_SELF) & FW_BLC_SELF_EN; |
David Weinehall | 36cdd01 | 2016-08-22 13:59:31 +0300 | [diff] [blame] | 1429 | else if (IS_I915GM(dev_priv)) |
Jesse Barnes | 4a9bef3 | 2010-02-05 12:47:35 -0800 | [diff] [blame] | 1430 | sr_enabled = I915_READ(INSTPM) & INSTPM_SELF_EN; |
David Weinehall | 36cdd01 | 2016-08-22 13:59:31 +0300 | [diff] [blame] | 1431 | else if (IS_PINEVIEW(dev_priv)) |
Jesse Barnes | 4a9bef3 | 2010-02-05 12:47:35 -0800 | [diff] [blame] | 1432 | sr_enabled = I915_READ(DSPFW3) & PINEVIEW_SELF_REFRESH_EN; |
David Weinehall | 36cdd01 | 2016-08-22 13:59:31 +0300 | [diff] [blame] | 1433 | else if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) |
Ander Conselvan de Oliveira | 77b6455 | 2015-06-02 14:17:47 +0300 | [diff] [blame] | 1434 | sr_enabled = I915_READ(FW_BLC_SELF_VLV) & FW_CSPWRDWNEN; |
Jesse Barnes | 4a9bef3 | 2010-02-05 12:47:35 -0800 | [diff] [blame] | 1435 | |
Chris Wilson | 0e6e0be | 2019-01-14 14:21:24 +0000 | [diff] [blame] | 1436 | intel_display_power_put(dev_priv, POWER_DOMAIN_INIT, wakeref); |
Paulo Zanoni | 36623ef | 2014-02-21 13:52:23 -0300 | [diff] [blame] | 1437 | |
Tvrtko Ursulin | 08c4d7f | 2016-11-17 12:30:14 +0000 | [diff] [blame] | 1438 | seq_printf(m, "self-refresh: %s\n", enableddisabled(sr_enabled)); |
Jesse Barnes | 4a9bef3 | 2010-02-05 12:47:35 -0800 | [diff] [blame] | 1439 | |
| 1440 | return 0; |
| 1441 | } |
| 1442 | |
Jesse Barnes | 23b2f8b | 2011-06-28 13:04:16 -0700 | [diff] [blame] | 1443 | static int i915_ring_freq_table(struct seq_file *m, void *unused) |
| 1444 | { |
David Weinehall | 36cdd01 | 2016-08-22 13:59:31 +0300 | [diff] [blame] | 1445 | struct drm_i915_private *dev_priv = node_to_i915(m->private); |
Sagar Arun Kamble | 562d9ba | 2017-10-10 22:30:06 +0100 | [diff] [blame] | 1446 | struct intel_rps *rps = &dev_priv->gt_pm.rps; |
Akash Goel | f936ec3 | 2015-06-29 14:50:22 +0530 | [diff] [blame] | 1447 | unsigned int max_gpu_freq, min_gpu_freq; |
Chris Wilson | a037121 | 2019-01-14 14:21:14 +0000 | [diff] [blame] | 1448 | intel_wakeref_t wakeref; |
Chris Wilson | d586b5f | 2018-03-08 14:26:48 +0000 | [diff] [blame] | 1449 | int gpu_freq, ia_freq; |
Jesse Barnes | 23b2f8b | 2011-06-28 13:04:16 -0700 | [diff] [blame] | 1450 | |
Michal Wajdeczko | ab309a6 | 2017-12-15 14:36:35 +0000 | [diff] [blame] | 1451 | if (!HAS_LLC(dev_priv)) |
| 1452 | return -ENODEV; |
Jesse Barnes | 23b2f8b | 2011-06-28 13:04:16 -0700 | [diff] [blame] | 1453 | |
Chris Wilson | d586b5f | 2018-03-08 14:26:48 +0000 | [diff] [blame] | 1454 | min_gpu_freq = rps->min_freq; |
| 1455 | max_gpu_freq = rps->max_freq; |
Oscar Mateo | 2b2874e | 2018-04-05 17:00:52 +0300 | [diff] [blame] | 1456 | if (IS_GEN9_BC(dev_priv) || INTEL_GEN(dev_priv) >= 10) { |
Akash Goel | f936ec3 | 2015-06-29 14:50:22 +0530 | [diff] [blame] | 1457 | /* Convert GT frequency to 50 HZ units */ |
Chris Wilson | d586b5f | 2018-03-08 14:26:48 +0000 | [diff] [blame] | 1458 | min_gpu_freq /= GEN9_FREQ_SCALER; |
| 1459 | max_gpu_freq /= GEN9_FREQ_SCALER; |
Akash Goel | f936ec3 | 2015-06-29 14:50:22 +0530 | [diff] [blame] | 1460 | } |
| 1461 | |
Damien Lespiau | 267f0c9 | 2013-06-24 22:59:48 +0100 | [diff] [blame] | 1462 | seq_puts(m, "GPU freq (MHz)\tEffective CPU freq (MHz)\tEffective Ring freq (MHz)\n"); |
Jesse Barnes | 23b2f8b | 2011-06-28 13:04:16 -0700 | [diff] [blame] | 1463 | |
Daniele Ceraolo Spurio | d858d56 | 2019-06-13 16:21:54 -0700 | [diff] [blame] | 1464 | wakeref = intel_runtime_pm_get(&dev_priv->runtime_pm); |
Akash Goel | f936ec3 | 2015-06-29 14:50:22 +0530 | [diff] [blame] | 1465 | for (gpu_freq = min_gpu_freq; gpu_freq <= max_gpu_freq; gpu_freq++) { |
Ben Widawsky | 42c0526 | 2012-09-26 10:34:00 -0700 | [diff] [blame] | 1466 | ia_freq = gpu_freq; |
| 1467 | sandybridge_pcode_read(dev_priv, |
| 1468 | GEN6_PCODE_READ_MIN_FREQ_TABLE, |
Ville Syrjälä | d284d51 | 2019-05-21 19:40:24 +0300 | [diff] [blame] | 1469 | &ia_freq, NULL); |
Chris Wilson | 3ebecd0 | 2013-04-12 19:10:13 +0100 | [diff] [blame] | 1470 | seq_printf(m, "%d\t\t%d\t\t\t\t%d\n", |
Akash Goel | f936ec3 | 2015-06-29 14:50:22 +0530 | [diff] [blame] | 1471 | intel_gpu_freq(dev_priv, (gpu_freq * |
Rodrigo Vivi | 35ceabf | 2017-07-06 13:41:13 -0700 | [diff] [blame] | 1472 | (IS_GEN9_BC(dev_priv) || |
Oscar Mateo | 2b2874e | 2018-04-05 17:00:52 +0300 | [diff] [blame] | 1473 | INTEL_GEN(dev_priv) >= 10 ? |
Rodrigo Vivi | b976dc5 | 2017-01-23 10:32:37 -0800 | [diff] [blame] | 1474 | GEN9_FREQ_SCALER : 1))), |
Chris Wilson | 3ebecd0 | 2013-04-12 19:10:13 +0100 | [diff] [blame] | 1475 | ((ia_freq >> 0) & 0xff) * 100, |
| 1476 | ((ia_freq >> 8) & 0xff) * 100); |
Jesse Barnes | 23b2f8b | 2011-06-28 13:04:16 -0700 | [diff] [blame] | 1477 | } |
Daniele Ceraolo Spurio | d858d56 | 2019-06-13 16:21:54 -0700 | [diff] [blame] | 1478 | intel_runtime_pm_put(&dev_priv->runtime_pm, wakeref); |
Chris Wilson | ebb5eb7 | 2019-04-26 09:17:21 +0100 | [diff] [blame] | 1479 | |
| 1480 | return 0; |
Jesse Barnes | 23b2f8b | 2011-06-28 13:04:16 -0700 | [diff] [blame] | 1481 | } |
| 1482 | |
Chris Wilson | 44834a6 | 2010-08-19 16:09:23 +0100 | [diff] [blame] | 1483 | static int i915_opregion(struct seq_file *m, void *unused) |
| 1484 | { |
David Weinehall | 36cdd01 | 2016-08-22 13:59:31 +0300 | [diff] [blame] | 1485 | struct drm_i915_private *dev_priv = node_to_i915(m->private); |
| 1486 | struct drm_device *dev = &dev_priv->drm; |
Chris Wilson | 44834a6 | 2010-08-19 16:09:23 +0100 | [diff] [blame] | 1487 | struct intel_opregion *opregion = &dev_priv->opregion; |
| 1488 | int ret; |
| 1489 | |
| 1490 | ret = mutex_lock_interruptible(&dev->struct_mutex); |
| 1491 | if (ret) |
Daniel Vetter | 0d38f00 | 2012-04-21 22:49:10 +0200 | [diff] [blame] | 1492 | goto out; |
Chris Wilson | 44834a6 | 2010-08-19 16:09:23 +0100 | [diff] [blame] | 1493 | |
Jani Nikula | 2455a8e | 2015-12-14 12:50:53 +0200 | [diff] [blame] | 1494 | if (opregion->header) |
| 1495 | seq_write(m, opregion->header, OPREGION_SIZE); |
Chris Wilson | 44834a6 | 2010-08-19 16:09:23 +0100 | [diff] [blame] | 1496 | |
| 1497 | mutex_unlock(&dev->struct_mutex); |
| 1498 | |
Daniel Vetter | 0d38f00 | 2012-04-21 22:49:10 +0200 | [diff] [blame] | 1499 | out: |
Chris Wilson | 44834a6 | 2010-08-19 16:09:23 +0100 | [diff] [blame] | 1500 | return 0; |
| 1501 | } |
| 1502 | |
Jani Nikula | ada8f95 | 2015-12-15 13:17:12 +0200 | [diff] [blame] | 1503 | static int i915_vbt(struct seq_file *m, void *unused) |
| 1504 | { |
David Weinehall | 36cdd01 | 2016-08-22 13:59:31 +0300 | [diff] [blame] | 1505 | struct intel_opregion *opregion = &node_to_i915(m->private)->opregion; |
Jani Nikula | ada8f95 | 2015-12-15 13:17:12 +0200 | [diff] [blame] | 1506 | |
| 1507 | if (opregion->vbt) |
| 1508 | seq_write(m, opregion->vbt, opregion->vbt_size); |
| 1509 | |
| 1510 | return 0; |
| 1511 | } |
| 1512 | |
Chris Wilson | 37811fc | 2010-08-25 22:45:57 +0100 | [diff] [blame] | 1513 | static int i915_gem_framebuffer_info(struct seq_file *m, void *data) |
| 1514 | { |
David Weinehall | 36cdd01 | 2016-08-22 13:59:31 +0300 | [diff] [blame] | 1515 | struct drm_i915_private *dev_priv = node_to_i915(m->private); |
| 1516 | struct drm_device *dev = &dev_priv->drm; |
Namrta Salonie | b13b840 | 2015-11-27 13:43:11 +0530 | [diff] [blame] | 1517 | struct intel_framebuffer *fbdev_fb = NULL; |
Daniel Vetter | 3a58ee1 | 2015-07-10 19:02:51 +0200 | [diff] [blame] | 1518 | struct drm_framebuffer *drm_fb; |
Chris Wilson | 188c1ab | 2016-04-03 14:14:20 +0100 | [diff] [blame] | 1519 | int ret; |
| 1520 | |
| 1521 | ret = mutex_lock_interruptible(&dev->struct_mutex); |
| 1522 | if (ret) |
| 1523 | return ret; |
Chris Wilson | 37811fc | 2010-08-25 22:45:57 +0100 | [diff] [blame] | 1524 | |
Daniel Vetter | 0695726 | 2015-08-10 13:34:08 +0200 | [diff] [blame] | 1525 | #ifdef CONFIG_DRM_FBDEV_EMULATION |
Daniel Vetter | 346fb4e | 2017-07-06 15:00:20 +0200 | [diff] [blame] | 1526 | if (dev_priv->fbdev && dev_priv->fbdev->helper.fb) { |
David Weinehall | 36cdd01 | 2016-08-22 13:59:31 +0300 | [diff] [blame] | 1527 | fbdev_fb = to_intel_framebuffer(dev_priv->fbdev->helper.fb); |
Chris Wilson | 37811fc | 2010-08-25 22:45:57 +0100 | [diff] [blame] | 1528 | |
Chris Wilson | 25bcce9 | 2016-07-02 15:36:00 +0100 | [diff] [blame] | 1529 | seq_printf(m, "fbcon size: %d x %d, depth %d, %d bpp, modifier 0x%llx, refcount %d, obj ", |
| 1530 | fbdev_fb->base.width, |
| 1531 | fbdev_fb->base.height, |
Ville Syrjälä | b00c600 | 2016-12-14 23:31:35 +0200 | [diff] [blame] | 1532 | fbdev_fb->base.format->depth, |
Ville Syrjälä | 272725c | 2016-12-14 23:32:20 +0200 | [diff] [blame] | 1533 | fbdev_fb->base.format->cpp[0] * 8, |
Ville Syrjälä | bae781b | 2016-11-16 13:33:16 +0200 | [diff] [blame] | 1534 | fbdev_fb->base.modifier, |
Chris Wilson | 25bcce9 | 2016-07-02 15:36:00 +0100 | [diff] [blame] | 1535 | drm_framebuffer_read_refcount(&fbdev_fb->base)); |
Daniel Stone | a5ff7a4 | 2018-05-18 15:30:07 +0100 | [diff] [blame] | 1536 | describe_obj(m, intel_fb_obj(&fbdev_fb->base)); |
Chris Wilson | 25bcce9 | 2016-07-02 15:36:00 +0100 | [diff] [blame] | 1537 | seq_putc(m, '\n'); |
| 1538 | } |
Daniel Vetter | 4520f53 | 2013-10-09 09:18:51 +0200 | [diff] [blame] | 1539 | #endif |
Chris Wilson | 37811fc | 2010-08-25 22:45:57 +0100 | [diff] [blame] | 1540 | |
Daniel Vetter | 4b096ac | 2012-12-10 21:19:18 +0100 | [diff] [blame] | 1541 | mutex_lock(&dev->mode_config.fb_lock); |
Daniel Vetter | 3a58ee1 | 2015-07-10 19:02:51 +0200 | [diff] [blame] | 1542 | drm_for_each_fb(drm_fb, dev) { |
Namrta Salonie | b13b840 | 2015-11-27 13:43:11 +0530 | [diff] [blame] | 1543 | struct intel_framebuffer *fb = to_intel_framebuffer(drm_fb); |
| 1544 | if (fb == fbdev_fb) |
Chris Wilson | 37811fc | 2010-08-25 22:45:57 +0100 | [diff] [blame] | 1545 | continue; |
| 1546 | |
Tvrtko Ursulin | c1ca506d | 2015-02-10 17:16:07 +0000 | [diff] [blame] | 1547 | seq_printf(m, "user size: %d x %d, depth %d, %d bpp, modifier 0x%llx, refcount %d, obj ", |
Chris Wilson | 37811fc | 2010-08-25 22:45:57 +0100 | [diff] [blame] | 1548 | fb->base.width, |
| 1549 | fb->base.height, |
Ville Syrjälä | b00c600 | 2016-12-14 23:31:35 +0200 | [diff] [blame] | 1550 | fb->base.format->depth, |
Ville Syrjälä | 272725c | 2016-12-14 23:32:20 +0200 | [diff] [blame] | 1551 | fb->base.format->cpp[0] * 8, |
Ville Syrjälä | bae781b | 2016-11-16 13:33:16 +0200 | [diff] [blame] | 1552 | fb->base.modifier, |
Dave Airlie | 747a598 | 2016-04-15 15:10:35 +1000 | [diff] [blame] | 1553 | drm_framebuffer_read_refcount(&fb->base)); |
Daniel Stone | a5ff7a4 | 2018-05-18 15:30:07 +0100 | [diff] [blame] | 1554 | describe_obj(m, intel_fb_obj(&fb->base)); |
Damien Lespiau | 267f0c9 | 2013-06-24 22:59:48 +0100 | [diff] [blame] | 1555 | seq_putc(m, '\n'); |
Chris Wilson | 37811fc | 2010-08-25 22:45:57 +0100 | [diff] [blame] | 1556 | } |
Daniel Vetter | 4b096ac | 2012-12-10 21:19:18 +0100 | [diff] [blame] | 1557 | mutex_unlock(&dev->mode_config.fb_lock); |
Chris Wilson | 188c1ab | 2016-04-03 14:14:20 +0100 | [diff] [blame] | 1558 | mutex_unlock(&dev->struct_mutex); |
Chris Wilson | 37811fc | 2010-08-25 22:45:57 +0100 | [diff] [blame] | 1559 | |
| 1560 | return 0; |
| 1561 | } |
| 1562 | |
Chris Wilson | 7e37f88 | 2016-08-02 22:50:21 +0100 | [diff] [blame] | 1563 | static void describe_ctx_ring(struct seq_file *m, struct intel_ring *ring) |
Oscar Mateo | c9fe99b | 2014-07-24 17:04:46 +0100 | [diff] [blame] | 1564 | { |
Chris Wilson | ef5032a | 2018-03-07 13:42:24 +0000 | [diff] [blame] | 1565 | seq_printf(m, " (ringbuffer, space: %d, head: %u, tail: %u, emit: %u)", |
| 1566 | ring->space, ring->head, ring->tail, ring->emit); |
Oscar Mateo | c9fe99b | 2014-07-24 17:04:46 +0100 | [diff] [blame] | 1567 | } |
| 1568 | |
Ben Widawsky | e76d363 | 2011-03-19 18:14:29 -0700 | [diff] [blame] | 1569 | static int i915_context_status(struct seq_file *m, void *unused) |
| 1570 | { |
David Weinehall | 36cdd01 | 2016-08-22 13:59:31 +0300 | [diff] [blame] | 1571 | struct drm_i915_private *dev_priv = node_to_i915(m->private); |
| 1572 | struct drm_device *dev = &dev_priv->drm; |
Chris Wilson | e2efd13 | 2016-05-24 14:53:34 +0100 | [diff] [blame] | 1573 | struct i915_gem_context *ctx; |
Dave Gordon | c3232b1 | 2016-03-23 18:19:53 +0000 | [diff] [blame] | 1574 | int ret; |
Ben Widawsky | e76d363 | 2011-03-19 18:14:29 -0700 | [diff] [blame] | 1575 | |
Daniel Vetter | f3d2887 | 2014-05-29 23:23:08 +0200 | [diff] [blame] | 1576 | ret = mutex_lock_interruptible(&dev->struct_mutex); |
Ben Widawsky | e76d363 | 2011-03-19 18:14:29 -0700 | [diff] [blame] | 1577 | if (ret) |
| 1578 | return ret; |
| 1579 | |
Chris Wilson | 829a0af | 2017-06-20 12:05:45 +0100 | [diff] [blame] | 1580 | list_for_each_entry(ctx, &dev_priv->contexts.list, link) { |
Chris Wilson | 0268444 | 2019-04-26 17:33:35 +0100 | [diff] [blame] | 1581 | struct i915_gem_engines_iter it; |
Chris Wilson | 7e3d9a5 | 2019-03-08 13:25:16 +0000 | [diff] [blame] | 1582 | struct intel_context *ce; |
| 1583 | |
Chris Wilson | 288f1ce | 2018-09-04 16:31:17 +0100 | [diff] [blame] | 1584 | seq_puts(m, "HW context "); |
| 1585 | if (!list_empty(&ctx->hw_id_link)) |
| 1586 | seq_printf(m, "%x [pin %u]", ctx->hw_id, |
| 1587 | atomic_read(&ctx->hw_id_pin_count)); |
Chris Wilson | c84455b | 2016-08-15 10:49:08 +0100 | [diff] [blame] | 1588 | if (ctx->pid) { |
Chris Wilson | d28b99a | 2016-05-24 14:53:39 +0100 | [diff] [blame] | 1589 | struct task_struct *task; |
| 1590 | |
Chris Wilson | c84455b | 2016-08-15 10:49:08 +0100 | [diff] [blame] | 1591 | task = get_pid_task(ctx->pid, PIDTYPE_PID); |
Chris Wilson | d28b99a | 2016-05-24 14:53:39 +0100 | [diff] [blame] | 1592 | if (task) { |
| 1593 | seq_printf(m, "(%s [%d]) ", |
| 1594 | task->comm, task->pid); |
| 1595 | put_task_struct(task); |
| 1596 | } |
Chris Wilson | c84455b | 2016-08-15 10:49:08 +0100 | [diff] [blame] | 1597 | } else if (IS_ERR(ctx->file_priv)) { |
| 1598 | seq_puts(m, "(deleted) "); |
Chris Wilson | d28b99a | 2016-05-24 14:53:39 +0100 | [diff] [blame] | 1599 | } else { |
| 1600 | seq_puts(m, "(kernel) "); |
| 1601 | } |
| 1602 | |
Chris Wilson | bca44d8 | 2016-05-24 14:53:41 +0100 | [diff] [blame] | 1603 | seq_putc(m, ctx->remap_slice ? 'R' : 'r'); |
| 1604 | seq_putc(m, '\n'); |
Ben Widawsky | a33afea | 2013-09-17 21:12:45 -0700 | [diff] [blame] | 1605 | |
Chris Wilson | 0268444 | 2019-04-26 17:33:35 +0100 | [diff] [blame] | 1606 | for_each_gem_engine(ce, |
| 1607 | i915_gem_context_lock_engines(ctx), it) { |
Chris Wilson | 48ae397 | 2019-08-09 19:25:17 +0100 | [diff] [blame] | 1608 | intel_context_lock_pinned(ce); |
| 1609 | if (intel_context_is_pinned(ce)) { |
| 1610 | seq_printf(m, "%s: ", ce->engine->name); |
| 1611 | if (ce->state) |
| 1612 | describe_obj(m, ce->state->obj); |
Chris Wilson | 7e37f88 | 2016-08-02 22:50:21 +0100 | [diff] [blame] | 1613 | describe_ctx_ring(m, ce->ring); |
Chris Wilson | 48ae397 | 2019-08-09 19:25:17 +0100 | [diff] [blame] | 1614 | seq_putc(m, '\n'); |
| 1615 | } |
| 1616 | intel_context_unlock_pinned(ce); |
Oscar Mateo | c9fe99b | 2014-07-24 17:04:46 +0100 | [diff] [blame] | 1617 | } |
Chris Wilson | 0268444 | 2019-04-26 17:33:35 +0100 | [diff] [blame] | 1618 | i915_gem_context_unlock_engines(ctx); |
Oscar Mateo | c9fe99b | 2014-07-24 17:04:46 +0100 | [diff] [blame] | 1619 | |
Ben Widawsky | a33afea | 2013-09-17 21:12:45 -0700 | [diff] [blame] | 1620 | seq_putc(m, '\n'); |
Ben Widawsky | a168c29 | 2013-02-14 15:05:12 -0800 | [diff] [blame] | 1621 | } |
| 1622 | |
Daniel Vetter | f3d2887 | 2014-05-29 23:23:08 +0200 | [diff] [blame] | 1623 | mutex_unlock(&dev->struct_mutex); |
Ben Widawsky | e76d363 | 2011-03-19 18:14:29 -0700 | [diff] [blame] | 1624 | |
| 1625 | return 0; |
| 1626 | } |
| 1627 | |
Daniel Vetter | ea16a3c | 2011-12-14 13:57:16 +0100 | [diff] [blame] | 1628 | static const char *swizzle_string(unsigned swizzle) |
| 1629 | { |
Damien Lespiau | aee56cf | 2013-06-24 22:59:49 +0100 | [diff] [blame] | 1630 | switch (swizzle) { |
Daniel Vetter | ea16a3c | 2011-12-14 13:57:16 +0100 | [diff] [blame] | 1631 | case I915_BIT_6_SWIZZLE_NONE: |
| 1632 | return "none"; |
| 1633 | case I915_BIT_6_SWIZZLE_9: |
| 1634 | return "bit9"; |
| 1635 | case I915_BIT_6_SWIZZLE_9_10: |
| 1636 | return "bit9/bit10"; |
| 1637 | case I915_BIT_6_SWIZZLE_9_11: |
| 1638 | return "bit9/bit11"; |
| 1639 | case I915_BIT_6_SWIZZLE_9_10_11: |
| 1640 | return "bit9/bit10/bit11"; |
| 1641 | case I915_BIT_6_SWIZZLE_9_17: |
| 1642 | return "bit9/bit17"; |
| 1643 | case I915_BIT_6_SWIZZLE_9_10_17: |
| 1644 | return "bit9/bit10/bit17"; |
| 1645 | case I915_BIT_6_SWIZZLE_UNKNOWN: |
Masanari Iida | 8a168ca | 2012-12-29 02:00:09 +0900 | [diff] [blame] | 1646 | return "unknown"; |
Daniel Vetter | ea16a3c | 2011-12-14 13:57:16 +0100 | [diff] [blame] | 1647 | } |
| 1648 | |
| 1649 | return "bug"; |
| 1650 | } |
| 1651 | |
| 1652 | static int i915_swizzle_info(struct seq_file *m, void *data) |
| 1653 | { |
David Weinehall | 36cdd01 | 2016-08-22 13:59:31 +0300 | [diff] [blame] | 1654 | struct drm_i915_private *dev_priv = node_to_i915(m->private); |
Tvrtko Ursulin | 4f5fd91 | 2019-06-11 11:45:48 +0100 | [diff] [blame] | 1655 | struct intel_uncore *uncore = &dev_priv->uncore; |
Chris Wilson | a037121 | 2019-01-14 14:21:14 +0000 | [diff] [blame] | 1656 | intel_wakeref_t wakeref; |
Daniel Vetter | ea16a3c | 2011-12-14 13:57:16 +0100 | [diff] [blame] | 1657 | |
Daniele Ceraolo Spurio | d858d56 | 2019-06-13 16:21:54 -0700 | [diff] [blame] | 1658 | wakeref = intel_runtime_pm_get(&dev_priv->runtime_pm); |
Daniel Vetter | 22bcfc6 | 2012-08-09 15:07:02 +0200 | [diff] [blame] | 1659 | |
Daniel Vetter | ea16a3c | 2011-12-14 13:57:16 +0100 | [diff] [blame] | 1660 | seq_printf(m, "bit6 swizzle for X-tiling = %s\n", |
| 1661 | swizzle_string(dev_priv->mm.bit_6_swizzle_x)); |
| 1662 | seq_printf(m, "bit6 swizzle for Y-tiling = %s\n", |
| 1663 | swizzle_string(dev_priv->mm.bit_6_swizzle_y)); |
| 1664 | |
Lucas De Marchi | f3ce44a | 2018-12-12 10:10:44 -0800 | [diff] [blame] | 1665 | if (IS_GEN_RANGE(dev_priv, 3, 4)) { |
Daniel Vetter | ea16a3c | 2011-12-14 13:57:16 +0100 | [diff] [blame] | 1666 | seq_printf(m, "DDC = 0x%08x\n", |
Tvrtko Ursulin | 4f5fd91 | 2019-06-11 11:45:48 +0100 | [diff] [blame] | 1667 | intel_uncore_read(uncore, DCC)); |
Daniel Vetter | 656bfa3 | 2014-11-20 09:26:30 +0100 | [diff] [blame] | 1668 | seq_printf(m, "DDC2 = 0x%08x\n", |
Tvrtko Ursulin | 4f5fd91 | 2019-06-11 11:45:48 +0100 | [diff] [blame] | 1669 | intel_uncore_read(uncore, DCC2)); |
Daniel Vetter | ea16a3c | 2011-12-14 13:57:16 +0100 | [diff] [blame] | 1670 | seq_printf(m, "C0DRB3 = 0x%04x\n", |
Tvrtko Ursulin | 4f5fd91 | 2019-06-11 11:45:48 +0100 | [diff] [blame] | 1671 | intel_uncore_read16(uncore, C0DRB3)); |
Daniel Vetter | ea16a3c | 2011-12-14 13:57:16 +0100 | [diff] [blame] | 1672 | seq_printf(m, "C1DRB3 = 0x%04x\n", |
Tvrtko Ursulin | 4f5fd91 | 2019-06-11 11:45:48 +0100 | [diff] [blame] | 1673 | intel_uncore_read16(uncore, C1DRB3)); |
David Weinehall | 36cdd01 | 2016-08-22 13:59:31 +0300 | [diff] [blame] | 1674 | } else if (INTEL_GEN(dev_priv) >= 6) { |
Daniel Vetter | 3fa7d23 | 2012-01-31 16:47:56 +0100 | [diff] [blame] | 1675 | seq_printf(m, "MAD_DIMM_C0 = 0x%08x\n", |
Tvrtko Ursulin | 4f5fd91 | 2019-06-11 11:45:48 +0100 | [diff] [blame] | 1676 | intel_uncore_read(uncore, MAD_DIMM_C0)); |
Daniel Vetter | 3fa7d23 | 2012-01-31 16:47:56 +0100 | [diff] [blame] | 1677 | seq_printf(m, "MAD_DIMM_C1 = 0x%08x\n", |
Tvrtko Ursulin | 4f5fd91 | 2019-06-11 11:45:48 +0100 | [diff] [blame] | 1678 | intel_uncore_read(uncore, MAD_DIMM_C1)); |
Daniel Vetter | 3fa7d23 | 2012-01-31 16:47:56 +0100 | [diff] [blame] | 1679 | seq_printf(m, "MAD_DIMM_C2 = 0x%08x\n", |
Tvrtko Ursulin | 4f5fd91 | 2019-06-11 11:45:48 +0100 | [diff] [blame] | 1680 | intel_uncore_read(uncore, MAD_DIMM_C2)); |
Daniel Vetter | 3fa7d23 | 2012-01-31 16:47:56 +0100 | [diff] [blame] | 1681 | seq_printf(m, "TILECTL = 0x%08x\n", |
Tvrtko Ursulin | 4f5fd91 | 2019-06-11 11:45:48 +0100 | [diff] [blame] | 1682 | intel_uncore_read(uncore, TILECTL)); |
David Weinehall | 36cdd01 | 2016-08-22 13:59:31 +0300 | [diff] [blame] | 1683 | if (INTEL_GEN(dev_priv) >= 8) |
Ben Widawsky | 9d3203e | 2013-11-02 21:07:14 -0700 | [diff] [blame] | 1684 | seq_printf(m, "GAMTARBMODE = 0x%08x\n", |
Tvrtko Ursulin | 4f5fd91 | 2019-06-11 11:45:48 +0100 | [diff] [blame] | 1685 | intel_uncore_read(uncore, GAMTARBMODE)); |
Ben Widawsky | 9d3203e | 2013-11-02 21:07:14 -0700 | [diff] [blame] | 1686 | else |
| 1687 | seq_printf(m, "ARB_MODE = 0x%08x\n", |
Tvrtko Ursulin | 4f5fd91 | 2019-06-11 11:45:48 +0100 | [diff] [blame] | 1688 | intel_uncore_read(uncore, ARB_MODE)); |
Daniel Vetter | 3fa7d23 | 2012-01-31 16:47:56 +0100 | [diff] [blame] | 1689 | seq_printf(m, "DISP_ARB_CTL = 0x%08x\n", |
Tvrtko Ursulin | 4f5fd91 | 2019-06-11 11:45:48 +0100 | [diff] [blame] | 1690 | intel_uncore_read(uncore, DISP_ARB_CTL)); |
Daniel Vetter | ea16a3c | 2011-12-14 13:57:16 +0100 | [diff] [blame] | 1691 | } |
Daniel Vetter | 656bfa3 | 2014-11-20 09:26:30 +0100 | [diff] [blame] | 1692 | |
| 1693 | if (dev_priv->quirks & QUIRK_PIN_SWIZZLED_PAGES) |
| 1694 | seq_puts(m, "L-shaped memory detected\n"); |
| 1695 | |
Daniele Ceraolo Spurio | d858d56 | 2019-06-13 16:21:54 -0700 | [diff] [blame] | 1696 | intel_runtime_pm_put(&dev_priv->runtime_pm, wakeref); |
Daniel Vetter | ea16a3c | 2011-12-14 13:57:16 +0100 | [diff] [blame] | 1697 | |
| 1698 | return 0; |
| 1699 | } |
| 1700 | |
Chris Wilson | 7466c29 | 2016-08-15 09:49:33 +0100 | [diff] [blame] | 1701 | static const char *rps_power_to_str(unsigned int power) |
| 1702 | { |
| 1703 | static const char * const strings[] = { |
| 1704 | [LOW_POWER] = "low power", |
| 1705 | [BETWEEN] = "mixed", |
| 1706 | [HIGH_POWER] = "high power", |
| 1707 | }; |
| 1708 | |
| 1709 | if (power >= ARRAY_SIZE(strings) || !strings[power]) |
| 1710 | return "unknown"; |
| 1711 | |
| 1712 | return strings[power]; |
| 1713 | } |
| 1714 | |
Chris Wilson | 1854d5c | 2015-04-07 16:20:32 +0100 | [diff] [blame] | 1715 | static int i915_rps_boost_info(struct seq_file *m, void *data) |
| 1716 | { |
David Weinehall | 36cdd01 | 2016-08-22 13:59:31 +0300 | [diff] [blame] | 1717 | struct drm_i915_private *dev_priv = node_to_i915(m->private); |
Sagar Arun Kamble | 562d9ba | 2017-10-10 22:30:06 +0100 | [diff] [blame] | 1718 | struct intel_rps *rps = &dev_priv->gt_pm.rps; |
Chris Wilson | c0a6aa7 | 2018-10-02 12:32:21 +0100 | [diff] [blame] | 1719 | u32 act_freq = rps->cur_freq; |
Chris Wilson | a037121 | 2019-01-14 14:21:14 +0000 | [diff] [blame] | 1720 | intel_wakeref_t wakeref; |
Chris Wilson | 1854d5c | 2015-04-07 16:20:32 +0100 | [diff] [blame] | 1721 | |
Daniele Ceraolo Spurio | c447ff7 | 2019-06-13 16:21:55 -0700 | [diff] [blame] | 1722 | with_intel_runtime_pm_if_in_use(&dev_priv->runtime_pm, wakeref) { |
Chris Wilson | c0a6aa7 | 2018-10-02 12:32:21 +0100 | [diff] [blame] | 1723 | if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) { |
Chris Wilson | 337fa6e | 2019-04-26 09:17:20 +0100 | [diff] [blame] | 1724 | vlv_punit_get(dev_priv); |
Chris Wilson | c0a6aa7 | 2018-10-02 12:32:21 +0100 | [diff] [blame] | 1725 | act_freq = vlv_punit_read(dev_priv, |
| 1726 | PUNIT_REG_GPU_FREQ_STS); |
Chris Wilson | 337fa6e | 2019-04-26 09:17:20 +0100 | [diff] [blame] | 1727 | vlv_punit_put(dev_priv); |
Chris Wilson | c0a6aa7 | 2018-10-02 12:32:21 +0100 | [diff] [blame] | 1728 | act_freq = (act_freq >> 8) & 0xff; |
Chris Wilson | c0a6aa7 | 2018-10-02 12:32:21 +0100 | [diff] [blame] | 1729 | } else { |
| 1730 | act_freq = intel_get_cagf(dev_priv, |
| 1731 | I915_READ(GEN6_RPSTAT1)); |
| 1732 | } |
Chris Wilson | c0a6aa7 | 2018-10-02 12:32:21 +0100 | [diff] [blame] | 1733 | } |
| 1734 | |
Sagar Arun Kamble | 562d9ba | 2017-10-10 22:30:06 +0100 | [diff] [blame] | 1735 | seq_printf(m, "RPS enabled? %d\n", rps->enabled); |
Chris Wilson | 79ffac85 | 2019-04-24 21:07:17 +0100 | [diff] [blame] | 1736 | seq_printf(m, "GPU busy? %s\n", yesno(dev_priv->gt.awake)); |
Chris Wilson | 7b92c1b | 2017-06-28 13:35:48 +0100 | [diff] [blame] | 1737 | seq_printf(m, "Boosts outstanding? %d\n", |
Sagar Arun Kamble | 562d9ba | 2017-10-10 22:30:06 +0100 | [diff] [blame] | 1738 | atomic_read(&rps->num_waiters)); |
Chris Wilson | 60548c5 | 2018-07-31 14:26:29 +0100 | [diff] [blame] | 1739 | seq_printf(m, "Interactive? %d\n", READ_ONCE(rps->power.interactive)); |
Chris Wilson | c0a6aa7 | 2018-10-02 12:32:21 +0100 | [diff] [blame] | 1740 | seq_printf(m, "Frequency requested %d, actual %d\n", |
| 1741 | intel_gpu_freq(dev_priv, rps->cur_freq), |
| 1742 | intel_gpu_freq(dev_priv, act_freq)); |
Chris Wilson | 7466c29 | 2016-08-15 09:49:33 +0100 | [diff] [blame] | 1743 | seq_printf(m, " min hard:%d, soft:%d; max soft:%d, hard:%d\n", |
Sagar Arun Kamble | 562d9ba | 2017-10-10 22:30:06 +0100 | [diff] [blame] | 1744 | intel_gpu_freq(dev_priv, rps->min_freq), |
| 1745 | intel_gpu_freq(dev_priv, rps->min_freq_softlimit), |
| 1746 | intel_gpu_freq(dev_priv, rps->max_freq_softlimit), |
| 1747 | intel_gpu_freq(dev_priv, rps->max_freq)); |
Chris Wilson | 7466c29 | 2016-08-15 09:49:33 +0100 | [diff] [blame] | 1748 | seq_printf(m, " idle:%d, efficient:%d, boost:%d\n", |
Sagar Arun Kamble | 562d9ba | 2017-10-10 22:30:06 +0100 | [diff] [blame] | 1749 | intel_gpu_freq(dev_priv, rps->idle_freq), |
| 1750 | intel_gpu_freq(dev_priv, rps->efficient_freq), |
| 1751 | intel_gpu_freq(dev_priv, rps->boost_freq)); |
Daniel Vetter | 1d2ac40 | 2016-04-26 19:29:41 +0200 | [diff] [blame] | 1752 | |
Chris Wilson | 62eb3c2 | 2019-02-13 09:25:04 +0000 | [diff] [blame] | 1753 | seq_printf(m, "Wait boosts: %d\n", atomic_read(&rps->boosts)); |
Chris Wilson | 1854d5c | 2015-04-07 16:20:32 +0100 | [diff] [blame] | 1754 | |
Chris Wilson | 79ffac85 | 2019-04-24 21:07:17 +0100 | [diff] [blame] | 1755 | if (INTEL_GEN(dev_priv) >= 6 && rps->enabled && dev_priv->gt.awake) { |
Chris Wilson | 7466c29 | 2016-08-15 09:49:33 +0100 | [diff] [blame] | 1756 | u32 rpup, rpupei; |
| 1757 | u32 rpdown, rpdownei; |
| 1758 | |
Daniele Ceraolo Spurio | 3ceea6a | 2019-03-19 11:35:36 -0700 | [diff] [blame] | 1759 | intel_uncore_forcewake_get(&dev_priv->uncore, FORCEWAKE_ALL); |
Chris Wilson | 7466c29 | 2016-08-15 09:49:33 +0100 | [diff] [blame] | 1760 | rpup = I915_READ_FW(GEN6_RP_CUR_UP) & GEN6_RP_EI_MASK; |
| 1761 | rpupei = I915_READ_FW(GEN6_RP_CUR_UP_EI) & GEN6_RP_EI_MASK; |
| 1762 | rpdown = I915_READ_FW(GEN6_RP_CUR_DOWN) & GEN6_RP_EI_MASK; |
| 1763 | rpdownei = I915_READ_FW(GEN6_RP_CUR_DOWN_EI) & GEN6_RP_EI_MASK; |
Daniele Ceraolo Spurio | 3ceea6a | 2019-03-19 11:35:36 -0700 | [diff] [blame] | 1764 | intel_uncore_forcewake_put(&dev_priv->uncore, FORCEWAKE_ALL); |
Chris Wilson | 7466c29 | 2016-08-15 09:49:33 +0100 | [diff] [blame] | 1765 | |
| 1766 | seq_printf(m, "\nRPS Autotuning (current \"%s\" window):\n", |
Chris Wilson | 60548c5 | 2018-07-31 14:26:29 +0100 | [diff] [blame] | 1767 | rps_power_to_str(rps->power.mode)); |
Chris Wilson | 7466c29 | 2016-08-15 09:49:33 +0100 | [diff] [blame] | 1768 | seq_printf(m, " Avg. up: %d%% [above threshold? %d%%]\n", |
Chris Wilson | 23f4a28 | 2017-02-18 11:27:08 +0000 | [diff] [blame] | 1769 | rpup && rpupei ? 100 * rpup / rpupei : 0, |
Chris Wilson | 60548c5 | 2018-07-31 14:26:29 +0100 | [diff] [blame] | 1770 | rps->power.up_threshold); |
Chris Wilson | 7466c29 | 2016-08-15 09:49:33 +0100 | [diff] [blame] | 1771 | seq_printf(m, " Avg. down: %d%% [below threshold? %d%%]\n", |
Chris Wilson | 23f4a28 | 2017-02-18 11:27:08 +0000 | [diff] [blame] | 1772 | rpdown && rpdownei ? 100 * rpdown / rpdownei : 0, |
Chris Wilson | 60548c5 | 2018-07-31 14:26:29 +0100 | [diff] [blame] | 1773 | rps->power.down_threshold); |
Chris Wilson | 7466c29 | 2016-08-15 09:49:33 +0100 | [diff] [blame] | 1774 | } else { |
| 1775 | seq_puts(m, "\nRPS Autotuning inactive\n"); |
| 1776 | } |
| 1777 | |
Chris Wilson | 8d3afd7 | 2015-05-21 21:01:47 +0100 | [diff] [blame] | 1778 | return 0; |
Chris Wilson | 1854d5c | 2015-04-07 16:20:32 +0100 | [diff] [blame] | 1779 | } |
| 1780 | |
Ben Widawsky | 63573eb | 2013-07-04 11:02:07 -0700 | [diff] [blame] | 1781 | static int i915_llc(struct seq_file *m, void *data) |
| 1782 | { |
David Weinehall | 36cdd01 | 2016-08-22 13:59:31 +0300 | [diff] [blame] | 1783 | struct drm_i915_private *dev_priv = node_to_i915(m->private); |
Mika Kuoppala | 3accaf7 | 2016-04-13 17:26:43 +0300 | [diff] [blame] | 1784 | const bool edram = INTEL_GEN(dev_priv) > 8; |
Ben Widawsky | 63573eb | 2013-07-04 11:02:07 -0700 | [diff] [blame] | 1785 | |
David Weinehall | 36cdd01 | 2016-08-22 13:59:31 +0300 | [diff] [blame] | 1786 | seq_printf(m, "LLC: %s\n", yesno(HAS_LLC(dev_priv))); |
Daniele Ceraolo Spurio | f6ac993 | 2019-03-28 10:45:32 -0700 | [diff] [blame] | 1787 | seq_printf(m, "%s: %uMB\n", edram ? "eDRAM" : "eLLC", |
| 1788 | dev_priv->edram_size_mb); |
Ben Widawsky | 63573eb | 2013-07-04 11:02:07 -0700 | [diff] [blame] | 1789 | |
| 1790 | return 0; |
| 1791 | } |
| 1792 | |
Anusha Srivatsa | 0509ead | 2017-01-18 08:05:56 -0800 | [diff] [blame] | 1793 | static int i915_huc_load_status_info(struct seq_file *m, void *data) |
| 1794 | { |
| 1795 | struct drm_i915_private *dev_priv = node_to_i915(m->private); |
Chris Wilson | a037121 | 2019-01-14 14:21:14 +0000 | [diff] [blame] | 1796 | intel_wakeref_t wakeref; |
Michal Wajdeczko | 56ffc74 | 2017-10-17 09:44:49 +0000 | [diff] [blame] | 1797 | struct drm_printer p; |
Anusha Srivatsa | 0509ead | 2017-01-18 08:05:56 -0800 | [diff] [blame] | 1798 | |
Daniele Ceraolo Spurio | 702668e | 2019-07-24 17:18:06 -0700 | [diff] [blame] | 1799 | if (!HAS_GT_UC(dev_priv)) |
Michal Wajdeczko | ab309a6 | 2017-12-15 14:36:35 +0000 | [diff] [blame] | 1800 | return -ENODEV; |
Anusha Srivatsa | 0509ead | 2017-01-18 08:05:56 -0800 | [diff] [blame] | 1801 | |
Michal Wajdeczko | 56ffc74 | 2017-10-17 09:44:49 +0000 | [diff] [blame] | 1802 | p = drm_seq_file_printer(m); |
Daniele Ceraolo Spurio | 8b5689d | 2019-07-13 11:00:12 +0100 | [diff] [blame] | 1803 | intel_uc_fw_dump(&dev_priv->gt.uc.huc.fw, &p); |
Anusha Srivatsa | 0509ead | 2017-01-18 08:05:56 -0800 | [diff] [blame] | 1804 | |
Daniele Ceraolo Spurio | c447ff7 | 2019-06-13 16:21:55 -0700 | [diff] [blame] | 1805 | with_intel_runtime_pm(&dev_priv->runtime_pm, wakeref) |
Chris Wilson | d4225a5 | 2019-01-14 14:21:23 +0000 | [diff] [blame] | 1806 | seq_printf(m, "\nHuC status 0x%08x:\n", I915_READ(HUC_STATUS2)); |
Anusha Srivatsa | 0509ead | 2017-01-18 08:05:56 -0800 | [diff] [blame] | 1807 | |
| 1808 | return 0; |
| 1809 | } |
| 1810 | |
Alex Dai | fdf5d35 | 2015-08-12 15:43:37 +0100 | [diff] [blame] | 1811 | static int i915_guc_load_status_info(struct seq_file *m, void *data) |
| 1812 | { |
David Weinehall | 36cdd01 | 2016-08-22 13:59:31 +0300 | [diff] [blame] | 1813 | struct drm_i915_private *dev_priv = node_to_i915(m->private); |
Chris Wilson | a037121 | 2019-01-14 14:21:14 +0000 | [diff] [blame] | 1814 | intel_wakeref_t wakeref; |
Michal Wajdeczko | 56ffc74 | 2017-10-17 09:44:49 +0000 | [diff] [blame] | 1815 | struct drm_printer p; |
Alex Dai | fdf5d35 | 2015-08-12 15:43:37 +0100 | [diff] [blame] | 1816 | |
Daniele Ceraolo Spurio | 702668e | 2019-07-24 17:18:06 -0700 | [diff] [blame] | 1817 | if (!HAS_GT_UC(dev_priv)) |
Michal Wajdeczko | ab309a6 | 2017-12-15 14:36:35 +0000 | [diff] [blame] | 1818 | return -ENODEV; |
Alex Dai | fdf5d35 | 2015-08-12 15:43:37 +0100 | [diff] [blame] | 1819 | |
Michal Wajdeczko | 56ffc74 | 2017-10-17 09:44:49 +0000 | [diff] [blame] | 1820 | p = drm_seq_file_printer(m); |
Daniele Ceraolo Spurio | 8b5689d | 2019-07-13 11:00:12 +0100 | [diff] [blame] | 1821 | intel_uc_fw_dump(&dev_priv->gt.uc.guc.fw, &p); |
Alex Dai | fdf5d35 | 2015-08-12 15:43:37 +0100 | [diff] [blame] | 1822 | |
Daniele Ceraolo Spurio | c447ff7 | 2019-06-13 16:21:55 -0700 | [diff] [blame] | 1823 | with_intel_runtime_pm(&dev_priv->runtime_pm, wakeref) { |
Chris Wilson | d4225a5 | 2019-01-14 14:21:23 +0000 | [diff] [blame] | 1824 | u32 tmp = I915_READ(GUC_STATUS); |
| 1825 | u32 i; |
sagar.a.kamble@intel.com | 3582ad1 | 2017-02-03 13:58:33 +0530 | [diff] [blame] | 1826 | |
Chris Wilson | d4225a5 | 2019-01-14 14:21:23 +0000 | [diff] [blame] | 1827 | seq_printf(m, "\nGuC status 0x%08x:\n", tmp); |
| 1828 | seq_printf(m, "\tBootrom status = 0x%x\n", |
| 1829 | (tmp & GS_BOOTROM_MASK) >> GS_BOOTROM_SHIFT); |
| 1830 | seq_printf(m, "\tuKernel status = 0x%x\n", |
| 1831 | (tmp & GS_UKERNEL_MASK) >> GS_UKERNEL_SHIFT); |
| 1832 | seq_printf(m, "\tMIA Core status = 0x%x\n", |
| 1833 | (tmp & GS_MIA_MASK) >> GS_MIA_SHIFT); |
| 1834 | seq_puts(m, "\nScratch registers:\n"); |
| 1835 | for (i = 0; i < 16; i++) { |
| 1836 | seq_printf(m, "\t%2d: \t0x%x\n", |
| 1837 | i, I915_READ(SOFT_SCRATCH(i))); |
| 1838 | } |
| 1839 | } |
sagar.a.kamble@intel.com | 3582ad1 | 2017-02-03 13:58:33 +0530 | [diff] [blame] | 1840 | |
Alex Dai | fdf5d35 | 2015-08-12 15:43:37 +0100 | [diff] [blame] | 1841 | return 0; |
| 1842 | } |
| 1843 | |
Michał Winiarski | 5e24e4a | 2018-03-19 10:53:44 +0100 | [diff] [blame] | 1844 | static const char * |
| 1845 | stringify_guc_log_type(enum guc_log_buffer_type type) |
| 1846 | { |
| 1847 | switch (type) { |
| 1848 | case GUC_ISR_LOG_BUFFER: |
| 1849 | return "ISR"; |
| 1850 | case GUC_DPC_LOG_BUFFER: |
| 1851 | return "DPC"; |
| 1852 | case GUC_CRASH_DUMP_LOG_BUFFER: |
| 1853 | return "CRASH"; |
| 1854 | default: |
| 1855 | MISSING_CASE(type); |
| 1856 | } |
| 1857 | |
| 1858 | return ""; |
| 1859 | } |
| 1860 | |
Akash Goel | 5aa1ee4 | 2016-10-12 21:54:36 +0530 | [diff] [blame] | 1861 | static void i915_guc_log_info(struct seq_file *m, |
| 1862 | struct drm_i915_private *dev_priv) |
| 1863 | { |
Daniele Ceraolo Spurio | 8b5689d | 2019-07-13 11:00:12 +0100 | [diff] [blame] | 1864 | struct intel_guc_log *log = &dev_priv->gt.uc.guc.log; |
Michał Winiarski | 5e24e4a | 2018-03-19 10:53:44 +0100 | [diff] [blame] | 1865 | enum guc_log_buffer_type type; |
| 1866 | |
| 1867 | if (!intel_guc_log_relay_enabled(log)) { |
| 1868 | seq_puts(m, "GuC log relay disabled\n"); |
| 1869 | return; |
| 1870 | } |
Akash Goel | 5aa1ee4 | 2016-10-12 21:54:36 +0530 | [diff] [blame] | 1871 | |
Michał Winiarski | db55799 | 2018-03-19 10:53:43 +0100 | [diff] [blame] | 1872 | seq_puts(m, "GuC logging stats:\n"); |
Akash Goel | 5aa1ee4 | 2016-10-12 21:54:36 +0530 | [diff] [blame] | 1873 | |
Michał Winiarski | 6a96be2 | 2018-03-19 10:53:42 +0100 | [diff] [blame] | 1874 | seq_printf(m, "\tRelay full count: %u\n", |
Michał Winiarski | 5e24e4a | 2018-03-19 10:53:44 +0100 | [diff] [blame] | 1875 | log->relay.full_count); |
| 1876 | |
| 1877 | for (type = GUC_ISR_LOG_BUFFER; type < GUC_MAX_LOG_BUFFER; type++) { |
| 1878 | seq_printf(m, "\t%s:\tflush count %10u, overflow count %10u\n", |
| 1879 | stringify_guc_log_type(type), |
| 1880 | log->stats[type].flush, |
| 1881 | log->stats[type].sampled_overflow); |
| 1882 | } |
Akash Goel | 5aa1ee4 | 2016-10-12 21:54:36 +0530 | [diff] [blame] | 1883 | } |
| 1884 | |
Dave Gordon | 8b417c2 | 2015-08-12 15:43:44 +0100 | [diff] [blame] | 1885 | static void i915_guc_client_info(struct seq_file *m, |
| 1886 | struct drm_i915_private *dev_priv, |
Sagar Arun Kamble | 5afc8b4 | 2017-11-16 19:02:40 +0530 | [diff] [blame] | 1887 | struct intel_guc_client *client) |
Dave Gordon | 8b417c2 | 2015-08-12 15:43:44 +0100 | [diff] [blame] | 1888 | { |
Tvrtko Ursulin | e2f8039 | 2016-03-16 11:00:36 +0000 | [diff] [blame] | 1889 | struct intel_engine_cs *engine; |
Jani Nikula | e531521 | 2019-01-16 11:15:23 +0200 | [diff] [blame] | 1890 | u64 tot = 0; |
Dave Gordon | 8b417c2 | 2015-08-12 15:43:44 +0100 | [diff] [blame] | 1891 | |
Oscar Mateo | b09935a | 2017-03-22 10:39:53 -0700 | [diff] [blame] | 1892 | seq_printf(m, "\tPriority %d, GuC stage index: %u, PD offset 0x%x\n", |
| 1893 | client->priority, client->stage_id, client->proc_desc_offset); |
Michał Winiarski | 59db36c | 2017-09-14 12:51:23 +0200 | [diff] [blame] | 1894 | seq_printf(m, "\tDoorbell id %d, offset: 0x%lx\n", |
| 1895 | client->doorbell_id, client->doorbell_offset); |
Dave Gordon | 8b417c2 | 2015-08-12 15:43:44 +0100 | [diff] [blame] | 1896 | |
Chris Wilson | 750e76b | 2019-08-06 13:43:00 +0100 | [diff] [blame] | 1897 | for_each_uabi_engine(engine, dev_priv) { |
| 1898 | u64 submissions = client->submissions[engine->guc_id]; |
Dave Gordon | c18468c | 2016-08-09 15:19:22 +0100 | [diff] [blame] | 1899 | tot += submissions; |
Dave Gordon | 8b417c2 | 2015-08-12 15:43:44 +0100 | [diff] [blame] | 1900 | seq_printf(m, "\tSubmissions: %llu %s\n", |
Dave Gordon | c18468c | 2016-08-09 15:19:22 +0100 | [diff] [blame] | 1901 | submissions, engine->name); |
Dave Gordon | 8b417c2 | 2015-08-12 15:43:44 +0100 | [diff] [blame] | 1902 | } |
| 1903 | seq_printf(m, "\tTotal: %llu\n", tot); |
| 1904 | } |
| 1905 | |
| 1906 | static int i915_guc_info(struct seq_file *m, void *data) |
| 1907 | { |
David Weinehall | 36cdd01 | 2016-08-22 13:59:31 +0300 | [diff] [blame] | 1908 | struct drm_i915_private *dev_priv = node_to_i915(m->private); |
Daniele Ceraolo Spurio | 8b5689d | 2019-07-13 11:00:12 +0100 | [diff] [blame] | 1909 | const struct intel_guc *guc = &dev_priv->gt.uc.guc; |
Dave Gordon | 8b417c2 | 2015-08-12 15:43:44 +0100 | [diff] [blame] | 1910 | |
Michał Winiarski | db55799 | 2018-03-19 10:53:43 +0100 | [diff] [blame] | 1911 | if (!USES_GUC(dev_priv)) |
Michal Wajdeczko | ab309a6 | 2017-12-15 14:36:35 +0000 | [diff] [blame] | 1912 | return -ENODEV; |
| 1913 | |
Michał Winiarski | db55799 | 2018-03-19 10:53:43 +0100 | [diff] [blame] | 1914 | i915_guc_log_info(m, dev_priv); |
| 1915 | |
| 1916 | if (!USES_GUC_SUBMISSION(dev_priv)) |
| 1917 | return 0; |
| 1918 | |
Michal Wajdeczko | ab309a6 | 2017-12-15 14:36:35 +0000 | [diff] [blame] | 1919 | GEM_BUG_ON(!guc->execbuf_client); |
Dave Gordon | 8b417c2 | 2015-08-12 15:43:44 +0100 | [diff] [blame] | 1920 | |
Michał Winiarski | db55799 | 2018-03-19 10:53:43 +0100 | [diff] [blame] | 1921 | seq_printf(m, "\nDoorbell map:\n"); |
Joonas Lahtinen | abddffd | 2017-03-22 10:39:44 -0700 | [diff] [blame] | 1922 | seq_printf(m, "\t%*pb\n", GUC_NUM_DOORBELLS, guc->doorbell_bitmap); |
Michał Winiarski | db55799 | 2018-03-19 10:53:43 +0100 | [diff] [blame] | 1923 | seq_printf(m, "Doorbell next cacheline: 0x%x\n", guc->db_cacheline); |
Dave Gordon | 9636f6d | 2016-06-13 17:57:28 +0100 | [diff] [blame] | 1924 | |
Chris Wilson | 334636c | 2016-11-29 12:10:20 +0000 | [diff] [blame] | 1925 | seq_printf(m, "\nGuC execbuf client @ %p:\n", guc->execbuf_client); |
| 1926 | i915_guc_client_info(m, dev_priv, guc->execbuf_client); |
Dave Gordon | 8b417c2 | 2015-08-12 15:43:44 +0100 | [diff] [blame] | 1927 | |
| 1928 | /* Add more as required ... */ |
| 1929 | |
| 1930 | return 0; |
| 1931 | } |
| 1932 | |
Oscar Mateo | a8b9370 | 2017-05-10 15:04:51 +0000 | [diff] [blame] | 1933 | static int i915_guc_stage_pool(struct seq_file *m, void *data) |
Alex Dai | 4c7e77f | 2015-08-12 15:43:40 +0100 | [diff] [blame] | 1934 | { |
David Weinehall | 36cdd01 | 2016-08-22 13:59:31 +0300 | [diff] [blame] | 1935 | struct drm_i915_private *dev_priv = node_to_i915(m->private); |
Daniele Ceraolo Spurio | 8b5689d | 2019-07-13 11:00:12 +0100 | [diff] [blame] | 1936 | const struct intel_guc *guc = &dev_priv->gt.uc.guc; |
Oscar Mateo | a8b9370 | 2017-05-10 15:04:51 +0000 | [diff] [blame] | 1937 | struct guc_stage_desc *desc = guc->stage_desc_pool_vaddr; |
Oscar Mateo | a8b9370 | 2017-05-10 15:04:51 +0000 | [diff] [blame] | 1938 | int index; |
Alex Dai | 4c7e77f | 2015-08-12 15:43:40 +0100 | [diff] [blame] | 1939 | |
Michal Wajdeczko | ab309a6 | 2017-12-15 14:36:35 +0000 | [diff] [blame] | 1940 | if (!USES_GUC_SUBMISSION(dev_priv)) |
| 1941 | return -ENODEV; |
Alex Dai | 4c7e77f | 2015-08-12 15:43:40 +0100 | [diff] [blame] | 1942 | |
Oscar Mateo | a8b9370 | 2017-05-10 15:04:51 +0000 | [diff] [blame] | 1943 | for (index = 0; index < GUC_MAX_STAGE_DESCRIPTORS; index++, desc++) { |
| 1944 | struct intel_engine_cs *engine; |
Alex Dai | 4c7e77f | 2015-08-12 15:43:40 +0100 | [diff] [blame] | 1945 | |
Oscar Mateo | a8b9370 | 2017-05-10 15:04:51 +0000 | [diff] [blame] | 1946 | if (!(desc->attribute & GUC_STAGE_DESC_ATTR_ACTIVE)) |
| 1947 | continue; |
Alex Dai | 4c7e77f | 2015-08-12 15:43:40 +0100 | [diff] [blame] | 1948 | |
Oscar Mateo | a8b9370 | 2017-05-10 15:04:51 +0000 | [diff] [blame] | 1949 | seq_printf(m, "GuC stage descriptor %u:\n", index); |
| 1950 | seq_printf(m, "\tIndex: %u\n", desc->stage_id); |
| 1951 | seq_printf(m, "\tAttribute: 0x%x\n", desc->attribute); |
| 1952 | seq_printf(m, "\tPriority: %d\n", desc->priority); |
| 1953 | seq_printf(m, "\tDoorbell id: %d\n", desc->db_id); |
| 1954 | seq_printf(m, "\tEngines used: 0x%x\n", |
| 1955 | desc->engines_used); |
| 1956 | seq_printf(m, "\tDoorbell trigger phy: 0x%llx, cpu: 0x%llx, uK: 0x%x\n", |
| 1957 | desc->db_trigger_phy, |
| 1958 | desc->db_trigger_cpu, |
| 1959 | desc->db_trigger_uk); |
| 1960 | seq_printf(m, "\tProcess descriptor: 0x%x\n", |
| 1961 | desc->process_desc); |
Colin Ian King | 9a09485 | 2017-05-16 10:22:35 +0100 | [diff] [blame] | 1962 | seq_printf(m, "\tWorkqueue address: 0x%x, size: 0x%x\n", |
Oscar Mateo | a8b9370 | 2017-05-10 15:04:51 +0000 | [diff] [blame] | 1963 | desc->wq_addr, desc->wq_size); |
| 1964 | seq_putc(m, '\n'); |
| 1965 | |
Chris Wilson | 750e76b | 2019-08-06 13:43:00 +0100 | [diff] [blame] | 1966 | for_each_uabi_engine(engine, dev_priv) { |
Oscar Mateo | a8b9370 | 2017-05-10 15:04:51 +0000 | [diff] [blame] | 1967 | u32 guc_engine_id = engine->guc_id; |
| 1968 | struct guc_execlist_context *lrc = |
| 1969 | &desc->lrc[guc_engine_id]; |
| 1970 | |
| 1971 | seq_printf(m, "\t%s LRC:\n", engine->name); |
| 1972 | seq_printf(m, "\t\tContext desc: 0x%x\n", |
| 1973 | lrc->context_desc); |
| 1974 | seq_printf(m, "\t\tContext id: 0x%x\n", lrc->context_id); |
| 1975 | seq_printf(m, "\t\tLRCA: 0x%x\n", lrc->ring_lrca); |
| 1976 | seq_printf(m, "\t\tRing begin: 0x%x\n", lrc->ring_begin); |
| 1977 | seq_printf(m, "\t\tRing end: 0x%x\n", lrc->ring_end); |
| 1978 | seq_putc(m, '\n'); |
| 1979 | } |
Alex Dai | 4c7e77f | 2015-08-12 15:43:40 +0100 | [diff] [blame] | 1980 | } |
| 1981 | |
Oscar Mateo | a8b9370 | 2017-05-10 15:04:51 +0000 | [diff] [blame] | 1982 | return 0; |
| 1983 | } |
| 1984 | |
Alex Dai | 4c7e77f | 2015-08-12 15:43:40 +0100 | [diff] [blame] | 1985 | static int i915_guc_log_dump(struct seq_file *m, void *data) |
| 1986 | { |
Daniele Ceraolo Spurio | ac58d2a | 2017-05-22 10:50:28 -0700 | [diff] [blame] | 1987 | struct drm_info_node *node = m->private; |
| 1988 | struct drm_i915_private *dev_priv = node_to_i915(node); |
| 1989 | bool dump_load_err = !!node->info_ent->data; |
| 1990 | struct drm_i915_gem_object *obj = NULL; |
| 1991 | u32 *log; |
| 1992 | int i = 0; |
Alex Dai | 4c7e77f | 2015-08-12 15:43:40 +0100 | [diff] [blame] | 1993 | |
Daniele Ceraolo Spurio | 702668e | 2019-07-24 17:18:06 -0700 | [diff] [blame] | 1994 | if (!HAS_GT_UC(dev_priv)) |
Michal Wajdeczko | ab309a6 | 2017-12-15 14:36:35 +0000 | [diff] [blame] | 1995 | return -ENODEV; |
| 1996 | |
Daniele Ceraolo Spurio | ac58d2a | 2017-05-22 10:50:28 -0700 | [diff] [blame] | 1997 | if (dump_load_err) |
Michal Wajdeczko | 32ff76e8 | 2019-08-02 18:40:53 +0000 | [diff] [blame] | 1998 | obj = dev_priv->gt.uc.load_err_log; |
Daniele Ceraolo Spurio | 8b5689d | 2019-07-13 11:00:12 +0100 | [diff] [blame] | 1999 | else if (dev_priv->gt.uc.guc.log.vma) |
| 2000 | obj = dev_priv->gt.uc.guc.log.vma->obj; |
Daniele Ceraolo Spurio | ac58d2a | 2017-05-22 10:50:28 -0700 | [diff] [blame] | 2001 | |
| 2002 | if (!obj) |
Alex Dai | 4c7e77f | 2015-08-12 15:43:40 +0100 | [diff] [blame] | 2003 | return 0; |
| 2004 | |
Daniele Ceraolo Spurio | ac58d2a | 2017-05-22 10:50:28 -0700 | [diff] [blame] | 2005 | log = i915_gem_object_pin_map(obj, I915_MAP_WC); |
| 2006 | if (IS_ERR(log)) { |
| 2007 | DRM_DEBUG("Failed to pin object\n"); |
| 2008 | seq_puts(m, "(log data unaccessible)\n"); |
| 2009 | return PTR_ERR(log); |
Alex Dai | 4c7e77f | 2015-08-12 15:43:40 +0100 | [diff] [blame] | 2010 | } |
| 2011 | |
Daniele Ceraolo Spurio | ac58d2a | 2017-05-22 10:50:28 -0700 | [diff] [blame] | 2012 | for (i = 0; i < obj->base.size / sizeof(u32); i += 4) |
| 2013 | seq_printf(m, "0x%08x 0x%08x 0x%08x 0x%08x\n", |
| 2014 | *(log + i), *(log + i + 1), |
| 2015 | *(log + i + 2), *(log + i + 3)); |
| 2016 | |
Alex Dai | 4c7e77f | 2015-08-12 15:43:40 +0100 | [diff] [blame] | 2017 | seq_putc(m, '\n'); |
| 2018 | |
Daniele Ceraolo Spurio | ac58d2a | 2017-05-22 10:50:28 -0700 | [diff] [blame] | 2019 | i915_gem_object_unpin_map(obj); |
| 2020 | |
Alex Dai | 4c7e77f | 2015-08-12 15:43:40 +0100 | [diff] [blame] | 2021 | return 0; |
| 2022 | } |
| 2023 | |
Michał Winiarski | 4977a28 | 2018-03-19 10:53:40 +0100 | [diff] [blame] | 2024 | static int i915_guc_log_level_get(void *data, u64 *val) |
Sagar Arun Kamble | 685534e | 2016-10-12 21:54:41 +0530 | [diff] [blame] | 2025 | { |
Chris Wilson | bcc36d8 | 2017-04-07 20:42:20 +0100 | [diff] [blame] | 2026 | struct drm_i915_private *dev_priv = data; |
Sagar Arun Kamble | 685534e | 2016-10-12 21:54:41 +0530 | [diff] [blame] | 2027 | |
Michał Winiarski | 86aa824 | 2018-03-08 16:46:53 +0100 | [diff] [blame] | 2028 | if (!USES_GUC(dev_priv)) |
Michal Wajdeczko | ab309a6 | 2017-12-15 14:36:35 +0000 | [diff] [blame] | 2029 | return -ENODEV; |
| 2030 | |
Daniele Ceraolo Spurio | 8b5689d | 2019-07-13 11:00:12 +0100 | [diff] [blame] | 2031 | *val = intel_guc_log_get_level(&dev_priv->gt.uc.guc.log); |
Sagar Arun Kamble | 685534e | 2016-10-12 21:54:41 +0530 | [diff] [blame] | 2032 | |
| 2033 | return 0; |
| 2034 | } |
| 2035 | |
Michał Winiarski | 4977a28 | 2018-03-19 10:53:40 +0100 | [diff] [blame] | 2036 | static int i915_guc_log_level_set(void *data, u64 val) |
Sagar Arun Kamble | 685534e | 2016-10-12 21:54:41 +0530 | [diff] [blame] | 2037 | { |
Chris Wilson | bcc36d8 | 2017-04-07 20:42:20 +0100 | [diff] [blame] | 2038 | struct drm_i915_private *dev_priv = data; |
Sagar Arun Kamble | 685534e | 2016-10-12 21:54:41 +0530 | [diff] [blame] | 2039 | |
Michał Winiarski | 86aa824 | 2018-03-08 16:46:53 +0100 | [diff] [blame] | 2040 | if (!USES_GUC(dev_priv)) |
Michal Wajdeczko | ab309a6 | 2017-12-15 14:36:35 +0000 | [diff] [blame] | 2041 | return -ENODEV; |
| 2042 | |
Daniele Ceraolo Spurio | 8b5689d | 2019-07-13 11:00:12 +0100 | [diff] [blame] | 2043 | return intel_guc_log_set_level(&dev_priv->gt.uc.guc.log, val); |
Sagar Arun Kamble | 685534e | 2016-10-12 21:54:41 +0530 | [diff] [blame] | 2044 | } |
| 2045 | |
Michał Winiarski | 4977a28 | 2018-03-19 10:53:40 +0100 | [diff] [blame] | 2046 | DEFINE_SIMPLE_ATTRIBUTE(i915_guc_log_level_fops, |
| 2047 | i915_guc_log_level_get, i915_guc_log_level_set, |
Sagar Arun Kamble | 685534e | 2016-10-12 21:54:41 +0530 | [diff] [blame] | 2048 | "%lld\n"); |
| 2049 | |
Michał Winiarski | 4977a28 | 2018-03-19 10:53:40 +0100 | [diff] [blame] | 2050 | static int i915_guc_log_relay_open(struct inode *inode, struct file *file) |
| 2051 | { |
| 2052 | struct drm_i915_private *dev_priv = inode->i_private; |
| 2053 | |
| 2054 | if (!USES_GUC(dev_priv)) |
| 2055 | return -ENODEV; |
| 2056 | |
Daniele Ceraolo Spurio | 8b5689d | 2019-07-13 11:00:12 +0100 | [diff] [blame] | 2057 | file->private_data = &dev_priv->gt.uc.guc.log; |
Michał Winiarski | 4977a28 | 2018-03-19 10:53:40 +0100 | [diff] [blame] | 2058 | |
Daniele Ceraolo Spurio | 8b5689d | 2019-07-13 11:00:12 +0100 | [diff] [blame] | 2059 | return intel_guc_log_relay_open(&dev_priv->gt.uc.guc.log); |
Michał Winiarski | 4977a28 | 2018-03-19 10:53:40 +0100 | [diff] [blame] | 2060 | } |
| 2061 | |
| 2062 | static ssize_t |
| 2063 | i915_guc_log_relay_write(struct file *filp, |
| 2064 | const char __user *ubuf, |
| 2065 | size_t cnt, |
| 2066 | loff_t *ppos) |
| 2067 | { |
| 2068 | struct intel_guc_log *log = filp->private_data; |
| 2069 | |
| 2070 | intel_guc_log_relay_flush(log); |
| 2071 | |
| 2072 | return cnt; |
| 2073 | } |
| 2074 | |
| 2075 | static int i915_guc_log_relay_release(struct inode *inode, struct file *file) |
| 2076 | { |
| 2077 | struct drm_i915_private *dev_priv = inode->i_private; |
| 2078 | |
Daniele Ceraolo Spurio | 8b5689d | 2019-07-13 11:00:12 +0100 | [diff] [blame] | 2079 | intel_guc_log_relay_close(&dev_priv->gt.uc.guc.log); |
Michał Winiarski | 4977a28 | 2018-03-19 10:53:40 +0100 | [diff] [blame] | 2080 | |
| 2081 | return 0; |
| 2082 | } |
| 2083 | |
| 2084 | static const struct file_operations i915_guc_log_relay_fops = { |
| 2085 | .owner = THIS_MODULE, |
| 2086 | .open = i915_guc_log_relay_open, |
| 2087 | .write = i915_guc_log_relay_write, |
| 2088 | .release = i915_guc_log_relay_release, |
| 2089 | }; |
| 2090 | |
Dhinakaran Pandiyan | 5b7b308 | 2018-07-04 17:31:21 -0700 | [diff] [blame] | 2091 | static int i915_psr_sink_status_show(struct seq_file *m, void *data) |
| 2092 | { |
| 2093 | u8 val; |
| 2094 | static const char * const sink_status[] = { |
| 2095 | "inactive", |
| 2096 | "transition to active, capture and display", |
| 2097 | "active, display from RFB", |
| 2098 | "active, capture and display on sink device timings", |
| 2099 | "transition to inactive, capture and display, timing re-sync", |
| 2100 | "reserved", |
| 2101 | "reserved", |
| 2102 | "sink internal error", |
| 2103 | }; |
| 2104 | struct drm_connector *connector = m->private; |
Rodrigo Vivi | 7a72c78 | 2018-07-19 17:31:55 -0700 | [diff] [blame] | 2105 | struct drm_i915_private *dev_priv = to_i915(connector->dev); |
Dhinakaran Pandiyan | 5b7b308 | 2018-07-04 17:31:21 -0700 | [diff] [blame] | 2106 | struct intel_dp *intel_dp = |
| 2107 | enc_to_intel_dp(&intel_attached_encoder(connector)->base); |
Rodrigo Vivi | 7a72c78 | 2018-07-19 17:31:55 -0700 | [diff] [blame] | 2108 | int ret; |
| 2109 | |
| 2110 | if (!CAN_PSR(dev_priv)) { |
| 2111 | seq_puts(m, "PSR Unsupported\n"); |
| 2112 | return -ENODEV; |
| 2113 | } |
Dhinakaran Pandiyan | 5b7b308 | 2018-07-04 17:31:21 -0700 | [diff] [blame] | 2114 | |
| 2115 | if (connector->status != connector_status_connected) |
| 2116 | return -ENODEV; |
| 2117 | |
Rodrigo Vivi | 7a72c78 | 2018-07-19 17:31:55 -0700 | [diff] [blame] | 2118 | ret = drm_dp_dpcd_readb(&intel_dp->aux, DP_PSR_STATUS, &val); |
| 2119 | |
| 2120 | if (ret == 1) { |
Dhinakaran Pandiyan | 5b7b308 | 2018-07-04 17:31:21 -0700 | [diff] [blame] | 2121 | const char *str = "unknown"; |
| 2122 | |
| 2123 | val &= DP_PSR_SINK_STATE_MASK; |
| 2124 | if (val < ARRAY_SIZE(sink_status)) |
| 2125 | str = sink_status[val]; |
| 2126 | seq_printf(m, "Sink PSR status: 0x%x [%s]\n", val, str); |
| 2127 | } else { |
Rodrigo Vivi | 7a72c78 | 2018-07-19 17:31:55 -0700 | [diff] [blame] | 2128 | return ret; |
Dhinakaran Pandiyan | 5b7b308 | 2018-07-04 17:31:21 -0700 | [diff] [blame] | 2129 | } |
| 2130 | |
| 2131 | return 0; |
| 2132 | } |
| 2133 | DEFINE_SHOW_ATTRIBUTE(i915_psr_sink_status); |
| 2134 | |
Vathsala Nagaraju | 00b0629 | 2018-06-27 13:38:30 +0530 | [diff] [blame] | 2135 | static void |
| 2136 | psr_source_status(struct drm_i915_private *dev_priv, struct seq_file *m) |
Chris Wilson | b86bef20 | 2017-01-16 13:06:21 +0000 | [diff] [blame] | 2137 | { |
José Roberto de Souza | 47c6cd5 | 2019-01-17 12:55:46 -0800 | [diff] [blame] | 2138 | u32 val, status_val; |
| 2139 | const char *status = "unknown"; |
Chris Wilson | b86bef20 | 2017-01-16 13:06:21 +0000 | [diff] [blame] | 2140 | |
Vathsala Nagaraju | 00b0629 | 2018-06-27 13:38:30 +0530 | [diff] [blame] | 2141 | if (dev_priv->psr.psr2_enabled) { |
| 2142 | static const char * const live_status[] = { |
| 2143 | "IDLE", |
| 2144 | "CAPTURE", |
| 2145 | "CAPTURE_FS", |
| 2146 | "SLEEP", |
| 2147 | "BUFON_FW", |
| 2148 | "ML_UP", |
| 2149 | "SU_STANDBY", |
| 2150 | "FAST_SLEEP", |
| 2151 | "DEEP_SLEEP", |
| 2152 | "BUF_ON", |
| 2153 | "TG_ON" |
| 2154 | }; |
José Roberto de Souza | 47c6cd5 | 2019-01-17 12:55:46 -0800 | [diff] [blame] | 2155 | val = I915_READ(EDP_PSR2_STATUS); |
| 2156 | status_val = (val & EDP_PSR2_STATUS_STATE_MASK) >> |
| 2157 | EDP_PSR2_STATUS_STATE_SHIFT; |
| 2158 | if (status_val < ARRAY_SIZE(live_status)) |
| 2159 | status = live_status[status_val]; |
Vathsala Nagaraju | 00b0629 | 2018-06-27 13:38:30 +0530 | [diff] [blame] | 2160 | } else { |
| 2161 | static const char * const live_status[] = { |
| 2162 | "IDLE", |
| 2163 | "SRDONACK", |
| 2164 | "SRDENT", |
| 2165 | "BUFOFF", |
| 2166 | "BUFON", |
| 2167 | "AUXACK", |
| 2168 | "SRDOFFACK", |
| 2169 | "SRDENT_ON", |
| 2170 | }; |
José Roberto de Souza | 47c6cd5 | 2019-01-17 12:55:46 -0800 | [diff] [blame] | 2171 | val = I915_READ(EDP_PSR_STATUS); |
| 2172 | status_val = (val & EDP_PSR_STATUS_STATE_MASK) >> |
| 2173 | EDP_PSR_STATUS_STATE_SHIFT; |
| 2174 | if (status_val < ARRAY_SIZE(live_status)) |
| 2175 | status = live_status[status_val]; |
Vathsala Nagaraju | 00b0629 | 2018-06-27 13:38:30 +0530 | [diff] [blame] | 2176 | } |
Chris Wilson | b86bef20 | 2017-01-16 13:06:21 +0000 | [diff] [blame] | 2177 | |
José Roberto de Souza | 47c6cd5 | 2019-01-17 12:55:46 -0800 | [diff] [blame] | 2178 | seq_printf(m, "Source PSR status: %s [0x%08x]\n", status, val); |
Chris Wilson | b86bef20 | 2017-01-16 13:06:21 +0000 | [diff] [blame] | 2179 | } |
| 2180 | |
Rodrigo Vivi | e91fd8c | 2013-07-11 18:44:59 -0300 | [diff] [blame] | 2181 | static int i915_edp_psr_status(struct seq_file *m, void *data) |
| 2182 | { |
David Weinehall | 36cdd01 | 2016-08-22 13:59:31 +0300 | [diff] [blame] | 2183 | struct drm_i915_private *dev_priv = node_to_i915(m->private); |
José Roberto de Souza | 47c6cd5 | 2019-01-17 12:55:46 -0800 | [diff] [blame] | 2184 | struct i915_psr *psr = &dev_priv->psr; |
Chris Wilson | a037121 | 2019-01-14 14:21:14 +0000 | [diff] [blame] | 2185 | intel_wakeref_t wakeref; |
José Roberto de Souza | 47c6cd5 | 2019-01-17 12:55:46 -0800 | [diff] [blame] | 2186 | const char *status; |
| 2187 | bool enabled; |
| 2188 | u32 val; |
Rodrigo Vivi | e91fd8c | 2013-07-11 18:44:59 -0300 | [diff] [blame] | 2189 | |
Michal Wajdeczko | ab309a6 | 2017-12-15 14:36:35 +0000 | [diff] [blame] | 2190 | if (!HAS_PSR(dev_priv)) |
| 2191 | return -ENODEV; |
Damien Lespiau | 3553a8e | 2015-03-09 14:17:58 +0000 | [diff] [blame] | 2192 | |
José Roberto de Souza | 47c6cd5 | 2019-01-17 12:55:46 -0800 | [diff] [blame] | 2193 | seq_printf(m, "Sink support: %s", yesno(psr->sink_support)); |
| 2194 | if (psr->dp) |
| 2195 | seq_printf(m, " [0x%02x]", psr->dp->psr_dpcd[0]); |
| 2196 | seq_puts(m, "\n"); |
| 2197 | |
| 2198 | if (!psr->sink_support) |
Dhinakaran Pandiyan | c9ef291 | 2018-01-03 13:38:24 -0800 | [diff] [blame] | 2199 | return 0; |
| 2200 | |
Daniele Ceraolo Spurio | d858d56 | 2019-06-13 16:21:54 -0700 | [diff] [blame] | 2201 | wakeref = intel_runtime_pm_get(&dev_priv->runtime_pm); |
José Roberto de Souza | 47c6cd5 | 2019-01-17 12:55:46 -0800 | [diff] [blame] | 2202 | mutex_lock(&psr->lock); |
Paulo Zanoni | c8c8fb3 | 2013-11-27 18:21:54 -0200 | [diff] [blame] | 2203 | |
José Roberto de Souza | 47c6cd5 | 2019-01-17 12:55:46 -0800 | [diff] [blame] | 2204 | if (psr->enabled) |
| 2205 | status = psr->psr2_enabled ? "PSR2 enabled" : "PSR1 enabled"; |
Dhinakaran Pandiyan | ce3508f | 2018-05-11 16:00:59 -0700 | [diff] [blame] | 2206 | else |
José Roberto de Souza | 47c6cd5 | 2019-01-17 12:55:46 -0800 | [diff] [blame] | 2207 | status = "disabled"; |
| 2208 | seq_printf(m, "PSR mode: %s\n", status); |
Rodrigo Vivi | 60e5ffe | 2016-02-01 12:02:07 -0800 | [diff] [blame] | 2209 | |
José Roberto de Souza | 47c6cd5 | 2019-01-17 12:55:46 -0800 | [diff] [blame] | 2210 | if (!psr->enabled) |
| 2211 | goto unlock; |
Rodrigo Vivi | 60e5ffe | 2016-02-01 12:02:07 -0800 | [diff] [blame] | 2212 | |
José Roberto de Souza | 47c6cd5 | 2019-01-17 12:55:46 -0800 | [diff] [blame] | 2213 | if (psr->psr2_enabled) { |
| 2214 | val = I915_READ(EDP_PSR2_CTL); |
| 2215 | enabled = val & EDP_PSR2_ENABLE; |
| 2216 | } else { |
| 2217 | val = I915_READ(EDP_PSR_CTL); |
| 2218 | enabled = val & EDP_PSR_ENABLE; |
| 2219 | } |
| 2220 | seq_printf(m, "Source PSR ctl: %s [0x%08x]\n", |
| 2221 | enableddisabled(enabled), val); |
| 2222 | psr_source_status(dev_priv, m); |
| 2223 | seq_printf(m, "Busy frontbuffer bits: 0x%08x\n", |
| 2224 | psr->busy_frontbuffer_bits); |
Rodrigo Vivi | a6cbdb8 | 2014-11-14 08:52:40 -0800 | [diff] [blame] | 2225 | |
Rodrigo Vivi | 05eec3c | 2015-11-23 14:16:40 -0800 | [diff] [blame] | 2226 | /* |
Rodrigo Vivi | 05eec3c | 2015-11-23 14:16:40 -0800 | [diff] [blame] | 2227 | * SKL+ Perf counter is reset to 0 everytime DC state is entered |
| 2228 | */ |
David Weinehall | 36cdd01 | 2016-08-22 13:59:31 +0300 | [diff] [blame] | 2229 | if (IS_HASWELL(dev_priv) || IS_BROADWELL(dev_priv)) { |
José Roberto de Souza | 47c6cd5 | 2019-01-17 12:55:46 -0800 | [diff] [blame] | 2230 | val = I915_READ(EDP_PSR_PERF_CNT) & EDP_PSR_PERF_CNT_MASK; |
| 2231 | seq_printf(m, "Performance counter: %u\n", val); |
Rodrigo Vivi | a6cbdb8 | 2014-11-14 08:52:40 -0800 | [diff] [blame] | 2232 | } |
Nagaraju, Vathsala | 6ba1f9e | 2017-01-06 22:02:32 +0530 | [diff] [blame] | 2233 | |
José Roberto de Souza | 47c6cd5 | 2019-01-17 12:55:46 -0800 | [diff] [blame] | 2234 | if (psr->debug & I915_PSR_DEBUG_IRQ) { |
Dhinakaran Pandiyan | 3f983e54 | 2018-04-03 14:24:20 -0700 | [diff] [blame] | 2235 | seq_printf(m, "Last attempted entry at: %lld\n", |
José Roberto de Souza | 47c6cd5 | 2019-01-17 12:55:46 -0800 | [diff] [blame] | 2236 | psr->last_entry_attempt); |
| 2237 | seq_printf(m, "Last exit at: %lld\n", psr->last_exit); |
Dhinakaran Pandiyan | 3f983e54 | 2018-04-03 14:24:20 -0700 | [diff] [blame] | 2238 | } |
| 2239 | |
José Roberto de Souza | a81f781 | 2019-01-17 12:55:48 -0800 | [diff] [blame] | 2240 | if (psr->psr2_enabled) { |
| 2241 | u32 su_frames_val[3]; |
| 2242 | int frame; |
| 2243 | |
| 2244 | /* |
| 2245 | * Reading all 3 registers before hand to minimize crossing a |
| 2246 | * frame boundary between register reads |
| 2247 | */ |
| 2248 | for (frame = 0; frame < PSR2_SU_STATUS_FRAMES; frame += 3) |
| 2249 | su_frames_val[frame / 3] = I915_READ(PSR2_SU_STATUS(frame)); |
| 2250 | |
| 2251 | seq_puts(m, "Frame:\tPSR2 SU blocks:\n"); |
| 2252 | |
| 2253 | for (frame = 0; frame < PSR2_SU_STATUS_FRAMES; frame++) { |
| 2254 | u32 su_blocks; |
| 2255 | |
| 2256 | su_blocks = su_frames_val[frame / 3] & |
| 2257 | PSR2_SU_STATUS_MASK(frame); |
| 2258 | su_blocks = su_blocks >> PSR2_SU_STATUS_SHIFT(frame); |
| 2259 | seq_printf(m, "%d\t%d\n", frame, su_blocks); |
| 2260 | } |
| 2261 | } |
| 2262 | |
José Roberto de Souza | 47c6cd5 | 2019-01-17 12:55:46 -0800 | [diff] [blame] | 2263 | unlock: |
| 2264 | mutex_unlock(&psr->lock); |
Daniele Ceraolo Spurio | d858d56 | 2019-06-13 16:21:54 -0700 | [diff] [blame] | 2265 | intel_runtime_pm_put(&dev_priv->runtime_pm, wakeref); |
José Roberto de Souza | 47c6cd5 | 2019-01-17 12:55:46 -0800 | [diff] [blame] | 2266 | |
Rodrigo Vivi | e91fd8c | 2013-07-11 18:44:59 -0300 | [diff] [blame] | 2267 | return 0; |
| 2268 | } |
| 2269 | |
Dhinakaran Pandiyan | 54fd314 | 2018-04-04 18:37:17 -0700 | [diff] [blame] | 2270 | static int |
| 2271 | i915_edp_psr_debug_set(void *data, u64 val) |
| 2272 | { |
| 2273 | struct drm_i915_private *dev_priv = data; |
Chris Wilson | a037121 | 2019-01-14 14:21:14 +0000 | [diff] [blame] | 2274 | intel_wakeref_t wakeref; |
Maarten Lankhorst | c44301f | 2018-08-09 16:21:01 +0200 | [diff] [blame] | 2275 | int ret; |
Dhinakaran Pandiyan | 54fd314 | 2018-04-04 18:37:17 -0700 | [diff] [blame] | 2276 | |
| 2277 | if (!CAN_PSR(dev_priv)) |
| 2278 | return -ENODEV; |
| 2279 | |
Maarten Lankhorst | c44301f | 2018-08-09 16:21:01 +0200 | [diff] [blame] | 2280 | DRM_DEBUG_KMS("Setting PSR debug to %llx\n", val); |
Dhinakaran Pandiyan | 54fd314 | 2018-04-04 18:37:17 -0700 | [diff] [blame] | 2281 | |
Daniele Ceraolo Spurio | d858d56 | 2019-06-13 16:21:54 -0700 | [diff] [blame] | 2282 | wakeref = intel_runtime_pm_get(&dev_priv->runtime_pm); |
Maarten Lankhorst | c44301f | 2018-08-09 16:21:01 +0200 | [diff] [blame] | 2283 | |
José Roberto de Souza | 23ec9f5 | 2019-02-06 13:18:45 -0800 | [diff] [blame] | 2284 | ret = intel_psr_debug_set(dev_priv, val); |
Maarten Lankhorst | c44301f | 2018-08-09 16:21:01 +0200 | [diff] [blame] | 2285 | |
Daniele Ceraolo Spurio | d858d56 | 2019-06-13 16:21:54 -0700 | [diff] [blame] | 2286 | intel_runtime_pm_put(&dev_priv->runtime_pm, wakeref); |
Dhinakaran Pandiyan | 54fd314 | 2018-04-04 18:37:17 -0700 | [diff] [blame] | 2287 | |
Maarten Lankhorst | c44301f | 2018-08-09 16:21:01 +0200 | [diff] [blame] | 2288 | return ret; |
Dhinakaran Pandiyan | 54fd314 | 2018-04-04 18:37:17 -0700 | [diff] [blame] | 2289 | } |
| 2290 | |
| 2291 | static int |
| 2292 | i915_edp_psr_debug_get(void *data, u64 *val) |
| 2293 | { |
| 2294 | struct drm_i915_private *dev_priv = data; |
| 2295 | |
| 2296 | if (!CAN_PSR(dev_priv)) |
| 2297 | return -ENODEV; |
| 2298 | |
| 2299 | *val = READ_ONCE(dev_priv->psr.debug); |
| 2300 | return 0; |
| 2301 | } |
| 2302 | |
| 2303 | DEFINE_SIMPLE_ATTRIBUTE(i915_edp_psr_debug_fops, |
| 2304 | i915_edp_psr_debug_get, i915_edp_psr_debug_set, |
| 2305 | "%llu\n"); |
| 2306 | |
Jesse Barnes | ec013e7 | 2013-08-20 10:29:23 +0100 | [diff] [blame] | 2307 | static int i915_energy_uJ(struct seq_file *m, void *data) |
| 2308 | { |
David Weinehall | 36cdd01 | 2016-08-22 13:59:31 +0300 | [diff] [blame] | 2309 | struct drm_i915_private *dev_priv = node_to_i915(m->private); |
Gabriel Krisman Bertazi | d38014e | 2017-07-26 02:30:16 -0300 | [diff] [blame] | 2310 | unsigned long long power; |
Chris Wilson | a037121 | 2019-01-14 14:21:14 +0000 | [diff] [blame] | 2311 | intel_wakeref_t wakeref; |
Jesse Barnes | ec013e7 | 2013-08-20 10:29:23 +0100 | [diff] [blame] | 2312 | u32 units; |
| 2313 | |
David Weinehall | 36cdd01 | 2016-08-22 13:59:31 +0300 | [diff] [blame] | 2314 | if (INTEL_GEN(dev_priv) < 6) |
Jesse Barnes | ec013e7 | 2013-08-20 10:29:23 +0100 | [diff] [blame] | 2315 | return -ENODEV; |
| 2316 | |
Chris Wilson | d4225a5 | 2019-01-14 14:21:23 +0000 | [diff] [blame] | 2317 | if (rdmsrl_safe(MSR_RAPL_POWER_UNIT, &power)) |
Gabriel Krisman Bertazi | d38014e | 2017-07-26 02:30:16 -0300 | [diff] [blame] | 2318 | return -ENODEV; |
Gabriel Krisman Bertazi | d38014e | 2017-07-26 02:30:16 -0300 | [diff] [blame] | 2319 | |
| 2320 | units = (power & 0x1f00) >> 8; |
Daniele Ceraolo Spurio | c447ff7 | 2019-06-13 16:21:55 -0700 | [diff] [blame] | 2321 | with_intel_runtime_pm(&dev_priv->runtime_pm, wakeref) |
Chris Wilson | d4225a5 | 2019-01-14 14:21:23 +0000 | [diff] [blame] | 2322 | power = I915_READ(MCH_SECP_NRG_STTS); |
| 2323 | |
Gabriel Krisman Bertazi | d38014e | 2017-07-26 02:30:16 -0300 | [diff] [blame] | 2324 | power = (1000000 * power) >> units; /* convert to uJ */ |
Gabriel Krisman Bertazi | d38014e | 2017-07-26 02:30:16 -0300 | [diff] [blame] | 2325 | seq_printf(m, "%llu", power); |
Paulo Zanoni | 371db66 | 2013-08-19 13:18:10 -0300 | [diff] [blame] | 2326 | |
| 2327 | return 0; |
| 2328 | } |
| 2329 | |
Damien Lespiau | 6455c87 | 2015-06-04 18:23:57 +0100 | [diff] [blame] | 2330 | static int i915_runtime_pm_status(struct seq_file *m, void *unused) |
Paulo Zanoni | 371db66 | 2013-08-19 13:18:10 -0300 | [diff] [blame] | 2331 | { |
David Weinehall | 36cdd01 | 2016-08-22 13:59:31 +0300 | [diff] [blame] | 2332 | struct drm_i915_private *dev_priv = node_to_i915(m->private); |
David Weinehall | 52a05c3 | 2016-08-22 13:32:44 +0300 | [diff] [blame] | 2333 | struct pci_dev *pdev = dev_priv->drm.pdev; |
Paulo Zanoni | 371db66 | 2013-08-19 13:18:10 -0300 | [diff] [blame] | 2334 | |
Chris Wilson | a156e64 | 2016-04-03 14:14:21 +0100 | [diff] [blame] | 2335 | if (!HAS_RUNTIME_PM(dev_priv)) |
| 2336 | seq_puts(m, "Runtime power management not supported\n"); |
Paulo Zanoni | 371db66 | 2013-08-19 13:18:10 -0300 | [diff] [blame] | 2337 | |
Chris Wilson | 25c896bd | 2019-01-14 14:21:25 +0000 | [diff] [blame] | 2338 | seq_printf(m, "Runtime power status: %s\n", |
| 2339 | enableddisabled(!dev_priv->power_domains.wakeref)); |
| 2340 | |
Chris Wilson | d9948a1 | 2019-02-28 10:20:35 +0000 | [diff] [blame] | 2341 | seq_printf(m, "GPU idle: %s\n", yesno(!dev_priv->gt.awake)); |
Paulo Zanoni | 371db66 | 2013-08-19 13:18:10 -0300 | [diff] [blame] | 2342 | seq_printf(m, "IRQs disabled: %s\n", |
Jesse Barnes | 9df7575f | 2014-06-20 09:29:20 -0700 | [diff] [blame] | 2343 | yesno(!intel_irqs_enabled(dev_priv))); |
Chris Wilson | 0d80418 | 2015-06-15 12:52:28 +0100 | [diff] [blame] | 2344 | #ifdef CONFIG_PM |
Damien Lespiau | a6aaec8 | 2015-06-04 18:23:58 +0100 | [diff] [blame] | 2345 | seq_printf(m, "Usage count: %d\n", |
David Weinehall | 36cdd01 | 2016-08-22 13:59:31 +0300 | [diff] [blame] | 2346 | atomic_read(&dev_priv->drm.dev->power.usage_count)); |
Chris Wilson | 0d80418 | 2015-06-15 12:52:28 +0100 | [diff] [blame] | 2347 | #else |
| 2348 | seq_printf(m, "Device Power Management (CONFIG_PM) disabled\n"); |
| 2349 | #endif |
Chris Wilson | a156e64 | 2016-04-03 14:14:21 +0100 | [diff] [blame] | 2350 | seq_printf(m, "PCI device power state: %s [%d]\n", |
David Weinehall | 52a05c3 | 2016-08-22 13:32:44 +0300 | [diff] [blame] | 2351 | pci_power_name(pdev->current_state), |
| 2352 | pdev->current_state); |
Paulo Zanoni | 371db66 | 2013-08-19 13:18:10 -0300 | [diff] [blame] | 2353 | |
Chris Wilson | bd780f3 | 2019-01-14 14:21:09 +0000 | [diff] [blame] | 2354 | if (IS_ENABLED(CONFIG_DRM_I915_DEBUG_RUNTIME_PM)) { |
| 2355 | struct drm_printer p = drm_seq_file_printer(m); |
| 2356 | |
Daniele Ceraolo Spurio | 69c6635 | 2019-06-13 16:21:53 -0700 | [diff] [blame] | 2357 | print_intel_runtime_pm_wakeref(&dev_priv->runtime_pm, &p); |
Chris Wilson | bd780f3 | 2019-01-14 14:21:09 +0000 | [diff] [blame] | 2358 | } |
| 2359 | |
Jesse Barnes | ec013e7 | 2013-08-20 10:29:23 +0100 | [diff] [blame] | 2360 | return 0; |
| 2361 | } |
| 2362 | |
Imre Deak | 1da5158 | 2013-11-25 17:15:35 +0200 | [diff] [blame] | 2363 | static int i915_power_domain_info(struct seq_file *m, void *unused) |
| 2364 | { |
David Weinehall | 36cdd01 | 2016-08-22 13:59:31 +0300 | [diff] [blame] | 2365 | struct drm_i915_private *dev_priv = node_to_i915(m->private); |
Imre Deak | 1da5158 | 2013-11-25 17:15:35 +0200 | [diff] [blame] | 2366 | struct i915_power_domains *power_domains = &dev_priv->power_domains; |
| 2367 | int i; |
| 2368 | |
| 2369 | mutex_lock(&power_domains->lock); |
| 2370 | |
| 2371 | seq_printf(m, "%-25s %s\n", "Power well/domain", "Use count"); |
| 2372 | for (i = 0; i < power_domains->power_well_count; i++) { |
| 2373 | struct i915_power_well *power_well; |
| 2374 | enum intel_display_power_domain power_domain; |
| 2375 | |
| 2376 | power_well = &power_domains->power_wells[i]; |
Imre Deak | f28ec6f | 2018-08-06 12:58:37 +0300 | [diff] [blame] | 2377 | seq_printf(m, "%-25s %d\n", power_well->desc->name, |
Imre Deak | 1da5158 | 2013-11-25 17:15:35 +0200 | [diff] [blame] | 2378 | power_well->count); |
| 2379 | |
Imre Deak | f28ec6f | 2018-08-06 12:58:37 +0300 | [diff] [blame] | 2380 | for_each_power_domain(power_domain, power_well->desc->domains) |
Imre Deak | 1da5158 | 2013-11-25 17:15:35 +0200 | [diff] [blame] | 2381 | seq_printf(m, " %-23s %d\n", |
Imre Deak | 656409b | 2019-07-11 10:31:02 -0700 | [diff] [blame] | 2382 | intel_display_power_domain_str(dev_priv, |
| 2383 | power_domain), |
Imre Deak | 1da5158 | 2013-11-25 17:15:35 +0200 | [diff] [blame] | 2384 | power_domains->domain_use_count[power_domain]); |
Imre Deak | 1da5158 | 2013-11-25 17:15:35 +0200 | [diff] [blame] | 2385 | } |
| 2386 | |
| 2387 | mutex_unlock(&power_domains->lock); |
| 2388 | |
| 2389 | return 0; |
| 2390 | } |
| 2391 | |
Damien Lespiau | b7cec66 | 2015-10-27 14:47:01 +0200 | [diff] [blame] | 2392 | static int i915_dmc_info(struct seq_file *m, void *unused) |
| 2393 | { |
David Weinehall | 36cdd01 | 2016-08-22 13:59:31 +0300 | [diff] [blame] | 2394 | struct drm_i915_private *dev_priv = node_to_i915(m->private); |
Chris Wilson | a037121 | 2019-01-14 14:21:14 +0000 | [diff] [blame] | 2395 | intel_wakeref_t wakeref; |
Damien Lespiau | b7cec66 | 2015-10-27 14:47:01 +0200 | [diff] [blame] | 2396 | struct intel_csr *csr; |
José Roberto de Souza | 5d57106 | 2019-07-25 17:24:10 -0700 | [diff] [blame] | 2397 | i915_reg_t dc5_reg, dc6_reg = {}; |
Damien Lespiau | b7cec66 | 2015-10-27 14:47:01 +0200 | [diff] [blame] | 2398 | |
Michal Wajdeczko | ab309a6 | 2017-12-15 14:36:35 +0000 | [diff] [blame] | 2399 | if (!HAS_CSR(dev_priv)) |
| 2400 | return -ENODEV; |
Damien Lespiau | b7cec66 | 2015-10-27 14:47:01 +0200 | [diff] [blame] | 2401 | |
| 2402 | csr = &dev_priv->csr; |
| 2403 | |
Daniele Ceraolo Spurio | d858d56 | 2019-06-13 16:21:54 -0700 | [diff] [blame] | 2404 | wakeref = intel_runtime_pm_get(&dev_priv->runtime_pm); |
Mika Kuoppala | 6fb403d | 2015-10-30 17:54:47 +0200 | [diff] [blame] | 2405 | |
Damien Lespiau | b7cec66 | 2015-10-27 14:47:01 +0200 | [diff] [blame] | 2406 | seq_printf(m, "fw loaded: %s\n", yesno(csr->dmc_payload != NULL)); |
| 2407 | seq_printf(m, "path: %s\n", csr->fw_path); |
| 2408 | |
| 2409 | if (!csr->dmc_payload) |
Mika Kuoppala | 6fb403d | 2015-10-30 17:54:47 +0200 | [diff] [blame] | 2410 | goto out; |
Damien Lespiau | b7cec66 | 2015-10-27 14:47:01 +0200 | [diff] [blame] | 2411 | |
| 2412 | seq_printf(m, "version: %d.%d\n", CSR_VERSION_MAJOR(csr->version), |
| 2413 | CSR_VERSION_MINOR(csr->version)); |
| 2414 | |
José Roberto de Souza | 5d57106 | 2019-07-25 17:24:10 -0700 | [diff] [blame] | 2415 | if (INTEL_GEN(dev_priv) >= 12) { |
| 2416 | dc5_reg = TGL_DMC_DEBUG_DC5_COUNT; |
| 2417 | dc6_reg = TGL_DMC_DEBUG_DC6_COUNT; |
| 2418 | } else { |
| 2419 | dc5_reg = IS_BROXTON(dev_priv) ? BXT_CSR_DC3_DC5_COUNT : |
| 2420 | SKL_CSR_DC3_DC5_COUNT; |
| 2421 | if (!IS_GEN9_LP(dev_priv)) |
| 2422 | dc6_reg = SKL_CSR_DC5_DC6_COUNT; |
| 2423 | } |
Imre Deak | 34b2f8d | 2018-10-31 22:02:20 +0200 | [diff] [blame] | 2424 | |
José Roberto de Souza | 5d57106 | 2019-07-25 17:24:10 -0700 | [diff] [blame] | 2425 | seq_printf(m, "DC3 -> DC5 count: %d\n", I915_READ(dc5_reg)); |
| 2426 | if (dc6_reg.reg) |
| 2427 | seq_printf(m, "DC5 -> DC6 count: %d\n", I915_READ(dc6_reg)); |
Damien Lespiau | 8337206 | 2015-10-30 17:53:32 +0200 | [diff] [blame] | 2428 | |
Mika Kuoppala | 6fb403d | 2015-10-30 17:54:47 +0200 | [diff] [blame] | 2429 | out: |
| 2430 | seq_printf(m, "program base: 0x%08x\n", I915_READ(CSR_PROGRAM(0))); |
| 2431 | seq_printf(m, "ssp base: 0x%08x\n", I915_READ(CSR_SSP_BASE)); |
| 2432 | seq_printf(m, "htp: 0x%08x\n", I915_READ(CSR_HTP_SKL)); |
| 2433 | |
Daniele Ceraolo Spurio | d858d56 | 2019-06-13 16:21:54 -0700 | [diff] [blame] | 2434 | intel_runtime_pm_put(&dev_priv->runtime_pm, wakeref); |
Damien Lespiau | 8337206 | 2015-10-30 17:53:32 +0200 | [diff] [blame] | 2435 | |
Damien Lespiau | b7cec66 | 2015-10-27 14:47:01 +0200 | [diff] [blame] | 2436 | return 0; |
| 2437 | } |
| 2438 | |
Jesse Barnes | 53f5e3c | 2014-02-07 12:48:15 -0800 | [diff] [blame] | 2439 | static void intel_seq_print_mode(struct seq_file *m, int tabs, |
| 2440 | struct drm_display_mode *mode) |
| 2441 | { |
| 2442 | int i; |
| 2443 | |
| 2444 | for (i = 0; i < tabs; i++) |
| 2445 | seq_putc(m, '\t'); |
| 2446 | |
Shayenne Moura | 4fb6bb8 | 2018-12-20 10:27:57 -0200 | [diff] [blame] | 2447 | seq_printf(m, DRM_MODE_FMT "\n", DRM_MODE_ARG(mode)); |
Jesse Barnes | 53f5e3c | 2014-02-07 12:48:15 -0800 | [diff] [blame] | 2448 | } |
| 2449 | |
| 2450 | static void intel_encoder_info(struct seq_file *m, |
| 2451 | struct intel_crtc *intel_crtc, |
| 2452 | struct intel_encoder *intel_encoder) |
| 2453 | { |
David Weinehall | 36cdd01 | 2016-08-22 13:59:31 +0300 | [diff] [blame] | 2454 | struct drm_i915_private *dev_priv = node_to_i915(m->private); |
| 2455 | struct drm_device *dev = &dev_priv->drm; |
Jesse Barnes | 53f5e3c | 2014-02-07 12:48:15 -0800 | [diff] [blame] | 2456 | struct drm_crtc *crtc = &intel_crtc->base; |
| 2457 | struct intel_connector *intel_connector; |
| 2458 | struct drm_encoder *encoder; |
| 2459 | |
| 2460 | encoder = &intel_encoder->base; |
| 2461 | seq_printf(m, "\tencoder %d: type: %s, connectors:\n", |
Jani Nikula | 8e329a03 | 2014-06-03 14:56:21 +0300 | [diff] [blame] | 2462 | encoder->base.id, encoder->name); |
Jesse Barnes | 53f5e3c | 2014-02-07 12:48:15 -0800 | [diff] [blame] | 2463 | for_each_connector_on_encoder(dev, encoder, intel_connector) { |
| 2464 | struct drm_connector *connector = &intel_connector->base; |
| 2465 | seq_printf(m, "\t\tconnector %d: type: %s, status: %s", |
| 2466 | connector->base.id, |
Jani Nikula | c23cc41 | 2014-06-03 14:56:17 +0300 | [diff] [blame] | 2467 | connector->name, |
Jesse Barnes | 53f5e3c | 2014-02-07 12:48:15 -0800 | [diff] [blame] | 2468 | drm_get_connector_status_name(connector->status)); |
| 2469 | if (connector->status == connector_status_connected) { |
| 2470 | struct drm_display_mode *mode = &crtc->mode; |
| 2471 | seq_printf(m, ", mode:\n"); |
| 2472 | intel_seq_print_mode(m, 2, mode); |
| 2473 | } else { |
| 2474 | seq_putc(m, '\n'); |
| 2475 | } |
| 2476 | } |
| 2477 | } |
| 2478 | |
| 2479 | static void intel_crtc_info(struct seq_file *m, struct intel_crtc *intel_crtc) |
| 2480 | { |
David Weinehall | 36cdd01 | 2016-08-22 13:59:31 +0300 | [diff] [blame] | 2481 | struct drm_i915_private *dev_priv = node_to_i915(m->private); |
| 2482 | struct drm_device *dev = &dev_priv->drm; |
Jesse Barnes | 53f5e3c | 2014-02-07 12:48:15 -0800 | [diff] [blame] | 2483 | struct drm_crtc *crtc = &intel_crtc->base; |
| 2484 | struct intel_encoder *intel_encoder; |
Maarten Lankhorst | 23a48d5 | 2015-09-10 16:07:57 +0200 | [diff] [blame] | 2485 | struct drm_plane_state *plane_state = crtc->primary->state; |
| 2486 | struct drm_framebuffer *fb = plane_state->fb; |
Jesse Barnes | 53f5e3c | 2014-02-07 12:48:15 -0800 | [diff] [blame] | 2487 | |
Maarten Lankhorst | 23a48d5 | 2015-09-10 16:07:57 +0200 | [diff] [blame] | 2488 | if (fb) |
Matt Roper | 5aa8a93 | 2014-06-16 10:12:55 -0700 | [diff] [blame] | 2489 | seq_printf(m, "\tfb: %d, pos: %dx%d, size: %dx%d\n", |
Maarten Lankhorst | 23a48d5 | 2015-09-10 16:07:57 +0200 | [diff] [blame] | 2490 | fb->base.id, plane_state->src_x >> 16, |
| 2491 | plane_state->src_y >> 16, fb->width, fb->height); |
Matt Roper | 5aa8a93 | 2014-06-16 10:12:55 -0700 | [diff] [blame] | 2492 | else |
| 2493 | seq_puts(m, "\tprimary plane disabled\n"); |
Jesse Barnes | 53f5e3c | 2014-02-07 12:48:15 -0800 | [diff] [blame] | 2494 | for_each_encoder_on_crtc(dev, crtc, intel_encoder) |
| 2495 | intel_encoder_info(m, intel_crtc, intel_encoder); |
| 2496 | } |
| 2497 | |
| 2498 | static void intel_panel_info(struct seq_file *m, struct intel_panel *panel) |
| 2499 | { |
| 2500 | struct drm_display_mode *mode = panel->fixed_mode; |
| 2501 | |
| 2502 | seq_printf(m, "\tfixed mode:\n"); |
| 2503 | intel_seq_print_mode(m, 2, mode); |
| 2504 | } |
| 2505 | |
Anshuman Gupta | aed7450 | 2019-07-19 11:25:13 +0530 | [diff] [blame] | 2506 | static void intel_hdcp_info(struct seq_file *m, |
| 2507 | struct intel_connector *intel_connector) |
| 2508 | { |
| 2509 | bool hdcp_cap, hdcp2_cap; |
| 2510 | |
| 2511 | hdcp_cap = intel_hdcp_capable(intel_connector); |
| 2512 | hdcp2_cap = intel_hdcp2_capable(intel_connector); |
| 2513 | |
| 2514 | if (hdcp_cap) |
| 2515 | seq_puts(m, "HDCP1.4 "); |
| 2516 | if (hdcp2_cap) |
| 2517 | seq_puts(m, "HDCP2.2 "); |
| 2518 | |
| 2519 | if (!hdcp_cap && !hdcp2_cap) |
| 2520 | seq_puts(m, "None"); |
| 2521 | |
| 2522 | seq_puts(m, "\n"); |
| 2523 | } |
| 2524 | |
Jesse Barnes | 53f5e3c | 2014-02-07 12:48:15 -0800 | [diff] [blame] | 2525 | static void intel_dp_info(struct seq_file *m, |
| 2526 | struct intel_connector *intel_connector) |
| 2527 | { |
| 2528 | struct intel_encoder *intel_encoder = intel_connector->encoder; |
| 2529 | struct intel_dp *intel_dp = enc_to_intel_dp(&intel_encoder->base); |
| 2530 | |
| 2531 | seq_printf(m, "\tDPCD rev: %x\n", intel_dp->dpcd[DP_DPCD_REV]); |
Jani Nikula | 742f491 | 2015-09-03 11:16:09 +0300 | [diff] [blame] | 2532 | seq_printf(m, "\taudio support: %s\n", yesno(intel_dp->has_audio)); |
Maarten Lankhorst | b6dabe3 | 2016-06-20 15:57:37 +0200 | [diff] [blame] | 2533 | if (intel_connector->base.connector_type == DRM_MODE_CONNECTOR_eDP) |
Jesse Barnes | 53f5e3c | 2014-02-07 12:48:15 -0800 | [diff] [blame] | 2534 | intel_panel_info(m, &intel_connector->panel); |
Mika Kahola | 80209e5 | 2016-09-09 14:10:57 +0300 | [diff] [blame] | 2535 | |
| 2536 | drm_dp_downstream_debug(m, intel_dp->dpcd, intel_dp->downstream_ports, |
| 2537 | &intel_dp->aux); |
Anshuman Gupta | aed7450 | 2019-07-19 11:25:13 +0530 | [diff] [blame] | 2538 | if (intel_connector->hdcp.shim) { |
| 2539 | seq_puts(m, "\tHDCP version: "); |
| 2540 | intel_hdcp_info(m, intel_connector); |
| 2541 | } |
Jesse Barnes | 53f5e3c | 2014-02-07 12:48:15 -0800 | [diff] [blame] | 2542 | } |
| 2543 | |
Libin Yang | 9a148a9 | 2016-11-28 20:07:05 +0800 | [diff] [blame] | 2544 | static void intel_dp_mst_info(struct seq_file *m, |
| 2545 | struct intel_connector *intel_connector) |
| 2546 | { |
| 2547 | struct intel_encoder *intel_encoder = intel_connector->encoder; |
| 2548 | struct intel_dp_mst_encoder *intel_mst = |
| 2549 | enc_to_mst(&intel_encoder->base); |
| 2550 | struct intel_digital_port *intel_dig_port = intel_mst->primary; |
| 2551 | struct intel_dp *intel_dp = &intel_dig_port->dp; |
| 2552 | bool has_audio = drm_dp_mst_port_has_audio(&intel_dp->mst_mgr, |
| 2553 | intel_connector->port); |
| 2554 | |
| 2555 | seq_printf(m, "\taudio support: %s\n", yesno(has_audio)); |
| 2556 | } |
| 2557 | |
Jesse Barnes | 53f5e3c | 2014-02-07 12:48:15 -0800 | [diff] [blame] | 2558 | static void intel_hdmi_info(struct seq_file *m, |
| 2559 | struct intel_connector *intel_connector) |
| 2560 | { |
| 2561 | struct intel_encoder *intel_encoder = intel_connector->encoder; |
| 2562 | struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(&intel_encoder->base); |
| 2563 | |
Jani Nikula | 742f491 | 2015-09-03 11:16:09 +0300 | [diff] [blame] | 2564 | seq_printf(m, "\taudio support: %s\n", yesno(intel_hdmi->has_audio)); |
Anshuman Gupta | aed7450 | 2019-07-19 11:25:13 +0530 | [diff] [blame] | 2565 | if (intel_connector->hdcp.shim) { |
| 2566 | seq_puts(m, "\tHDCP version: "); |
| 2567 | intel_hdcp_info(m, intel_connector); |
| 2568 | } |
Jesse Barnes | 53f5e3c | 2014-02-07 12:48:15 -0800 | [diff] [blame] | 2569 | } |
| 2570 | |
| 2571 | static void intel_lvds_info(struct seq_file *m, |
| 2572 | struct intel_connector *intel_connector) |
| 2573 | { |
| 2574 | intel_panel_info(m, &intel_connector->panel); |
| 2575 | } |
| 2576 | |
| 2577 | static void intel_connector_info(struct seq_file *m, |
| 2578 | struct drm_connector *connector) |
| 2579 | { |
| 2580 | struct intel_connector *intel_connector = to_intel_connector(connector); |
| 2581 | struct intel_encoder *intel_encoder = intel_connector->encoder; |
Jesse Barnes | f103fc7 | 2014-02-20 12:39:57 -0800 | [diff] [blame] | 2582 | struct drm_display_mode *mode; |
Jesse Barnes | 53f5e3c | 2014-02-07 12:48:15 -0800 | [diff] [blame] | 2583 | |
| 2584 | seq_printf(m, "connector %d: type %s, status: %s\n", |
Jani Nikula | c23cc41 | 2014-06-03 14:56:17 +0300 | [diff] [blame] | 2585 | connector->base.id, connector->name, |
Jesse Barnes | 53f5e3c | 2014-02-07 12:48:15 -0800 | [diff] [blame] | 2586 | drm_get_connector_status_name(connector->status)); |
José Roberto de Souza | 3e037f9 | 2018-10-30 14:57:46 -0700 | [diff] [blame] | 2587 | |
| 2588 | if (connector->status == connector_status_disconnected) |
| 2589 | return; |
| 2590 | |
José Roberto de Souza | 3e037f9 | 2018-10-30 14:57:46 -0700 | [diff] [blame] | 2591 | seq_printf(m, "\tphysical dimensions: %dx%dmm\n", |
| 2592 | connector->display_info.width_mm, |
| 2593 | connector->display_info.height_mm); |
| 2594 | seq_printf(m, "\tsubpixel order: %s\n", |
| 2595 | drm_get_subpixel_order_name(connector->display_info.subpixel_order)); |
| 2596 | seq_printf(m, "\tCEA rev: %d\n", connector->display_info.cea_rev); |
Maarten Lankhorst | ee648a7 | 2016-06-21 12:00:38 +0200 | [diff] [blame] | 2597 | |
Maarten Lankhorst | 77d1f61 | 2017-06-26 10:33:49 +0200 | [diff] [blame] | 2598 | if (!intel_encoder) |
Maarten Lankhorst | ee648a7 | 2016-06-21 12:00:38 +0200 | [diff] [blame] | 2599 | return; |
| 2600 | |
| 2601 | switch (connector->connector_type) { |
| 2602 | case DRM_MODE_CONNECTOR_DisplayPort: |
| 2603 | case DRM_MODE_CONNECTOR_eDP: |
Libin Yang | 9a148a9 | 2016-11-28 20:07:05 +0800 | [diff] [blame] | 2604 | if (intel_encoder->type == INTEL_OUTPUT_DP_MST) |
| 2605 | intel_dp_mst_info(m, intel_connector); |
| 2606 | else |
| 2607 | intel_dp_info(m, intel_connector); |
Maarten Lankhorst | ee648a7 | 2016-06-21 12:00:38 +0200 | [diff] [blame] | 2608 | break; |
| 2609 | case DRM_MODE_CONNECTOR_LVDS: |
| 2610 | if (intel_encoder->type == INTEL_OUTPUT_LVDS) |
Dave Airlie | 36cd744 | 2014-05-02 13:44:18 +1000 | [diff] [blame] | 2611 | intel_lvds_info(m, intel_connector); |
Maarten Lankhorst | ee648a7 | 2016-06-21 12:00:38 +0200 | [diff] [blame] | 2612 | break; |
| 2613 | case DRM_MODE_CONNECTOR_HDMIA: |
| 2614 | if (intel_encoder->type == INTEL_OUTPUT_HDMI || |
Ville Syrjälä | 7e732ca | 2017-10-27 22:31:24 +0300 | [diff] [blame] | 2615 | intel_encoder->type == INTEL_OUTPUT_DDI) |
Maarten Lankhorst | ee648a7 | 2016-06-21 12:00:38 +0200 | [diff] [blame] | 2616 | intel_hdmi_info(m, intel_connector); |
| 2617 | break; |
| 2618 | default: |
| 2619 | break; |
Dave Airlie | 36cd744 | 2014-05-02 13:44:18 +1000 | [diff] [blame] | 2620 | } |
Jesse Barnes | 53f5e3c | 2014-02-07 12:48:15 -0800 | [diff] [blame] | 2621 | |
Jesse Barnes | f103fc7 | 2014-02-20 12:39:57 -0800 | [diff] [blame] | 2622 | seq_printf(m, "\tmodes:\n"); |
| 2623 | list_for_each_entry(mode, &connector->modes, head) |
| 2624 | intel_seq_print_mode(m, 2, mode); |
Jesse Barnes | 53f5e3c | 2014-02-07 12:48:15 -0800 | [diff] [blame] | 2625 | } |
| 2626 | |
Robert Fekete | 3abc4e0 | 2015-10-27 16:58:32 +0100 | [diff] [blame] | 2627 | static const char *plane_type(enum drm_plane_type type) |
| 2628 | { |
| 2629 | switch (type) { |
| 2630 | case DRM_PLANE_TYPE_OVERLAY: |
| 2631 | return "OVL"; |
| 2632 | case DRM_PLANE_TYPE_PRIMARY: |
| 2633 | return "PRI"; |
| 2634 | case DRM_PLANE_TYPE_CURSOR: |
| 2635 | return "CUR"; |
| 2636 | /* |
| 2637 | * Deliberately omitting default: to generate compiler warnings |
| 2638 | * when a new drm_plane_type gets added. |
| 2639 | */ |
| 2640 | } |
| 2641 | |
| 2642 | return "unknown"; |
| 2643 | } |
| 2644 | |
Jani Nikula | 5852a15 | 2019-01-07 16:51:49 +0200 | [diff] [blame] | 2645 | static void plane_rotation(char *buf, size_t bufsize, unsigned int rotation) |
Robert Fekete | 3abc4e0 | 2015-10-27 16:58:32 +0100 | [diff] [blame] | 2646 | { |
Robert Fekete | 3abc4e0 | 2015-10-27 16:58:32 +0100 | [diff] [blame] | 2647 | /* |
Robert Foss | c2c446a | 2017-05-19 16:50:17 -0400 | [diff] [blame] | 2648 | * According to doc only one DRM_MODE_ROTATE_ is allowed but this |
Robert Fekete | 3abc4e0 | 2015-10-27 16:58:32 +0100 | [diff] [blame] | 2649 | * will print them all to visualize if the values are misused |
| 2650 | */ |
Jani Nikula | 5852a15 | 2019-01-07 16:51:49 +0200 | [diff] [blame] | 2651 | snprintf(buf, bufsize, |
Robert Fekete | 3abc4e0 | 2015-10-27 16:58:32 +0100 | [diff] [blame] | 2652 | "%s%s%s%s%s%s(0x%08x)", |
Robert Foss | c2c446a | 2017-05-19 16:50:17 -0400 | [diff] [blame] | 2653 | (rotation & DRM_MODE_ROTATE_0) ? "0 " : "", |
| 2654 | (rotation & DRM_MODE_ROTATE_90) ? "90 " : "", |
| 2655 | (rotation & DRM_MODE_ROTATE_180) ? "180 " : "", |
| 2656 | (rotation & DRM_MODE_ROTATE_270) ? "270 " : "", |
| 2657 | (rotation & DRM_MODE_REFLECT_X) ? "FLIPX " : "", |
| 2658 | (rotation & DRM_MODE_REFLECT_Y) ? "FLIPY " : "", |
Robert Fekete | 3abc4e0 | 2015-10-27 16:58:32 +0100 | [diff] [blame] | 2659 | rotation); |
Robert Fekete | 3abc4e0 | 2015-10-27 16:58:32 +0100 | [diff] [blame] | 2660 | } |
| 2661 | |
| 2662 | static void intel_plane_info(struct seq_file *m, struct intel_crtc *intel_crtc) |
| 2663 | { |
David Weinehall | 36cdd01 | 2016-08-22 13:59:31 +0300 | [diff] [blame] | 2664 | struct drm_i915_private *dev_priv = node_to_i915(m->private); |
| 2665 | struct drm_device *dev = &dev_priv->drm; |
Robert Fekete | 3abc4e0 | 2015-10-27 16:58:32 +0100 | [diff] [blame] | 2666 | struct intel_plane *intel_plane; |
| 2667 | |
| 2668 | for_each_intel_plane_on_crtc(dev, intel_crtc, intel_plane) { |
| 2669 | struct drm_plane_state *state; |
| 2670 | struct drm_plane *plane = &intel_plane->base; |
Eric Engestrom | b3c11ac | 2016-11-12 01:12:56 +0000 | [diff] [blame] | 2671 | struct drm_format_name_buf format_name; |
Jani Nikula | 5852a15 | 2019-01-07 16:51:49 +0200 | [diff] [blame] | 2672 | char rot_str[48]; |
Robert Fekete | 3abc4e0 | 2015-10-27 16:58:32 +0100 | [diff] [blame] | 2673 | |
| 2674 | if (!plane->state) { |
| 2675 | seq_puts(m, "plane->state is NULL!\n"); |
| 2676 | continue; |
| 2677 | } |
| 2678 | |
| 2679 | state = plane->state; |
| 2680 | |
Eric Engestrom | 90844f0 | 2016-08-15 01:02:38 +0100 | [diff] [blame] | 2681 | if (state->fb) { |
Ville Syrjälä | 438b74a | 2016-12-14 23:32:55 +0200 | [diff] [blame] | 2682 | drm_get_format_name(state->fb->format->format, |
| 2683 | &format_name); |
Eric Engestrom | 90844f0 | 2016-08-15 01:02:38 +0100 | [diff] [blame] | 2684 | } else { |
Eric Engestrom | b3c11ac | 2016-11-12 01:12:56 +0000 | [diff] [blame] | 2685 | sprintf(format_name.str, "N/A"); |
Eric Engestrom | 90844f0 | 2016-08-15 01:02:38 +0100 | [diff] [blame] | 2686 | } |
| 2687 | |
Jani Nikula | 5852a15 | 2019-01-07 16:51:49 +0200 | [diff] [blame] | 2688 | plane_rotation(rot_str, sizeof(rot_str), state->rotation); |
| 2689 | |
Robert Fekete | 3abc4e0 | 2015-10-27 16:58:32 +0100 | [diff] [blame] | 2690 | seq_printf(m, "\t--Plane id %d: type=%s, crtc_pos=%4dx%4d, crtc_size=%4dx%4d, src_pos=%d.%04ux%d.%04u, src_size=%d.%04ux%d.%04u, format=%s, rotation=%s\n", |
| 2691 | plane->base.id, |
| 2692 | plane_type(intel_plane->base.type), |
| 2693 | state->crtc_x, state->crtc_y, |
| 2694 | state->crtc_w, state->crtc_h, |
| 2695 | (state->src_x >> 16), |
| 2696 | ((state->src_x & 0xffff) * 15625) >> 10, |
| 2697 | (state->src_y >> 16), |
| 2698 | ((state->src_y & 0xffff) * 15625) >> 10, |
| 2699 | (state->src_w >> 16), |
| 2700 | ((state->src_w & 0xffff) * 15625) >> 10, |
| 2701 | (state->src_h >> 16), |
| 2702 | ((state->src_h & 0xffff) * 15625) >> 10, |
Eric Engestrom | b3c11ac | 2016-11-12 01:12:56 +0000 | [diff] [blame] | 2703 | format_name.str, |
Jani Nikula | 5852a15 | 2019-01-07 16:51:49 +0200 | [diff] [blame] | 2704 | rot_str); |
Robert Fekete | 3abc4e0 | 2015-10-27 16:58:32 +0100 | [diff] [blame] | 2705 | } |
| 2706 | } |
| 2707 | |
| 2708 | static void intel_scaler_info(struct seq_file *m, struct intel_crtc *intel_crtc) |
| 2709 | { |
| 2710 | struct intel_crtc_state *pipe_config; |
| 2711 | int num_scalers = intel_crtc->num_scalers; |
| 2712 | int i; |
| 2713 | |
| 2714 | pipe_config = to_intel_crtc_state(intel_crtc->base.state); |
| 2715 | |
| 2716 | /* Not all platformas have a scaler */ |
| 2717 | if (num_scalers) { |
| 2718 | seq_printf(m, "\tnum_scalers=%d, scaler_users=%x scaler_id=%d", |
| 2719 | num_scalers, |
| 2720 | pipe_config->scaler_state.scaler_users, |
| 2721 | pipe_config->scaler_state.scaler_id); |
| 2722 | |
A.Sunil Kamath | 5841591 | 2016-11-20 23:20:26 +0530 | [diff] [blame] | 2723 | for (i = 0; i < num_scalers; i++) { |
Robert Fekete | 3abc4e0 | 2015-10-27 16:58:32 +0100 | [diff] [blame] | 2724 | struct intel_scaler *sc = |
| 2725 | &pipe_config->scaler_state.scalers[i]; |
| 2726 | |
| 2727 | seq_printf(m, ", scalers[%d]: use=%s, mode=%x", |
| 2728 | i, yesno(sc->in_use), sc->mode); |
| 2729 | } |
| 2730 | seq_puts(m, "\n"); |
| 2731 | } else { |
| 2732 | seq_puts(m, "\tNo scalers available on this platform\n"); |
| 2733 | } |
| 2734 | } |
| 2735 | |
Jesse Barnes | 53f5e3c | 2014-02-07 12:48:15 -0800 | [diff] [blame] | 2736 | static int i915_display_info(struct seq_file *m, void *unused) |
| 2737 | { |
David Weinehall | 36cdd01 | 2016-08-22 13:59:31 +0300 | [diff] [blame] | 2738 | struct drm_i915_private *dev_priv = node_to_i915(m->private); |
| 2739 | struct drm_device *dev = &dev_priv->drm; |
Chris Wilson | 065f2ec | 2014-03-12 09:13:13 +0000 | [diff] [blame] | 2740 | struct intel_crtc *crtc; |
Jesse Barnes | 53f5e3c | 2014-02-07 12:48:15 -0800 | [diff] [blame] | 2741 | struct drm_connector *connector; |
Daniel Vetter | 3f6a5e1 | 2017-03-01 10:52:21 +0100 | [diff] [blame] | 2742 | struct drm_connector_list_iter conn_iter; |
Chris Wilson | a037121 | 2019-01-14 14:21:14 +0000 | [diff] [blame] | 2743 | intel_wakeref_t wakeref; |
Jesse Barnes | 53f5e3c | 2014-02-07 12:48:15 -0800 | [diff] [blame] | 2744 | |
Daniele Ceraolo Spurio | d858d56 | 2019-06-13 16:21:54 -0700 | [diff] [blame] | 2745 | wakeref = intel_runtime_pm_get(&dev_priv->runtime_pm); |
Chris Wilson | a037121 | 2019-01-14 14:21:14 +0000 | [diff] [blame] | 2746 | |
Jesse Barnes | 53f5e3c | 2014-02-07 12:48:15 -0800 | [diff] [blame] | 2747 | seq_printf(m, "CRTC info\n"); |
| 2748 | seq_printf(m, "---------\n"); |
Damien Lespiau | d3fcc80 | 2014-05-13 23:32:22 +0100 | [diff] [blame] | 2749 | for_each_intel_crtc(dev, crtc) { |
Maarten Lankhorst | f77076c | 2015-06-01 12:50:08 +0200 | [diff] [blame] | 2750 | struct intel_crtc_state *pipe_config; |
Jesse Barnes | 53f5e3c | 2014-02-07 12:48:15 -0800 | [diff] [blame] | 2751 | |
Daniel Vetter | 3f6a5e1 | 2017-03-01 10:52:21 +0100 | [diff] [blame] | 2752 | drm_modeset_lock(&crtc->base.mutex, NULL); |
Maarten Lankhorst | f77076c | 2015-06-01 12:50:08 +0200 | [diff] [blame] | 2753 | pipe_config = to_intel_crtc_state(crtc->base.state); |
| 2754 | |
Robert Fekete | 3abc4e0 | 2015-10-27 16:58:32 +0100 | [diff] [blame] | 2755 | seq_printf(m, "CRTC %d: pipe: %c, active=%s, (size=%dx%d), dither=%s, bpp=%d\n", |
Chris Wilson | 065f2ec | 2014-03-12 09:13:13 +0000 | [diff] [blame] | 2756 | crtc->base.base.id, pipe_name(crtc->pipe), |
Maarten Lankhorst | f77076c | 2015-06-01 12:50:08 +0200 | [diff] [blame] | 2757 | yesno(pipe_config->base.active), |
Robert Fekete | 3abc4e0 | 2015-10-27 16:58:32 +0100 | [diff] [blame] | 2758 | pipe_config->pipe_src_w, pipe_config->pipe_src_h, |
| 2759 | yesno(pipe_config->dither), pipe_config->pipe_bpp); |
| 2760 | |
Maarten Lankhorst | f77076c | 2015-06-01 12:50:08 +0200 | [diff] [blame] | 2761 | if (pipe_config->base.active) { |
Ville Syrjälä | cd5dcbf | 2017-03-27 21:55:35 +0300 | [diff] [blame] | 2762 | struct intel_plane *cursor = |
| 2763 | to_intel_plane(crtc->base.cursor); |
| 2764 | |
Chris Wilson | 065f2ec | 2014-03-12 09:13:13 +0000 | [diff] [blame] | 2765 | intel_crtc_info(m, crtc); |
| 2766 | |
Ville Syrjälä | cd5dcbf | 2017-03-27 21:55:35 +0300 | [diff] [blame] | 2767 | seq_printf(m, "\tcursor visible? %s, position (%d, %d), size %dx%d, addr 0x%08x\n", |
| 2768 | yesno(cursor->base.state->visible), |
| 2769 | cursor->base.state->crtc_x, |
| 2770 | cursor->base.state->crtc_y, |
| 2771 | cursor->base.state->crtc_w, |
| 2772 | cursor->base.state->crtc_h, |
| 2773 | cursor->cursor.base); |
Robert Fekete | 3abc4e0 | 2015-10-27 16:58:32 +0100 | [diff] [blame] | 2774 | intel_scaler_info(m, crtc); |
| 2775 | intel_plane_info(m, crtc); |
Paulo Zanoni | a23dc65 | 2014-04-01 14:55:11 -0300 | [diff] [blame] | 2776 | } |
Daniel Vetter | cace841 | 2014-05-22 17:56:31 +0200 | [diff] [blame] | 2777 | |
| 2778 | seq_printf(m, "\tunderrun reporting: cpu=%s pch=%s \n", |
| 2779 | yesno(!crtc->cpu_fifo_underrun_disabled), |
| 2780 | yesno(!crtc->pch_fifo_underrun_disabled)); |
Daniel Vetter | 3f6a5e1 | 2017-03-01 10:52:21 +0100 | [diff] [blame] | 2781 | drm_modeset_unlock(&crtc->base.mutex); |
Jesse Barnes | 53f5e3c | 2014-02-07 12:48:15 -0800 | [diff] [blame] | 2782 | } |
| 2783 | |
| 2784 | seq_printf(m, "\n"); |
| 2785 | seq_printf(m, "Connector info\n"); |
| 2786 | seq_printf(m, "--------------\n"); |
Daniel Vetter | 3f6a5e1 | 2017-03-01 10:52:21 +0100 | [diff] [blame] | 2787 | mutex_lock(&dev->mode_config.mutex); |
| 2788 | drm_connector_list_iter_begin(dev, &conn_iter); |
| 2789 | drm_for_each_connector_iter(connector, &conn_iter) |
Jesse Barnes | 53f5e3c | 2014-02-07 12:48:15 -0800 | [diff] [blame] | 2790 | intel_connector_info(m, connector); |
Daniel Vetter | 3f6a5e1 | 2017-03-01 10:52:21 +0100 | [diff] [blame] | 2791 | drm_connector_list_iter_end(&conn_iter); |
| 2792 | mutex_unlock(&dev->mode_config.mutex); |
| 2793 | |
Daniele Ceraolo Spurio | d858d56 | 2019-06-13 16:21:54 -0700 | [diff] [blame] | 2794 | intel_runtime_pm_put(&dev_priv->runtime_pm, wakeref); |
Jesse Barnes | 53f5e3c | 2014-02-07 12:48:15 -0800 | [diff] [blame] | 2795 | |
| 2796 | return 0; |
| 2797 | } |
| 2798 | |
Chris Wilson | 1b36595 | 2016-10-04 21:11:31 +0100 | [diff] [blame] | 2799 | static int i915_engine_info(struct seq_file *m, void *unused) |
| 2800 | { |
| 2801 | struct drm_i915_private *dev_priv = node_to_i915(m->private); |
| 2802 | struct intel_engine_cs *engine; |
Chris Wilson | a037121 | 2019-01-14 14:21:14 +0000 | [diff] [blame] | 2803 | intel_wakeref_t wakeref; |
Chris Wilson | f636edb | 2017-10-09 12:02:57 +0100 | [diff] [blame] | 2804 | struct drm_printer p; |
Chris Wilson | 1b36595 | 2016-10-04 21:11:31 +0100 | [diff] [blame] | 2805 | |
Daniele Ceraolo Spurio | d858d56 | 2019-06-13 16:21:54 -0700 | [diff] [blame] | 2806 | wakeref = intel_runtime_pm_get(&dev_priv->runtime_pm); |
Chris Wilson | 9c870d0 | 2016-10-24 13:42:15 +0100 | [diff] [blame] | 2807 | |
Chris Wilson | 79ffac85 | 2019-04-24 21:07:17 +0100 | [diff] [blame] | 2808 | seq_printf(m, "GT awake? %s [%d]\n", |
| 2809 | yesno(dev_priv->gt.awake), |
| 2810 | atomic_read(&dev_priv->gt.wakeref.count)); |
Lionel Landwerlin | f577a03 | 2017-11-13 23:34:53 +0000 | [diff] [blame] | 2811 | seq_printf(m, "CS timestamp frequency: %u kHz\n", |
Jani Nikula | 0258404 | 2018-12-31 16:56:41 +0200 | [diff] [blame] | 2812 | RUNTIME_INFO(dev_priv)->cs_timestamp_frequency_khz); |
Chris Wilson | f73b567 | 2017-03-02 15:03:56 +0000 | [diff] [blame] | 2813 | |
Chris Wilson | f636edb | 2017-10-09 12:02:57 +0100 | [diff] [blame] | 2814 | p = drm_seq_file_printer(m); |
Chris Wilson | 750e76b | 2019-08-06 13:43:00 +0100 | [diff] [blame] | 2815 | for_each_uabi_engine(engine, dev_priv) |
Chris Wilson | 0db18b1 | 2017-12-08 01:23:00 +0000 | [diff] [blame] | 2816 | intel_engine_dump(engine, &p, "%s\n", engine->name); |
Chris Wilson | 1b36595 | 2016-10-04 21:11:31 +0100 | [diff] [blame] | 2817 | |
Daniele Ceraolo Spurio | d858d56 | 2019-06-13 16:21:54 -0700 | [diff] [blame] | 2818 | intel_runtime_pm_put(&dev_priv->runtime_pm, wakeref); |
Chris Wilson | 9c870d0 | 2016-10-24 13:42:15 +0100 | [diff] [blame] | 2819 | |
Chris Wilson | 1b36595 | 2016-10-04 21:11:31 +0100 | [diff] [blame] | 2820 | return 0; |
| 2821 | } |
| 2822 | |
Lionel Landwerlin | 79e9cd5 | 2018-03-06 12:28:54 +0000 | [diff] [blame] | 2823 | static int i915_rcs_topology(struct seq_file *m, void *unused) |
| 2824 | { |
| 2825 | struct drm_i915_private *dev_priv = node_to_i915(m->private); |
| 2826 | struct drm_printer p = drm_seq_file_printer(m); |
| 2827 | |
Jani Nikula | 0258404 | 2018-12-31 16:56:41 +0200 | [diff] [blame] | 2828 | intel_device_info_dump_topology(&RUNTIME_INFO(dev_priv)->sseu, &p); |
Lionel Landwerlin | 79e9cd5 | 2018-03-06 12:28:54 +0000 | [diff] [blame] | 2829 | |
| 2830 | return 0; |
| 2831 | } |
| 2832 | |
Chris Wilson | c5418a8 | 2017-10-13 21:26:19 +0100 | [diff] [blame] | 2833 | static int i915_shrinker_info(struct seq_file *m, void *unused) |
| 2834 | { |
| 2835 | struct drm_i915_private *i915 = node_to_i915(m->private); |
| 2836 | |
| 2837 | seq_printf(m, "seeks = %d\n", i915->mm.shrinker.seeks); |
| 2838 | seq_printf(m, "batch = %lu\n", i915->mm.shrinker.batch); |
| 2839 | |
| 2840 | return 0; |
| 2841 | } |
| 2842 | |
Daniel Vetter | 728e29d | 2014-06-25 22:01:53 +0300 | [diff] [blame] | 2843 | static int i915_shared_dplls_info(struct seq_file *m, void *unused) |
| 2844 | { |
David Weinehall | 36cdd01 | 2016-08-22 13:59:31 +0300 | [diff] [blame] | 2845 | struct drm_i915_private *dev_priv = node_to_i915(m->private); |
| 2846 | struct drm_device *dev = &dev_priv->drm; |
Daniel Vetter | 728e29d | 2014-06-25 22:01:53 +0300 | [diff] [blame] | 2847 | int i; |
| 2848 | |
| 2849 | drm_modeset_lock_all(dev); |
| 2850 | for (i = 0; i < dev_priv->num_shared_dpll; i++) { |
| 2851 | struct intel_shared_dpll *pll = &dev_priv->shared_dplls[i]; |
| 2852 | |
Lucas De Marchi | 72f775f | 2018-03-20 15:06:34 -0700 | [diff] [blame] | 2853 | seq_printf(m, "DPLL%i: %s, id: %i\n", i, pll->info->name, |
Lucas De Marchi | 0823eb9 | 2018-03-20 15:06:35 -0700 | [diff] [blame] | 2854 | pll->info->id); |
Maarten Lankhorst | 2dd66ebd | 2016-03-14 09:27:52 +0100 | [diff] [blame] | 2855 | seq_printf(m, " crtc_mask: 0x%08x, active: 0x%x, on: %s\n", |
Ander Conselvan de Oliveira | 2c42e53 | 2016-12-29 17:22:09 +0200 | [diff] [blame] | 2856 | pll->state.crtc_mask, pll->active_mask, yesno(pll->on)); |
Daniel Vetter | 728e29d | 2014-06-25 22:01:53 +0300 | [diff] [blame] | 2857 | seq_printf(m, " tracked hardware state:\n"); |
Ander Conselvan de Oliveira | 2c42e53 | 2016-12-29 17:22:09 +0200 | [diff] [blame] | 2858 | seq_printf(m, " dpll: 0x%08x\n", pll->state.hw_state.dpll); |
Ander Conselvan de Oliveira | 3e369b7 | 2014-10-29 11:32:32 +0200 | [diff] [blame] | 2859 | seq_printf(m, " dpll_md: 0x%08x\n", |
Ander Conselvan de Oliveira | 2c42e53 | 2016-12-29 17:22:09 +0200 | [diff] [blame] | 2860 | pll->state.hw_state.dpll_md); |
| 2861 | seq_printf(m, " fp0: 0x%08x\n", pll->state.hw_state.fp0); |
| 2862 | seq_printf(m, " fp1: 0x%08x\n", pll->state.hw_state.fp1); |
| 2863 | seq_printf(m, " wrpll: 0x%08x\n", pll->state.hw_state.wrpll); |
Paulo Zanoni | c27e917 | 2018-04-27 16:14:36 -0700 | [diff] [blame] | 2864 | seq_printf(m, " cfgcr0: 0x%08x\n", pll->state.hw_state.cfgcr0); |
| 2865 | seq_printf(m, " cfgcr1: 0x%08x\n", pll->state.hw_state.cfgcr1); |
| 2866 | seq_printf(m, " mg_refclkin_ctl: 0x%08x\n", |
| 2867 | pll->state.hw_state.mg_refclkin_ctl); |
| 2868 | seq_printf(m, " mg_clktop2_coreclkctl1: 0x%08x\n", |
| 2869 | pll->state.hw_state.mg_clktop2_coreclkctl1); |
| 2870 | seq_printf(m, " mg_clktop2_hsclkctl: 0x%08x\n", |
| 2871 | pll->state.hw_state.mg_clktop2_hsclkctl); |
| 2872 | seq_printf(m, " mg_pll_div0: 0x%08x\n", |
| 2873 | pll->state.hw_state.mg_pll_div0); |
| 2874 | seq_printf(m, " mg_pll_div1: 0x%08x\n", |
| 2875 | pll->state.hw_state.mg_pll_div1); |
| 2876 | seq_printf(m, " mg_pll_lf: 0x%08x\n", |
| 2877 | pll->state.hw_state.mg_pll_lf); |
| 2878 | seq_printf(m, " mg_pll_frac_lock: 0x%08x\n", |
| 2879 | pll->state.hw_state.mg_pll_frac_lock); |
| 2880 | seq_printf(m, " mg_pll_ssc: 0x%08x\n", |
| 2881 | pll->state.hw_state.mg_pll_ssc); |
| 2882 | seq_printf(m, " mg_pll_bias: 0x%08x\n", |
| 2883 | pll->state.hw_state.mg_pll_bias); |
| 2884 | seq_printf(m, " mg_pll_tdc_coldst_bias: 0x%08x\n", |
| 2885 | pll->state.hw_state.mg_pll_tdc_coldst_bias); |
Daniel Vetter | 728e29d | 2014-06-25 22:01:53 +0300 | [diff] [blame] | 2886 | } |
| 2887 | drm_modeset_unlock_all(dev); |
| 2888 | |
| 2889 | return 0; |
| 2890 | } |
| 2891 | |
Damien Lespiau | 1ed1ef9 | 2014-08-30 16:50:59 +0100 | [diff] [blame] | 2892 | static int i915_wa_registers(struct seq_file *m, void *unused) |
Arun Siluvery | 888b599 | 2014-08-26 14:44:51 +0100 | [diff] [blame] | 2893 | { |
Tvrtko Ursulin | 452420d | 2018-12-03 13:33:57 +0000 | [diff] [blame] | 2894 | struct drm_i915_private *i915 = node_to_i915(m->private); |
Chris Wilson | 4a54da3 | 2019-07-03 14:58:04 +0100 | [diff] [blame] | 2895 | struct intel_engine_cs *engine; |
Arun Siluvery | 888b599 | 2014-08-26 14:44:51 +0100 | [diff] [blame] | 2896 | |
Chris Wilson | 750e76b | 2019-08-06 13:43:00 +0100 | [diff] [blame] | 2897 | for_each_uabi_engine(engine, i915) { |
Chris Wilson | 4a54da3 | 2019-07-03 14:58:04 +0100 | [diff] [blame] | 2898 | const struct i915_wa_list *wal = &engine->ctx_wa_list; |
| 2899 | const struct i915_wa *wa; |
| 2900 | unsigned int count; |
| 2901 | |
| 2902 | count = wal->count; |
| 2903 | if (!count) |
| 2904 | continue; |
| 2905 | |
| 2906 | seq_printf(m, "%s: Workarounds applied: %u\n", |
| 2907 | engine->name, count); |
| 2908 | |
| 2909 | for (wa = wal->list; count--; wa++) |
| 2910 | seq_printf(m, "0x%X: 0x%08X, mask: 0x%08X\n", |
| 2911 | i915_mmio_reg_offset(wa->reg), |
| 2912 | wa->val, wa->mask); |
| 2913 | |
| 2914 | seq_printf(m, "\n"); |
| 2915 | } |
Arun Siluvery | 888b599 | 2014-08-26 14:44:51 +0100 | [diff] [blame] | 2916 | |
| 2917 | return 0; |
| 2918 | } |
| 2919 | |
Kumar, Mahesh | d2d4f39 | 2017-08-17 19:15:29 +0530 | [diff] [blame] | 2920 | static int i915_ipc_status_show(struct seq_file *m, void *data) |
| 2921 | { |
| 2922 | struct drm_i915_private *dev_priv = m->private; |
| 2923 | |
| 2924 | seq_printf(m, "Isochronous Priority Control: %s\n", |
| 2925 | yesno(dev_priv->ipc_enabled)); |
| 2926 | return 0; |
| 2927 | } |
| 2928 | |
| 2929 | static int i915_ipc_status_open(struct inode *inode, struct file *file) |
| 2930 | { |
| 2931 | struct drm_i915_private *dev_priv = inode->i_private; |
| 2932 | |
| 2933 | if (!HAS_IPC(dev_priv)) |
| 2934 | return -ENODEV; |
| 2935 | |
| 2936 | return single_open(file, i915_ipc_status_show, dev_priv); |
| 2937 | } |
| 2938 | |
| 2939 | static ssize_t i915_ipc_status_write(struct file *file, const char __user *ubuf, |
| 2940 | size_t len, loff_t *offp) |
| 2941 | { |
| 2942 | struct seq_file *m = file->private_data; |
| 2943 | struct drm_i915_private *dev_priv = m->private; |
Chris Wilson | a037121 | 2019-01-14 14:21:14 +0000 | [diff] [blame] | 2944 | intel_wakeref_t wakeref; |
Kumar, Mahesh | d2d4f39 | 2017-08-17 19:15:29 +0530 | [diff] [blame] | 2945 | bool enable; |
Chris Wilson | d4225a5 | 2019-01-14 14:21:23 +0000 | [diff] [blame] | 2946 | int ret; |
Kumar, Mahesh | d2d4f39 | 2017-08-17 19:15:29 +0530 | [diff] [blame] | 2947 | |
| 2948 | ret = kstrtobool_from_user(ubuf, len, &enable); |
| 2949 | if (ret < 0) |
| 2950 | return ret; |
| 2951 | |
Daniele Ceraolo Spurio | c447ff7 | 2019-06-13 16:21:55 -0700 | [diff] [blame] | 2952 | with_intel_runtime_pm(&dev_priv->runtime_pm, wakeref) { |
Chris Wilson | d4225a5 | 2019-01-14 14:21:23 +0000 | [diff] [blame] | 2953 | if (!dev_priv->ipc_enabled && enable) |
| 2954 | DRM_INFO("Enabling IPC: WM will be proper only after next commit\n"); |
| 2955 | dev_priv->wm.distrust_bios_wm = true; |
| 2956 | dev_priv->ipc_enabled = enable; |
| 2957 | intel_enable_ipc(dev_priv); |
| 2958 | } |
Kumar, Mahesh | d2d4f39 | 2017-08-17 19:15:29 +0530 | [diff] [blame] | 2959 | |
| 2960 | return len; |
| 2961 | } |
| 2962 | |
| 2963 | static const struct file_operations i915_ipc_status_fops = { |
| 2964 | .owner = THIS_MODULE, |
| 2965 | .open = i915_ipc_status_open, |
| 2966 | .read = seq_read, |
| 2967 | .llseek = seq_lseek, |
| 2968 | .release = single_release, |
| 2969 | .write = i915_ipc_status_write |
| 2970 | }; |
| 2971 | |
Damien Lespiau | c5511e4 | 2014-11-04 17:06:51 +0000 | [diff] [blame] | 2972 | static int i915_ddb_info(struct seq_file *m, void *unused) |
| 2973 | { |
David Weinehall | 36cdd01 | 2016-08-22 13:59:31 +0300 | [diff] [blame] | 2974 | struct drm_i915_private *dev_priv = node_to_i915(m->private); |
| 2975 | struct drm_device *dev = &dev_priv->drm; |
Damien Lespiau | c5511e4 | 2014-11-04 17:06:51 +0000 | [diff] [blame] | 2976 | struct skl_ddb_entry *entry; |
Ville Syrjälä | ff43bc3 | 2018-11-27 18:59:00 +0200 | [diff] [blame] | 2977 | struct intel_crtc *crtc; |
Damien Lespiau | c5511e4 | 2014-11-04 17:06:51 +0000 | [diff] [blame] | 2978 | |
David Weinehall | 36cdd01 | 2016-08-22 13:59:31 +0300 | [diff] [blame] | 2979 | if (INTEL_GEN(dev_priv) < 9) |
Michal Wajdeczko | ab309a6 | 2017-12-15 14:36:35 +0000 | [diff] [blame] | 2980 | return -ENODEV; |
Damien Lespiau | 2fcffe1 | 2014-12-03 17:33:24 +0000 | [diff] [blame] | 2981 | |
Damien Lespiau | c5511e4 | 2014-11-04 17:06:51 +0000 | [diff] [blame] | 2982 | drm_modeset_lock_all(dev); |
| 2983 | |
Damien Lespiau | c5511e4 | 2014-11-04 17:06:51 +0000 | [diff] [blame] | 2984 | seq_printf(m, "%-15s%8s%8s%8s\n", "", "Start", "End", "Size"); |
| 2985 | |
Ville Syrjälä | ff43bc3 | 2018-11-27 18:59:00 +0200 | [diff] [blame] | 2986 | for_each_intel_crtc(&dev_priv->drm, crtc) { |
| 2987 | struct intel_crtc_state *crtc_state = |
| 2988 | to_intel_crtc_state(crtc->base.state); |
| 2989 | enum pipe pipe = crtc->pipe; |
| 2990 | enum plane_id plane_id; |
| 2991 | |
Damien Lespiau | c5511e4 | 2014-11-04 17:06:51 +0000 | [diff] [blame] | 2992 | seq_printf(m, "Pipe %c\n", pipe_name(pipe)); |
| 2993 | |
Ville Syrjälä | ff43bc3 | 2018-11-27 18:59:00 +0200 | [diff] [blame] | 2994 | for_each_plane_id_on_crtc(crtc, plane_id) { |
| 2995 | entry = &crtc_state->wm.skl.plane_ddb_y[plane_id]; |
| 2996 | seq_printf(m, " Plane%-8d%8u%8u%8u\n", plane_id + 1, |
Damien Lespiau | c5511e4 | 2014-11-04 17:06:51 +0000 | [diff] [blame] | 2997 | entry->start, entry->end, |
| 2998 | skl_ddb_entry_size(entry)); |
| 2999 | } |
| 3000 | |
Ville Syrjälä | ff43bc3 | 2018-11-27 18:59:00 +0200 | [diff] [blame] | 3001 | entry = &crtc_state->wm.skl.plane_ddb_y[PLANE_CURSOR]; |
Damien Lespiau | c5511e4 | 2014-11-04 17:06:51 +0000 | [diff] [blame] | 3002 | seq_printf(m, " %-13s%8u%8u%8u\n", "Cursor", entry->start, |
| 3003 | entry->end, skl_ddb_entry_size(entry)); |
| 3004 | } |
| 3005 | |
| 3006 | drm_modeset_unlock_all(dev); |
| 3007 | |
| 3008 | return 0; |
| 3009 | } |
| 3010 | |
Vandana Kannan | a54746e | 2015-03-03 20:53:10 +0530 | [diff] [blame] | 3011 | static void drrs_status_per_crtc(struct seq_file *m, |
David Weinehall | 36cdd01 | 2016-08-22 13:59:31 +0300 | [diff] [blame] | 3012 | struct drm_device *dev, |
| 3013 | struct intel_crtc *intel_crtc) |
Vandana Kannan | a54746e | 2015-03-03 20:53:10 +0530 | [diff] [blame] | 3014 | { |
Chris Wilson | fac5e23 | 2016-07-04 11:34:36 +0100 | [diff] [blame] | 3015 | struct drm_i915_private *dev_priv = to_i915(dev); |
Vandana Kannan | a54746e | 2015-03-03 20:53:10 +0530 | [diff] [blame] | 3016 | struct i915_drrs *drrs = &dev_priv->drrs; |
| 3017 | int vrefresh = 0; |
Maarten Lankhorst | 26875fe | 2016-06-20 15:57:36 +0200 | [diff] [blame] | 3018 | struct drm_connector *connector; |
Daniel Vetter | 3f6a5e1 | 2017-03-01 10:52:21 +0100 | [diff] [blame] | 3019 | struct drm_connector_list_iter conn_iter; |
Vandana Kannan | a54746e | 2015-03-03 20:53:10 +0530 | [diff] [blame] | 3020 | |
Daniel Vetter | 3f6a5e1 | 2017-03-01 10:52:21 +0100 | [diff] [blame] | 3021 | drm_connector_list_iter_begin(dev, &conn_iter); |
| 3022 | drm_for_each_connector_iter(connector, &conn_iter) { |
Maarten Lankhorst | 26875fe | 2016-06-20 15:57:36 +0200 | [diff] [blame] | 3023 | if (connector->state->crtc != &intel_crtc->base) |
| 3024 | continue; |
| 3025 | |
| 3026 | seq_printf(m, "%s:\n", connector->name); |
Vandana Kannan | a54746e | 2015-03-03 20:53:10 +0530 | [diff] [blame] | 3027 | } |
Daniel Vetter | 3f6a5e1 | 2017-03-01 10:52:21 +0100 | [diff] [blame] | 3028 | drm_connector_list_iter_end(&conn_iter); |
Vandana Kannan | a54746e | 2015-03-03 20:53:10 +0530 | [diff] [blame] | 3029 | |
| 3030 | if (dev_priv->vbt.drrs_type == STATIC_DRRS_SUPPORT) |
| 3031 | seq_puts(m, "\tVBT: DRRS_type: Static"); |
| 3032 | else if (dev_priv->vbt.drrs_type == SEAMLESS_DRRS_SUPPORT) |
| 3033 | seq_puts(m, "\tVBT: DRRS_type: Seamless"); |
| 3034 | else if (dev_priv->vbt.drrs_type == DRRS_NOT_SUPPORTED) |
| 3035 | seq_puts(m, "\tVBT: DRRS_type: None"); |
| 3036 | else |
| 3037 | seq_puts(m, "\tVBT: DRRS_type: FIXME: Unrecognized Value"); |
| 3038 | |
| 3039 | seq_puts(m, "\n\n"); |
| 3040 | |
Maarten Lankhorst | f77076c | 2015-06-01 12:50:08 +0200 | [diff] [blame] | 3041 | if (to_intel_crtc_state(intel_crtc->base.state)->has_drrs) { |
Vandana Kannan | a54746e | 2015-03-03 20:53:10 +0530 | [diff] [blame] | 3042 | struct intel_panel *panel; |
| 3043 | |
| 3044 | mutex_lock(&drrs->mutex); |
| 3045 | /* DRRS Supported */ |
| 3046 | seq_puts(m, "\tDRRS Supported: Yes\n"); |
| 3047 | |
| 3048 | /* disable_drrs() will make drrs->dp NULL */ |
| 3049 | if (!drrs->dp) { |
C, Ramalingam | ce6e213 | 2017-11-20 09:53:47 +0530 | [diff] [blame] | 3050 | seq_puts(m, "Idleness DRRS: Disabled\n"); |
| 3051 | if (dev_priv->psr.enabled) |
| 3052 | seq_puts(m, |
| 3053 | "\tAs PSR is enabled, DRRS is not enabled\n"); |
Vandana Kannan | a54746e | 2015-03-03 20:53:10 +0530 | [diff] [blame] | 3054 | mutex_unlock(&drrs->mutex); |
| 3055 | return; |
| 3056 | } |
| 3057 | |
| 3058 | panel = &drrs->dp->attached_connector->panel; |
| 3059 | seq_printf(m, "\t\tBusy_frontbuffer_bits: 0x%X", |
| 3060 | drrs->busy_frontbuffer_bits); |
| 3061 | |
| 3062 | seq_puts(m, "\n\t\t"); |
| 3063 | if (drrs->refresh_rate_type == DRRS_HIGH_RR) { |
| 3064 | seq_puts(m, "DRRS_State: DRRS_HIGH_RR\n"); |
| 3065 | vrefresh = panel->fixed_mode->vrefresh; |
| 3066 | } else if (drrs->refresh_rate_type == DRRS_LOW_RR) { |
| 3067 | seq_puts(m, "DRRS_State: DRRS_LOW_RR\n"); |
| 3068 | vrefresh = panel->downclock_mode->vrefresh; |
| 3069 | } else { |
| 3070 | seq_printf(m, "DRRS_State: Unknown(%d)\n", |
| 3071 | drrs->refresh_rate_type); |
| 3072 | mutex_unlock(&drrs->mutex); |
| 3073 | return; |
| 3074 | } |
| 3075 | seq_printf(m, "\t\tVrefresh: %d", vrefresh); |
| 3076 | |
| 3077 | seq_puts(m, "\n\t\t"); |
| 3078 | mutex_unlock(&drrs->mutex); |
| 3079 | } else { |
| 3080 | /* DRRS not supported. Print the VBT parameter*/ |
| 3081 | seq_puts(m, "\tDRRS Supported : No"); |
| 3082 | } |
| 3083 | seq_puts(m, "\n"); |
| 3084 | } |
| 3085 | |
| 3086 | static int i915_drrs_status(struct seq_file *m, void *unused) |
| 3087 | { |
David Weinehall | 36cdd01 | 2016-08-22 13:59:31 +0300 | [diff] [blame] | 3088 | struct drm_i915_private *dev_priv = node_to_i915(m->private); |
| 3089 | struct drm_device *dev = &dev_priv->drm; |
Vandana Kannan | a54746e | 2015-03-03 20:53:10 +0530 | [diff] [blame] | 3090 | struct intel_crtc *intel_crtc; |
| 3091 | int active_crtc_cnt = 0; |
| 3092 | |
Maarten Lankhorst | 26875fe | 2016-06-20 15:57:36 +0200 | [diff] [blame] | 3093 | drm_modeset_lock_all(dev); |
Vandana Kannan | a54746e | 2015-03-03 20:53:10 +0530 | [diff] [blame] | 3094 | for_each_intel_crtc(dev, intel_crtc) { |
Maarten Lankhorst | f77076c | 2015-06-01 12:50:08 +0200 | [diff] [blame] | 3095 | if (intel_crtc->base.state->active) { |
Vandana Kannan | a54746e | 2015-03-03 20:53:10 +0530 | [diff] [blame] | 3096 | active_crtc_cnt++; |
| 3097 | seq_printf(m, "\nCRTC %d: ", active_crtc_cnt); |
| 3098 | |
| 3099 | drrs_status_per_crtc(m, dev, intel_crtc); |
| 3100 | } |
Vandana Kannan | a54746e | 2015-03-03 20:53:10 +0530 | [diff] [blame] | 3101 | } |
Maarten Lankhorst | 26875fe | 2016-06-20 15:57:36 +0200 | [diff] [blame] | 3102 | drm_modeset_unlock_all(dev); |
Vandana Kannan | a54746e | 2015-03-03 20:53:10 +0530 | [diff] [blame] | 3103 | |
| 3104 | if (!active_crtc_cnt) |
| 3105 | seq_puts(m, "No active crtc found\n"); |
| 3106 | |
| 3107 | return 0; |
| 3108 | } |
| 3109 | |
Dave Airlie | 11bed95 | 2014-05-12 15:22:27 +1000 | [diff] [blame] | 3110 | static int i915_dp_mst_info(struct seq_file *m, void *unused) |
| 3111 | { |
David Weinehall | 36cdd01 | 2016-08-22 13:59:31 +0300 | [diff] [blame] | 3112 | struct drm_i915_private *dev_priv = node_to_i915(m->private); |
| 3113 | struct drm_device *dev = &dev_priv->drm; |
Dave Airlie | 11bed95 | 2014-05-12 15:22:27 +1000 | [diff] [blame] | 3114 | struct intel_encoder *intel_encoder; |
| 3115 | struct intel_digital_port *intel_dig_port; |
Maarten Lankhorst | b6dabe3 | 2016-06-20 15:57:37 +0200 | [diff] [blame] | 3116 | struct drm_connector *connector; |
Daniel Vetter | 3f6a5e1 | 2017-03-01 10:52:21 +0100 | [diff] [blame] | 3117 | struct drm_connector_list_iter conn_iter; |
Maarten Lankhorst | b6dabe3 | 2016-06-20 15:57:37 +0200 | [diff] [blame] | 3118 | |
Daniel Vetter | 3f6a5e1 | 2017-03-01 10:52:21 +0100 | [diff] [blame] | 3119 | drm_connector_list_iter_begin(dev, &conn_iter); |
| 3120 | drm_for_each_connector_iter(connector, &conn_iter) { |
Maarten Lankhorst | b6dabe3 | 2016-06-20 15:57:37 +0200 | [diff] [blame] | 3121 | if (connector->connector_type != DRM_MODE_CONNECTOR_DisplayPort) |
Dave Airlie | 11bed95 | 2014-05-12 15:22:27 +1000 | [diff] [blame] | 3122 | continue; |
Maarten Lankhorst | b6dabe3 | 2016-06-20 15:57:37 +0200 | [diff] [blame] | 3123 | |
| 3124 | intel_encoder = intel_attached_encoder(connector); |
| 3125 | if (!intel_encoder || intel_encoder->type == INTEL_OUTPUT_DP_MST) |
| 3126 | continue; |
| 3127 | |
| 3128 | intel_dig_port = enc_to_dig_port(&intel_encoder->base); |
Dave Airlie | 11bed95 | 2014-05-12 15:22:27 +1000 | [diff] [blame] | 3129 | if (!intel_dig_port->dp.can_mst) |
| 3130 | continue; |
Maarten Lankhorst | b6dabe3 | 2016-06-20 15:57:37 +0200 | [diff] [blame] | 3131 | |
Jim Bride | 40ae80c | 2016-04-14 10:18:37 -0700 | [diff] [blame] | 3132 | seq_printf(m, "MST Source Port %c\n", |
Ville Syrjälä | 8f4f279 | 2017-11-09 17:24:34 +0200 | [diff] [blame] | 3133 | port_name(intel_dig_port->base.port)); |
Dave Airlie | 11bed95 | 2014-05-12 15:22:27 +1000 | [diff] [blame] | 3134 | drm_dp_mst_dump_topology(m, &intel_dig_port->dp.mst_mgr); |
| 3135 | } |
Daniel Vetter | 3f6a5e1 | 2017-03-01 10:52:21 +0100 | [diff] [blame] | 3136 | drm_connector_list_iter_end(&conn_iter); |
| 3137 | |
Dave Airlie | 11bed95 | 2014-05-12 15:22:27 +1000 | [diff] [blame] | 3138 | return 0; |
| 3139 | } |
| 3140 | |
Todd Previte | eb3394fa | 2015-04-18 00:04:19 -0700 | [diff] [blame] | 3141 | static ssize_t i915_displayport_test_active_write(struct file *file, |
David Weinehall | 36cdd01 | 2016-08-22 13:59:31 +0300 | [diff] [blame] | 3142 | const char __user *ubuf, |
| 3143 | size_t len, loff_t *offp) |
Todd Previte | eb3394fa | 2015-04-18 00:04:19 -0700 | [diff] [blame] | 3144 | { |
| 3145 | char *input_buffer; |
| 3146 | int status = 0; |
Todd Previte | eb3394fa | 2015-04-18 00:04:19 -0700 | [diff] [blame] | 3147 | struct drm_device *dev; |
| 3148 | struct drm_connector *connector; |
Daniel Vetter | 3f6a5e1 | 2017-03-01 10:52:21 +0100 | [diff] [blame] | 3149 | struct drm_connector_list_iter conn_iter; |
Todd Previte | eb3394fa | 2015-04-18 00:04:19 -0700 | [diff] [blame] | 3150 | struct intel_dp *intel_dp; |
| 3151 | int val = 0; |
| 3152 | |
Sudip Mukherjee | 9aaffa3 | 2015-07-21 17:36:45 +0530 | [diff] [blame] | 3153 | dev = ((struct seq_file *)file->private_data)->private; |
Todd Previte | eb3394fa | 2015-04-18 00:04:19 -0700 | [diff] [blame] | 3154 | |
Todd Previte | eb3394fa | 2015-04-18 00:04:19 -0700 | [diff] [blame] | 3155 | if (len == 0) |
| 3156 | return 0; |
| 3157 | |
Geliang Tang | 261aeba | 2017-05-06 23:40:17 +0800 | [diff] [blame] | 3158 | input_buffer = memdup_user_nul(ubuf, len); |
| 3159 | if (IS_ERR(input_buffer)) |
| 3160 | return PTR_ERR(input_buffer); |
Todd Previte | eb3394fa | 2015-04-18 00:04:19 -0700 | [diff] [blame] | 3161 | |
Todd Previte | eb3394fa | 2015-04-18 00:04:19 -0700 | [diff] [blame] | 3162 | DRM_DEBUG_DRIVER("Copied %d bytes from user\n", (unsigned int)len); |
| 3163 | |
Daniel Vetter | 3f6a5e1 | 2017-03-01 10:52:21 +0100 | [diff] [blame] | 3164 | drm_connector_list_iter_begin(dev, &conn_iter); |
| 3165 | drm_for_each_connector_iter(connector, &conn_iter) { |
Maarten Lankhorst | a874b6a | 2017-06-26 10:18:35 +0200 | [diff] [blame] | 3166 | struct intel_encoder *encoder; |
| 3167 | |
Todd Previte | eb3394fa | 2015-04-18 00:04:19 -0700 | [diff] [blame] | 3168 | if (connector->connector_type != |
| 3169 | DRM_MODE_CONNECTOR_DisplayPort) |
| 3170 | continue; |
| 3171 | |
Maarten Lankhorst | a874b6a | 2017-06-26 10:18:35 +0200 | [diff] [blame] | 3172 | encoder = to_intel_encoder(connector->encoder); |
| 3173 | if (encoder && encoder->type == INTEL_OUTPUT_DP_MST) |
| 3174 | continue; |
| 3175 | |
| 3176 | if (encoder && connector->status == connector_status_connected) { |
| 3177 | intel_dp = enc_to_intel_dp(&encoder->base); |
Todd Previte | eb3394fa | 2015-04-18 00:04:19 -0700 | [diff] [blame] | 3178 | status = kstrtoint(input_buffer, 10, &val); |
| 3179 | if (status < 0) |
Daniel Vetter | 3f6a5e1 | 2017-03-01 10:52:21 +0100 | [diff] [blame] | 3180 | break; |
Todd Previte | eb3394fa | 2015-04-18 00:04:19 -0700 | [diff] [blame] | 3181 | DRM_DEBUG_DRIVER("Got %d for test active\n", val); |
| 3182 | /* To prevent erroneous activation of the compliance |
| 3183 | * testing code, only accept an actual value of 1 here |
| 3184 | */ |
| 3185 | if (val == 1) |
Manasi Navare | c1617ab | 2016-12-09 16:22:50 -0800 | [diff] [blame] | 3186 | intel_dp->compliance.test_active = 1; |
Todd Previte | eb3394fa | 2015-04-18 00:04:19 -0700 | [diff] [blame] | 3187 | else |
Manasi Navare | c1617ab | 2016-12-09 16:22:50 -0800 | [diff] [blame] | 3188 | intel_dp->compliance.test_active = 0; |
Todd Previte | eb3394fa | 2015-04-18 00:04:19 -0700 | [diff] [blame] | 3189 | } |
| 3190 | } |
Daniel Vetter | 3f6a5e1 | 2017-03-01 10:52:21 +0100 | [diff] [blame] | 3191 | drm_connector_list_iter_end(&conn_iter); |
Todd Previte | eb3394fa | 2015-04-18 00:04:19 -0700 | [diff] [blame] | 3192 | kfree(input_buffer); |
| 3193 | if (status < 0) |
| 3194 | return status; |
| 3195 | |
| 3196 | *offp += len; |
| 3197 | return len; |
| 3198 | } |
| 3199 | |
| 3200 | static int i915_displayport_test_active_show(struct seq_file *m, void *data) |
| 3201 | { |
Andy Shevchenko | e400671 | 2018-03-16 16:12:13 +0200 | [diff] [blame] | 3202 | struct drm_i915_private *dev_priv = m->private; |
| 3203 | struct drm_device *dev = &dev_priv->drm; |
Todd Previte | eb3394fa | 2015-04-18 00:04:19 -0700 | [diff] [blame] | 3204 | struct drm_connector *connector; |
Daniel Vetter | 3f6a5e1 | 2017-03-01 10:52:21 +0100 | [diff] [blame] | 3205 | struct drm_connector_list_iter conn_iter; |
Todd Previte | eb3394fa | 2015-04-18 00:04:19 -0700 | [diff] [blame] | 3206 | struct intel_dp *intel_dp; |
| 3207 | |
Daniel Vetter | 3f6a5e1 | 2017-03-01 10:52:21 +0100 | [diff] [blame] | 3208 | drm_connector_list_iter_begin(dev, &conn_iter); |
| 3209 | drm_for_each_connector_iter(connector, &conn_iter) { |
Maarten Lankhorst | a874b6a | 2017-06-26 10:18:35 +0200 | [diff] [blame] | 3210 | struct intel_encoder *encoder; |
| 3211 | |
Todd Previte | eb3394fa | 2015-04-18 00:04:19 -0700 | [diff] [blame] | 3212 | if (connector->connector_type != |
| 3213 | DRM_MODE_CONNECTOR_DisplayPort) |
| 3214 | continue; |
| 3215 | |
Maarten Lankhorst | a874b6a | 2017-06-26 10:18:35 +0200 | [diff] [blame] | 3216 | encoder = to_intel_encoder(connector->encoder); |
| 3217 | if (encoder && encoder->type == INTEL_OUTPUT_DP_MST) |
| 3218 | continue; |
| 3219 | |
| 3220 | if (encoder && connector->status == connector_status_connected) { |
| 3221 | intel_dp = enc_to_intel_dp(&encoder->base); |
Manasi Navare | c1617ab | 2016-12-09 16:22:50 -0800 | [diff] [blame] | 3222 | if (intel_dp->compliance.test_active) |
Todd Previte | eb3394fa | 2015-04-18 00:04:19 -0700 | [diff] [blame] | 3223 | seq_puts(m, "1"); |
| 3224 | else |
| 3225 | seq_puts(m, "0"); |
| 3226 | } else |
| 3227 | seq_puts(m, "0"); |
| 3228 | } |
Daniel Vetter | 3f6a5e1 | 2017-03-01 10:52:21 +0100 | [diff] [blame] | 3229 | drm_connector_list_iter_end(&conn_iter); |
Todd Previte | eb3394fa | 2015-04-18 00:04:19 -0700 | [diff] [blame] | 3230 | |
| 3231 | return 0; |
| 3232 | } |
| 3233 | |
| 3234 | static int i915_displayport_test_active_open(struct inode *inode, |
David Weinehall | 36cdd01 | 2016-08-22 13:59:31 +0300 | [diff] [blame] | 3235 | struct file *file) |
Todd Previte | eb3394fa | 2015-04-18 00:04:19 -0700 | [diff] [blame] | 3236 | { |
David Weinehall | 36cdd01 | 2016-08-22 13:59:31 +0300 | [diff] [blame] | 3237 | return single_open(file, i915_displayport_test_active_show, |
Andy Shevchenko | e400671 | 2018-03-16 16:12:13 +0200 | [diff] [blame] | 3238 | inode->i_private); |
Todd Previte | eb3394fa | 2015-04-18 00:04:19 -0700 | [diff] [blame] | 3239 | } |
| 3240 | |
| 3241 | static const struct file_operations i915_displayport_test_active_fops = { |
| 3242 | .owner = THIS_MODULE, |
| 3243 | .open = i915_displayport_test_active_open, |
| 3244 | .read = seq_read, |
| 3245 | .llseek = seq_lseek, |
| 3246 | .release = single_release, |
| 3247 | .write = i915_displayport_test_active_write |
| 3248 | }; |
| 3249 | |
| 3250 | static int i915_displayport_test_data_show(struct seq_file *m, void *data) |
| 3251 | { |
Andy Shevchenko | e400671 | 2018-03-16 16:12:13 +0200 | [diff] [blame] | 3252 | struct drm_i915_private *dev_priv = m->private; |
| 3253 | struct drm_device *dev = &dev_priv->drm; |
Todd Previte | eb3394fa | 2015-04-18 00:04:19 -0700 | [diff] [blame] | 3254 | struct drm_connector *connector; |
Daniel Vetter | 3f6a5e1 | 2017-03-01 10:52:21 +0100 | [diff] [blame] | 3255 | struct drm_connector_list_iter conn_iter; |
Todd Previte | eb3394fa | 2015-04-18 00:04:19 -0700 | [diff] [blame] | 3256 | struct intel_dp *intel_dp; |
| 3257 | |
Daniel Vetter | 3f6a5e1 | 2017-03-01 10:52:21 +0100 | [diff] [blame] | 3258 | drm_connector_list_iter_begin(dev, &conn_iter); |
| 3259 | drm_for_each_connector_iter(connector, &conn_iter) { |
Maarten Lankhorst | a874b6a | 2017-06-26 10:18:35 +0200 | [diff] [blame] | 3260 | struct intel_encoder *encoder; |
| 3261 | |
Todd Previte | eb3394fa | 2015-04-18 00:04:19 -0700 | [diff] [blame] | 3262 | if (connector->connector_type != |
| 3263 | DRM_MODE_CONNECTOR_DisplayPort) |
| 3264 | continue; |
| 3265 | |
Maarten Lankhorst | a874b6a | 2017-06-26 10:18:35 +0200 | [diff] [blame] | 3266 | encoder = to_intel_encoder(connector->encoder); |
| 3267 | if (encoder && encoder->type == INTEL_OUTPUT_DP_MST) |
| 3268 | continue; |
| 3269 | |
| 3270 | if (encoder && connector->status == connector_status_connected) { |
| 3271 | intel_dp = enc_to_intel_dp(&encoder->base); |
Manasi Navare | b48a5ba | 2017-01-20 19:09:28 -0800 | [diff] [blame] | 3272 | if (intel_dp->compliance.test_type == |
| 3273 | DP_TEST_LINK_EDID_READ) |
| 3274 | seq_printf(m, "%lx", |
| 3275 | intel_dp->compliance.test_data.edid); |
Manasi Navare | 611032b | 2017-01-24 08:21:49 -0800 | [diff] [blame] | 3276 | else if (intel_dp->compliance.test_type == |
| 3277 | DP_TEST_LINK_VIDEO_PATTERN) { |
| 3278 | seq_printf(m, "hdisplay: %d\n", |
| 3279 | intel_dp->compliance.test_data.hdisplay); |
| 3280 | seq_printf(m, "vdisplay: %d\n", |
| 3281 | intel_dp->compliance.test_data.vdisplay); |
| 3282 | seq_printf(m, "bpc: %u\n", |
| 3283 | intel_dp->compliance.test_data.bpc); |
| 3284 | } |
Todd Previte | eb3394fa | 2015-04-18 00:04:19 -0700 | [diff] [blame] | 3285 | } else |
| 3286 | seq_puts(m, "0"); |
| 3287 | } |
Daniel Vetter | 3f6a5e1 | 2017-03-01 10:52:21 +0100 | [diff] [blame] | 3288 | drm_connector_list_iter_end(&conn_iter); |
Todd Previte | eb3394fa | 2015-04-18 00:04:19 -0700 | [diff] [blame] | 3289 | |
| 3290 | return 0; |
| 3291 | } |
Andy Shevchenko | e400671 | 2018-03-16 16:12:13 +0200 | [diff] [blame] | 3292 | DEFINE_SHOW_ATTRIBUTE(i915_displayport_test_data); |
Todd Previte | eb3394fa | 2015-04-18 00:04:19 -0700 | [diff] [blame] | 3293 | |
| 3294 | static int i915_displayport_test_type_show(struct seq_file *m, void *data) |
| 3295 | { |
Andy Shevchenko | e400671 | 2018-03-16 16:12:13 +0200 | [diff] [blame] | 3296 | struct drm_i915_private *dev_priv = m->private; |
| 3297 | struct drm_device *dev = &dev_priv->drm; |
Todd Previte | eb3394fa | 2015-04-18 00:04:19 -0700 | [diff] [blame] | 3298 | struct drm_connector *connector; |
Daniel Vetter | 3f6a5e1 | 2017-03-01 10:52:21 +0100 | [diff] [blame] | 3299 | struct drm_connector_list_iter conn_iter; |
Todd Previte | eb3394fa | 2015-04-18 00:04:19 -0700 | [diff] [blame] | 3300 | struct intel_dp *intel_dp; |
| 3301 | |
Daniel Vetter | 3f6a5e1 | 2017-03-01 10:52:21 +0100 | [diff] [blame] | 3302 | drm_connector_list_iter_begin(dev, &conn_iter); |
| 3303 | drm_for_each_connector_iter(connector, &conn_iter) { |
Maarten Lankhorst | a874b6a | 2017-06-26 10:18:35 +0200 | [diff] [blame] | 3304 | struct intel_encoder *encoder; |
| 3305 | |
Todd Previte | eb3394fa | 2015-04-18 00:04:19 -0700 | [diff] [blame] | 3306 | if (connector->connector_type != |
| 3307 | DRM_MODE_CONNECTOR_DisplayPort) |
| 3308 | continue; |
| 3309 | |
Maarten Lankhorst | a874b6a | 2017-06-26 10:18:35 +0200 | [diff] [blame] | 3310 | encoder = to_intel_encoder(connector->encoder); |
| 3311 | if (encoder && encoder->type == INTEL_OUTPUT_DP_MST) |
| 3312 | continue; |
| 3313 | |
| 3314 | if (encoder && connector->status == connector_status_connected) { |
| 3315 | intel_dp = enc_to_intel_dp(&encoder->base); |
Manasi Navare | c1617ab | 2016-12-09 16:22:50 -0800 | [diff] [blame] | 3316 | seq_printf(m, "%02lx", intel_dp->compliance.test_type); |
Todd Previte | eb3394fa | 2015-04-18 00:04:19 -0700 | [diff] [blame] | 3317 | } else |
| 3318 | seq_puts(m, "0"); |
| 3319 | } |
Daniel Vetter | 3f6a5e1 | 2017-03-01 10:52:21 +0100 | [diff] [blame] | 3320 | drm_connector_list_iter_end(&conn_iter); |
Todd Previte | eb3394fa | 2015-04-18 00:04:19 -0700 | [diff] [blame] | 3321 | |
| 3322 | return 0; |
| 3323 | } |
Andy Shevchenko | e400671 | 2018-03-16 16:12:13 +0200 | [diff] [blame] | 3324 | DEFINE_SHOW_ATTRIBUTE(i915_displayport_test_type); |
Todd Previte | eb3394fa | 2015-04-18 00:04:19 -0700 | [diff] [blame] | 3325 | |
Jani Nikula | e531521 | 2019-01-16 11:15:23 +0200 | [diff] [blame] | 3326 | static void wm_latency_show(struct seq_file *m, const u16 wm[8]) |
Ville Syrjälä | 369a134 | 2014-01-22 14:36:08 +0200 | [diff] [blame] | 3327 | { |
David Weinehall | 36cdd01 | 2016-08-22 13:59:31 +0300 | [diff] [blame] | 3328 | struct drm_i915_private *dev_priv = m->private; |
| 3329 | struct drm_device *dev = &dev_priv->drm; |
Ville Syrjälä | 369a134 | 2014-01-22 14:36:08 +0200 | [diff] [blame] | 3330 | int level; |
Ville Syrjälä | de38b95 | 2015-06-24 22:00:09 +0300 | [diff] [blame] | 3331 | int num_levels; |
| 3332 | |
David Weinehall | 36cdd01 | 2016-08-22 13:59:31 +0300 | [diff] [blame] | 3333 | if (IS_CHERRYVIEW(dev_priv)) |
Ville Syrjälä | de38b95 | 2015-06-24 22:00:09 +0300 | [diff] [blame] | 3334 | num_levels = 3; |
David Weinehall | 36cdd01 | 2016-08-22 13:59:31 +0300 | [diff] [blame] | 3335 | else if (IS_VALLEYVIEW(dev_priv)) |
Ville Syrjälä | de38b95 | 2015-06-24 22:00:09 +0300 | [diff] [blame] | 3336 | num_levels = 1; |
Ville Syrjälä | 04548cb | 2017-04-21 21:14:29 +0300 | [diff] [blame] | 3337 | else if (IS_G4X(dev_priv)) |
| 3338 | num_levels = 3; |
Ville Syrjälä | de38b95 | 2015-06-24 22:00:09 +0300 | [diff] [blame] | 3339 | else |
Tvrtko Ursulin | 5db9401 | 2016-10-13 11:03:10 +0100 | [diff] [blame] | 3340 | num_levels = ilk_wm_max_level(dev_priv) + 1; |
Ville Syrjälä | 369a134 | 2014-01-22 14:36:08 +0200 | [diff] [blame] | 3341 | |
| 3342 | drm_modeset_lock_all(dev); |
| 3343 | |
| 3344 | for (level = 0; level < num_levels; level++) { |
| 3345 | unsigned int latency = wm[level]; |
| 3346 | |
Damien Lespiau | 97e94b2 | 2014-11-04 17:06:50 +0000 | [diff] [blame] | 3347 | /* |
| 3348 | * - WM1+ latency values in 0.5us units |
Ville Syrjälä | de38b95 | 2015-06-24 22:00:09 +0300 | [diff] [blame] | 3349 | * - latencies are in us on gen9/vlv/chv |
Damien Lespiau | 97e94b2 | 2014-11-04 17:06:50 +0000 | [diff] [blame] | 3350 | */ |
Ville Syrjälä | 04548cb | 2017-04-21 21:14:29 +0300 | [diff] [blame] | 3351 | if (INTEL_GEN(dev_priv) >= 9 || |
| 3352 | IS_VALLEYVIEW(dev_priv) || |
| 3353 | IS_CHERRYVIEW(dev_priv) || |
| 3354 | IS_G4X(dev_priv)) |
Damien Lespiau | 97e94b2 | 2014-11-04 17:06:50 +0000 | [diff] [blame] | 3355 | latency *= 10; |
| 3356 | else if (level > 0) |
Ville Syrjälä | 369a134 | 2014-01-22 14:36:08 +0200 | [diff] [blame] | 3357 | latency *= 5; |
| 3358 | |
| 3359 | seq_printf(m, "WM%d %u (%u.%u usec)\n", |
Damien Lespiau | 97e94b2 | 2014-11-04 17:06:50 +0000 | [diff] [blame] | 3360 | level, wm[level], latency / 10, latency % 10); |
Ville Syrjälä | 369a134 | 2014-01-22 14:36:08 +0200 | [diff] [blame] | 3361 | } |
| 3362 | |
| 3363 | drm_modeset_unlock_all(dev); |
| 3364 | } |
| 3365 | |
| 3366 | static int pri_wm_latency_show(struct seq_file *m, void *data) |
| 3367 | { |
David Weinehall | 36cdd01 | 2016-08-22 13:59:31 +0300 | [diff] [blame] | 3368 | struct drm_i915_private *dev_priv = m->private; |
Jani Nikula | e531521 | 2019-01-16 11:15:23 +0200 | [diff] [blame] | 3369 | const u16 *latencies; |
Ville Syrjälä | 369a134 | 2014-01-22 14:36:08 +0200 | [diff] [blame] | 3370 | |
David Weinehall | 36cdd01 | 2016-08-22 13:59:31 +0300 | [diff] [blame] | 3371 | if (INTEL_GEN(dev_priv) >= 9) |
Damien Lespiau | 97e94b2 | 2014-11-04 17:06:50 +0000 | [diff] [blame] | 3372 | latencies = dev_priv->wm.skl_latency; |
| 3373 | else |
David Weinehall | 36cdd01 | 2016-08-22 13:59:31 +0300 | [diff] [blame] | 3374 | latencies = dev_priv->wm.pri_latency; |
Damien Lespiau | 97e94b2 | 2014-11-04 17:06:50 +0000 | [diff] [blame] | 3375 | |
| 3376 | wm_latency_show(m, latencies); |
Ville Syrjälä | 369a134 | 2014-01-22 14:36:08 +0200 | [diff] [blame] | 3377 | |
| 3378 | return 0; |
| 3379 | } |
| 3380 | |
| 3381 | static int spr_wm_latency_show(struct seq_file *m, void *data) |
| 3382 | { |
David Weinehall | 36cdd01 | 2016-08-22 13:59:31 +0300 | [diff] [blame] | 3383 | struct drm_i915_private *dev_priv = m->private; |
Jani Nikula | e531521 | 2019-01-16 11:15:23 +0200 | [diff] [blame] | 3384 | const u16 *latencies; |
Ville Syrjälä | 369a134 | 2014-01-22 14:36:08 +0200 | [diff] [blame] | 3385 | |
David Weinehall | 36cdd01 | 2016-08-22 13:59:31 +0300 | [diff] [blame] | 3386 | if (INTEL_GEN(dev_priv) >= 9) |
Damien Lespiau | 97e94b2 | 2014-11-04 17:06:50 +0000 | [diff] [blame] | 3387 | latencies = dev_priv->wm.skl_latency; |
| 3388 | else |
David Weinehall | 36cdd01 | 2016-08-22 13:59:31 +0300 | [diff] [blame] | 3389 | latencies = dev_priv->wm.spr_latency; |
Damien Lespiau | 97e94b2 | 2014-11-04 17:06:50 +0000 | [diff] [blame] | 3390 | |
| 3391 | wm_latency_show(m, latencies); |
Ville Syrjälä | 369a134 | 2014-01-22 14:36:08 +0200 | [diff] [blame] | 3392 | |
| 3393 | return 0; |
| 3394 | } |
| 3395 | |
| 3396 | static int cur_wm_latency_show(struct seq_file *m, void *data) |
| 3397 | { |
David Weinehall | 36cdd01 | 2016-08-22 13:59:31 +0300 | [diff] [blame] | 3398 | struct drm_i915_private *dev_priv = m->private; |
Jani Nikula | e531521 | 2019-01-16 11:15:23 +0200 | [diff] [blame] | 3399 | const u16 *latencies; |
Ville Syrjälä | 369a134 | 2014-01-22 14:36:08 +0200 | [diff] [blame] | 3400 | |
David Weinehall | 36cdd01 | 2016-08-22 13:59:31 +0300 | [diff] [blame] | 3401 | if (INTEL_GEN(dev_priv) >= 9) |
Damien Lespiau | 97e94b2 | 2014-11-04 17:06:50 +0000 | [diff] [blame] | 3402 | latencies = dev_priv->wm.skl_latency; |
| 3403 | else |
David Weinehall | 36cdd01 | 2016-08-22 13:59:31 +0300 | [diff] [blame] | 3404 | latencies = dev_priv->wm.cur_latency; |
Damien Lespiau | 97e94b2 | 2014-11-04 17:06:50 +0000 | [diff] [blame] | 3405 | |
| 3406 | wm_latency_show(m, latencies); |
Ville Syrjälä | 369a134 | 2014-01-22 14:36:08 +0200 | [diff] [blame] | 3407 | |
| 3408 | return 0; |
| 3409 | } |
| 3410 | |
| 3411 | static int pri_wm_latency_open(struct inode *inode, struct file *file) |
| 3412 | { |
David Weinehall | 36cdd01 | 2016-08-22 13:59:31 +0300 | [diff] [blame] | 3413 | struct drm_i915_private *dev_priv = inode->i_private; |
Ville Syrjälä | 369a134 | 2014-01-22 14:36:08 +0200 | [diff] [blame] | 3414 | |
Ville Syrjälä | 04548cb | 2017-04-21 21:14:29 +0300 | [diff] [blame] | 3415 | if (INTEL_GEN(dev_priv) < 5 && !IS_G4X(dev_priv)) |
Ville Syrjälä | 369a134 | 2014-01-22 14:36:08 +0200 | [diff] [blame] | 3416 | return -ENODEV; |
| 3417 | |
David Weinehall | 36cdd01 | 2016-08-22 13:59:31 +0300 | [diff] [blame] | 3418 | return single_open(file, pri_wm_latency_show, dev_priv); |
Ville Syrjälä | 369a134 | 2014-01-22 14:36:08 +0200 | [diff] [blame] | 3419 | } |
| 3420 | |
| 3421 | static int spr_wm_latency_open(struct inode *inode, struct file *file) |
| 3422 | { |
David Weinehall | 36cdd01 | 2016-08-22 13:59:31 +0300 | [diff] [blame] | 3423 | struct drm_i915_private *dev_priv = inode->i_private; |
Ville Syrjälä | 369a134 | 2014-01-22 14:36:08 +0200 | [diff] [blame] | 3424 | |
Rodrigo Vivi | b2ae318 | 2019-02-04 14:25:38 -0800 | [diff] [blame] | 3425 | if (HAS_GMCH(dev_priv)) |
Ville Syrjälä | 369a134 | 2014-01-22 14:36:08 +0200 | [diff] [blame] | 3426 | return -ENODEV; |
| 3427 | |
David Weinehall | 36cdd01 | 2016-08-22 13:59:31 +0300 | [diff] [blame] | 3428 | return single_open(file, spr_wm_latency_show, dev_priv); |
Ville Syrjälä | 369a134 | 2014-01-22 14:36:08 +0200 | [diff] [blame] | 3429 | } |
| 3430 | |
| 3431 | static int cur_wm_latency_open(struct inode *inode, struct file *file) |
| 3432 | { |
David Weinehall | 36cdd01 | 2016-08-22 13:59:31 +0300 | [diff] [blame] | 3433 | struct drm_i915_private *dev_priv = inode->i_private; |
Ville Syrjälä | 369a134 | 2014-01-22 14:36:08 +0200 | [diff] [blame] | 3434 | |
Rodrigo Vivi | b2ae318 | 2019-02-04 14:25:38 -0800 | [diff] [blame] | 3435 | if (HAS_GMCH(dev_priv)) |
Ville Syrjälä | 369a134 | 2014-01-22 14:36:08 +0200 | [diff] [blame] | 3436 | return -ENODEV; |
| 3437 | |
David Weinehall | 36cdd01 | 2016-08-22 13:59:31 +0300 | [diff] [blame] | 3438 | return single_open(file, cur_wm_latency_show, dev_priv); |
Ville Syrjälä | 369a134 | 2014-01-22 14:36:08 +0200 | [diff] [blame] | 3439 | } |
| 3440 | |
| 3441 | static ssize_t wm_latency_write(struct file *file, const char __user *ubuf, |
Jani Nikula | e531521 | 2019-01-16 11:15:23 +0200 | [diff] [blame] | 3442 | size_t len, loff_t *offp, u16 wm[8]) |
Ville Syrjälä | 369a134 | 2014-01-22 14:36:08 +0200 | [diff] [blame] | 3443 | { |
| 3444 | struct seq_file *m = file->private_data; |
David Weinehall | 36cdd01 | 2016-08-22 13:59:31 +0300 | [diff] [blame] | 3445 | struct drm_i915_private *dev_priv = m->private; |
| 3446 | struct drm_device *dev = &dev_priv->drm; |
Jani Nikula | e531521 | 2019-01-16 11:15:23 +0200 | [diff] [blame] | 3447 | u16 new[8] = { 0 }; |
Ville Syrjälä | de38b95 | 2015-06-24 22:00:09 +0300 | [diff] [blame] | 3448 | int num_levels; |
Ville Syrjälä | 369a134 | 2014-01-22 14:36:08 +0200 | [diff] [blame] | 3449 | int level; |
| 3450 | int ret; |
| 3451 | char tmp[32]; |
| 3452 | |
David Weinehall | 36cdd01 | 2016-08-22 13:59:31 +0300 | [diff] [blame] | 3453 | if (IS_CHERRYVIEW(dev_priv)) |
Ville Syrjälä | de38b95 | 2015-06-24 22:00:09 +0300 | [diff] [blame] | 3454 | num_levels = 3; |
David Weinehall | 36cdd01 | 2016-08-22 13:59:31 +0300 | [diff] [blame] | 3455 | else if (IS_VALLEYVIEW(dev_priv)) |
Ville Syrjälä | de38b95 | 2015-06-24 22:00:09 +0300 | [diff] [blame] | 3456 | num_levels = 1; |
Ville Syrjälä | 04548cb | 2017-04-21 21:14:29 +0300 | [diff] [blame] | 3457 | else if (IS_G4X(dev_priv)) |
| 3458 | num_levels = 3; |
Ville Syrjälä | de38b95 | 2015-06-24 22:00:09 +0300 | [diff] [blame] | 3459 | else |
Tvrtko Ursulin | 5db9401 | 2016-10-13 11:03:10 +0100 | [diff] [blame] | 3460 | num_levels = ilk_wm_max_level(dev_priv) + 1; |
Ville Syrjälä | de38b95 | 2015-06-24 22:00:09 +0300 | [diff] [blame] | 3461 | |
Ville Syrjälä | 369a134 | 2014-01-22 14:36:08 +0200 | [diff] [blame] | 3462 | if (len >= sizeof(tmp)) |
| 3463 | return -EINVAL; |
| 3464 | |
| 3465 | if (copy_from_user(tmp, ubuf, len)) |
| 3466 | return -EFAULT; |
| 3467 | |
| 3468 | tmp[len] = '\0'; |
| 3469 | |
Damien Lespiau | 97e94b2 | 2014-11-04 17:06:50 +0000 | [diff] [blame] | 3470 | ret = sscanf(tmp, "%hu %hu %hu %hu %hu %hu %hu %hu", |
| 3471 | &new[0], &new[1], &new[2], &new[3], |
| 3472 | &new[4], &new[5], &new[6], &new[7]); |
Ville Syrjälä | 369a134 | 2014-01-22 14:36:08 +0200 | [diff] [blame] | 3473 | if (ret != num_levels) |
| 3474 | return -EINVAL; |
| 3475 | |
| 3476 | drm_modeset_lock_all(dev); |
| 3477 | |
| 3478 | for (level = 0; level < num_levels; level++) |
| 3479 | wm[level] = new[level]; |
| 3480 | |
| 3481 | drm_modeset_unlock_all(dev); |
| 3482 | |
| 3483 | return len; |
| 3484 | } |
| 3485 | |
| 3486 | |
| 3487 | static ssize_t pri_wm_latency_write(struct file *file, const char __user *ubuf, |
| 3488 | size_t len, loff_t *offp) |
| 3489 | { |
| 3490 | struct seq_file *m = file->private_data; |
David Weinehall | 36cdd01 | 2016-08-22 13:59:31 +0300 | [diff] [blame] | 3491 | struct drm_i915_private *dev_priv = m->private; |
Jani Nikula | e531521 | 2019-01-16 11:15:23 +0200 | [diff] [blame] | 3492 | u16 *latencies; |
Ville Syrjälä | 369a134 | 2014-01-22 14:36:08 +0200 | [diff] [blame] | 3493 | |
David Weinehall | 36cdd01 | 2016-08-22 13:59:31 +0300 | [diff] [blame] | 3494 | if (INTEL_GEN(dev_priv) >= 9) |
Damien Lespiau | 97e94b2 | 2014-11-04 17:06:50 +0000 | [diff] [blame] | 3495 | latencies = dev_priv->wm.skl_latency; |
| 3496 | else |
David Weinehall | 36cdd01 | 2016-08-22 13:59:31 +0300 | [diff] [blame] | 3497 | latencies = dev_priv->wm.pri_latency; |
Damien Lespiau | 97e94b2 | 2014-11-04 17:06:50 +0000 | [diff] [blame] | 3498 | |
| 3499 | return wm_latency_write(file, ubuf, len, offp, latencies); |
Ville Syrjälä | 369a134 | 2014-01-22 14:36:08 +0200 | [diff] [blame] | 3500 | } |
| 3501 | |
| 3502 | static ssize_t spr_wm_latency_write(struct file *file, const char __user *ubuf, |
| 3503 | size_t len, loff_t *offp) |
| 3504 | { |
| 3505 | struct seq_file *m = file->private_data; |
David Weinehall | 36cdd01 | 2016-08-22 13:59:31 +0300 | [diff] [blame] | 3506 | struct drm_i915_private *dev_priv = m->private; |
Jani Nikula | e531521 | 2019-01-16 11:15:23 +0200 | [diff] [blame] | 3507 | u16 *latencies; |
Ville Syrjälä | 369a134 | 2014-01-22 14:36:08 +0200 | [diff] [blame] | 3508 | |
David Weinehall | 36cdd01 | 2016-08-22 13:59:31 +0300 | [diff] [blame] | 3509 | if (INTEL_GEN(dev_priv) >= 9) |
Damien Lespiau | 97e94b2 | 2014-11-04 17:06:50 +0000 | [diff] [blame] | 3510 | latencies = dev_priv->wm.skl_latency; |
| 3511 | else |
David Weinehall | 36cdd01 | 2016-08-22 13:59:31 +0300 | [diff] [blame] | 3512 | latencies = dev_priv->wm.spr_latency; |
Damien Lespiau | 97e94b2 | 2014-11-04 17:06:50 +0000 | [diff] [blame] | 3513 | |
| 3514 | return wm_latency_write(file, ubuf, len, offp, latencies); |
Ville Syrjälä | 369a134 | 2014-01-22 14:36:08 +0200 | [diff] [blame] | 3515 | } |
| 3516 | |
| 3517 | static ssize_t cur_wm_latency_write(struct file *file, const char __user *ubuf, |
| 3518 | size_t len, loff_t *offp) |
| 3519 | { |
| 3520 | struct seq_file *m = file->private_data; |
David Weinehall | 36cdd01 | 2016-08-22 13:59:31 +0300 | [diff] [blame] | 3521 | struct drm_i915_private *dev_priv = m->private; |
Jani Nikula | e531521 | 2019-01-16 11:15:23 +0200 | [diff] [blame] | 3522 | u16 *latencies; |
Ville Syrjälä | 369a134 | 2014-01-22 14:36:08 +0200 | [diff] [blame] | 3523 | |
David Weinehall | 36cdd01 | 2016-08-22 13:59:31 +0300 | [diff] [blame] | 3524 | if (INTEL_GEN(dev_priv) >= 9) |
Damien Lespiau | 97e94b2 | 2014-11-04 17:06:50 +0000 | [diff] [blame] | 3525 | latencies = dev_priv->wm.skl_latency; |
| 3526 | else |
David Weinehall | 36cdd01 | 2016-08-22 13:59:31 +0300 | [diff] [blame] | 3527 | latencies = dev_priv->wm.cur_latency; |
Damien Lespiau | 97e94b2 | 2014-11-04 17:06:50 +0000 | [diff] [blame] | 3528 | |
| 3529 | return wm_latency_write(file, ubuf, len, offp, latencies); |
Ville Syrjälä | 369a134 | 2014-01-22 14:36:08 +0200 | [diff] [blame] | 3530 | } |
| 3531 | |
| 3532 | static const struct file_operations i915_pri_wm_latency_fops = { |
| 3533 | .owner = THIS_MODULE, |
| 3534 | .open = pri_wm_latency_open, |
| 3535 | .read = seq_read, |
| 3536 | .llseek = seq_lseek, |
| 3537 | .release = single_release, |
| 3538 | .write = pri_wm_latency_write |
| 3539 | }; |
| 3540 | |
| 3541 | static const struct file_operations i915_spr_wm_latency_fops = { |
| 3542 | .owner = THIS_MODULE, |
| 3543 | .open = spr_wm_latency_open, |
| 3544 | .read = seq_read, |
| 3545 | .llseek = seq_lseek, |
| 3546 | .release = single_release, |
| 3547 | .write = spr_wm_latency_write |
| 3548 | }; |
| 3549 | |
| 3550 | static const struct file_operations i915_cur_wm_latency_fops = { |
| 3551 | .owner = THIS_MODULE, |
| 3552 | .open = cur_wm_latency_open, |
| 3553 | .read = seq_read, |
| 3554 | .llseek = seq_lseek, |
| 3555 | .release = single_release, |
| 3556 | .write = cur_wm_latency_write |
| 3557 | }; |
| 3558 | |
Kees Cook | 647416f | 2013-03-10 14:10:06 -0700 | [diff] [blame] | 3559 | static int |
| 3560 | i915_wedged_get(void *data, u64 *val) |
Chris Wilson | f3cd474 | 2009-10-13 22:20:20 +0100 | [diff] [blame] | 3561 | { |
Chris Wilson | cb823ed | 2019-07-12 20:29:53 +0100 | [diff] [blame] | 3562 | struct drm_i915_private *i915 = data; |
| 3563 | int ret = intel_gt_terminally_wedged(&i915->gt); |
Chris Wilson | f3cd474 | 2009-10-13 22:20:20 +0100 | [diff] [blame] | 3564 | |
Chris Wilson | c41166f | 2019-02-20 14:56:37 +0000 | [diff] [blame] | 3565 | switch (ret) { |
| 3566 | case -EIO: |
| 3567 | *val = 1; |
| 3568 | return 0; |
| 3569 | case 0: |
| 3570 | *val = 0; |
| 3571 | return 0; |
| 3572 | default: |
| 3573 | return ret; |
| 3574 | } |
Chris Wilson | f3cd474 | 2009-10-13 22:20:20 +0100 | [diff] [blame] | 3575 | } |
| 3576 | |
Kees Cook | 647416f | 2013-03-10 14:10:06 -0700 | [diff] [blame] | 3577 | static int |
| 3578 | i915_wedged_set(void *data, u64 val) |
Chris Wilson | f3cd474 | 2009-10-13 22:20:20 +0100 | [diff] [blame] | 3579 | { |
Chris Wilson | 598b6b5 | 2017-03-25 13:47:35 +0000 | [diff] [blame] | 3580 | struct drm_i915_private *i915 = data; |
Imre Deak | d46c051 | 2014-04-14 20:24:27 +0300 | [diff] [blame] | 3581 | |
Chris Wilson | 15cbf00 | 2019-02-08 15:37:06 +0000 | [diff] [blame] | 3582 | /* Flush any previous reset before applying for a new one */ |
Chris Wilson | cb823ed | 2019-07-12 20:29:53 +0100 | [diff] [blame] | 3583 | wait_event(i915->gt.reset.queue, |
| 3584 | !test_bit(I915_RESET_BACKOFF, &i915->gt.reset.flags)); |
Mika Kuoppala | b8d24a0 | 2015-01-28 17:03:14 +0200 | [diff] [blame] | 3585 | |
Chris Wilson | cb823ed | 2019-07-12 20:29:53 +0100 | [diff] [blame] | 3586 | intel_gt_handle_error(&i915->gt, val, I915_ERROR_CAPTURE, |
| 3587 | "Manually set wedged engine mask = %llx", val); |
Kees Cook | 647416f | 2013-03-10 14:10:06 -0700 | [diff] [blame] | 3588 | return 0; |
Chris Wilson | f3cd474 | 2009-10-13 22:20:20 +0100 | [diff] [blame] | 3589 | } |
| 3590 | |
Kees Cook | 647416f | 2013-03-10 14:10:06 -0700 | [diff] [blame] | 3591 | DEFINE_SIMPLE_ATTRIBUTE(i915_wedged_fops, |
| 3592 | i915_wedged_get, i915_wedged_set, |
Mika Kuoppala | 3a3b4f9 | 2013-04-12 12:10:05 +0300 | [diff] [blame] | 3593 | "%llu\n"); |
Chris Wilson | f3cd474 | 2009-10-13 22:20:20 +0100 | [diff] [blame] | 3594 | |
Chris Wilson | b4a0b32 | 2017-10-18 13:16:21 +0100 | [diff] [blame] | 3595 | #define DROP_UNBOUND BIT(0) |
| 3596 | #define DROP_BOUND BIT(1) |
| 3597 | #define DROP_RETIRE BIT(2) |
| 3598 | #define DROP_ACTIVE BIT(3) |
| 3599 | #define DROP_FREED BIT(4) |
| 3600 | #define DROP_SHRINK_ALL BIT(5) |
| 3601 | #define DROP_IDLE BIT(6) |
Chris Wilson | 6b04870 | 2018-09-03 09:33:37 +0100 | [diff] [blame] | 3602 | #define DROP_RESET_ACTIVE BIT(7) |
| 3603 | #define DROP_RESET_SEQNO BIT(8) |
Chris Wilson | fbbd37b | 2016-10-28 13:58:42 +0100 | [diff] [blame] | 3604 | #define DROP_ALL (DROP_UNBOUND | \ |
| 3605 | DROP_BOUND | \ |
| 3606 | DROP_RETIRE | \ |
| 3607 | DROP_ACTIVE | \ |
Chris Wilson | 8eadc19 | 2017-03-08 14:46:22 +0000 | [diff] [blame] | 3608 | DROP_FREED | \ |
Chris Wilson | b4a0b32 | 2017-10-18 13:16:21 +0100 | [diff] [blame] | 3609 | DROP_SHRINK_ALL |\ |
Chris Wilson | 6b04870 | 2018-09-03 09:33:37 +0100 | [diff] [blame] | 3610 | DROP_IDLE | \ |
| 3611 | DROP_RESET_ACTIVE | \ |
| 3612 | DROP_RESET_SEQNO) |
Kees Cook | 647416f | 2013-03-10 14:10:06 -0700 | [diff] [blame] | 3613 | static int |
| 3614 | i915_drop_caches_get(void *data, u64 *val) |
Chris Wilson | dd624af | 2013-01-15 12:39:35 +0000 | [diff] [blame] | 3615 | { |
Kees Cook | 647416f | 2013-03-10 14:10:06 -0700 | [diff] [blame] | 3616 | *val = DROP_ALL; |
Chris Wilson | dd624af | 2013-01-15 12:39:35 +0000 | [diff] [blame] | 3617 | |
Kees Cook | 647416f | 2013-03-10 14:10:06 -0700 | [diff] [blame] | 3618 | return 0; |
Chris Wilson | dd624af | 2013-01-15 12:39:35 +0000 | [diff] [blame] | 3619 | } |
| 3620 | |
Kees Cook | 647416f | 2013-03-10 14:10:06 -0700 | [diff] [blame] | 3621 | static int |
| 3622 | i915_drop_caches_set(void *data, u64 val) |
Chris Wilson | dd624af | 2013-01-15 12:39:35 +0000 | [diff] [blame] | 3623 | { |
Chris Wilson | 6b04870 | 2018-09-03 09:33:37 +0100 | [diff] [blame] | 3624 | struct drm_i915_private *i915 = data; |
Chris Wilson | dd624af | 2013-01-15 12:39:35 +0000 | [diff] [blame] | 3625 | |
Chris Wilson | b4a0b32 | 2017-10-18 13:16:21 +0100 | [diff] [blame] | 3626 | DRM_DEBUG("Dropping caches: 0x%08llx [0x%08llx]\n", |
| 3627 | val, val & DROP_ALL); |
Chris Wilson | dd624af | 2013-01-15 12:39:35 +0000 | [diff] [blame] | 3628 | |
Chris Wilson | ad4062d | 2019-01-28 01:02:18 +0000 | [diff] [blame] | 3629 | if (val & DROP_RESET_ACTIVE && |
Chris Wilson | cb823ed | 2019-07-12 20:29:53 +0100 | [diff] [blame] | 3630 | wait_for(intel_engines_are_idle(&i915->gt), |
| 3631 | I915_IDLE_ENGINES_TIMEOUT)) |
| 3632 | intel_gt_set_wedged(&i915->gt); |
Chris Wilson | 6b04870 | 2018-09-03 09:33:37 +0100 | [diff] [blame] | 3633 | |
Chris Wilson | dd624af | 2013-01-15 12:39:35 +0000 | [diff] [blame] | 3634 | /* No need to check and wait for gpu resets, only libdrm auto-restarts |
| 3635 | * on ioctls on -EAGAIN. */ |
Chris Wilson | ba00016 | 2019-05-07 13:11:05 +0100 | [diff] [blame] | 3636 | if (val & (DROP_ACTIVE | DROP_IDLE | DROP_RETIRE | DROP_RESET_SEQNO)) { |
Chris Wilson | 6cffeb8 | 2019-03-18 09:51:49 +0000 | [diff] [blame] | 3637 | int ret; |
| 3638 | |
Chris Wilson | 6b04870 | 2018-09-03 09:33:37 +0100 | [diff] [blame] | 3639 | ret = mutex_lock_interruptible(&i915->drm.struct_mutex); |
Chris Wilson | dd624af | 2013-01-15 12:39:35 +0000 | [diff] [blame] | 3640 | if (ret) |
Chris Wilson | 6cffeb8 | 2019-03-18 09:51:49 +0000 | [diff] [blame] | 3641 | return ret; |
Chris Wilson | dd624af | 2013-01-15 12:39:35 +0000 | [diff] [blame] | 3642 | |
Chris Wilson | ba00016 | 2019-05-07 13:11:05 +0100 | [diff] [blame] | 3643 | /* |
| 3644 | * To finish the flush of the idle_worker, we must complete |
| 3645 | * the switch-to-kernel-context, which requires a double |
| 3646 | * pass through wait_for_idle: first queues the switch, |
| 3647 | * second waits for the switch. |
| 3648 | */ |
| 3649 | if (ret == 0 && val & (DROP_IDLE | DROP_ACTIVE)) |
| 3650 | ret = i915_gem_wait_for_idle(i915, |
| 3651 | I915_WAIT_INTERRUPTIBLE | |
| 3652 | I915_WAIT_LOCKED, |
| 3653 | MAX_SCHEDULE_TIMEOUT); |
| 3654 | |
| 3655 | if (ret == 0 && val & DROP_IDLE) |
Chris Wilson | 6b04870 | 2018-09-03 09:33:37 +0100 | [diff] [blame] | 3656 | ret = i915_gem_wait_for_idle(i915, |
Chris Wilson | 00c26cf | 2017-05-24 17:26:53 +0100 | [diff] [blame] | 3657 | I915_WAIT_INTERRUPTIBLE | |
Chris Wilson | ec625fb | 2018-07-09 13:20:42 +0100 | [diff] [blame] | 3658 | I915_WAIT_LOCKED, |
| 3659 | MAX_SCHEDULE_TIMEOUT); |
Chris Wilson | 00c26cf | 2017-05-24 17:26:53 +0100 | [diff] [blame] | 3660 | |
Chris Wilson | 6b04870 | 2018-09-03 09:33:37 +0100 | [diff] [blame] | 3661 | if (val & DROP_RETIRE) |
| 3662 | i915_retire_requests(i915); |
| 3663 | |
| 3664 | mutex_unlock(&i915->drm.struct_mutex); |
Chris Wilson | c7302f2 | 2019-08-08 21:27:58 +0100 | [diff] [blame] | 3665 | |
| 3666 | if (ret == 0 && val & DROP_IDLE) |
| 3667 | ret = intel_gt_pm_wait_for_idle(&i915->gt); |
Chris Wilson | 6b04870 | 2018-09-03 09:33:37 +0100 | [diff] [blame] | 3668 | } |
| 3669 | |
Chris Wilson | cb823ed | 2019-07-12 20:29:53 +0100 | [diff] [blame] | 3670 | if (val & DROP_RESET_ACTIVE && intel_gt_terminally_wedged(&i915->gt)) |
| 3671 | intel_gt_handle_error(&i915->gt, ALL_ENGINES, 0, NULL); |
Chris Wilson | dd624af | 2013-01-15 12:39:35 +0000 | [diff] [blame] | 3672 | |
Peter Zijlstra | d92a8cf | 2017-03-03 10:13:38 +0100 | [diff] [blame] | 3673 | fs_reclaim_acquire(GFP_KERNEL); |
Chris Wilson | 21ab4e7 | 2014-09-09 11:16:08 +0100 | [diff] [blame] | 3674 | if (val & DROP_BOUND) |
Chris Wilson | 6b04870 | 2018-09-03 09:33:37 +0100 | [diff] [blame] | 3675 | i915_gem_shrink(i915, LONG_MAX, NULL, I915_SHRINK_BOUND); |
Chris Wilson | 4ad72b7 | 2014-09-03 19:23:37 +0100 | [diff] [blame] | 3676 | |
Chris Wilson | 21ab4e7 | 2014-09-09 11:16:08 +0100 | [diff] [blame] | 3677 | if (val & DROP_UNBOUND) |
Chris Wilson | 6b04870 | 2018-09-03 09:33:37 +0100 | [diff] [blame] | 3678 | i915_gem_shrink(i915, LONG_MAX, NULL, I915_SHRINK_UNBOUND); |
Chris Wilson | dd624af | 2013-01-15 12:39:35 +0000 | [diff] [blame] | 3679 | |
Chris Wilson | 8eadc19 | 2017-03-08 14:46:22 +0000 | [diff] [blame] | 3680 | if (val & DROP_SHRINK_ALL) |
Chris Wilson | 6b04870 | 2018-09-03 09:33:37 +0100 | [diff] [blame] | 3681 | i915_gem_shrink_all(i915); |
Peter Zijlstra | d92a8cf | 2017-03-03 10:13:38 +0100 | [diff] [blame] | 3682 | fs_reclaim_release(GFP_KERNEL); |
Chris Wilson | 8eadc19 | 2017-03-08 14:46:22 +0000 | [diff] [blame] | 3683 | |
Chris Wilson | 4dfacb0 | 2018-05-31 09:22:43 +0100 | [diff] [blame] | 3684 | if (val & DROP_IDLE) { |
Chris Wilson | 3970564 | 2019-05-07 13:11:08 +0100 | [diff] [blame] | 3685 | flush_delayed_work(&i915->gem.retire_work); |
Chris Wilson | ae23063 | 2019-05-07 13:11:06 +0100 | [diff] [blame] | 3686 | flush_work(&i915->gem.idle_work); |
Chris Wilson | 4dfacb0 | 2018-05-31 09:22:43 +0100 | [diff] [blame] | 3687 | } |
Chris Wilson | b4a0b32 | 2017-10-18 13:16:21 +0100 | [diff] [blame] | 3688 | |
Chris Wilson | c9c70471 | 2018-02-19 22:06:31 +0000 | [diff] [blame] | 3689 | if (val & DROP_FREED) |
Chris Wilson | 6b04870 | 2018-09-03 09:33:37 +0100 | [diff] [blame] | 3690 | i915_gem_drain_freed_objects(i915); |
Chris Wilson | fbbd37b | 2016-10-28 13:58:42 +0100 | [diff] [blame] | 3691 | |
Chris Wilson | 6cffeb8 | 2019-03-18 09:51:49 +0000 | [diff] [blame] | 3692 | return 0; |
Chris Wilson | dd624af | 2013-01-15 12:39:35 +0000 | [diff] [blame] | 3693 | } |
| 3694 | |
Kees Cook | 647416f | 2013-03-10 14:10:06 -0700 | [diff] [blame] | 3695 | DEFINE_SIMPLE_ATTRIBUTE(i915_drop_caches_fops, |
| 3696 | i915_drop_caches_get, i915_drop_caches_set, |
| 3697 | "0x%08llx\n"); |
Chris Wilson | dd624af | 2013-01-15 12:39:35 +0000 | [diff] [blame] | 3698 | |
Kees Cook | 647416f | 2013-03-10 14:10:06 -0700 | [diff] [blame] | 3699 | static int |
Kees Cook | 647416f | 2013-03-10 14:10:06 -0700 | [diff] [blame] | 3700 | i915_cache_sharing_get(void *data, u64 *val) |
Jesse Barnes | 07b7ddd | 2011-08-03 11:28:44 -0700 | [diff] [blame] | 3701 | { |
David Weinehall | 36cdd01 | 2016-08-22 13:59:31 +0300 | [diff] [blame] | 3702 | struct drm_i915_private *dev_priv = data; |
Chris Wilson | a037121 | 2019-01-14 14:21:14 +0000 | [diff] [blame] | 3703 | intel_wakeref_t wakeref; |
Chris Wilson | d4225a5 | 2019-01-14 14:21:23 +0000 | [diff] [blame] | 3704 | u32 snpcr = 0; |
Jesse Barnes | 07b7ddd | 2011-08-03 11:28:44 -0700 | [diff] [blame] | 3705 | |
Lucas De Marchi | f3ce44a | 2018-12-12 10:10:44 -0800 | [diff] [blame] | 3706 | if (!(IS_GEN_RANGE(dev_priv, 6, 7))) |
Daniel Vetter | 004777c | 2012-08-09 15:07:01 +0200 | [diff] [blame] | 3707 | return -ENODEV; |
| 3708 | |
Daniele Ceraolo Spurio | c447ff7 | 2019-06-13 16:21:55 -0700 | [diff] [blame] | 3709 | with_intel_runtime_pm(&dev_priv->runtime_pm, wakeref) |
Chris Wilson | d4225a5 | 2019-01-14 14:21:23 +0000 | [diff] [blame] | 3710 | snpcr = I915_READ(GEN6_MBCUNIT_SNPCR); |
Jesse Barnes | 07b7ddd | 2011-08-03 11:28:44 -0700 | [diff] [blame] | 3711 | |
Kees Cook | 647416f | 2013-03-10 14:10:06 -0700 | [diff] [blame] | 3712 | *val = (snpcr & GEN6_MBC_SNPCR_MASK) >> GEN6_MBC_SNPCR_SHIFT; |
Jesse Barnes | 07b7ddd | 2011-08-03 11:28:44 -0700 | [diff] [blame] | 3713 | |
Kees Cook | 647416f | 2013-03-10 14:10:06 -0700 | [diff] [blame] | 3714 | return 0; |
Jesse Barnes | 07b7ddd | 2011-08-03 11:28:44 -0700 | [diff] [blame] | 3715 | } |
| 3716 | |
Kees Cook | 647416f | 2013-03-10 14:10:06 -0700 | [diff] [blame] | 3717 | static int |
| 3718 | i915_cache_sharing_set(void *data, u64 val) |
Jesse Barnes | 07b7ddd | 2011-08-03 11:28:44 -0700 | [diff] [blame] | 3719 | { |
David Weinehall | 36cdd01 | 2016-08-22 13:59:31 +0300 | [diff] [blame] | 3720 | struct drm_i915_private *dev_priv = data; |
Chris Wilson | a037121 | 2019-01-14 14:21:14 +0000 | [diff] [blame] | 3721 | intel_wakeref_t wakeref; |
Jesse Barnes | 07b7ddd | 2011-08-03 11:28:44 -0700 | [diff] [blame] | 3722 | |
Lucas De Marchi | f3ce44a | 2018-12-12 10:10:44 -0800 | [diff] [blame] | 3723 | if (!(IS_GEN_RANGE(dev_priv, 6, 7))) |
Daniel Vetter | 004777c | 2012-08-09 15:07:01 +0200 | [diff] [blame] | 3724 | return -ENODEV; |
| 3725 | |
Kees Cook | 647416f | 2013-03-10 14:10:06 -0700 | [diff] [blame] | 3726 | if (val > 3) |
Jesse Barnes | 07b7ddd | 2011-08-03 11:28:44 -0700 | [diff] [blame] | 3727 | return -EINVAL; |
| 3728 | |
Kees Cook | 647416f | 2013-03-10 14:10:06 -0700 | [diff] [blame] | 3729 | DRM_DEBUG_DRIVER("Manually setting uncore sharing to %llu\n", val); |
Daniele Ceraolo Spurio | c447ff7 | 2019-06-13 16:21:55 -0700 | [diff] [blame] | 3730 | with_intel_runtime_pm(&dev_priv->runtime_pm, wakeref) { |
Chris Wilson | d4225a5 | 2019-01-14 14:21:23 +0000 | [diff] [blame] | 3731 | u32 snpcr; |
Jesse Barnes | 07b7ddd | 2011-08-03 11:28:44 -0700 | [diff] [blame] | 3732 | |
Chris Wilson | d4225a5 | 2019-01-14 14:21:23 +0000 | [diff] [blame] | 3733 | /* Update the cache sharing policy here as well */ |
| 3734 | snpcr = I915_READ(GEN6_MBCUNIT_SNPCR); |
| 3735 | snpcr &= ~GEN6_MBC_SNPCR_MASK; |
| 3736 | snpcr |= val << GEN6_MBC_SNPCR_SHIFT; |
| 3737 | I915_WRITE(GEN6_MBCUNIT_SNPCR, snpcr); |
| 3738 | } |
Jesse Barnes | 07b7ddd | 2011-08-03 11:28:44 -0700 | [diff] [blame] | 3739 | |
Kees Cook | 647416f | 2013-03-10 14:10:06 -0700 | [diff] [blame] | 3740 | return 0; |
Jesse Barnes | 07b7ddd | 2011-08-03 11:28:44 -0700 | [diff] [blame] | 3741 | } |
| 3742 | |
Kees Cook | 647416f | 2013-03-10 14:10:06 -0700 | [diff] [blame] | 3743 | DEFINE_SIMPLE_ATTRIBUTE(i915_cache_sharing_fops, |
| 3744 | i915_cache_sharing_get, i915_cache_sharing_set, |
| 3745 | "%llu\n"); |
Jesse Barnes | 07b7ddd | 2011-08-03 11:28:44 -0700 | [diff] [blame] | 3746 | |
David Weinehall | 36cdd01 | 2016-08-22 13:59:31 +0300 | [diff] [blame] | 3747 | static void cherryview_sseu_device_status(struct drm_i915_private *dev_priv, |
Imre Deak | 915490d | 2016-08-31 19:13:01 +0300 | [diff] [blame] | 3748 | struct sseu_dev_info *sseu) |
Jeff McGee | 5d39525 | 2015-04-03 18:13:17 -0700 | [diff] [blame] | 3749 | { |
Chris Wilson | 7aa0b14 | 2018-03-13 00:40:54 +0000 | [diff] [blame] | 3750 | #define SS_MAX 2 |
| 3751 | const int ss_max = SS_MAX; |
| 3752 | u32 sig1[SS_MAX], sig2[SS_MAX]; |
Jeff McGee | 5d39525 | 2015-04-03 18:13:17 -0700 | [diff] [blame] | 3753 | int ss; |
Jeff McGee | 5d39525 | 2015-04-03 18:13:17 -0700 | [diff] [blame] | 3754 | |
| 3755 | sig1[0] = I915_READ(CHV_POWER_SS0_SIG1); |
| 3756 | sig1[1] = I915_READ(CHV_POWER_SS1_SIG1); |
| 3757 | sig2[0] = I915_READ(CHV_POWER_SS0_SIG2); |
| 3758 | sig2[1] = I915_READ(CHV_POWER_SS1_SIG2); |
| 3759 | |
| 3760 | for (ss = 0; ss < ss_max; ss++) { |
| 3761 | unsigned int eu_cnt; |
| 3762 | |
| 3763 | if (sig1[ss] & CHV_SS_PG_ENABLE) |
| 3764 | /* skip disabled subslice */ |
| 3765 | continue; |
| 3766 | |
Imre Deak | f08a0c9 | 2016-08-31 19:13:04 +0300 | [diff] [blame] | 3767 | sseu->slice_mask = BIT(0); |
Lionel Landwerlin | 8cc7669 | 2018-03-06 12:28:52 +0000 | [diff] [blame] | 3768 | sseu->subslice_mask[0] |= BIT(ss); |
Jeff McGee | 5d39525 | 2015-04-03 18:13:17 -0700 | [diff] [blame] | 3769 | eu_cnt = ((sig1[ss] & CHV_EU08_PG_ENABLE) ? 0 : 2) + |
| 3770 | ((sig1[ss] & CHV_EU19_PG_ENABLE) ? 0 : 2) + |
| 3771 | ((sig1[ss] & CHV_EU210_PG_ENABLE) ? 0 : 2) + |
| 3772 | ((sig2[ss] & CHV_EU311_PG_ENABLE) ? 0 : 2); |
Imre Deak | 915490d | 2016-08-31 19:13:01 +0300 | [diff] [blame] | 3773 | sseu->eu_total += eu_cnt; |
| 3774 | sseu->eu_per_subslice = max_t(unsigned int, |
| 3775 | sseu->eu_per_subslice, eu_cnt); |
Jeff McGee | 5d39525 | 2015-04-03 18:13:17 -0700 | [diff] [blame] | 3776 | } |
Chris Wilson | 7aa0b14 | 2018-03-13 00:40:54 +0000 | [diff] [blame] | 3777 | #undef SS_MAX |
Jeff McGee | 5d39525 | 2015-04-03 18:13:17 -0700 | [diff] [blame] | 3778 | } |
| 3779 | |
Rodrigo Vivi | f8c3dcf | 2017-10-25 17:15:46 -0700 | [diff] [blame] | 3780 | static void gen10_sseu_device_status(struct drm_i915_private *dev_priv, |
| 3781 | struct sseu_dev_info *sseu) |
| 3782 | { |
Chris Wilson | c7fb3c6 | 2018-03-13 11:31:49 +0000 | [diff] [blame] | 3783 | #define SS_MAX 6 |
Jani Nikula | 0258404 | 2018-12-31 16:56:41 +0200 | [diff] [blame] | 3784 | const struct intel_runtime_info *info = RUNTIME_INFO(dev_priv); |
Chris Wilson | c7fb3c6 | 2018-03-13 11:31:49 +0000 | [diff] [blame] | 3785 | u32 s_reg[SS_MAX], eu_reg[2 * SS_MAX], eu_mask[2]; |
Rodrigo Vivi | f8c3dcf | 2017-10-25 17:15:46 -0700 | [diff] [blame] | 3786 | int s, ss; |
Rodrigo Vivi | f8c3dcf | 2017-10-25 17:15:46 -0700 | [diff] [blame] | 3787 | |
Lionel Landwerlin | b3e7f86 | 2018-03-06 12:28:53 +0000 | [diff] [blame] | 3788 | for (s = 0; s < info->sseu.max_slices; s++) { |
Rodrigo Vivi | f8c3dcf | 2017-10-25 17:15:46 -0700 | [diff] [blame] | 3789 | /* |
| 3790 | * FIXME: Valid SS Mask respects the spec and read |
Alexandre Belloni | 3c64ea8 | 2018-11-20 16:14:15 +0100 | [diff] [blame] | 3791 | * only valid bits for those registers, excluding reserved |
Rodrigo Vivi | f8c3dcf | 2017-10-25 17:15:46 -0700 | [diff] [blame] | 3792 | * although this seems wrong because it would leave many |
| 3793 | * subslices without ACK. |
| 3794 | */ |
| 3795 | s_reg[s] = I915_READ(GEN10_SLICE_PGCTL_ACK(s)) & |
| 3796 | GEN10_PGCTL_VALID_SS_MASK(s); |
| 3797 | eu_reg[2 * s] = I915_READ(GEN10_SS01_EU_PGCTL_ACK(s)); |
| 3798 | eu_reg[2 * s + 1] = I915_READ(GEN10_SS23_EU_PGCTL_ACK(s)); |
| 3799 | } |
| 3800 | |
| 3801 | eu_mask[0] = GEN9_PGCTL_SSA_EU08_ACK | |
| 3802 | GEN9_PGCTL_SSA_EU19_ACK | |
| 3803 | GEN9_PGCTL_SSA_EU210_ACK | |
| 3804 | GEN9_PGCTL_SSA_EU311_ACK; |
| 3805 | eu_mask[1] = GEN9_PGCTL_SSB_EU08_ACK | |
| 3806 | GEN9_PGCTL_SSB_EU19_ACK | |
| 3807 | GEN9_PGCTL_SSB_EU210_ACK | |
| 3808 | GEN9_PGCTL_SSB_EU311_ACK; |
| 3809 | |
Lionel Landwerlin | b3e7f86 | 2018-03-06 12:28:53 +0000 | [diff] [blame] | 3810 | for (s = 0; s < info->sseu.max_slices; s++) { |
Rodrigo Vivi | f8c3dcf | 2017-10-25 17:15:46 -0700 | [diff] [blame] | 3811 | if ((s_reg[s] & GEN9_PGCTL_SLICE_ACK) == 0) |
| 3812 | /* skip disabled slice */ |
| 3813 | continue; |
| 3814 | |
| 3815 | sseu->slice_mask |= BIT(s); |
Jani Nikula | a10f361 | 2019-05-29 11:21:50 +0300 | [diff] [blame] | 3816 | sseu->subslice_mask[s] = info->sseu.subslice_mask[s]; |
Rodrigo Vivi | f8c3dcf | 2017-10-25 17:15:46 -0700 | [diff] [blame] | 3817 | |
Lionel Landwerlin | b3e7f86 | 2018-03-06 12:28:53 +0000 | [diff] [blame] | 3818 | for (ss = 0; ss < info->sseu.max_subslices; ss++) { |
Rodrigo Vivi | f8c3dcf | 2017-10-25 17:15:46 -0700 | [diff] [blame] | 3819 | unsigned int eu_cnt; |
| 3820 | |
| 3821 | if (!(s_reg[s] & (GEN9_PGCTL_SS_ACK(ss)))) |
| 3822 | /* skip disabled subslice */ |
| 3823 | continue; |
| 3824 | |
| 3825 | eu_cnt = 2 * hweight32(eu_reg[2 * s + ss / 2] & |
| 3826 | eu_mask[ss % 2]); |
| 3827 | sseu->eu_total += eu_cnt; |
| 3828 | sseu->eu_per_subslice = max_t(unsigned int, |
| 3829 | sseu->eu_per_subslice, |
| 3830 | eu_cnt); |
| 3831 | } |
| 3832 | } |
Chris Wilson | c7fb3c6 | 2018-03-13 11:31:49 +0000 | [diff] [blame] | 3833 | #undef SS_MAX |
Rodrigo Vivi | f8c3dcf | 2017-10-25 17:15:46 -0700 | [diff] [blame] | 3834 | } |
| 3835 | |
David Weinehall | 36cdd01 | 2016-08-22 13:59:31 +0300 | [diff] [blame] | 3836 | static void gen9_sseu_device_status(struct drm_i915_private *dev_priv, |
Imre Deak | 915490d | 2016-08-31 19:13:01 +0300 | [diff] [blame] | 3837 | struct sseu_dev_info *sseu) |
Jeff McGee | 5d39525 | 2015-04-03 18:13:17 -0700 | [diff] [blame] | 3838 | { |
Chris Wilson | c7fb3c6 | 2018-03-13 11:31:49 +0000 | [diff] [blame] | 3839 | #define SS_MAX 3 |
Jani Nikula | 0258404 | 2018-12-31 16:56:41 +0200 | [diff] [blame] | 3840 | const struct intel_runtime_info *info = RUNTIME_INFO(dev_priv); |
Chris Wilson | c7fb3c6 | 2018-03-13 11:31:49 +0000 | [diff] [blame] | 3841 | u32 s_reg[SS_MAX], eu_reg[2 * SS_MAX], eu_mask[2]; |
Jeff McGee | 5d39525 | 2015-04-03 18:13:17 -0700 | [diff] [blame] | 3842 | int s, ss; |
Jeff McGee | 5d39525 | 2015-04-03 18:13:17 -0700 | [diff] [blame] | 3843 | |
Lionel Landwerlin | b3e7f86 | 2018-03-06 12:28:53 +0000 | [diff] [blame] | 3844 | for (s = 0; s < info->sseu.max_slices; s++) { |
Jeff McGee | 1c046bc | 2015-04-03 18:13:18 -0700 | [diff] [blame] | 3845 | s_reg[s] = I915_READ(GEN9_SLICE_PGCTL_ACK(s)); |
| 3846 | eu_reg[2*s] = I915_READ(GEN9_SS01_EU_PGCTL_ACK(s)); |
| 3847 | eu_reg[2*s + 1] = I915_READ(GEN9_SS23_EU_PGCTL_ACK(s)); |
| 3848 | } |
| 3849 | |
Jeff McGee | 5d39525 | 2015-04-03 18:13:17 -0700 | [diff] [blame] | 3850 | eu_mask[0] = GEN9_PGCTL_SSA_EU08_ACK | |
| 3851 | GEN9_PGCTL_SSA_EU19_ACK | |
| 3852 | GEN9_PGCTL_SSA_EU210_ACK | |
| 3853 | GEN9_PGCTL_SSA_EU311_ACK; |
| 3854 | eu_mask[1] = GEN9_PGCTL_SSB_EU08_ACK | |
| 3855 | GEN9_PGCTL_SSB_EU19_ACK | |
| 3856 | GEN9_PGCTL_SSB_EU210_ACK | |
| 3857 | GEN9_PGCTL_SSB_EU311_ACK; |
| 3858 | |
Lionel Landwerlin | b3e7f86 | 2018-03-06 12:28:53 +0000 | [diff] [blame] | 3859 | for (s = 0; s < info->sseu.max_slices; s++) { |
Jeff McGee | 5d39525 | 2015-04-03 18:13:17 -0700 | [diff] [blame] | 3860 | if ((s_reg[s] & GEN9_PGCTL_SLICE_ACK) == 0) |
| 3861 | /* skip disabled slice */ |
| 3862 | continue; |
| 3863 | |
Imre Deak | f08a0c9 | 2016-08-31 19:13:04 +0300 | [diff] [blame] | 3864 | sseu->slice_mask |= BIT(s); |
Jeff McGee | 1c046bc | 2015-04-03 18:13:18 -0700 | [diff] [blame] | 3865 | |
Rodrigo Vivi | f8c3dcf | 2017-10-25 17:15:46 -0700 | [diff] [blame] | 3866 | if (IS_GEN9_BC(dev_priv)) |
Jani Nikula | a10f361 | 2019-05-29 11:21:50 +0300 | [diff] [blame] | 3867 | sseu->subslice_mask[s] = |
| 3868 | RUNTIME_INFO(dev_priv)->sseu.subslice_mask[s]; |
Jeff McGee | 1c046bc | 2015-04-03 18:13:18 -0700 | [diff] [blame] | 3869 | |
Lionel Landwerlin | b3e7f86 | 2018-03-06 12:28:53 +0000 | [diff] [blame] | 3870 | for (ss = 0; ss < info->sseu.max_subslices; ss++) { |
Jeff McGee | 5d39525 | 2015-04-03 18:13:17 -0700 | [diff] [blame] | 3871 | unsigned int eu_cnt; |
| 3872 | |
Ander Conselvan de Oliveira | cc3f90f | 2016-12-02 10:23:49 +0200 | [diff] [blame] | 3873 | if (IS_GEN9_LP(dev_priv)) { |
Imre Deak | 57ec171 | 2016-08-31 19:13:05 +0300 | [diff] [blame] | 3874 | if (!(s_reg[s] & (GEN9_PGCTL_SS_ACK(ss)))) |
| 3875 | /* skip disabled subslice */ |
| 3876 | continue; |
Jeff McGee | 1c046bc | 2015-04-03 18:13:18 -0700 | [diff] [blame] | 3877 | |
Jani Nikula | a10f361 | 2019-05-29 11:21:50 +0300 | [diff] [blame] | 3878 | sseu->subslice_mask[s] |= BIT(ss); |
Imre Deak | 57ec171 | 2016-08-31 19:13:05 +0300 | [diff] [blame] | 3879 | } |
Jeff McGee | 1c046bc | 2015-04-03 18:13:18 -0700 | [diff] [blame] | 3880 | |
Jeff McGee | 5d39525 | 2015-04-03 18:13:17 -0700 | [diff] [blame] | 3881 | eu_cnt = 2 * hweight32(eu_reg[2*s + ss/2] & |
| 3882 | eu_mask[ss%2]); |
Imre Deak | 915490d | 2016-08-31 19:13:01 +0300 | [diff] [blame] | 3883 | sseu->eu_total += eu_cnt; |
| 3884 | sseu->eu_per_subslice = max_t(unsigned int, |
| 3885 | sseu->eu_per_subslice, |
| 3886 | eu_cnt); |
Jeff McGee | 5d39525 | 2015-04-03 18:13:17 -0700 | [diff] [blame] | 3887 | } |
| 3888 | } |
Chris Wilson | c7fb3c6 | 2018-03-13 11:31:49 +0000 | [diff] [blame] | 3889 | #undef SS_MAX |
Jeff McGee | 5d39525 | 2015-04-03 18:13:17 -0700 | [diff] [blame] | 3890 | } |
| 3891 | |
David Weinehall | 36cdd01 | 2016-08-22 13:59:31 +0300 | [diff] [blame] | 3892 | static void broadwell_sseu_device_status(struct drm_i915_private *dev_priv, |
Imre Deak | 915490d | 2016-08-31 19:13:01 +0300 | [diff] [blame] | 3893 | struct sseu_dev_info *sseu) |
Łukasz Daniluk | 91bedd3 | 2015-09-25 11:54:58 +0200 | [diff] [blame] | 3894 | { |
Łukasz Daniluk | 91bedd3 | 2015-09-25 11:54:58 +0200 | [diff] [blame] | 3895 | u32 slice_info = I915_READ(GEN8_GT_SLICE_INFO); |
David Weinehall | 36cdd01 | 2016-08-22 13:59:31 +0300 | [diff] [blame] | 3896 | int s; |
Łukasz Daniluk | 91bedd3 | 2015-09-25 11:54:58 +0200 | [diff] [blame] | 3897 | |
Imre Deak | f08a0c9 | 2016-08-31 19:13:04 +0300 | [diff] [blame] | 3898 | sseu->slice_mask = slice_info & GEN8_LSLICESTAT_MASK; |
Łukasz Daniluk | 91bedd3 | 2015-09-25 11:54:58 +0200 | [diff] [blame] | 3899 | |
Imre Deak | f08a0c9 | 2016-08-31 19:13:04 +0300 | [diff] [blame] | 3900 | if (sseu->slice_mask) { |
Jani Nikula | a10f361 | 2019-05-29 11:21:50 +0300 | [diff] [blame] | 3901 | sseu->eu_per_subslice = |
| 3902 | RUNTIME_INFO(dev_priv)->sseu.eu_per_subslice; |
| 3903 | for (s = 0; s < fls(sseu->slice_mask); s++) { |
| 3904 | sseu->subslice_mask[s] = |
| 3905 | RUNTIME_INFO(dev_priv)->sseu.subslice_mask[s]; |
| 3906 | } |
Imre Deak | 57ec171 | 2016-08-31 19:13:05 +0300 | [diff] [blame] | 3907 | sseu->eu_total = sseu->eu_per_subslice * |
Stuart Summers | 0040fd1 | 2019-05-24 08:40:21 -0700 | [diff] [blame] | 3908 | intel_sseu_subslice_total(sseu); |
Łukasz Daniluk | 91bedd3 | 2015-09-25 11:54:58 +0200 | [diff] [blame] | 3909 | |
| 3910 | /* subtract fused off EU(s) from enabled slice(s) */ |
Imre Deak | 795b38b | 2016-08-31 19:13:07 +0300 | [diff] [blame] | 3911 | for (s = 0; s < fls(sseu->slice_mask); s++) { |
Jani Nikula | a10f361 | 2019-05-29 11:21:50 +0300 | [diff] [blame] | 3912 | u8 subslice_7eu = |
| 3913 | RUNTIME_INFO(dev_priv)->sseu.subslice_7eu[s]; |
Łukasz Daniluk | 91bedd3 | 2015-09-25 11:54:58 +0200 | [diff] [blame] | 3914 | |
Imre Deak | 915490d | 2016-08-31 19:13:01 +0300 | [diff] [blame] | 3915 | sseu->eu_total -= hweight8(subslice_7eu); |
Łukasz Daniluk | 91bedd3 | 2015-09-25 11:54:58 +0200 | [diff] [blame] | 3916 | } |
| 3917 | } |
| 3918 | } |
| 3919 | |
Imre Deak | 615d890 | 2016-08-31 19:13:03 +0300 | [diff] [blame] | 3920 | static void i915_print_sseu_info(struct seq_file *m, bool is_available_info, |
| 3921 | const struct sseu_dev_info *sseu) |
| 3922 | { |
| 3923 | struct drm_i915_private *dev_priv = node_to_i915(m->private); |
| 3924 | const char *type = is_available_info ? "Available" : "Enabled"; |
Lionel Landwerlin | 8cc7669 | 2018-03-06 12:28:52 +0000 | [diff] [blame] | 3925 | int s; |
Imre Deak | 615d890 | 2016-08-31 19:13:03 +0300 | [diff] [blame] | 3926 | |
Imre Deak | c67ba53 | 2016-08-31 19:13:06 +0300 | [diff] [blame] | 3927 | seq_printf(m, " %s Slice Mask: %04x\n", type, |
| 3928 | sseu->slice_mask); |
Imre Deak | 615d890 | 2016-08-31 19:13:03 +0300 | [diff] [blame] | 3929 | seq_printf(m, " %s Slice Total: %u\n", type, |
Imre Deak | f08a0c9 | 2016-08-31 19:13:04 +0300 | [diff] [blame] | 3930 | hweight8(sseu->slice_mask)); |
Imre Deak | 615d890 | 2016-08-31 19:13:03 +0300 | [diff] [blame] | 3931 | seq_printf(m, " %s Subslice Total: %u\n", type, |
Stuart Summers | 0040fd1 | 2019-05-24 08:40:21 -0700 | [diff] [blame] | 3932 | intel_sseu_subslice_total(sseu)); |
Lionel Landwerlin | 8cc7669 | 2018-03-06 12:28:52 +0000 | [diff] [blame] | 3933 | for (s = 0; s < fls(sseu->slice_mask); s++) { |
| 3934 | seq_printf(m, " %s Slice%i subslices: %u\n", type, |
Stuart Summers | b5ab1ab | 2019-05-24 08:40:20 -0700 | [diff] [blame] | 3935 | s, intel_sseu_subslices_per_slice(sseu, s)); |
Lionel Landwerlin | 8cc7669 | 2018-03-06 12:28:52 +0000 | [diff] [blame] | 3936 | } |
Imre Deak | 615d890 | 2016-08-31 19:13:03 +0300 | [diff] [blame] | 3937 | seq_printf(m, " %s EU Total: %u\n", type, |
| 3938 | sseu->eu_total); |
| 3939 | seq_printf(m, " %s EU Per Subslice: %u\n", type, |
| 3940 | sseu->eu_per_subslice); |
| 3941 | |
| 3942 | if (!is_available_info) |
| 3943 | return; |
| 3944 | |
| 3945 | seq_printf(m, " Has Pooled EU: %s\n", yesno(HAS_POOLED_EU(dev_priv))); |
| 3946 | if (HAS_POOLED_EU(dev_priv)) |
| 3947 | seq_printf(m, " Min EU in pool: %u\n", sseu->min_eu_in_pool); |
| 3948 | |
| 3949 | seq_printf(m, " Has Slice Power Gating: %s\n", |
| 3950 | yesno(sseu->has_slice_pg)); |
| 3951 | seq_printf(m, " Has Subslice Power Gating: %s\n", |
| 3952 | yesno(sseu->has_subslice_pg)); |
| 3953 | seq_printf(m, " Has EU Power Gating: %s\n", |
| 3954 | yesno(sseu->has_eu_pg)); |
| 3955 | } |
| 3956 | |
Jeff McGee | 3873218 | 2015-02-13 10:27:54 -0600 | [diff] [blame] | 3957 | static int i915_sseu_status(struct seq_file *m, void *unused) |
| 3958 | { |
David Weinehall | 36cdd01 | 2016-08-22 13:59:31 +0300 | [diff] [blame] | 3959 | struct drm_i915_private *dev_priv = node_to_i915(m->private); |
Imre Deak | 915490d | 2016-08-31 19:13:01 +0300 | [diff] [blame] | 3960 | struct sseu_dev_info sseu; |
Chris Wilson | a037121 | 2019-01-14 14:21:14 +0000 | [diff] [blame] | 3961 | intel_wakeref_t wakeref; |
Jeff McGee | 3873218 | 2015-02-13 10:27:54 -0600 | [diff] [blame] | 3962 | |
David Weinehall | 36cdd01 | 2016-08-22 13:59:31 +0300 | [diff] [blame] | 3963 | if (INTEL_GEN(dev_priv) < 8) |
Jeff McGee | 3873218 | 2015-02-13 10:27:54 -0600 | [diff] [blame] | 3964 | return -ENODEV; |
| 3965 | |
| 3966 | seq_puts(m, "SSEU Device Info\n"); |
Jani Nikula | a10f361 | 2019-05-29 11:21:50 +0300 | [diff] [blame] | 3967 | i915_print_sseu_info(m, true, &RUNTIME_INFO(dev_priv)->sseu); |
Jeff McGee | 3873218 | 2015-02-13 10:27:54 -0600 | [diff] [blame] | 3968 | |
Jeff McGee | 7f992ab | 2015-02-13 10:27:55 -0600 | [diff] [blame] | 3969 | seq_puts(m, "SSEU Device Status\n"); |
Imre Deak | 915490d | 2016-08-31 19:13:01 +0300 | [diff] [blame] | 3970 | memset(&sseu, 0, sizeof(sseu)); |
Jani Nikula | a10f361 | 2019-05-29 11:21:50 +0300 | [diff] [blame] | 3971 | sseu.max_slices = RUNTIME_INFO(dev_priv)->sseu.max_slices; |
| 3972 | sseu.max_subslices = RUNTIME_INFO(dev_priv)->sseu.max_subslices; |
| 3973 | sseu.max_eus_per_subslice = |
| 3974 | RUNTIME_INFO(dev_priv)->sseu.max_eus_per_subslice; |
David Weinehall | 238010e | 2016-08-01 17:33:27 +0300 | [diff] [blame] | 3975 | |
Daniele Ceraolo Spurio | c447ff7 | 2019-06-13 16:21:55 -0700 | [diff] [blame] | 3976 | with_intel_runtime_pm(&dev_priv->runtime_pm, wakeref) { |
Chris Wilson | d4225a5 | 2019-01-14 14:21:23 +0000 | [diff] [blame] | 3977 | if (IS_CHERRYVIEW(dev_priv)) |
| 3978 | cherryview_sseu_device_status(dev_priv, &sseu); |
| 3979 | else if (IS_BROADWELL(dev_priv)) |
| 3980 | broadwell_sseu_device_status(dev_priv, &sseu); |
| 3981 | else if (IS_GEN(dev_priv, 9)) |
| 3982 | gen9_sseu_device_status(dev_priv, &sseu); |
| 3983 | else if (INTEL_GEN(dev_priv) >= 10) |
| 3984 | gen10_sseu_device_status(dev_priv, &sseu); |
Jeff McGee | 7f992ab | 2015-02-13 10:27:55 -0600 | [diff] [blame] | 3985 | } |
David Weinehall | 238010e | 2016-08-01 17:33:27 +0300 | [diff] [blame] | 3986 | |
Imre Deak | 615d890 | 2016-08-31 19:13:03 +0300 | [diff] [blame] | 3987 | i915_print_sseu_info(m, false, &sseu); |
Jeff McGee | 7f992ab | 2015-02-13 10:27:55 -0600 | [diff] [blame] | 3988 | |
Jeff McGee | 3873218 | 2015-02-13 10:27:54 -0600 | [diff] [blame] | 3989 | return 0; |
| 3990 | } |
| 3991 | |
Ben Widawsky | 6d794d4 | 2011-04-25 11:25:56 -0700 | [diff] [blame] | 3992 | static int i915_forcewake_open(struct inode *inode, struct file *file) |
| 3993 | { |
Chris Wilson | d7a133d | 2017-09-07 14:44:41 +0100 | [diff] [blame] | 3994 | struct drm_i915_private *i915 = inode->i_private; |
Ben Widawsky | 6d794d4 | 2011-04-25 11:25:56 -0700 | [diff] [blame] | 3995 | |
Chris Wilson | d7a133d | 2017-09-07 14:44:41 +0100 | [diff] [blame] | 3996 | if (INTEL_GEN(i915) < 6) |
Ben Widawsky | 6d794d4 | 2011-04-25 11:25:56 -0700 | [diff] [blame] | 3997 | return 0; |
| 3998 | |
Daniele Ceraolo Spurio | d858d56 | 2019-06-13 16:21:54 -0700 | [diff] [blame] | 3999 | file->private_data = |
| 4000 | (void *)(uintptr_t)intel_runtime_pm_get(&i915->runtime_pm); |
Daniele Ceraolo Spurio | 3ceea6a | 2019-03-19 11:35:36 -0700 | [diff] [blame] | 4001 | intel_uncore_forcewake_user_get(&i915->uncore); |
Ben Widawsky | 6d794d4 | 2011-04-25 11:25:56 -0700 | [diff] [blame] | 4002 | |
| 4003 | return 0; |
| 4004 | } |
| 4005 | |
Ben Widawsky | c43b563 | 2012-04-16 14:07:40 -0700 | [diff] [blame] | 4006 | static int i915_forcewake_release(struct inode *inode, struct file *file) |
Ben Widawsky | 6d794d4 | 2011-04-25 11:25:56 -0700 | [diff] [blame] | 4007 | { |
Chris Wilson | d7a133d | 2017-09-07 14:44:41 +0100 | [diff] [blame] | 4008 | struct drm_i915_private *i915 = inode->i_private; |
Ben Widawsky | 6d794d4 | 2011-04-25 11:25:56 -0700 | [diff] [blame] | 4009 | |
Chris Wilson | d7a133d | 2017-09-07 14:44:41 +0100 | [diff] [blame] | 4010 | if (INTEL_GEN(i915) < 6) |
Ben Widawsky | 6d794d4 | 2011-04-25 11:25:56 -0700 | [diff] [blame] | 4011 | return 0; |
| 4012 | |
Daniele Ceraolo Spurio | 3ceea6a | 2019-03-19 11:35:36 -0700 | [diff] [blame] | 4013 | intel_uncore_forcewake_user_put(&i915->uncore); |
Daniele Ceraolo Spurio | d858d56 | 2019-06-13 16:21:54 -0700 | [diff] [blame] | 4014 | intel_runtime_pm_put(&i915->runtime_pm, |
Tvrtko Ursulin | 6ddbb12e | 2019-01-17 14:48:31 +0000 | [diff] [blame] | 4015 | (intel_wakeref_t)(uintptr_t)file->private_data); |
Ben Widawsky | 6d794d4 | 2011-04-25 11:25:56 -0700 | [diff] [blame] | 4016 | |
| 4017 | return 0; |
| 4018 | } |
| 4019 | |
| 4020 | static const struct file_operations i915_forcewake_fops = { |
| 4021 | .owner = THIS_MODULE, |
| 4022 | .open = i915_forcewake_open, |
| 4023 | .release = i915_forcewake_release, |
| 4024 | }; |
| 4025 | |
Lyude | 317eaa9 | 2017-02-03 21:18:25 -0500 | [diff] [blame] | 4026 | static int i915_hpd_storm_ctl_show(struct seq_file *m, void *data) |
| 4027 | { |
| 4028 | struct drm_i915_private *dev_priv = m->private; |
| 4029 | struct i915_hotplug *hotplug = &dev_priv->hotplug; |
| 4030 | |
Lyude Paul | 6fc5d78 | 2018-11-20 19:37:17 -0500 | [diff] [blame] | 4031 | /* Synchronize with everything first in case there's been an HPD |
| 4032 | * storm, but we haven't finished handling it in the kernel yet |
| 4033 | */ |
Ville Syrjälä | 315ca4c | 2019-07-02 18:17:23 +0300 | [diff] [blame] | 4034 | intel_synchronize_irq(dev_priv); |
Lyude Paul | 6fc5d78 | 2018-11-20 19:37:17 -0500 | [diff] [blame] | 4035 | flush_work(&dev_priv->hotplug.dig_port_work); |
Imre Deak | 3944709 | 2019-07-11 17:53:42 -0700 | [diff] [blame] | 4036 | flush_delayed_work(&dev_priv->hotplug.hotplug_work); |
Lyude Paul | 6fc5d78 | 2018-11-20 19:37:17 -0500 | [diff] [blame] | 4037 | |
Lyude | 317eaa9 | 2017-02-03 21:18:25 -0500 | [diff] [blame] | 4038 | seq_printf(m, "Threshold: %d\n", hotplug->hpd_storm_threshold); |
| 4039 | seq_printf(m, "Detected: %s\n", |
| 4040 | yesno(delayed_work_pending(&hotplug->reenable_work))); |
| 4041 | |
| 4042 | return 0; |
| 4043 | } |
| 4044 | |
| 4045 | static ssize_t i915_hpd_storm_ctl_write(struct file *file, |
| 4046 | const char __user *ubuf, size_t len, |
| 4047 | loff_t *offp) |
| 4048 | { |
| 4049 | struct seq_file *m = file->private_data; |
| 4050 | struct drm_i915_private *dev_priv = m->private; |
| 4051 | struct i915_hotplug *hotplug = &dev_priv->hotplug; |
| 4052 | unsigned int new_threshold; |
| 4053 | int i; |
| 4054 | char *newline; |
| 4055 | char tmp[16]; |
| 4056 | |
| 4057 | if (len >= sizeof(tmp)) |
| 4058 | return -EINVAL; |
| 4059 | |
| 4060 | if (copy_from_user(tmp, ubuf, len)) |
| 4061 | return -EFAULT; |
| 4062 | |
| 4063 | tmp[len] = '\0'; |
| 4064 | |
| 4065 | /* Strip newline, if any */ |
| 4066 | newline = strchr(tmp, '\n'); |
| 4067 | if (newline) |
| 4068 | *newline = '\0'; |
| 4069 | |
| 4070 | if (strcmp(tmp, "reset") == 0) |
| 4071 | new_threshold = HPD_STORM_DEFAULT_THRESHOLD; |
| 4072 | else if (kstrtouint(tmp, 10, &new_threshold) != 0) |
| 4073 | return -EINVAL; |
| 4074 | |
| 4075 | if (new_threshold > 0) |
| 4076 | DRM_DEBUG_KMS("Setting HPD storm detection threshold to %d\n", |
| 4077 | new_threshold); |
| 4078 | else |
| 4079 | DRM_DEBUG_KMS("Disabling HPD storm detection\n"); |
| 4080 | |
| 4081 | spin_lock_irq(&dev_priv->irq_lock); |
| 4082 | hotplug->hpd_storm_threshold = new_threshold; |
| 4083 | /* Reset the HPD storm stats so we don't accidentally trigger a storm */ |
| 4084 | for_each_hpd_pin(i) |
| 4085 | hotplug->stats[i].count = 0; |
| 4086 | spin_unlock_irq(&dev_priv->irq_lock); |
| 4087 | |
| 4088 | /* Re-enable hpd immediately if we were in an irq storm */ |
| 4089 | flush_delayed_work(&dev_priv->hotplug.reenable_work); |
| 4090 | |
| 4091 | return len; |
| 4092 | } |
| 4093 | |
| 4094 | static int i915_hpd_storm_ctl_open(struct inode *inode, struct file *file) |
| 4095 | { |
| 4096 | return single_open(file, i915_hpd_storm_ctl_show, inode->i_private); |
| 4097 | } |
| 4098 | |
| 4099 | static const struct file_operations i915_hpd_storm_ctl_fops = { |
| 4100 | .owner = THIS_MODULE, |
| 4101 | .open = i915_hpd_storm_ctl_open, |
| 4102 | .read = seq_read, |
| 4103 | .llseek = seq_lseek, |
| 4104 | .release = single_release, |
| 4105 | .write = i915_hpd_storm_ctl_write |
| 4106 | }; |
| 4107 | |
Lyude Paul | 9a64c65 | 2018-11-06 16:30:16 -0500 | [diff] [blame] | 4108 | static int i915_hpd_short_storm_ctl_show(struct seq_file *m, void *data) |
| 4109 | { |
| 4110 | struct drm_i915_private *dev_priv = m->private; |
| 4111 | |
| 4112 | seq_printf(m, "Enabled: %s\n", |
| 4113 | yesno(dev_priv->hotplug.hpd_short_storm_enabled)); |
| 4114 | |
| 4115 | return 0; |
| 4116 | } |
| 4117 | |
| 4118 | static int |
| 4119 | i915_hpd_short_storm_ctl_open(struct inode *inode, struct file *file) |
| 4120 | { |
| 4121 | return single_open(file, i915_hpd_short_storm_ctl_show, |
| 4122 | inode->i_private); |
| 4123 | } |
| 4124 | |
| 4125 | static ssize_t i915_hpd_short_storm_ctl_write(struct file *file, |
| 4126 | const char __user *ubuf, |
| 4127 | size_t len, loff_t *offp) |
| 4128 | { |
| 4129 | struct seq_file *m = file->private_data; |
| 4130 | struct drm_i915_private *dev_priv = m->private; |
| 4131 | struct i915_hotplug *hotplug = &dev_priv->hotplug; |
| 4132 | char *newline; |
| 4133 | char tmp[16]; |
| 4134 | int i; |
| 4135 | bool new_state; |
| 4136 | |
| 4137 | if (len >= sizeof(tmp)) |
| 4138 | return -EINVAL; |
| 4139 | |
| 4140 | if (copy_from_user(tmp, ubuf, len)) |
| 4141 | return -EFAULT; |
| 4142 | |
| 4143 | tmp[len] = '\0'; |
| 4144 | |
| 4145 | /* Strip newline, if any */ |
| 4146 | newline = strchr(tmp, '\n'); |
| 4147 | if (newline) |
| 4148 | *newline = '\0'; |
| 4149 | |
| 4150 | /* Reset to the "default" state for this system */ |
| 4151 | if (strcmp(tmp, "reset") == 0) |
| 4152 | new_state = !HAS_DP_MST(dev_priv); |
| 4153 | else if (kstrtobool(tmp, &new_state) != 0) |
| 4154 | return -EINVAL; |
| 4155 | |
| 4156 | DRM_DEBUG_KMS("%sabling HPD short storm detection\n", |
| 4157 | new_state ? "En" : "Dis"); |
| 4158 | |
| 4159 | spin_lock_irq(&dev_priv->irq_lock); |
| 4160 | hotplug->hpd_short_storm_enabled = new_state; |
| 4161 | /* Reset the HPD storm stats so we don't accidentally trigger a storm */ |
| 4162 | for_each_hpd_pin(i) |
| 4163 | hotplug->stats[i].count = 0; |
| 4164 | spin_unlock_irq(&dev_priv->irq_lock); |
| 4165 | |
| 4166 | /* Re-enable hpd immediately if we were in an irq storm */ |
| 4167 | flush_delayed_work(&dev_priv->hotplug.reenable_work); |
| 4168 | |
| 4169 | return len; |
| 4170 | } |
| 4171 | |
| 4172 | static const struct file_operations i915_hpd_short_storm_ctl_fops = { |
| 4173 | .owner = THIS_MODULE, |
| 4174 | .open = i915_hpd_short_storm_ctl_open, |
| 4175 | .read = seq_read, |
| 4176 | .llseek = seq_lseek, |
| 4177 | .release = single_release, |
| 4178 | .write = i915_hpd_short_storm_ctl_write, |
| 4179 | }; |
| 4180 | |
C, Ramalingam | 35954e8 | 2017-11-08 00:08:23 +0530 | [diff] [blame] | 4181 | static int i915_drrs_ctl_set(void *data, u64 val) |
| 4182 | { |
| 4183 | struct drm_i915_private *dev_priv = data; |
| 4184 | struct drm_device *dev = &dev_priv->drm; |
Maarten Lankhorst | 138bdac | 2018-10-11 12:04:48 +0200 | [diff] [blame] | 4185 | struct intel_crtc *crtc; |
C, Ramalingam | 35954e8 | 2017-11-08 00:08:23 +0530 | [diff] [blame] | 4186 | |
| 4187 | if (INTEL_GEN(dev_priv) < 7) |
| 4188 | return -ENODEV; |
| 4189 | |
Maarten Lankhorst | 138bdac | 2018-10-11 12:04:48 +0200 | [diff] [blame] | 4190 | for_each_intel_crtc(dev, crtc) { |
| 4191 | struct drm_connector_list_iter conn_iter; |
| 4192 | struct intel_crtc_state *crtc_state; |
| 4193 | struct drm_connector *connector; |
| 4194 | struct drm_crtc_commit *commit; |
| 4195 | int ret; |
C, Ramalingam | 35954e8 | 2017-11-08 00:08:23 +0530 | [diff] [blame] | 4196 | |
Maarten Lankhorst | 138bdac | 2018-10-11 12:04:48 +0200 | [diff] [blame] | 4197 | ret = drm_modeset_lock_single_interruptible(&crtc->base.mutex); |
| 4198 | if (ret) |
| 4199 | return ret; |
| 4200 | |
| 4201 | crtc_state = to_intel_crtc_state(crtc->base.state); |
| 4202 | |
| 4203 | if (!crtc_state->base.active || |
| 4204 | !crtc_state->has_drrs) |
| 4205 | goto out; |
| 4206 | |
| 4207 | commit = crtc_state->base.commit; |
| 4208 | if (commit) { |
| 4209 | ret = wait_for_completion_interruptible(&commit->hw_done); |
| 4210 | if (ret) |
| 4211 | goto out; |
| 4212 | } |
| 4213 | |
| 4214 | drm_connector_list_iter_begin(dev, &conn_iter); |
| 4215 | drm_for_each_connector_iter(connector, &conn_iter) { |
| 4216 | struct intel_encoder *encoder; |
| 4217 | struct intel_dp *intel_dp; |
| 4218 | |
| 4219 | if (!(crtc_state->base.connector_mask & |
| 4220 | drm_connector_mask(connector))) |
| 4221 | continue; |
| 4222 | |
| 4223 | encoder = intel_attached_encoder(connector); |
C, Ramalingam | 35954e8 | 2017-11-08 00:08:23 +0530 | [diff] [blame] | 4224 | if (encoder->type != INTEL_OUTPUT_EDP) |
| 4225 | continue; |
| 4226 | |
| 4227 | DRM_DEBUG_DRIVER("Manually %sabling DRRS. %llu\n", |
| 4228 | val ? "en" : "dis", val); |
| 4229 | |
| 4230 | intel_dp = enc_to_intel_dp(&encoder->base); |
| 4231 | if (val) |
| 4232 | intel_edp_drrs_enable(intel_dp, |
Maarten Lankhorst | 138bdac | 2018-10-11 12:04:48 +0200 | [diff] [blame] | 4233 | crtc_state); |
C, Ramalingam | 35954e8 | 2017-11-08 00:08:23 +0530 | [diff] [blame] | 4234 | else |
| 4235 | intel_edp_drrs_disable(intel_dp, |
Maarten Lankhorst | 138bdac | 2018-10-11 12:04:48 +0200 | [diff] [blame] | 4236 | crtc_state); |
C, Ramalingam | 35954e8 | 2017-11-08 00:08:23 +0530 | [diff] [blame] | 4237 | } |
Maarten Lankhorst | 138bdac | 2018-10-11 12:04:48 +0200 | [diff] [blame] | 4238 | drm_connector_list_iter_end(&conn_iter); |
| 4239 | |
| 4240 | out: |
| 4241 | drm_modeset_unlock(&crtc->base.mutex); |
| 4242 | if (ret) |
| 4243 | return ret; |
C, Ramalingam | 35954e8 | 2017-11-08 00:08:23 +0530 | [diff] [blame] | 4244 | } |
C, Ramalingam | 35954e8 | 2017-11-08 00:08:23 +0530 | [diff] [blame] | 4245 | |
| 4246 | return 0; |
| 4247 | } |
| 4248 | |
| 4249 | DEFINE_SIMPLE_ATTRIBUTE(i915_drrs_ctl_fops, NULL, i915_drrs_ctl_set, "%llu\n"); |
| 4250 | |
Maarten Lankhorst | d52ad9c | 2018-03-28 12:05:26 +0200 | [diff] [blame] | 4251 | static ssize_t |
| 4252 | i915_fifo_underrun_reset_write(struct file *filp, |
| 4253 | const char __user *ubuf, |
| 4254 | size_t cnt, loff_t *ppos) |
| 4255 | { |
| 4256 | struct drm_i915_private *dev_priv = filp->private_data; |
| 4257 | struct intel_crtc *intel_crtc; |
| 4258 | struct drm_device *dev = &dev_priv->drm; |
| 4259 | int ret; |
| 4260 | bool reset; |
| 4261 | |
| 4262 | ret = kstrtobool_from_user(ubuf, cnt, &reset); |
| 4263 | if (ret) |
| 4264 | return ret; |
| 4265 | |
| 4266 | if (!reset) |
| 4267 | return cnt; |
| 4268 | |
| 4269 | for_each_intel_crtc(dev, intel_crtc) { |
| 4270 | struct drm_crtc_commit *commit; |
| 4271 | struct intel_crtc_state *crtc_state; |
| 4272 | |
| 4273 | ret = drm_modeset_lock_single_interruptible(&intel_crtc->base.mutex); |
| 4274 | if (ret) |
| 4275 | return ret; |
| 4276 | |
| 4277 | crtc_state = to_intel_crtc_state(intel_crtc->base.state); |
| 4278 | commit = crtc_state->base.commit; |
| 4279 | if (commit) { |
| 4280 | ret = wait_for_completion_interruptible(&commit->hw_done); |
| 4281 | if (!ret) |
| 4282 | ret = wait_for_completion_interruptible(&commit->flip_done); |
| 4283 | } |
| 4284 | |
| 4285 | if (!ret && crtc_state->base.active) { |
| 4286 | DRM_DEBUG_KMS("Re-arming FIFO underruns on pipe %c\n", |
| 4287 | pipe_name(intel_crtc->pipe)); |
| 4288 | |
| 4289 | intel_crtc_arm_fifo_underrun(intel_crtc, crtc_state); |
| 4290 | } |
| 4291 | |
| 4292 | drm_modeset_unlock(&intel_crtc->base.mutex); |
| 4293 | |
| 4294 | if (ret) |
| 4295 | return ret; |
| 4296 | } |
| 4297 | |
| 4298 | ret = intel_fbc_reset_underrun(dev_priv); |
| 4299 | if (ret) |
| 4300 | return ret; |
| 4301 | |
| 4302 | return cnt; |
| 4303 | } |
| 4304 | |
| 4305 | static const struct file_operations i915_fifo_underrun_reset_ops = { |
| 4306 | .owner = THIS_MODULE, |
| 4307 | .open = simple_open, |
| 4308 | .write = i915_fifo_underrun_reset_write, |
| 4309 | .llseek = default_llseek, |
| 4310 | }; |
| 4311 | |
Lespiau, Damien | 06c5bf8 | 2013-10-17 19:09:56 +0100 | [diff] [blame] | 4312 | static const struct drm_info_list i915_debugfs_list[] = { |
Chris Wilson | 311bd68 | 2011-01-13 19:06:50 +0000 | [diff] [blame] | 4313 | {"i915_capabilities", i915_capabilities, 0}, |
Chris Wilson | 73aa808 | 2010-09-30 11:46:12 +0100 | [diff] [blame] | 4314 | {"i915_gem_objects", i915_gem_object_info, 0}, |
Chris Wilson | a6172a8 | 2009-02-11 14:26:38 +0000 | [diff] [blame] | 4315 | {"i915_gem_fence_regs", i915_gem_fence_regs_info, 0}, |
Ben Gamari | 2017263 | 2009-02-17 20:08:50 -0500 | [diff] [blame] | 4316 | {"i915_gem_interrupt", i915_interrupt_info, 0}, |
Dave Gordon | 8b417c2 | 2015-08-12 15:43:44 +0100 | [diff] [blame] | 4317 | {"i915_guc_info", i915_guc_info, 0}, |
Alex Dai | fdf5d35 | 2015-08-12 15:43:37 +0100 | [diff] [blame] | 4318 | {"i915_guc_load_status", i915_guc_load_status_info, 0}, |
Alex Dai | 4c7e77f | 2015-08-12 15:43:40 +0100 | [diff] [blame] | 4319 | {"i915_guc_log_dump", i915_guc_log_dump, 0}, |
Daniele Ceraolo Spurio | ac58d2a | 2017-05-22 10:50:28 -0700 | [diff] [blame] | 4320 | {"i915_guc_load_err_log_dump", i915_guc_log_dump, 0, (void *)1}, |
Oscar Mateo | a8b9370 | 2017-05-10 15:04:51 +0000 | [diff] [blame] | 4321 | {"i915_guc_stage_pool", i915_guc_stage_pool, 0}, |
Anusha Srivatsa | 0509ead | 2017-01-18 08:05:56 -0800 | [diff] [blame] | 4322 | {"i915_huc_load_status", i915_huc_load_status_info, 0}, |
Deepak S | adb4bd1 | 2014-03-31 11:30:02 +0530 | [diff] [blame] | 4323 | {"i915_frequency_info", i915_frequency_info, 0}, |
Chris Wilson | f654449 | 2015-01-26 18:03:04 +0200 | [diff] [blame] | 4324 | {"i915_hangcheck_info", i915_hangcheck_info, 0}, |
Jesse Barnes | f97108d | 2010-01-29 11:27:07 -0800 | [diff] [blame] | 4325 | {"i915_drpc_info", i915_drpc_info, 0}, |
Jesse Barnes | 23b2f8b | 2011-06-28 13:04:16 -0700 | [diff] [blame] | 4326 | {"i915_ring_freq_table", i915_ring_freq_table, 0}, |
Daniel Vetter | 9a85178 | 2015-06-18 10:30:22 +0200 | [diff] [blame] | 4327 | {"i915_frontbuffer_tracking", i915_frontbuffer_tracking, 0}, |
Jesse Barnes | b5e50c3 | 2010-02-05 12:42:41 -0800 | [diff] [blame] | 4328 | {"i915_fbc_status", i915_fbc_status, 0}, |
Paulo Zanoni | 92d4462 | 2013-05-31 16:33:24 -0300 | [diff] [blame] | 4329 | {"i915_ips_status", i915_ips_status, 0}, |
Jesse Barnes | 4a9bef3 | 2010-02-05 12:47:35 -0800 | [diff] [blame] | 4330 | {"i915_sr_status", i915_sr_status, 0}, |
Chris Wilson | 44834a6 | 2010-08-19 16:09:23 +0100 | [diff] [blame] | 4331 | {"i915_opregion", i915_opregion, 0}, |
Jani Nikula | ada8f95 | 2015-12-15 13:17:12 +0200 | [diff] [blame] | 4332 | {"i915_vbt", i915_vbt, 0}, |
Chris Wilson | 37811fc | 2010-08-25 22:45:57 +0100 | [diff] [blame] | 4333 | {"i915_gem_framebuffer", i915_gem_framebuffer_info, 0}, |
Ben Widawsky | e76d363 | 2011-03-19 18:14:29 -0700 | [diff] [blame] | 4334 | {"i915_context_status", i915_context_status, 0}, |
Mika Kuoppala | f65367b | 2015-01-16 11:34:42 +0200 | [diff] [blame] | 4335 | {"i915_forcewake_domains", i915_forcewake_domains, 0}, |
Daniel Vetter | ea16a3c | 2011-12-14 13:57:16 +0100 | [diff] [blame] | 4336 | {"i915_swizzle_info", i915_swizzle_info, 0}, |
Ben Widawsky | 63573eb | 2013-07-04 11:02:07 -0700 | [diff] [blame] | 4337 | {"i915_llc", i915_llc, 0}, |
Rodrigo Vivi | e91fd8c | 2013-07-11 18:44:59 -0300 | [diff] [blame] | 4338 | {"i915_edp_psr_status", i915_edp_psr_status, 0}, |
Jesse Barnes | ec013e7 | 2013-08-20 10:29:23 +0100 | [diff] [blame] | 4339 | {"i915_energy_uJ", i915_energy_uJ, 0}, |
Damien Lespiau | 6455c87 | 2015-06-04 18:23:57 +0100 | [diff] [blame] | 4340 | {"i915_runtime_pm_status", i915_runtime_pm_status, 0}, |
Imre Deak | 1da5158 | 2013-11-25 17:15:35 +0200 | [diff] [blame] | 4341 | {"i915_power_domain_info", i915_power_domain_info, 0}, |
Damien Lespiau | b7cec66 | 2015-10-27 14:47:01 +0200 | [diff] [blame] | 4342 | {"i915_dmc_info", i915_dmc_info, 0}, |
Jesse Barnes | 53f5e3c | 2014-02-07 12:48:15 -0800 | [diff] [blame] | 4343 | {"i915_display_info", i915_display_info, 0}, |
Chris Wilson | 1b36595 | 2016-10-04 21:11:31 +0100 | [diff] [blame] | 4344 | {"i915_engine_info", i915_engine_info, 0}, |
Lionel Landwerlin | 79e9cd5 | 2018-03-06 12:28:54 +0000 | [diff] [blame] | 4345 | {"i915_rcs_topology", i915_rcs_topology, 0}, |
Chris Wilson | c5418a8 | 2017-10-13 21:26:19 +0100 | [diff] [blame] | 4346 | {"i915_shrinker_info", i915_shrinker_info, 0}, |
Daniel Vetter | 728e29d | 2014-06-25 22:01:53 +0300 | [diff] [blame] | 4347 | {"i915_shared_dplls_info", i915_shared_dplls_info, 0}, |
Dave Airlie | 11bed95 | 2014-05-12 15:22:27 +1000 | [diff] [blame] | 4348 | {"i915_dp_mst_info", i915_dp_mst_info, 0}, |
Damien Lespiau | 1ed1ef9 | 2014-08-30 16:50:59 +0100 | [diff] [blame] | 4349 | {"i915_wa_registers", i915_wa_registers, 0}, |
Damien Lespiau | c5511e4 | 2014-11-04 17:06:51 +0000 | [diff] [blame] | 4350 | {"i915_ddb_info", i915_ddb_info, 0}, |
Jeff McGee | 3873218 | 2015-02-13 10:27:54 -0600 | [diff] [blame] | 4351 | {"i915_sseu_status", i915_sseu_status, 0}, |
Vandana Kannan | a54746e | 2015-03-03 20:53:10 +0530 | [diff] [blame] | 4352 | {"i915_drrs_status", i915_drrs_status, 0}, |
Chris Wilson | 1854d5c | 2015-04-07 16:20:32 +0100 | [diff] [blame] | 4353 | {"i915_rps_boost_info", i915_rps_boost_info, 0}, |
Ben Gamari | 2017263 | 2009-02-17 20:08:50 -0500 | [diff] [blame] | 4354 | }; |
Ben Gamari | 27c202a | 2009-07-01 22:26:52 -0400 | [diff] [blame] | 4355 | #define I915_DEBUGFS_ENTRIES ARRAY_SIZE(i915_debugfs_list) |
Ben Gamari | 2017263 | 2009-02-17 20:08:50 -0500 | [diff] [blame] | 4356 | |
Lespiau, Damien | 06c5bf8 | 2013-10-17 19:09:56 +0100 | [diff] [blame] | 4357 | static const struct i915_debugfs_files { |
Daniel Vetter | 34b9674 | 2013-07-04 20:49:44 +0200 | [diff] [blame] | 4358 | const char *name; |
| 4359 | const struct file_operations *fops; |
| 4360 | } i915_debugfs_files[] = { |
| 4361 | {"i915_wedged", &i915_wedged_fops}, |
Daniel Vetter | 34b9674 | 2013-07-04 20:49:44 +0200 | [diff] [blame] | 4362 | {"i915_cache_sharing", &i915_cache_sharing_fops}, |
Daniel Vetter | 34b9674 | 2013-07-04 20:49:44 +0200 | [diff] [blame] | 4363 | {"i915_gem_drop_caches", &i915_drop_caches_fops}, |
Chris Wilson | 98a2f41 | 2016-10-12 10:05:18 +0100 | [diff] [blame] | 4364 | #if IS_ENABLED(CONFIG_DRM_I915_CAPTURE_ERROR) |
Daniel Vetter | 34b9674 | 2013-07-04 20:49:44 +0200 | [diff] [blame] | 4365 | {"i915_error_state", &i915_error_state_fops}, |
Chris Wilson | 5a4c6f1 | 2017-02-14 16:46:11 +0000 | [diff] [blame] | 4366 | {"i915_gpu_info", &i915_gpu_info_fops}, |
Chris Wilson | 98a2f41 | 2016-10-12 10:05:18 +0100 | [diff] [blame] | 4367 | #endif |
Maarten Lankhorst | d52ad9c | 2018-03-28 12:05:26 +0200 | [diff] [blame] | 4368 | {"i915_fifo_underrun_reset", &i915_fifo_underrun_reset_ops}, |
Ville Syrjälä | 369a134 | 2014-01-22 14:36:08 +0200 | [diff] [blame] | 4369 | {"i915_pri_wm_latency", &i915_pri_wm_latency_fops}, |
| 4370 | {"i915_spr_wm_latency", &i915_spr_wm_latency_fops}, |
| 4371 | {"i915_cur_wm_latency", &i915_cur_wm_latency_fops}, |
Ville Syrjälä | 4127dc4 | 2017-06-06 15:44:12 +0300 | [diff] [blame] | 4372 | {"i915_fbc_false_color", &i915_fbc_false_color_fops}, |
Todd Previte | eb3394fa | 2015-04-18 00:04:19 -0700 | [diff] [blame] | 4373 | {"i915_dp_test_data", &i915_displayport_test_data_fops}, |
| 4374 | {"i915_dp_test_type", &i915_displayport_test_type_fops}, |
Sagar Arun Kamble | 685534e | 2016-10-12 21:54:41 +0530 | [diff] [blame] | 4375 | {"i915_dp_test_active", &i915_displayport_test_active_fops}, |
Michał Winiarski | 4977a28 | 2018-03-19 10:53:40 +0100 | [diff] [blame] | 4376 | {"i915_guc_log_level", &i915_guc_log_level_fops}, |
| 4377 | {"i915_guc_log_relay", &i915_guc_log_relay_fops}, |
Kumar, Mahesh | d2d4f39 | 2017-08-17 19:15:29 +0530 | [diff] [blame] | 4378 | {"i915_hpd_storm_ctl", &i915_hpd_storm_ctl_fops}, |
Lyude Paul | 9a64c65 | 2018-11-06 16:30:16 -0500 | [diff] [blame] | 4379 | {"i915_hpd_short_storm_ctl", &i915_hpd_short_storm_ctl_fops}, |
C, Ramalingam | 35954e8 | 2017-11-08 00:08:23 +0530 | [diff] [blame] | 4380 | {"i915_ipc_status", &i915_ipc_status_fops}, |
Dhinakaran Pandiyan | 54fd314 | 2018-04-04 18:37:17 -0700 | [diff] [blame] | 4381 | {"i915_drrs_ctl", &i915_drrs_ctl_fops}, |
| 4382 | {"i915_edp_psr_debug", &i915_edp_psr_debug_fops} |
Daniel Vetter | 34b9674 | 2013-07-04 20:49:44 +0200 | [diff] [blame] | 4383 | }; |
| 4384 | |
Chris Wilson | 1dac891 | 2016-06-24 14:00:17 +0100 | [diff] [blame] | 4385 | int i915_debugfs_register(struct drm_i915_private *dev_priv) |
Ben Gamari | 2017263 | 2009-02-17 20:08:50 -0500 | [diff] [blame] | 4386 | { |
Chris Wilson | 91c8a32 | 2016-07-05 10:40:23 +0100 | [diff] [blame] | 4387 | struct drm_minor *minor = dev_priv->drm.primary; |
Maarten Lankhorst | 6cc4215 | 2018-06-28 09:23:02 +0200 | [diff] [blame] | 4388 | int i; |
Chris Wilson | f3cd474 | 2009-10-13 22:20:20 +0100 | [diff] [blame] | 4389 | |
Greg Kroah-Hartman | 0780f3b | 2019-06-13 17:52:29 +0300 | [diff] [blame] | 4390 | debugfs_create_file("i915_forcewake_user", S_IRUSR, minor->debugfs_root, |
| 4391 | to_i915(minor->dev), &i915_forcewake_fops); |
Daniel Vetter | 6a9c308 | 2011-12-14 13:57:11 +0100 | [diff] [blame] | 4392 | |
Daniel Vetter | 34b9674 | 2013-07-04 20:49:44 +0200 | [diff] [blame] | 4393 | for (i = 0; i < ARRAY_SIZE(i915_debugfs_files); i++) { |
Greg Kroah-Hartman | 0780f3b | 2019-06-13 17:52:29 +0300 | [diff] [blame] | 4394 | debugfs_create_file(i915_debugfs_files[i].name, |
| 4395 | S_IRUGO | S_IWUSR, |
| 4396 | minor->debugfs_root, |
| 4397 | to_i915(minor->dev), |
| 4398 | i915_debugfs_files[i].fops); |
Daniel Vetter | 34b9674 | 2013-07-04 20:49:44 +0200 | [diff] [blame] | 4399 | } |
Mika Kuoppala | 4063321 | 2012-12-04 15:12:00 +0200 | [diff] [blame] | 4400 | |
Ben Gamari | 27c202a | 2009-07-01 22:26:52 -0400 | [diff] [blame] | 4401 | return drm_debugfs_create_files(i915_debugfs_list, |
| 4402 | I915_DEBUGFS_ENTRIES, |
Ben Gamari | 2017263 | 2009-02-17 20:08:50 -0500 | [diff] [blame] | 4403 | minor->debugfs_root, minor); |
| 4404 | } |
| 4405 | |
Jani Nikula | aa7471d | 2015-04-01 11:15:21 +0300 | [diff] [blame] | 4406 | struct dpcd_block { |
| 4407 | /* DPCD dump start address. */ |
| 4408 | unsigned int offset; |
| 4409 | /* DPCD dump end address, inclusive. If unset, .size will be used. */ |
| 4410 | unsigned int end; |
| 4411 | /* DPCD dump size. Used if .end is unset. If unset, defaults to 1. */ |
| 4412 | size_t size; |
| 4413 | /* Only valid for eDP. */ |
| 4414 | bool edp; |
| 4415 | }; |
| 4416 | |
| 4417 | static const struct dpcd_block i915_dpcd_debug[] = { |
| 4418 | { .offset = DP_DPCD_REV, .size = DP_RECEIVER_CAP_SIZE }, |
| 4419 | { .offset = DP_PSR_SUPPORT, .end = DP_PSR_CAPS }, |
| 4420 | { .offset = DP_DOWNSTREAM_PORT_0, .size = 16 }, |
| 4421 | { .offset = DP_LINK_BW_SET, .end = DP_EDP_CONFIGURATION_SET }, |
| 4422 | { .offset = DP_SINK_COUNT, .end = DP_ADJUST_REQUEST_LANE2_3 }, |
| 4423 | { .offset = DP_SET_POWER }, |
| 4424 | { .offset = DP_EDP_DPCD_REV }, |
| 4425 | { .offset = DP_EDP_GENERAL_CAP_1, .end = DP_EDP_GENERAL_CAP_3 }, |
| 4426 | { .offset = DP_EDP_DISPLAY_CONTROL_REGISTER, .end = DP_EDP_BACKLIGHT_FREQ_CAP_MAX_LSB }, |
| 4427 | { .offset = DP_EDP_DBC_MINIMUM_BRIGHTNESS_SET, .end = DP_EDP_DBC_MAXIMUM_BRIGHTNESS_SET }, |
| 4428 | }; |
| 4429 | |
| 4430 | static int i915_dpcd_show(struct seq_file *m, void *data) |
| 4431 | { |
| 4432 | struct drm_connector *connector = m->private; |
| 4433 | struct intel_dp *intel_dp = |
| 4434 | enc_to_intel_dp(&intel_attached_encoder(connector)->base); |
Jani Nikula | e531521 | 2019-01-16 11:15:23 +0200 | [diff] [blame] | 4435 | u8 buf[16]; |
Jani Nikula | aa7471d | 2015-04-01 11:15:21 +0300 | [diff] [blame] | 4436 | ssize_t err; |
| 4437 | int i; |
| 4438 | |
Mika Kuoppala | 5c1a887 | 2015-05-15 13:09:21 +0300 | [diff] [blame] | 4439 | if (connector->status != connector_status_connected) |
| 4440 | return -ENODEV; |
| 4441 | |
Jani Nikula | aa7471d | 2015-04-01 11:15:21 +0300 | [diff] [blame] | 4442 | for (i = 0; i < ARRAY_SIZE(i915_dpcd_debug); i++) { |
| 4443 | const struct dpcd_block *b = &i915_dpcd_debug[i]; |
| 4444 | size_t size = b->end ? b->end - b->offset + 1 : (b->size ?: 1); |
| 4445 | |
| 4446 | if (b->edp && |
| 4447 | connector->connector_type != DRM_MODE_CONNECTOR_eDP) |
| 4448 | continue; |
| 4449 | |
| 4450 | /* low tech for now */ |
| 4451 | if (WARN_ON(size > sizeof(buf))) |
| 4452 | continue; |
| 4453 | |
| 4454 | err = drm_dp_dpcd_read(&intel_dp->aux, b->offset, buf, size); |
Chris Wilson | 65404c8 | 2018-10-10 09:17:06 +0100 | [diff] [blame] | 4455 | if (err < 0) |
| 4456 | seq_printf(m, "%04x: ERROR %d\n", b->offset, (int)err); |
| 4457 | else |
| 4458 | seq_printf(m, "%04x: %*ph\n", b->offset, (int)err, buf); |
kbuild test robot | b3f9d7d | 2015-04-16 18:34:06 +0800 | [diff] [blame] | 4459 | } |
Jani Nikula | aa7471d | 2015-04-01 11:15:21 +0300 | [diff] [blame] | 4460 | |
| 4461 | return 0; |
| 4462 | } |
Andy Shevchenko | e400671 | 2018-03-16 16:12:13 +0200 | [diff] [blame] | 4463 | DEFINE_SHOW_ATTRIBUTE(i915_dpcd); |
Jani Nikula | aa7471d | 2015-04-01 11:15:21 +0300 | [diff] [blame] | 4464 | |
David Weinehall | ecbd678 | 2016-08-23 12:23:56 +0300 | [diff] [blame] | 4465 | static int i915_panel_show(struct seq_file *m, void *data) |
| 4466 | { |
| 4467 | struct drm_connector *connector = m->private; |
| 4468 | struct intel_dp *intel_dp = |
| 4469 | enc_to_intel_dp(&intel_attached_encoder(connector)->base); |
| 4470 | |
| 4471 | if (connector->status != connector_status_connected) |
| 4472 | return -ENODEV; |
| 4473 | |
| 4474 | seq_printf(m, "Panel power up delay: %d\n", |
| 4475 | intel_dp->panel_power_up_delay); |
| 4476 | seq_printf(m, "Panel power down delay: %d\n", |
| 4477 | intel_dp->panel_power_down_delay); |
| 4478 | seq_printf(m, "Backlight on delay: %d\n", |
| 4479 | intel_dp->backlight_on_delay); |
| 4480 | seq_printf(m, "Backlight off delay: %d\n", |
| 4481 | intel_dp->backlight_off_delay); |
| 4482 | |
| 4483 | return 0; |
| 4484 | } |
Andy Shevchenko | e400671 | 2018-03-16 16:12:13 +0200 | [diff] [blame] | 4485 | DEFINE_SHOW_ATTRIBUTE(i915_panel); |
David Weinehall | ecbd678 | 2016-08-23 12:23:56 +0300 | [diff] [blame] | 4486 | |
Ramalingam C | bdc93fe | 2018-10-23 14:52:29 +0530 | [diff] [blame] | 4487 | static int i915_hdcp_sink_capability_show(struct seq_file *m, void *data) |
| 4488 | { |
| 4489 | struct drm_connector *connector = m->private; |
| 4490 | struct intel_connector *intel_connector = to_intel_connector(connector); |
| 4491 | |
| 4492 | if (connector->status != connector_status_connected) |
| 4493 | return -ENODEV; |
| 4494 | |
| 4495 | /* HDCP is supported by connector */ |
Ramalingam C | d3dacc7 | 2018-10-29 15:15:46 +0530 | [diff] [blame] | 4496 | if (!intel_connector->hdcp.shim) |
Ramalingam C | bdc93fe | 2018-10-23 14:52:29 +0530 | [diff] [blame] | 4497 | return -EINVAL; |
| 4498 | |
| 4499 | seq_printf(m, "%s:%d HDCP version: ", connector->name, |
| 4500 | connector->base.id); |
Anshuman Gupta | aed7450 | 2019-07-19 11:25:13 +0530 | [diff] [blame] | 4501 | intel_hdcp_info(m, intel_connector); |
Ramalingam C | bdc93fe | 2018-10-23 14:52:29 +0530 | [diff] [blame] | 4502 | |
| 4503 | return 0; |
| 4504 | } |
| 4505 | DEFINE_SHOW_ATTRIBUTE(i915_hdcp_sink_capability); |
| 4506 | |
Manasi Navare | e845f09 | 2018-12-05 16:54:07 -0800 | [diff] [blame] | 4507 | static int i915_dsc_fec_support_show(struct seq_file *m, void *data) |
| 4508 | { |
| 4509 | struct drm_connector *connector = m->private; |
| 4510 | struct drm_device *dev = connector->dev; |
| 4511 | struct drm_crtc *crtc; |
| 4512 | struct intel_dp *intel_dp; |
| 4513 | struct drm_modeset_acquire_ctx ctx; |
| 4514 | struct intel_crtc_state *crtc_state = NULL; |
| 4515 | int ret = 0; |
| 4516 | bool try_again = false; |
| 4517 | |
| 4518 | drm_modeset_acquire_init(&ctx, DRM_MODESET_ACQUIRE_INTERRUPTIBLE); |
| 4519 | |
| 4520 | do { |
Manasi Navare | 6afe892 | 2018-12-19 15:51:20 -0800 | [diff] [blame] | 4521 | try_again = false; |
Manasi Navare | e845f09 | 2018-12-05 16:54:07 -0800 | [diff] [blame] | 4522 | ret = drm_modeset_lock(&dev->mode_config.connection_mutex, |
| 4523 | &ctx); |
| 4524 | if (ret) { |
Chris Wilson | ee6df56 | 2019-03-29 16:51:52 +0000 | [diff] [blame] | 4525 | if (ret == -EDEADLK && !drm_modeset_backoff(&ctx)) { |
| 4526 | try_again = true; |
| 4527 | continue; |
| 4528 | } |
Manasi Navare | e845f09 | 2018-12-05 16:54:07 -0800 | [diff] [blame] | 4529 | break; |
| 4530 | } |
| 4531 | crtc = connector->state->crtc; |
| 4532 | if (connector->status != connector_status_connected || !crtc) { |
| 4533 | ret = -ENODEV; |
| 4534 | break; |
| 4535 | } |
| 4536 | ret = drm_modeset_lock(&crtc->mutex, &ctx); |
| 4537 | if (ret == -EDEADLK) { |
| 4538 | ret = drm_modeset_backoff(&ctx); |
| 4539 | if (!ret) { |
| 4540 | try_again = true; |
| 4541 | continue; |
| 4542 | } |
| 4543 | break; |
| 4544 | } else if (ret) { |
| 4545 | break; |
| 4546 | } |
| 4547 | intel_dp = enc_to_intel_dp(&intel_attached_encoder(connector)->base); |
| 4548 | crtc_state = to_intel_crtc_state(crtc->state); |
| 4549 | seq_printf(m, "DSC_Enabled: %s\n", |
| 4550 | yesno(crtc_state->dsc_params.compression_enable)); |
Radhakrishna Sripada | fed8569 | 2019-01-09 13:14:14 -0800 | [diff] [blame] | 4551 | seq_printf(m, "DSC_Sink_Support: %s\n", |
| 4552 | yesno(drm_dp_sink_supports_dsc(intel_dp->dsc_dpcd))); |
Manasi Navare | feb8846 | 2019-04-05 15:48:21 -0700 | [diff] [blame] | 4553 | seq_printf(m, "Force_DSC_Enable: %s\n", |
| 4554 | yesno(intel_dp->force_dsc_en)); |
Manasi Navare | e845f09 | 2018-12-05 16:54:07 -0800 | [diff] [blame] | 4555 | if (!intel_dp_is_edp(intel_dp)) |
| 4556 | seq_printf(m, "FEC_Sink_Support: %s\n", |
| 4557 | yesno(drm_dp_sink_supports_fec(intel_dp->fec_capable))); |
| 4558 | } while (try_again); |
| 4559 | |
| 4560 | drm_modeset_drop_locks(&ctx); |
| 4561 | drm_modeset_acquire_fini(&ctx); |
| 4562 | |
| 4563 | return ret; |
| 4564 | } |
| 4565 | |
| 4566 | static ssize_t i915_dsc_fec_support_write(struct file *file, |
| 4567 | const char __user *ubuf, |
| 4568 | size_t len, loff_t *offp) |
| 4569 | { |
| 4570 | bool dsc_enable = false; |
| 4571 | int ret; |
| 4572 | struct drm_connector *connector = |
| 4573 | ((struct seq_file *)file->private_data)->private; |
| 4574 | struct intel_encoder *encoder = intel_attached_encoder(connector); |
| 4575 | struct intel_dp *intel_dp = enc_to_intel_dp(&encoder->base); |
| 4576 | |
| 4577 | if (len == 0) |
| 4578 | return 0; |
| 4579 | |
| 4580 | DRM_DEBUG_DRIVER("Copied %zu bytes from user to force DSC\n", |
| 4581 | len); |
| 4582 | |
| 4583 | ret = kstrtobool_from_user(ubuf, len, &dsc_enable); |
| 4584 | if (ret < 0) |
| 4585 | return ret; |
| 4586 | |
| 4587 | DRM_DEBUG_DRIVER("Got %s for DSC Enable\n", |
| 4588 | (dsc_enable) ? "true" : "false"); |
| 4589 | intel_dp->force_dsc_en = dsc_enable; |
| 4590 | |
| 4591 | *offp += len; |
| 4592 | return len; |
| 4593 | } |
| 4594 | |
| 4595 | static int i915_dsc_fec_support_open(struct inode *inode, |
| 4596 | struct file *file) |
| 4597 | { |
| 4598 | return single_open(file, i915_dsc_fec_support_show, |
| 4599 | inode->i_private); |
| 4600 | } |
| 4601 | |
| 4602 | static const struct file_operations i915_dsc_fec_support_fops = { |
| 4603 | .owner = THIS_MODULE, |
| 4604 | .open = i915_dsc_fec_support_open, |
| 4605 | .read = seq_read, |
| 4606 | .llseek = seq_lseek, |
| 4607 | .release = single_release, |
| 4608 | .write = i915_dsc_fec_support_write |
| 4609 | }; |
| 4610 | |
Jani Nikula | aa7471d | 2015-04-01 11:15:21 +0300 | [diff] [blame] | 4611 | /** |
| 4612 | * i915_debugfs_connector_add - add i915 specific connector debugfs files |
| 4613 | * @connector: pointer to a registered drm_connector |
| 4614 | * |
| 4615 | * Cleanup will be done by drm_connector_unregister() through a call to |
| 4616 | * drm_debugfs_connector_remove(). |
| 4617 | * |
| 4618 | * Returns 0 on success, negative error codes on error. |
| 4619 | */ |
| 4620 | int i915_debugfs_connector_add(struct drm_connector *connector) |
| 4621 | { |
| 4622 | struct dentry *root = connector->debugfs_entry; |
Manasi Navare | e845f09 | 2018-12-05 16:54:07 -0800 | [diff] [blame] | 4623 | struct drm_i915_private *dev_priv = to_i915(connector->dev); |
Jani Nikula | aa7471d | 2015-04-01 11:15:21 +0300 | [diff] [blame] | 4624 | |
| 4625 | /* The connector must have been registered beforehands. */ |
| 4626 | if (!root) |
| 4627 | return -ENODEV; |
| 4628 | |
| 4629 | if (connector->connector_type == DRM_MODE_CONNECTOR_DisplayPort || |
| 4630 | connector->connector_type == DRM_MODE_CONNECTOR_eDP) |
David Weinehall | ecbd678 | 2016-08-23 12:23:56 +0300 | [diff] [blame] | 4631 | debugfs_create_file("i915_dpcd", S_IRUGO, root, |
| 4632 | connector, &i915_dpcd_fops); |
| 4633 | |
Dhinakaran Pandiyan | 5b7b308 | 2018-07-04 17:31:21 -0700 | [diff] [blame] | 4634 | if (connector->connector_type == DRM_MODE_CONNECTOR_eDP) { |
David Weinehall | ecbd678 | 2016-08-23 12:23:56 +0300 | [diff] [blame] | 4635 | debugfs_create_file("i915_panel_timings", S_IRUGO, root, |
| 4636 | connector, &i915_panel_fops); |
Dhinakaran Pandiyan | 5b7b308 | 2018-07-04 17:31:21 -0700 | [diff] [blame] | 4637 | debugfs_create_file("i915_psr_sink_status", S_IRUGO, root, |
| 4638 | connector, &i915_psr_sink_status_fops); |
| 4639 | } |
Jani Nikula | aa7471d | 2015-04-01 11:15:21 +0300 | [diff] [blame] | 4640 | |
Ramalingam C | bdc93fe | 2018-10-23 14:52:29 +0530 | [diff] [blame] | 4641 | if (connector->connector_type == DRM_MODE_CONNECTOR_DisplayPort || |
| 4642 | connector->connector_type == DRM_MODE_CONNECTOR_HDMIA || |
| 4643 | connector->connector_type == DRM_MODE_CONNECTOR_HDMIB) { |
| 4644 | debugfs_create_file("i915_hdcp_sink_capability", S_IRUGO, root, |
| 4645 | connector, &i915_hdcp_sink_capability_fops); |
| 4646 | } |
| 4647 | |
Manasi Navare | e845f09 | 2018-12-05 16:54:07 -0800 | [diff] [blame] | 4648 | if (INTEL_GEN(dev_priv) >= 10 && |
| 4649 | (connector->connector_type == DRM_MODE_CONNECTOR_DisplayPort || |
| 4650 | connector->connector_type == DRM_MODE_CONNECTOR_eDP)) |
| 4651 | debugfs_create_file("i915_dsc_fec_support", S_IRUGO, root, |
| 4652 | connector, &i915_dsc_fec_support_fops); |
| 4653 | |
Jani Nikula | aa7471d | 2015-04-01 11:15:21 +0300 | [diff] [blame] | 4654 | return 0; |
| 4655 | } |