diff options
Diffstat (limited to 'drivers/gpu/drm/i915/i915_debugfs.c')
-rw-r--r-- | drivers/gpu/drm/i915/i915_debugfs.c | 63 |
1 files changed, 56 insertions, 7 deletions
diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c index 8e95d66800b..d09a6e02dc9 100644 --- a/drivers/gpu/drm/i915/i915_debugfs.c +++ b/drivers/gpu/drm/i915/i915_debugfs.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include <linux/seq_file.h> | 29 | #include <linux/seq_file.h> |
30 | #include <linux/debugfs.h> | 30 | #include <linux/debugfs.h> |
31 | #include <linux/slab.h> | 31 | #include <linux/slab.h> |
32 | #include <linux/export.h> | ||
32 | #include "drmP.h" | 33 | #include "drmP.h" |
33 | #include "drm.h" | 34 | #include "drm.h" |
34 | #include "intel_drv.h" | 35 | #include "intel_drv.h" |
@@ -635,11 +636,16 @@ static int i915_ringbuffer_info(struct seq_file *m, void *data) | |||
635 | struct drm_device *dev = node->minor->dev; | 636 | struct drm_device *dev = node->minor->dev; |
636 | drm_i915_private_t *dev_priv = dev->dev_private; | 637 | drm_i915_private_t *dev_priv = dev->dev_private; |
637 | struct intel_ring_buffer *ring; | 638 | struct intel_ring_buffer *ring; |
639 | int ret; | ||
638 | 640 | ||
639 | ring = &dev_priv->ring[(uintptr_t)node->info_ent->data]; | 641 | ring = &dev_priv->ring[(uintptr_t)node->info_ent->data]; |
640 | if (ring->size == 0) | 642 | if (ring->size == 0) |
641 | return 0; | 643 | return 0; |
642 | 644 | ||
645 | ret = mutex_lock_interruptible(&dev->struct_mutex); | ||
646 | if (ret) | ||
647 | return ret; | ||
648 | |||
643 | seq_printf(m, "Ring %s:\n", ring->name); | 649 | seq_printf(m, "Ring %s:\n", ring->name); |
644 | seq_printf(m, " Head : %08x\n", I915_READ_HEAD(ring) & HEAD_ADDR); | 650 | seq_printf(m, " Head : %08x\n", I915_READ_HEAD(ring) & HEAD_ADDR); |
645 | seq_printf(m, " Tail : %08x\n", I915_READ_TAIL(ring) & TAIL_ADDR); | 651 | seq_printf(m, " Tail : %08x\n", I915_READ_TAIL(ring) & TAIL_ADDR); |
@@ -653,6 +659,8 @@ static int i915_ringbuffer_info(struct seq_file *m, void *data) | |||
653 | seq_printf(m, " Control : %08x\n", I915_READ_CTL(ring)); | 659 | seq_printf(m, " Control : %08x\n", I915_READ_CTL(ring)); |
654 | seq_printf(m, " Start : %08x\n", I915_READ_START(ring)); | 660 | seq_printf(m, " Start : %08x\n", I915_READ_START(ring)); |
655 | 661 | ||
662 | mutex_unlock(&dev->struct_mutex); | ||
663 | |||
656 | return 0; | 664 | return 0; |
657 | } | 665 | } |
658 | 666 | ||
@@ -841,7 +849,16 @@ static int i915_rstdby_delays(struct seq_file *m, void *unused) | |||
841 | struct drm_info_node *node = (struct drm_info_node *) m->private; | 849 | struct drm_info_node *node = (struct drm_info_node *) m->private; |
842 | struct drm_device *dev = node->minor->dev; | 850 | struct drm_device *dev = node->minor->dev; |
843 | drm_i915_private_t *dev_priv = dev->dev_private; | 851 | drm_i915_private_t *dev_priv = dev->dev_private; |
844 | u16 crstanddelay = I915_READ16(CRSTANDVID); | 852 | u16 crstanddelay; |
853 | int ret; | ||
854 | |||
855 | ret = mutex_lock_interruptible(&dev->struct_mutex); | ||
856 | if (ret) | ||
857 | return ret; | ||
858 | |||
859 | crstanddelay = I915_READ16(CRSTANDVID); | ||
860 | |||
861 | mutex_unlock(&dev->struct_mutex); | ||
845 | 862 | ||
846 | seq_printf(m, "w/ctx: %d, w/o ctx: %d\n", (crstanddelay >> 8) & 0x3f, (crstanddelay & 0x3f)); | 863 | seq_printf(m, "w/ctx: %d, w/o ctx: %d\n", (crstanddelay >> 8) & 0x3f, (crstanddelay & 0x3f)); |
847 | 864 | ||
@@ -939,7 +956,11 @@ static int i915_delayfreq_table(struct seq_file *m, void *unused) | |||
939 | struct drm_device *dev = node->minor->dev; | 956 | struct drm_device *dev = node->minor->dev; |
940 | drm_i915_private_t *dev_priv = dev->dev_private; | 957 | drm_i915_private_t *dev_priv = dev->dev_private; |
941 | u32 delayfreq; | 958 | u32 delayfreq; |
942 | int i; | 959 | int ret, i; |
960 | |||
961 | ret = mutex_lock_interruptible(&dev->struct_mutex); | ||
962 | if (ret) | ||
963 | return ret; | ||
943 | 964 | ||
944 | for (i = 0; i < 16; i++) { | 965 | for (i = 0; i < 16; i++) { |
945 | delayfreq = I915_READ(PXVFREQ_BASE + i * 4); | 966 | delayfreq = I915_READ(PXVFREQ_BASE + i * 4); |
@@ -947,6 +968,8 @@ static int i915_delayfreq_table(struct seq_file *m, void *unused) | |||
947 | (delayfreq & PXVFREQ_PX_MASK) >> PXVFREQ_PX_SHIFT); | 968 | (delayfreq & PXVFREQ_PX_MASK) >> PXVFREQ_PX_SHIFT); |
948 | } | 969 | } |
949 | 970 | ||
971 | mutex_unlock(&dev->struct_mutex); | ||
972 | |||
950 | return 0; | 973 | return 0; |
951 | } | 974 | } |
952 | 975 | ||
@@ -961,13 +984,19 @@ static int i915_inttoext_table(struct seq_file *m, void *unused) | |||
961 | struct drm_device *dev = node->minor->dev; | 984 | struct drm_device *dev = node->minor->dev; |
962 | drm_i915_private_t *dev_priv = dev->dev_private; | 985 | drm_i915_private_t *dev_priv = dev->dev_private; |
963 | u32 inttoext; | 986 | u32 inttoext; |
964 | int i; | 987 | int ret, i; |
988 | |||
989 | ret = mutex_lock_interruptible(&dev->struct_mutex); | ||
990 | if (ret) | ||
991 | return ret; | ||
965 | 992 | ||
966 | for (i = 1; i <= 32; i++) { | 993 | for (i = 1; i <= 32; i++) { |
967 | inttoext = I915_READ(INTTOEXT_BASE_ILK + i * 4); | 994 | inttoext = I915_READ(INTTOEXT_BASE_ILK + i * 4); |
968 | seq_printf(m, "INTTOEXT%02d: 0x%08x\n", i, inttoext); | 995 | seq_printf(m, "INTTOEXT%02d: 0x%08x\n", i, inttoext); |
969 | } | 996 | } |
970 | 997 | ||
998 | mutex_unlock(&dev->struct_mutex); | ||
999 | |||
971 | return 0; | 1000 | return 0; |
972 | } | 1001 | } |
973 | 1002 | ||
@@ -976,9 +1005,19 @@ static int i915_drpc_info(struct seq_file *m, void *unused) | |||
976 | struct drm_info_node *node = (struct drm_info_node *) m->private; | 1005 | struct drm_info_node *node = (struct drm_info_node *) m->private; |
977 | struct drm_device *dev = node->minor->dev; | 1006 | struct drm_device *dev = node->minor->dev; |
978 | drm_i915_private_t *dev_priv = dev->dev_private; | 1007 | drm_i915_private_t *dev_priv = dev->dev_private; |
979 | u32 rgvmodectl = I915_READ(MEMMODECTL); | 1008 | u32 rgvmodectl, rstdbyctl; |
980 | u32 rstdbyctl = I915_READ(RSTDBYCTL); | 1009 | u16 crstandvid; |
981 | u16 crstandvid = I915_READ16(CRSTANDVID); | 1010 | int ret; |
1011 | |||
1012 | ret = mutex_lock_interruptible(&dev->struct_mutex); | ||
1013 | if (ret) | ||
1014 | return ret; | ||
1015 | |||
1016 | rgvmodectl = I915_READ(MEMMODECTL); | ||
1017 | rstdbyctl = I915_READ(RSTDBYCTL); | ||
1018 | crstandvid = I915_READ16(CRSTANDVID); | ||
1019 | |||
1020 | mutex_unlock(&dev->struct_mutex); | ||
982 | 1021 | ||
983 | seq_printf(m, "HD boost: %s\n", (rgvmodectl & MEMMODE_BOOST_EN) ? | 1022 | seq_printf(m, "HD boost: %s\n", (rgvmodectl & MEMMODE_BOOST_EN) ? |
984 | "yes" : "no"); | 1023 | "yes" : "no"); |
@@ -1166,9 +1205,16 @@ static int i915_gfxec(struct seq_file *m, void *unused) | |||
1166 | struct drm_info_node *node = (struct drm_info_node *) m->private; | 1205 | struct drm_info_node *node = (struct drm_info_node *) m->private; |
1167 | struct drm_device *dev = node->minor->dev; | 1206 | struct drm_device *dev = node->minor->dev; |
1168 | drm_i915_private_t *dev_priv = dev->dev_private; | 1207 | drm_i915_private_t *dev_priv = dev->dev_private; |
1208 | int ret; | ||
1209 | |||
1210 | ret = mutex_lock_interruptible(&dev->struct_mutex); | ||
1211 | if (ret) | ||
1212 | return ret; | ||
1169 | 1213 | ||
1170 | seq_printf(m, "GFXEC: %ld\n", (unsigned long)I915_READ(0x112f4)); | 1214 | seq_printf(m, "GFXEC: %ld\n", (unsigned long)I915_READ(0x112f4)); |
1171 | 1215 | ||
1216 | mutex_unlock(&dev->struct_mutex); | ||
1217 | |||
1172 | return 0; | 1218 | return 0; |
1173 | } | 1219 | } |
1174 | 1220 | ||
@@ -1505,7 +1551,10 @@ drm_add_fake_info_node(struct drm_minor *minor, | |||
1505 | node->minor = minor; | 1551 | node->minor = minor; |
1506 | node->dent = ent; | 1552 | node->dent = ent; |
1507 | node->info_ent = (void *) key; | 1553 | node->info_ent = (void *) key; |
1508 | list_add(&node->list, &minor->debugfs_nodes.list); | 1554 | |
1555 | mutex_lock(&minor->debugfs_lock); | ||
1556 | list_add(&node->list, &minor->debugfs_list); | ||
1557 | mutex_unlock(&minor->debugfs_lock); | ||
1509 | 1558 | ||
1510 | return 0; | 1559 | return 0; |
1511 | } | 1560 | } |