diff options
Diffstat (limited to 'drivers/gpu/drm/i915/i915_debugfs.c')
-rw-r--r-- | drivers/gpu/drm/i915/i915_debugfs.c | 65 |
1 files changed, 58 insertions, 7 deletions
diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c index 1a87cc9fd899..55ab9246e1b9 100644 --- a/drivers/gpu/drm/i915/i915_debugfs.c +++ b/drivers/gpu/drm/i915/i915_debugfs.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <linux/slab.h> | 31 | #include <linux/slab.h> |
32 | #include <linux/export.h> | 32 | #include <linux/export.h> |
33 | #include <linux/list_sort.h> | 33 | #include <linux/list_sort.h> |
34 | #include <asm/msr-index.h> | ||
34 | #include <drm/drmP.h> | 35 | #include <drm/drmP.h> |
35 | #include "intel_drv.h" | 36 | #include "intel_drv.h" |
36 | #include "intel_ringbuffer.h" | 37 | #include "intel_ringbuffer.h" |
@@ -99,7 +100,7 @@ static void | |||
99 | describe_obj(struct seq_file *m, struct drm_i915_gem_object *obj) | 100 | describe_obj(struct seq_file *m, struct drm_i915_gem_object *obj) |
100 | { | 101 | { |
101 | struct i915_vma *vma; | 102 | struct i915_vma *vma; |
102 | seq_printf(m, "%pK: %s%s%s %8zdKiB %02x %02x %d %d %d%s%s%s", | 103 | seq_printf(m, "%pK: %s%s%s %8zdKiB %02x %02x %u %u %u%s%s%s", |
103 | &obj->base, | 104 | &obj->base, |
104 | get_pin_flag(obj), | 105 | get_pin_flag(obj), |
105 | get_tiling_flag(obj), | 106 | get_tiling_flag(obj), |
@@ -117,6 +118,8 @@ describe_obj(struct seq_file *m, struct drm_i915_gem_object *obj) | |||
117 | seq_printf(m, " (name: %d)", obj->base.name); | 118 | seq_printf(m, " (name: %d)", obj->base.name); |
118 | if (obj->pin_count) | 119 | if (obj->pin_count) |
119 | seq_printf(m, " (pinned x %d)", obj->pin_count); | 120 | seq_printf(m, " (pinned x %d)", obj->pin_count); |
121 | if (obj->pin_display) | ||
122 | seq_printf(m, " (display)"); | ||
120 | if (obj->fence_reg != I915_FENCE_REG_NONE) | 123 | if (obj->fence_reg != I915_FENCE_REG_NONE) |
121 | seq_printf(m, " (fence: %d)", obj->fence_reg); | 124 | seq_printf(m, " (fence: %d)", obj->fence_reg); |
122 | list_for_each_entry(vma, &obj->vma_list, vma_link) { | 125 | list_for_each_entry(vma, &obj->vma_list, vma_link) { |
@@ -193,9 +196,9 @@ static int obj_rank_by_stolen(void *priv, | |||
193 | struct list_head *A, struct list_head *B) | 196 | struct list_head *A, struct list_head *B) |
194 | { | 197 | { |
195 | struct drm_i915_gem_object *a = | 198 | struct drm_i915_gem_object *a = |
196 | container_of(A, struct drm_i915_gem_object, exec_list); | 199 | container_of(A, struct drm_i915_gem_object, obj_exec_link); |
197 | struct drm_i915_gem_object *b = | 200 | struct drm_i915_gem_object *b = |
198 | container_of(B, struct drm_i915_gem_object, exec_list); | 201 | container_of(B, struct drm_i915_gem_object, obj_exec_link); |
199 | 202 | ||
200 | return a->stolen->start - b->stolen->start; | 203 | return a->stolen->start - b->stolen->start; |
201 | } | 204 | } |
@@ -219,7 +222,7 @@ static int i915_gem_stolen_list_info(struct seq_file *m, void *data) | |||
219 | if (obj->stolen == NULL) | 222 | if (obj->stolen == NULL) |
220 | continue; | 223 | continue; |
221 | 224 | ||
222 | list_add(&obj->exec_list, &stolen); | 225 | list_add(&obj->obj_exec_link, &stolen); |
223 | 226 | ||
224 | total_obj_size += obj->base.size; | 227 | total_obj_size += obj->base.size; |
225 | total_gtt_size += i915_gem_obj_ggtt_size(obj); | 228 | total_gtt_size += i915_gem_obj_ggtt_size(obj); |
@@ -229,7 +232,7 @@ static int i915_gem_stolen_list_info(struct seq_file *m, void *data) | |||
229 | if (obj->stolen == NULL) | 232 | if (obj->stolen == NULL) |
230 | continue; | 233 | continue; |
231 | 234 | ||
232 | list_add(&obj->exec_list, &stolen); | 235 | list_add(&obj->obj_exec_link, &stolen); |
233 | 236 | ||
234 | total_obj_size += obj->base.size; | 237 | total_obj_size += obj->base.size; |
235 | count++; | 238 | count++; |
@@ -237,11 +240,11 @@ static int i915_gem_stolen_list_info(struct seq_file *m, void *data) | |||
237 | list_sort(NULL, &stolen, obj_rank_by_stolen); | 240 | list_sort(NULL, &stolen, obj_rank_by_stolen); |
238 | seq_puts(m, "Stolen:\n"); | 241 | seq_puts(m, "Stolen:\n"); |
239 | while (!list_empty(&stolen)) { | 242 | while (!list_empty(&stolen)) { |
240 | obj = list_first_entry(&stolen, typeof(*obj), exec_list); | 243 | obj = list_first_entry(&stolen, typeof(*obj), obj_exec_link); |
241 | seq_puts(m, " "); | 244 | seq_puts(m, " "); |
242 | describe_obj(m, obj); | 245 | describe_obj(m, obj); |
243 | seq_putc(m, '\n'); | 246 | seq_putc(m, '\n'); |
244 | list_del_init(&obj->exec_list); | 247 | list_del_init(&obj->obj_exec_link); |
245 | } | 248 | } |
246 | mutex_unlock(&dev->struct_mutex); | 249 | mutex_unlock(&dev->struct_mutex); |
247 | 250 | ||
@@ -1767,6 +1770,52 @@ static int i915_edp_psr_status(struct seq_file *m, void *data) | |||
1767 | return 0; | 1770 | return 0; |
1768 | } | 1771 | } |
1769 | 1772 | ||
1773 | static int i915_energy_uJ(struct seq_file *m, void *data) | ||
1774 | { | ||
1775 | struct drm_info_node *node = m->private; | ||
1776 | struct drm_device *dev = node->minor->dev; | ||
1777 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
1778 | u64 power; | ||
1779 | u32 units; | ||
1780 | |||
1781 | if (INTEL_INFO(dev)->gen < 6) | ||
1782 | return -ENODEV; | ||
1783 | |||
1784 | rdmsrl(MSR_RAPL_POWER_UNIT, power); | ||
1785 | power = (power & 0x1f00) >> 8; | ||
1786 | units = 1000000 / (1 << power); /* convert to uJ */ | ||
1787 | power = I915_READ(MCH_SECP_NRG_STTS); | ||
1788 | power *= units; | ||
1789 | |||
1790 | seq_printf(m, "%llu", (long long unsigned)power); | ||
1791 | |||
1792 | return 0; | ||
1793 | } | ||
1794 | |||
1795 | static int i915_pc8_status(struct seq_file *m, void *unused) | ||
1796 | { | ||
1797 | struct drm_info_node *node = (struct drm_info_node *) m->private; | ||
1798 | struct drm_device *dev = node->minor->dev; | ||
1799 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
1800 | |||
1801 | if (!IS_HASWELL(dev)) { | ||
1802 | seq_puts(m, "not supported\n"); | ||
1803 | return 0; | ||
1804 | } | ||
1805 | |||
1806 | mutex_lock(&dev_priv->pc8.lock); | ||
1807 | seq_printf(m, "Requirements met: %s\n", | ||
1808 | yesno(dev_priv->pc8.requirements_met)); | ||
1809 | seq_printf(m, "GPU idle: %s\n", yesno(dev_priv->pc8.gpu_idle)); | ||
1810 | seq_printf(m, "Disable count: %d\n", dev_priv->pc8.disable_count); | ||
1811 | seq_printf(m, "IRQs disabled: %s\n", | ||
1812 | yesno(dev_priv->pc8.irqs_disabled)); | ||
1813 | seq_printf(m, "Enabled: %s\n", yesno(dev_priv->pc8.enabled)); | ||
1814 | mutex_unlock(&dev_priv->pc8.lock); | ||
1815 | |||
1816 | return 0; | ||
1817 | } | ||
1818 | |||
1770 | static int | 1819 | static int |
1771 | i915_wedged_get(void *data, u64 *val) | 1820 | i915_wedged_get(void *data, u64 *val) |
1772 | { | 1821 | { |
@@ -2206,6 +2255,8 @@ static struct drm_info_list i915_debugfs_list[] = { | |||
2206 | {"i915_dpio", i915_dpio_info, 0}, | 2255 | {"i915_dpio", i915_dpio_info, 0}, |
2207 | {"i915_llc", i915_llc, 0}, | 2256 | {"i915_llc", i915_llc, 0}, |
2208 | {"i915_edp_psr_status", i915_edp_psr_status, 0}, | 2257 | {"i915_edp_psr_status", i915_edp_psr_status, 0}, |
2258 | {"i915_energy_uJ", i915_energy_uJ, 0}, | ||
2259 | {"i915_pc8_status", i915_pc8_status, 0}, | ||
2209 | }; | 2260 | }; |
2210 | #define I915_DEBUGFS_ENTRIES ARRAY_SIZE(i915_debugfs_list) | 2261 | #define I915_DEBUGFS_ENTRIES ARRAY_SIZE(i915_debugfs_list) |
2211 | 2262 | ||