aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/i915_debugfs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/i915/i915_debugfs.c')
-rw-r--r--drivers/gpu/drm/i915/i915_debugfs.c383
1 files changed, 265 insertions, 118 deletions
diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index e6162a1681f0..eb2b3c25b9e1 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -47,7 +47,6 @@ enum {
47 FLUSHING_LIST, 47 FLUSHING_LIST,
48 INACTIVE_LIST, 48 INACTIVE_LIST,
49 PINNED_LIST, 49 PINNED_LIST,
50 DEFERRED_FREE_LIST,
51}; 50};
52 51
53static const char *yesno(int v) 52static const char *yesno(int v)
@@ -178,18 +177,10 @@ static int i915_gem_object_list_info(struct seq_file *m, void *data)
178 seq_printf(m, "Inactive:\n"); 177 seq_printf(m, "Inactive:\n");
179 head = &dev_priv->mm.inactive_list; 178 head = &dev_priv->mm.inactive_list;
180 break; 179 break;
181 case PINNED_LIST:
182 seq_printf(m, "Pinned:\n");
183 head = &dev_priv->mm.pinned_list;
184 break;
185 case FLUSHING_LIST: 180 case FLUSHING_LIST:
186 seq_printf(m, "Flushing:\n"); 181 seq_printf(m, "Flushing:\n");
187 head = &dev_priv->mm.flushing_list; 182 head = &dev_priv->mm.flushing_list;
188 break; 183 break;
189 case DEFERRED_FREE_LIST:
190 seq_printf(m, "Deferred free:\n");
191 head = &dev_priv->mm.deferred_free_list;
192 break;
193 default: 184 default:
194 mutex_unlock(&dev->struct_mutex); 185 mutex_unlock(&dev->struct_mutex);
195 return -EINVAL; 186 return -EINVAL;
@@ -252,21 +243,11 @@ static int i915_gem_object_info(struct seq_file *m, void* data)
252 count, mappable_count, size, mappable_size); 243 count, mappable_count, size, mappable_size);
253 244
254 size = count = mappable_size = mappable_count = 0; 245 size = count = mappable_size = mappable_count = 0;
255 count_objects(&dev_priv->mm.pinned_list, mm_list);
256 seq_printf(m, " %u [%u] pinned objects, %zu [%zu] bytes\n",
257 count, mappable_count, size, mappable_size);
258
259 size = count = mappable_size = mappable_count = 0;
260 count_objects(&dev_priv->mm.inactive_list, mm_list); 246 count_objects(&dev_priv->mm.inactive_list, mm_list);
261 seq_printf(m, " %u [%u] inactive objects, %zu [%zu] bytes\n", 247 seq_printf(m, " %u [%u] inactive objects, %zu [%zu] bytes\n",
262 count, mappable_count, size, mappable_size); 248 count, mappable_count, size, mappable_size);
263 249
264 size = count = mappable_size = mappable_count = 0; 250 size = count = mappable_size = mappable_count = 0;
265 count_objects(&dev_priv->mm.deferred_free_list, mm_list);
266 seq_printf(m, " %u [%u] freed objects, %zu [%zu] bytes\n",
267 count, mappable_count, size, mappable_size);
268
269 size = count = mappable_size = mappable_count = 0;
270 list_for_each_entry(obj, &dev_priv->mm.gtt_list, gtt_list) { 251 list_for_each_entry(obj, &dev_priv->mm.gtt_list, gtt_list) {
271 if (obj->fault_mappable) { 252 if (obj->fault_mappable) {
272 size += obj->gtt_space->size; 253 size += obj->gtt_space->size;
@@ -294,6 +275,7 @@ static int i915_gem_gtt_info(struct seq_file *m, void* data)
294{ 275{
295 struct drm_info_node *node = (struct drm_info_node *) m->private; 276 struct drm_info_node *node = (struct drm_info_node *) m->private;
296 struct drm_device *dev = node->minor->dev; 277 struct drm_device *dev = node->minor->dev;
278 uintptr_t list = (uintptr_t) node->info_ent->data;
297 struct drm_i915_private *dev_priv = dev->dev_private; 279 struct drm_i915_private *dev_priv = dev->dev_private;
298 struct drm_i915_gem_object *obj; 280 struct drm_i915_gem_object *obj;
299 size_t total_obj_size, total_gtt_size; 281 size_t total_obj_size, total_gtt_size;
@@ -305,6 +287,9 @@ static int i915_gem_gtt_info(struct seq_file *m, void* data)
305 287
306 total_obj_size = total_gtt_size = count = 0; 288 total_obj_size = total_gtt_size = count = 0;
307 list_for_each_entry(obj, &dev_priv->mm.gtt_list, gtt_list) { 289 list_for_each_entry(obj, &dev_priv->mm.gtt_list, gtt_list) {
290 if (list == PINNED_LIST && obj->pin_count == 0)
291 continue;
292
308 seq_printf(m, " "); 293 seq_printf(m, " ");
309 describe_obj(m, obj); 294 describe_obj(m, obj);
310 seq_printf(m, "\n"); 295 seq_printf(m, "\n");
@@ -321,7 +306,6 @@ static int i915_gem_gtt_info(struct seq_file *m, void* data)
321 return 0; 306 return 0;
322} 307}
323 308
324
325static int i915_gem_pageflip_info(struct seq_file *m, void *data) 309static int i915_gem_pageflip_info(struct seq_file *m, void *data)
326{ 310{
327 struct drm_info_node *node = (struct drm_info_node *) m->private; 311 struct drm_info_node *node = (struct drm_info_node *) m->private;
@@ -430,10 +414,6 @@ static void i915_ring_seqno_info(struct seq_file *m,
430 if (ring->get_seqno) { 414 if (ring->get_seqno) {
431 seq_printf(m, "Current sequence (%s): %d\n", 415 seq_printf(m, "Current sequence (%s): %d\n",
432 ring->name, ring->get_seqno(ring)); 416 ring->name, ring->get_seqno(ring));
433 seq_printf(m, "Waiter sequence (%s): %d\n",
434 ring->name, ring->waiting_seqno);
435 seq_printf(m, "IRQ sequence (%s): %d\n",
436 ring->name, ring->irq_seqno);
437 } 417 }
438} 418}
439 419
@@ -468,7 +448,45 @@ static int i915_interrupt_info(struct seq_file *m, void *data)
468 if (ret) 448 if (ret)
469 return ret; 449 return ret;
470 450
471 if (!HAS_PCH_SPLIT(dev)) { 451 if (IS_VALLEYVIEW(dev)) {
452 seq_printf(m, "Display IER:\t%08x\n",
453 I915_READ(VLV_IER));
454 seq_printf(m, "Display IIR:\t%08x\n",
455 I915_READ(VLV_IIR));
456 seq_printf(m, "Display IIR_RW:\t%08x\n",
457 I915_READ(VLV_IIR_RW));
458 seq_printf(m, "Display IMR:\t%08x\n",
459 I915_READ(VLV_IMR));
460 for_each_pipe(pipe)
461 seq_printf(m, "Pipe %c stat:\t%08x\n",
462 pipe_name(pipe),
463 I915_READ(PIPESTAT(pipe)));
464
465 seq_printf(m, "Master IER:\t%08x\n",
466 I915_READ(VLV_MASTER_IER));
467
468 seq_printf(m, "Render IER:\t%08x\n",
469 I915_READ(GTIER));
470 seq_printf(m, "Render IIR:\t%08x\n",
471 I915_READ(GTIIR));
472 seq_printf(m, "Render IMR:\t%08x\n",
473 I915_READ(GTIMR));
474
475 seq_printf(m, "PM IER:\t\t%08x\n",
476 I915_READ(GEN6_PMIER));
477 seq_printf(m, "PM IIR:\t\t%08x\n",
478 I915_READ(GEN6_PMIIR));
479 seq_printf(m, "PM IMR:\t\t%08x\n",
480 I915_READ(GEN6_PMIMR));
481
482 seq_printf(m, "Port hotplug:\t%08x\n",
483 I915_READ(PORT_HOTPLUG_EN));
484 seq_printf(m, "DPFLIPSTAT:\t%08x\n",
485 I915_READ(VLV_DPFLIPSTAT));
486 seq_printf(m, "DPINVGTT:\t%08x\n",
487 I915_READ(DPINVGTT));
488
489 } else if (!HAS_PCH_SPLIT(dev)) {
472 seq_printf(m, "Interrupt enable: %08x\n", 490 seq_printf(m, "Interrupt enable: %08x\n",
473 I915_READ(IER)); 491 I915_READ(IER));
474 seq_printf(m, "Interrupt identity: %08x\n", 492 seq_printf(m, "Interrupt identity: %08x\n",
@@ -564,69 +582,6 @@ static int i915_hws_info(struct seq_file *m, void *data)
564 return 0; 582 return 0;
565} 583}
566 584
567static int i915_ringbuffer_data(struct seq_file *m, void *data)
568{
569 struct drm_info_node *node = (struct drm_info_node *) m->private;
570 struct drm_device *dev = node->minor->dev;
571 drm_i915_private_t *dev_priv = dev->dev_private;
572 struct intel_ring_buffer *ring;
573 int ret;
574
575 ret = mutex_lock_interruptible(&dev->struct_mutex);
576 if (ret)
577 return ret;
578
579 ring = &dev_priv->ring[(uintptr_t)node->info_ent->data];
580 if (!ring->obj) {
581 seq_printf(m, "No ringbuffer setup\n");
582 } else {
583 const u8 __iomem *virt = ring->virtual_start;
584 uint32_t off;
585
586 for (off = 0; off < ring->size; off += 4) {
587 uint32_t *ptr = (uint32_t *)(virt + off);
588 seq_printf(m, "%08x : %08x\n", off, *ptr);
589 }
590 }
591 mutex_unlock(&dev->struct_mutex);
592
593 return 0;
594}
595
596static int i915_ringbuffer_info(struct seq_file *m, void *data)
597{
598 struct drm_info_node *node = (struct drm_info_node *) m->private;
599 struct drm_device *dev = node->minor->dev;
600 drm_i915_private_t *dev_priv = dev->dev_private;
601 struct intel_ring_buffer *ring;
602 int ret;
603
604 ring = &dev_priv->ring[(uintptr_t)node->info_ent->data];
605 if (ring->size == 0)
606 return 0;
607
608 ret = mutex_lock_interruptible(&dev->struct_mutex);
609 if (ret)
610 return ret;
611
612 seq_printf(m, "Ring %s:\n", ring->name);
613 seq_printf(m, " Head : %08x\n", I915_READ_HEAD(ring) & HEAD_ADDR);
614 seq_printf(m, " Tail : %08x\n", I915_READ_TAIL(ring) & TAIL_ADDR);
615 seq_printf(m, " Size : %08x\n", ring->size);
616 seq_printf(m, " Active : %08x\n", intel_ring_get_active_head(ring));
617 seq_printf(m, " NOPID : %08x\n", I915_READ_NOPID(ring));
618 if (IS_GEN6(dev) || IS_GEN7(dev)) {
619 seq_printf(m, " Sync 0 : %08x\n", I915_READ_SYNC_0(ring));
620 seq_printf(m, " Sync 1 : %08x\n", I915_READ_SYNC_1(ring));
621 }
622 seq_printf(m, " Control : %08x\n", I915_READ_CTL(ring));
623 seq_printf(m, " Start : %08x\n", I915_READ_START(ring));
624
625 mutex_unlock(&dev->struct_mutex);
626
627 return 0;
628}
629
630static const char *ring_str(int ring) 585static const char *ring_str(int ring)
631{ 586{
632 switch (ring) { 587 switch (ring) {
@@ -704,6 +659,7 @@ static void i915_ring_error_state(struct seq_file *m,
704 struct drm_i915_error_state *error, 659 struct drm_i915_error_state *error,
705 unsigned ring) 660 unsigned ring)
706{ 661{
662 BUG_ON(ring >= I915_NUM_RINGS); /* shut up confused gcc */
707 seq_printf(m, "%s command stream:\n", ring_str(ring)); 663 seq_printf(m, "%s command stream:\n", ring_str(ring));
708 seq_printf(m, " HEAD: 0x%08x\n", error->head[ring]); 664 seq_printf(m, " HEAD: 0x%08x\n", error->head[ring]);
709 seq_printf(m, " TAIL: 0x%08x\n", error->tail[ring]); 665 seq_printf(m, " TAIL: 0x%08x\n", error->tail[ring]);
@@ -718,8 +674,8 @@ static void i915_ring_error_state(struct seq_file *m,
718 if (INTEL_INFO(dev)->gen >= 4) 674 if (INTEL_INFO(dev)->gen >= 4)
719 seq_printf(m, " INSTPS: 0x%08x\n", error->instps[ring]); 675 seq_printf(m, " INSTPS: 0x%08x\n", error->instps[ring]);
720 seq_printf(m, " INSTPM: 0x%08x\n", error->instpm[ring]); 676 seq_printf(m, " INSTPM: 0x%08x\n", error->instpm[ring]);
677 seq_printf(m, " FADDR: 0x%08x\n", error->faddr[ring]);
721 if (INTEL_INFO(dev)->gen >= 6) { 678 if (INTEL_INFO(dev)->gen >= 6) {
722 seq_printf(m, " FADDR: 0x%08x\n", error->faddr[ring]);
723 seq_printf(m, " FAULT_REG: 0x%08x\n", error->fault_reg[ring]); 679 seq_printf(m, " FAULT_REG: 0x%08x\n", error->fault_reg[ring]);
724 seq_printf(m, " SYNC_0: 0x%08x\n", 680 seq_printf(m, " SYNC_0: 0x%08x\n",
725 error->semaphore_mboxes[ring][0]); 681 error->semaphore_mboxes[ring][0]);
@@ -727,31 +683,35 @@ static void i915_ring_error_state(struct seq_file *m,
727 error->semaphore_mboxes[ring][1]); 683 error->semaphore_mboxes[ring][1]);
728 } 684 }
729 seq_printf(m, " seqno: 0x%08x\n", error->seqno[ring]); 685 seq_printf(m, " seqno: 0x%08x\n", error->seqno[ring]);
686 seq_printf(m, " waiting: %s\n", yesno(error->waiting[ring]));
730 seq_printf(m, " ring->head: 0x%08x\n", error->cpu_ring_head[ring]); 687 seq_printf(m, " ring->head: 0x%08x\n", error->cpu_ring_head[ring]);
731 seq_printf(m, " ring->tail: 0x%08x\n", error->cpu_ring_tail[ring]); 688 seq_printf(m, " ring->tail: 0x%08x\n", error->cpu_ring_tail[ring]);
732} 689}
733 690
691struct i915_error_state_file_priv {
692 struct drm_device *dev;
693 struct drm_i915_error_state *error;
694};
695
734static int i915_error_state(struct seq_file *m, void *unused) 696static int i915_error_state(struct seq_file *m, void *unused)
735{ 697{
736 struct drm_info_node *node = (struct drm_info_node *) m->private; 698 struct i915_error_state_file_priv *error_priv = m->private;
737 struct drm_device *dev = node->minor->dev; 699 struct drm_device *dev = error_priv->dev;
738 drm_i915_private_t *dev_priv = dev->dev_private; 700 drm_i915_private_t *dev_priv = dev->dev_private;
739 struct drm_i915_error_state *error; 701 struct drm_i915_error_state *error = error_priv->error;
740 unsigned long flags; 702 struct intel_ring_buffer *ring;
741 int i, j, page, offset, elt; 703 int i, j, page, offset, elt;
742 704
743 spin_lock_irqsave(&dev_priv->error_lock, flags); 705 if (!error) {
744 if (!dev_priv->first_error) {
745 seq_printf(m, "no error state collected\n"); 706 seq_printf(m, "no error state collected\n");
746 goto out; 707 return 0;
747 } 708 }
748 709
749 error = dev_priv->first_error;
750
751 seq_printf(m, "Time: %ld s %ld us\n", error->time.tv_sec, 710 seq_printf(m, "Time: %ld s %ld us\n", error->time.tv_sec,
752 error->time.tv_usec); 711 error->time.tv_usec);
753 seq_printf(m, "PCI ID: 0x%04x\n", dev->pci_device); 712 seq_printf(m, "PCI ID: 0x%04x\n", dev->pci_device);
754 seq_printf(m, "EIR: 0x%08x\n", error->eir); 713 seq_printf(m, "EIR: 0x%08x\n", error->eir);
714 seq_printf(m, "IER: 0x%08x\n", error->ier);
755 seq_printf(m, "PGTBL_ER: 0x%08x\n", error->pgtbl_er); 715 seq_printf(m, "PGTBL_ER: 0x%08x\n", error->pgtbl_er);
756 716
757 for (i = 0; i < dev_priv->num_fence_regs; i++) 717 for (i = 0; i < dev_priv->num_fence_regs; i++)
@@ -762,11 +722,8 @@ static int i915_error_state(struct seq_file *m, void *unused)
762 seq_printf(m, "DONE_REG: 0x%08x\n", error->done_reg); 722 seq_printf(m, "DONE_REG: 0x%08x\n", error->done_reg);
763 } 723 }
764 724
765 i915_ring_error_state(m, dev, error, RCS); 725 for_each_ring(ring, dev_priv, i)
766 if (HAS_BLT(dev)) 726 i915_ring_error_state(m, dev, error, i);
767 i915_ring_error_state(m, dev, error, BCS);
768 if (HAS_BSD(dev))
769 i915_ring_error_state(m, dev, error, VCS);
770 727
771 if (error->active_bo) 728 if (error->active_bo)
772 print_error_buffers(m, "Active", 729 print_error_buffers(m, "Active",
@@ -828,12 +785,71 @@ static int i915_error_state(struct seq_file *m, void *unused)
828 if (error->display) 785 if (error->display)
829 intel_display_print_error_state(m, dev, error->display); 786 intel_display_print_error_state(m, dev, error->display);
830 787
831out: 788 return 0;
789}
790
791static ssize_t
792i915_error_state_write(struct file *filp,
793 const char __user *ubuf,
794 size_t cnt,
795 loff_t *ppos)
796{
797 struct seq_file *m = filp->private_data;
798 struct i915_error_state_file_priv *error_priv = m->private;
799 struct drm_device *dev = error_priv->dev;
800
801 DRM_DEBUG_DRIVER("Resetting error state\n");
802
803 mutex_lock(&dev->struct_mutex);
804 i915_destroy_error_state(dev);
805 mutex_unlock(&dev->struct_mutex);
806
807 return cnt;
808}
809
810static int i915_error_state_open(struct inode *inode, struct file *file)
811{
812 struct drm_device *dev = inode->i_private;
813 drm_i915_private_t *dev_priv = dev->dev_private;
814 struct i915_error_state_file_priv *error_priv;
815 unsigned long flags;
816
817 error_priv = kzalloc(sizeof(*error_priv), GFP_KERNEL);
818 if (!error_priv)
819 return -ENOMEM;
820
821 error_priv->dev = dev;
822
823 spin_lock_irqsave(&dev_priv->error_lock, flags);
824 error_priv->error = dev_priv->first_error;
825 if (error_priv->error)
826 kref_get(&error_priv->error->ref);
832 spin_unlock_irqrestore(&dev_priv->error_lock, flags); 827 spin_unlock_irqrestore(&dev_priv->error_lock, flags);
833 828
834 return 0; 829 return single_open(file, i915_error_state, error_priv);
830}
831
832static int i915_error_state_release(struct inode *inode, struct file *file)
833{
834 struct seq_file *m = file->private_data;
835 struct i915_error_state_file_priv *error_priv = m->private;
836
837 if (error_priv->error)
838 kref_put(&error_priv->error->ref, i915_error_state_free);
839 kfree(error_priv);
840
841 return single_release(inode, file);
835} 842}
836 843
844static const struct file_operations i915_error_state_fops = {
845 .owner = THIS_MODULE,
846 .open = i915_error_state_open,
847 .read = seq_read,
848 .write = i915_error_state_write,
849 .llseek = default_llseek,
850 .release = i915_error_state_release,
851};
852
837static int i915_rstdby_delays(struct seq_file *m, void *unused) 853static int i915_rstdby_delays(struct seq_file *m, void *unused)
838{ 854{
839 struct drm_info_node *node = (struct drm_info_node *) m->private; 855 struct drm_info_node *node = (struct drm_info_node *) m->private;
@@ -1132,6 +1148,17 @@ static int gen6_drpc_info(struct seq_file *m)
1132 1148
1133 seq_printf(m, "Core Power Down: %s\n", 1149 seq_printf(m, "Core Power Down: %s\n",
1134 yesno(gt_core_status & GEN6_CORE_CPD_STATE_MASK)); 1150 yesno(gt_core_status & GEN6_CORE_CPD_STATE_MASK));
1151
1152 /* Not exactly sure what this is */
1153 seq_printf(m, "RC6 \"Locked to RPn\" residency since boot: %u\n",
1154 I915_READ(GEN6_GT_GFX_RC6_LOCKED));
1155 seq_printf(m, "RC6 residency since boot: %u\n",
1156 I915_READ(GEN6_GT_GFX_RC6));
1157 seq_printf(m, "RC6+ residency since boot: %u\n",
1158 I915_READ(GEN6_GT_GFX_RC6p));
1159 seq_printf(m, "RC6++ residency since boot: %u\n",
1160 I915_READ(GEN6_GT_GFX_RC6pp));
1161
1135 return 0; 1162 return 0;
1136} 1163}
1137 1164
@@ -1306,17 +1333,25 @@ static int i915_opregion(struct seq_file *m, void *unused)
1306 struct drm_device *dev = node->minor->dev; 1333 struct drm_device *dev = node->minor->dev;
1307 drm_i915_private_t *dev_priv = dev->dev_private; 1334 drm_i915_private_t *dev_priv = dev->dev_private;
1308 struct intel_opregion *opregion = &dev_priv->opregion; 1335 struct intel_opregion *opregion = &dev_priv->opregion;
1336 void *data = kmalloc(OPREGION_SIZE, GFP_KERNEL);
1309 int ret; 1337 int ret;
1310 1338
1339 if (data == NULL)
1340 return -ENOMEM;
1341
1311 ret = mutex_lock_interruptible(&dev->struct_mutex); 1342 ret = mutex_lock_interruptible(&dev->struct_mutex);
1312 if (ret) 1343 if (ret)
1313 return ret; 1344 goto out;
1314 1345
1315 if (opregion->header) 1346 if (opregion->header) {
1316 seq_write(m, opregion->header, OPREGION_SIZE); 1347 memcpy_fromio(data, opregion->header, OPREGION_SIZE);
1348 seq_write(m, data, OPREGION_SIZE);
1349 }
1317 1350
1318 mutex_unlock(&dev->struct_mutex); 1351 mutex_unlock(&dev->struct_mutex);
1319 1352
1353out:
1354 kfree(data);
1320 return 0; 1355 return 0;
1321} 1356}
1322 1357
@@ -1505,6 +1540,53 @@ static int i915_ppgtt_info(struct seq_file *m, void *data)
1505 return 0; 1540 return 0;
1506} 1541}
1507 1542
1543static int i915_dpio_info(struct seq_file *m, void *data)
1544{
1545 struct drm_info_node *node = (struct drm_info_node *) m->private;
1546 struct drm_device *dev = node->minor->dev;
1547 struct drm_i915_private *dev_priv = dev->dev_private;
1548 int ret;
1549
1550
1551 if (!IS_VALLEYVIEW(dev)) {
1552 seq_printf(m, "unsupported\n");
1553 return 0;
1554 }
1555
1556 ret = mutex_lock_interruptible(&dev->mode_config.mutex);
1557 if (ret)
1558 return ret;
1559
1560 seq_printf(m, "DPIO_CTL: 0x%08x\n", I915_READ(DPIO_CTL));
1561
1562 seq_printf(m, "DPIO_DIV_A: 0x%08x\n",
1563 intel_dpio_read(dev_priv, _DPIO_DIV_A));
1564 seq_printf(m, "DPIO_DIV_B: 0x%08x\n",
1565 intel_dpio_read(dev_priv, _DPIO_DIV_B));
1566
1567 seq_printf(m, "DPIO_REFSFR_A: 0x%08x\n",
1568 intel_dpio_read(dev_priv, _DPIO_REFSFR_A));
1569 seq_printf(m, "DPIO_REFSFR_B: 0x%08x\n",
1570 intel_dpio_read(dev_priv, _DPIO_REFSFR_B));
1571
1572 seq_printf(m, "DPIO_CORE_CLK_A: 0x%08x\n",
1573 intel_dpio_read(dev_priv, _DPIO_CORE_CLK_A));
1574 seq_printf(m, "DPIO_CORE_CLK_B: 0x%08x\n",
1575 intel_dpio_read(dev_priv, _DPIO_CORE_CLK_B));
1576
1577 seq_printf(m, "DPIO_LFP_COEFF_A: 0x%08x\n",
1578 intel_dpio_read(dev_priv, _DPIO_LFP_COEFF_A));
1579 seq_printf(m, "DPIO_LFP_COEFF_B: 0x%08x\n",
1580 intel_dpio_read(dev_priv, _DPIO_LFP_COEFF_B));
1581
1582 seq_printf(m, "DPIO_FASTCLK_DISABLE: 0x%08x\n",
1583 intel_dpio_read(dev_priv, DPIO_FASTCLK_DISABLE));
1584
1585 mutex_unlock(&dev->mode_config.mutex);
1586
1587 return 0;
1588}
1589
1508static ssize_t 1590static ssize_t
1509i915_wedged_read(struct file *filp, 1591i915_wedged_read(struct file *filp,
1510 char __user *ubuf, 1592 char __user *ubuf,
@@ -1562,6 +1644,65 @@ static const struct file_operations i915_wedged_fops = {
1562}; 1644};
1563 1645
1564static ssize_t 1646static ssize_t
1647i915_ring_stop_read(struct file *filp,
1648 char __user *ubuf,
1649 size_t max,
1650 loff_t *ppos)
1651{
1652 struct drm_device *dev = filp->private_data;
1653 drm_i915_private_t *dev_priv = dev->dev_private;
1654 char buf[20];
1655 int len;
1656
1657 len = snprintf(buf, sizeof(buf),
1658 "0x%08x\n", dev_priv->stop_rings);
1659
1660 if (len > sizeof(buf))
1661 len = sizeof(buf);
1662
1663 return simple_read_from_buffer(ubuf, max, ppos, buf, len);
1664}
1665
1666static ssize_t
1667i915_ring_stop_write(struct file *filp,
1668 const char __user *ubuf,
1669 size_t cnt,
1670 loff_t *ppos)
1671{
1672 struct drm_device *dev = filp->private_data;
1673 struct drm_i915_private *dev_priv = dev->dev_private;
1674 char buf[20];
1675 int val = 0;
1676
1677 if (cnt > 0) {
1678 if (cnt > sizeof(buf) - 1)
1679 return -EINVAL;
1680
1681 if (copy_from_user(buf, ubuf, cnt))
1682 return -EFAULT;
1683 buf[cnt] = 0;
1684
1685 val = simple_strtoul(buf, NULL, 0);
1686 }
1687
1688 DRM_DEBUG_DRIVER("Stopping rings 0x%08x\n", val);
1689
1690 mutex_lock(&dev->struct_mutex);
1691 dev_priv->stop_rings = val;
1692 mutex_unlock(&dev->struct_mutex);
1693
1694 return cnt;
1695}
1696
1697static const struct file_operations i915_ring_stop_fops = {
1698 .owner = THIS_MODULE,
1699 .open = simple_open,
1700 .read = i915_ring_stop_read,
1701 .write = i915_ring_stop_write,
1702 .llseek = default_llseek,
1703};
1704
1705static ssize_t
1565i915_max_freq_read(struct file *filp, 1706i915_max_freq_read(struct file *filp,
1566 char __user *ubuf, 1707 char __user *ubuf,
1567 size_t max, 1708 size_t max,
@@ -1738,7 +1879,7 @@ static int i915_forcewake_open(struct inode *inode, struct file *file)
1738 return 0; 1879 return 0;
1739} 1880}
1740 1881
1741int i915_forcewake_release(struct inode *inode, struct file *file) 1882static int i915_forcewake_release(struct inode *inode, struct file *file)
1742{ 1883{
1743 struct drm_device *dev = inode->i_private; 1884 struct drm_device *dev = inode->i_private;
1744 struct drm_i915_private *dev_priv = dev->dev_private; 1885 struct drm_i915_private *dev_priv = dev->dev_private;
@@ -1803,11 +1944,10 @@ static struct drm_info_list i915_debugfs_list[] = {
1803 {"i915_capabilities", i915_capabilities, 0}, 1944 {"i915_capabilities", i915_capabilities, 0},
1804 {"i915_gem_objects", i915_gem_object_info, 0}, 1945 {"i915_gem_objects", i915_gem_object_info, 0},
1805 {"i915_gem_gtt", i915_gem_gtt_info, 0}, 1946 {"i915_gem_gtt", i915_gem_gtt_info, 0},
1947 {"i915_gem_pinned", i915_gem_gtt_info, 0, (void *) PINNED_LIST},
1806 {"i915_gem_active", i915_gem_object_list_info, 0, (void *) ACTIVE_LIST}, 1948 {"i915_gem_active", i915_gem_object_list_info, 0, (void *) ACTIVE_LIST},
1807 {"i915_gem_flushing", i915_gem_object_list_info, 0, (void *) FLUSHING_LIST}, 1949 {"i915_gem_flushing", i915_gem_object_list_info, 0, (void *) FLUSHING_LIST},
1808 {"i915_gem_inactive", i915_gem_object_list_info, 0, (void *) INACTIVE_LIST}, 1950 {"i915_gem_inactive", i915_gem_object_list_info, 0, (void *) INACTIVE_LIST},
1809 {"i915_gem_pinned", i915_gem_object_list_info, 0, (void *) PINNED_LIST},
1810 {"i915_gem_deferred_free", i915_gem_object_list_info, 0, (void *) DEFERRED_FREE_LIST},
1811 {"i915_gem_pageflip", i915_gem_pageflip_info, 0}, 1951 {"i915_gem_pageflip", i915_gem_pageflip_info, 0},
1812 {"i915_gem_request", i915_gem_request_info, 0}, 1952 {"i915_gem_request", i915_gem_request_info, 0},
1813 {"i915_gem_seqno", i915_gem_seqno_info, 0}, 1953 {"i915_gem_seqno", i915_gem_seqno_info, 0},
@@ -1816,13 +1956,6 @@ static struct drm_info_list i915_debugfs_list[] = {
1816 {"i915_gem_hws", i915_hws_info, 0, (void *)RCS}, 1956 {"i915_gem_hws", i915_hws_info, 0, (void *)RCS},
1817 {"i915_gem_hws_blt", i915_hws_info, 0, (void *)BCS}, 1957 {"i915_gem_hws_blt", i915_hws_info, 0, (void *)BCS},
1818 {"i915_gem_hws_bsd", i915_hws_info, 0, (void *)VCS}, 1958 {"i915_gem_hws_bsd", i915_hws_info, 0, (void *)VCS},
1819 {"i915_ringbuffer_data", i915_ringbuffer_data, 0, (void *)RCS},
1820 {"i915_ringbuffer_info", i915_ringbuffer_info, 0, (void *)RCS},
1821 {"i915_bsd_ringbuffer_data", i915_ringbuffer_data, 0, (void *)VCS},
1822 {"i915_bsd_ringbuffer_info", i915_ringbuffer_info, 0, (void *)VCS},
1823 {"i915_blt_ringbuffer_data", i915_ringbuffer_data, 0, (void *)BCS},
1824 {"i915_blt_ringbuffer_info", i915_ringbuffer_info, 0, (void *)BCS},
1825 {"i915_error_state", i915_error_state, 0},
1826 {"i915_rstdby_delays", i915_rstdby_delays, 0}, 1959 {"i915_rstdby_delays", i915_rstdby_delays, 0},
1827 {"i915_cur_delayinfo", i915_cur_delayinfo, 0}, 1960 {"i915_cur_delayinfo", i915_cur_delayinfo, 0},
1828 {"i915_delayfreq_table", i915_delayfreq_table, 0}, 1961 {"i915_delayfreq_table", i915_delayfreq_table, 0},
@@ -1839,6 +1972,7 @@ static struct drm_info_list i915_debugfs_list[] = {
1839 {"i915_gen6_forcewake_count", i915_gen6_forcewake_count_info, 0}, 1972 {"i915_gen6_forcewake_count", i915_gen6_forcewake_count_info, 0},
1840 {"i915_swizzle_info", i915_swizzle_info, 0}, 1973 {"i915_swizzle_info", i915_swizzle_info, 0},
1841 {"i915_ppgtt_info", i915_ppgtt_info, 0}, 1974 {"i915_ppgtt_info", i915_ppgtt_info, 0},
1975 {"i915_dpio", i915_dpio_info, 0},
1842}; 1976};
1843#define I915_DEBUGFS_ENTRIES ARRAY_SIZE(i915_debugfs_list) 1977#define I915_DEBUGFS_ENTRIES ARRAY_SIZE(i915_debugfs_list)
1844 1978
@@ -1867,6 +2001,17 @@ int i915_debugfs_init(struct drm_minor *minor)
1867 &i915_cache_sharing_fops); 2001 &i915_cache_sharing_fops);
1868 if (ret) 2002 if (ret)
1869 return ret; 2003 return ret;
2004 ret = i915_debugfs_create(minor->debugfs_root, minor,
2005 "i915_ring_stop",
2006 &i915_ring_stop_fops);
2007 if (ret)
2008 return ret;
2009
2010 ret = i915_debugfs_create(minor->debugfs_root, minor,
2011 "i915_error_state",
2012 &i915_error_state_fops);
2013 if (ret)
2014 return ret;
1870 2015
1871 return drm_debugfs_create_files(i915_debugfs_list, 2016 return drm_debugfs_create_files(i915_debugfs_list,
1872 I915_DEBUGFS_ENTRIES, 2017 I915_DEBUGFS_ENTRIES,
@@ -1885,6 +2030,8 @@ void i915_debugfs_cleanup(struct drm_minor *minor)
1885 1, minor); 2030 1, minor);
1886 drm_debugfs_remove_files((struct drm_info_list *) &i915_cache_sharing_fops, 2031 drm_debugfs_remove_files((struct drm_info_list *) &i915_cache_sharing_fops,
1887 1, minor); 2032 1, minor);
2033 drm_debugfs_remove_files((struct drm_info_list *) &i915_ring_stop_fops,
2034 1, minor);
1888} 2035}
1889 2036
1890#endif /* CONFIG_DEBUG_FS */ 2037#endif /* CONFIG_DEBUG_FS */