aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Skeggs <bskeggs@redhat.com>2010-09-03 01:46:58 -0400
committerBen Skeggs <bskeggs@redhat.com>2010-09-24 02:24:38 -0400
commitd96773e7b61d9976b8227e018a1c94fb7374e641 (patch)
treed0cbc60e4ebd8722b0f77d6e8008925dd20b027e
parente69b4418825c2e4c6563ae1d69bd75377826e263 (diff)
drm/nv50: move vm trap to nv50_fb.c
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_drv.h2
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_irq.c56
-rw-r--r--drivers/gpu/drm/nouveau/nv50_fb.c39
3 files changed, 51 insertions, 46 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_drv.h b/drivers/gpu/drm/nouveau/nouveau_drv.h
index dc90fd2861b7..c8b990b09f5d 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drv.h
+++ b/drivers/gpu/drm/nouveau/nouveau_drv.h
@@ -903,10 +903,10 @@ extern int nv40_fb_init(struct drm_device *);
903extern void nv40_fb_takedown(struct drm_device *); 903extern void nv40_fb_takedown(struct drm_device *);
904extern void nv40_fb_set_region_tiling(struct drm_device *, int, uint32_t, 904extern void nv40_fb_set_region_tiling(struct drm_device *, int, uint32_t,
905 uint32_t, uint32_t); 905 uint32_t, uint32_t);
906
907/* nv50_fb.c */ 906/* nv50_fb.c */
908extern int nv50_fb_init(struct drm_device *); 907extern int nv50_fb_init(struct drm_device *);
909extern void nv50_fb_takedown(struct drm_device *); 908extern void nv50_fb_takedown(struct drm_device *);
909extern void nv50_fb_vm_trap(struct drm_device *, int display, const char *);
910 910
911/* nvc0_fb.c */ 911/* nvc0_fb.c */
912extern int nvc0_fb_init(struct drm_device *); 912extern int nvc0_fb_init(struct drm_device *);
diff --git a/drivers/gpu/drm/nouveau/nouveau_irq.c b/drivers/gpu/drm/nouveau/nouveau_irq.c
index 9cc3259a54b9..316e0587fb01 100644
--- a/drivers/gpu/drm/nouveau/nouveau_irq.c
+++ b/drivers/gpu/drm/nouveau/nouveau_irq.c
@@ -607,40 +607,6 @@ nouveau_pgraph_irq_handler(struct drm_device *dev)
607 nv_wr32(dev, NV03_PMC_INTR_0, NV_PMC_INTR_0_PGRAPH_PENDING); 607 nv_wr32(dev, NV03_PMC_INTR_0, NV_PMC_INTR_0_PGRAPH_PENDING);
608} 608}
609 609
610static void
611nv50_pfb_vm_trap(struct drm_device *dev, int display, const char *name)
612{
613 struct drm_nouveau_private *dev_priv = dev->dev_private;
614 uint32_t trap[6];
615 int i, ch;
616 uint32_t idx = nv_rd32(dev, 0x100c90);
617 if (idx & 0x80000000) {
618 idx &= 0xffffff;
619 if (display) {
620 for (i = 0; i < 6; i++) {
621 nv_wr32(dev, 0x100c90, idx | i << 24);
622 trap[i] = nv_rd32(dev, 0x100c94);
623 }
624 for (ch = 0; ch < dev_priv->engine.fifo.channels; ch++) {
625 struct nouveau_channel *chan = dev_priv->fifos[ch];
626
627 if (!chan || !chan->ramin)
628 continue;
629
630 if (trap[1] == chan->ramin->vinst >> 12)
631 break;
632 }
633 NV_INFO(dev, "%s - VM: Trapped %s at %02x%04x%04x status %08x %08x channel %d\n",
634 name, (trap[5]&0x100?"read":"write"),
635 trap[5]&0xff, trap[4]&0xffff,
636 trap[3]&0xffff, trap[0], trap[2], ch);
637 }
638 nv_wr32(dev, 0x100c90, idx | 0x80000000);
639 } else if (display) {
640 NV_INFO(dev, "%s - no VM fault?\n", name);
641 }
642}
643
644static struct nouveau_enum_names nv50_mp_exec_error_names[] = 610static struct nouveau_enum_names nv50_mp_exec_error_names[] =
645{ 611{
646 { 3, "STACK_UNDERFLOW" }, 612 { 3, "STACK_UNDERFLOW" },
@@ -713,7 +679,7 @@ nv50_pgraph_tp_trap(struct drm_device *dev, int type, uint32_t ustatus_old,
713 tps++; 679 tps++;
714 switch (type) { 680 switch (type) {
715 case 6: /* texture error... unknown for now */ 681 case 6: /* texture error... unknown for now */
716 nv50_pfb_vm_trap(dev, display, name); 682 nv50_fb_vm_trap(dev, display, name);
717 if (display) { 683 if (display) {
718 NV_ERROR(dev, "magic set %d:\n", i); 684 NV_ERROR(dev, "magic set %d:\n", i);
719 for (r = ustatus_addr + 4; r <= ustatus_addr + 0x10; r += 4) 685 for (r = ustatus_addr + 4; r <= ustatus_addr + 0x10; r += 4)
@@ -736,7 +702,7 @@ nv50_pgraph_tp_trap(struct drm_device *dev, int type, uint32_t ustatus_old,
736 uint32_t e1c = nv_rd32(dev, ustatus_addr + 0x14); 702 uint32_t e1c = nv_rd32(dev, ustatus_addr + 0x14);
737 uint32_t e20 = nv_rd32(dev, ustatus_addr + 0x18); 703 uint32_t e20 = nv_rd32(dev, ustatus_addr + 0x18);
738 uint32_t e24 = nv_rd32(dev, ustatus_addr + 0x1c); 704 uint32_t e24 = nv_rd32(dev, ustatus_addr + 0x1c);
739 nv50_pfb_vm_trap(dev, display, name); 705 nv50_fb_vm_trap(dev, display, name);
740 /* 2d engine destination */ 706 /* 2d engine destination */
741 if (ustatus & 0x00000010) { 707 if (ustatus & 0x00000010) {
742 if (display) { 708 if (display) {
@@ -819,7 +785,7 @@ nv50_pgraph_trap_handler(struct drm_device *dev)
819 785
820 /* Known to be triggered by screwed up NOTIFY and COND... */ 786 /* Known to be triggered by screwed up NOTIFY and COND... */
821 if (ustatus & 0x00000001) { 787 if (ustatus & 0x00000001) {
822 nv50_pfb_vm_trap(dev, display, "PGRAPH_TRAP_DISPATCH_FAULT"); 788 nv50_fb_vm_trap(dev, display, "PGRAPH_TRAP_DISPATCH_FAULT");
823 nv_wr32(dev, 0x400500, 0); 789 nv_wr32(dev, 0x400500, 0);
824 if (nv_rd32(dev, 0x400808) & 0x80000000) { 790 if (nv_rd32(dev, 0x400808) & 0x80000000) {
825 if (display) { 791 if (display) {
@@ -844,7 +810,7 @@ nv50_pgraph_trap_handler(struct drm_device *dev)
844 ustatus &= ~0x00000001; 810 ustatus &= ~0x00000001;
845 } 811 }
846 if (ustatus & 0x00000002) { 812 if (ustatus & 0x00000002) {
847 nv50_pfb_vm_trap(dev, display, "PGRAPH_TRAP_DISPATCH_QUERY"); 813 nv50_fb_vm_trap(dev, display, "PGRAPH_TRAP_DISPATCH_QUERY");
848 nv_wr32(dev, 0x400500, 0); 814 nv_wr32(dev, 0x400500, 0);
849 if (nv_rd32(dev, 0x40084c) & 0x80000000) { 815 if (nv_rd32(dev, 0x40084c) & 0x80000000) {
850 if (display) { 816 if (display) {
@@ -886,15 +852,15 @@ nv50_pgraph_trap_handler(struct drm_device *dev)
886 NV_INFO(dev, "PGRAPH_TRAP_M2MF - no ustatus?\n"); 852 NV_INFO(dev, "PGRAPH_TRAP_M2MF - no ustatus?\n");
887 } 853 }
888 if (ustatus & 0x00000001) { 854 if (ustatus & 0x00000001) {
889 nv50_pfb_vm_trap(dev, display, "PGRAPH_TRAP_M2MF_NOTIFY"); 855 nv50_fb_vm_trap(dev, display, "PGRAPH_TRAP_M2MF_NOTIFY");
890 ustatus &= ~0x00000001; 856 ustatus &= ~0x00000001;
891 } 857 }
892 if (ustatus & 0x00000002) { 858 if (ustatus & 0x00000002) {
893 nv50_pfb_vm_trap(dev, display, "PGRAPH_TRAP_M2MF_IN"); 859 nv50_fb_vm_trap(dev, display, "PGRAPH_TRAP_M2MF_IN");
894 ustatus &= ~0x00000002; 860 ustatus &= ~0x00000002;
895 } 861 }
896 if (ustatus & 0x00000004) { 862 if (ustatus & 0x00000004) {
897 nv50_pfb_vm_trap(dev, display, "PGRAPH_TRAP_M2MF_OUT"); 863 nv50_fb_vm_trap(dev, display, "PGRAPH_TRAP_M2MF_OUT");
898 ustatus &= ~0x00000004; 864 ustatus &= ~0x00000004;
899 } 865 }
900 NV_INFO (dev, "PGRAPH_TRAP_M2MF - %08x %08x %08x %08x\n", 866 NV_INFO (dev, "PGRAPH_TRAP_M2MF - %08x %08x %08x %08x\n",
@@ -919,7 +885,7 @@ nv50_pgraph_trap_handler(struct drm_device *dev)
919 NV_INFO(dev, "PGRAPH_TRAP_VFETCH - no ustatus?\n"); 885 NV_INFO(dev, "PGRAPH_TRAP_VFETCH - no ustatus?\n");
920 } 886 }
921 if (ustatus & 0x00000001) { 887 if (ustatus & 0x00000001) {
922 nv50_pfb_vm_trap(dev, display, "PGRAPH_TRAP_VFETCH_FAULT"); 888 nv50_fb_vm_trap(dev, display, "PGRAPH_TRAP_VFETCH_FAULT");
923 NV_INFO (dev, "PGRAPH_TRAP_VFETCH_FAULT - %08x %08x %08x %08x\n", 889 NV_INFO (dev, "PGRAPH_TRAP_VFETCH_FAULT - %08x %08x %08x %08x\n",
924 nv_rd32(dev, 0x400c00), 890 nv_rd32(dev, 0x400c00),
925 nv_rd32(dev, 0x400c08), 891 nv_rd32(dev, 0x400c08),
@@ -941,7 +907,7 @@ nv50_pgraph_trap_handler(struct drm_device *dev)
941 NV_INFO(dev, "PGRAPH_TRAP_STRMOUT - no ustatus?\n"); 907 NV_INFO(dev, "PGRAPH_TRAP_STRMOUT - no ustatus?\n");
942 } 908 }
943 if (ustatus & 0x00000001) { 909 if (ustatus & 0x00000001) {
944 nv50_pfb_vm_trap(dev, display, "PGRAPH_TRAP_STRMOUT_FAULT"); 910 nv50_fb_vm_trap(dev, display, "PGRAPH_TRAP_STRMOUT_FAULT");
945 NV_INFO (dev, "PGRAPH_TRAP_STRMOUT_FAULT - %08x %08x %08x %08x\n", 911 NV_INFO (dev, "PGRAPH_TRAP_STRMOUT_FAULT - %08x %08x %08x %08x\n",
946 nv_rd32(dev, 0x401804), 912 nv_rd32(dev, 0x401804),
947 nv_rd32(dev, 0x401808), 913 nv_rd32(dev, 0x401808),
@@ -966,7 +932,7 @@ nv50_pgraph_trap_handler(struct drm_device *dev)
966 NV_INFO(dev, "PGRAPH_TRAP_CCACHE - no ustatus?\n"); 932 NV_INFO(dev, "PGRAPH_TRAP_CCACHE - no ustatus?\n");
967 } 933 }
968 if (ustatus & 0x00000001) { 934 if (ustatus & 0x00000001) {
969 nv50_pfb_vm_trap(dev, display, "PGRAPH_TRAP_CCACHE_FAULT"); 935 nv50_fb_vm_trap(dev, display, "PGRAPH_TRAP_CCACHE_FAULT");
970 NV_INFO (dev, "PGRAPH_TRAP_CCACHE_FAULT - %08x %08x %08x %08x %08x %08x %08x\n", 936 NV_INFO (dev, "PGRAPH_TRAP_CCACHE_FAULT - %08x %08x %08x %08x %08x %08x %08x\n",
971 nv_rd32(dev, 0x405800), 937 nv_rd32(dev, 0x405800),
972 nv_rd32(dev, 0x405804), 938 nv_rd32(dev, 0x405804),
@@ -988,7 +954,7 @@ nv50_pgraph_trap_handler(struct drm_device *dev)
988 * remaining, so try to handle it anyway. Perhaps related to that 954 * remaining, so try to handle it anyway. Perhaps related to that
989 * unknown DMA slot on tesla? */ 955 * unknown DMA slot on tesla? */
990 if (status & 0x20) { 956 if (status & 0x20) {
991 nv50_pfb_vm_trap(dev, display, "PGRAPH_TRAP_UNKC04"); 957 nv50_fb_vm_trap(dev, display, "PGRAPH_TRAP_UNKC04");
992 ustatus = nv_rd32(dev, 0x402000) & 0x7fffffff; 958 ustatus = nv_rd32(dev, 0x402000) & 0x7fffffff;
993 if (display) 959 if (display)
994 NV_INFO(dev, "PGRAPH_TRAP_UNKC04 - Unhandled ustatus 0x%08x\n", ustatus); 960 NV_INFO(dev, "PGRAPH_TRAP_UNKC04 - Unhandled ustatus 0x%08x\n", ustatus);
diff --git a/drivers/gpu/drm/nouveau/nv50_fb.c b/drivers/gpu/drm/nouveau/nv50_fb.c
index 32611bd30e6d..594720bd5191 100644
--- a/drivers/gpu/drm/nouveau/nv50_fb.c
+++ b/drivers/gpu/drm/nouveau/nv50_fb.c
@@ -36,3 +36,42 @@ void
36nv50_fb_takedown(struct drm_device *dev) 36nv50_fb_takedown(struct drm_device *dev)
37{ 37{
38} 38}
39
40void
41nv50_fb_vm_trap(struct drm_device *dev, int display, const char *name)
42{
43 struct drm_nouveau_private *dev_priv = dev->dev_private;
44 u32 trap[6], idx, chinst;
45 int i, ch;
46
47 idx = nv_rd32(dev, 0x100c90);
48 if (!(idx & 0x80000000))
49 return;
50 idx &= 0x00ffffff;
51
52 for (i = 0; i < 6; i++) {
53 nv_wr32(dev, 0x100c90, idx | i << 24);
54 trap[i] = nv_rd32(dev, 0x100c94);
55 }
56 nv_wr32(dev, 0x100c90, idx | 0x80000000);
57
58 if (!display)
59 return;
60
61 chinst = (trap[2] << 16) | trap[1];
62 for (ch = 0; ch < dev_priv->engine.fifo.channels; ch++) {
63 struct nouveau_channel *chan = dev_priv->fifos[ch];
64
65 if (!chan || !chan->ramin)
66 continue;
67
68 if (chinst == chan->ramin->vinst >> 12)
69 break;
70 }
71
72 NV_INFO(dev, "%s - VM: Trapped %s at %02x%04x%04x status %08x "
73 "channel %d (0x%08x)\n",
74 name, (trap[5] & 0x100 ? "read" : "write"),
75 trap[5] & 0xff, trap[4] & 0xffff, trap[3] & 0xffff,
76 trap[0], ch, chinst);
77}