65 *pobject = nv_object(obj);
70 nv_wo32(obj, 0x04, 0x00000000);
71 nv_wo32(obj, 0x08, 0x00000000);
72 nv_wo32(obj, 0x0c, 0x00000000);
78 .ctor = nv50_graph_object_ctor,
87 nv50_graph_sclass[] = {
88 { 0x0030, &nv50_graph_ofuncs },
89 { 0x502d, &nv50_graph_ofuncs },
90 { 0x5039, &nv50_graph_ofuncs },
91 { 0x5097, &nv50_graph_ofuncs },
92 { 0x50c0, &nv50_graph_ofuncs },
97 nv84_graph_sclass[] = {
98 { 0x0030, &nv50_graph_ofuncs },
99 { 0x502d, &nv50_graph_ofuncs },
100 { 0x5039, &nv50_graph_ofuncs },
101 { 0x50c0, &nv50_graph_ofuncs },
102 { 0x8297, &nv50_graph_ofuncs },
107 nva0_graph_sclass[] = {
108 { 0x0030, &nv50_graph_ofuncs },
109 { 0x502d, &nv50_graph_ofuncs },
110 { 0x5039, &nv50_graph_ofuncs },
111 { 0x50c0, &nv50_graph_ofuncs },
112 { 0x8397, &nv50_graph_ofuncs },
117 nva3_graph_sclass[] = {
118 { 0x0030, &nv50_graph_ofuncs },
119 { 0x502d, &nv50_graph_ofuncs },
120 { 0x5039, &nv50_graph_ofuncs },
121 { 0x50c0, &nv50_graph_ofuncs },
122 { 0x8597, &nv50_graph_ofuncs },
123 { 0x85c0, &nv50_graph_ofuncs },
128 nvaf_graph_sclass[] = {
129 { 0x0030, &nv50_graph_ofuncs },
130 { 0x502d, &nv50_graph_ofuncs },
131 { 0x5039, &nv50_graph_ofuncs },
132 { 0x50c0, &nv50_graph_ofuncs },
133 { 0x85c0, &nv50_graph_ofuncs },
134 { 0x8697, &nv50_graph_ofuncs },
155 *pobject = nv_object(chan);
164 nv50_graph_cclass = {
167 .ctor = nv50_graph_context_ctor,
198 nv_mask(priv, 0x400500, 0x00000001, 0x00000000);
200 start = ptimer->
read(ptimer);
204 for (tmp = nv_rd32(priv, 0x400380); tmp &&
idle; tmp >>= 3) {
209 for (tmp = nv_rd32(priv, 0x400384); tmp &&
idle; tmp >>= 3) {
214 for (tmp = nv_rd32(priv, 0x400388); tmp &&
idle; tmp >>= 3) {
219 !(timeout = ptimer->
read(ptimer) - start > 2000000000));
222 nv_error(priv,
"PGRAPH TLB flush idle timeout fail: "
223 "0x%08x 0x%08x 0x%08x 0x%08x\n",
224 nv_rd32(priv, 0x400700), nv_rd32(priv, 0x400380),
225 nv_rd32(priv, 0x400384), nv_rd32(priv, 0x400388));
230 nv_mask(priv, 0x400500, 0x00000001, 0x00000001);
231 spin_unlock_irqrestore(&priv->
lock, flags);
232 return timeout ? -
EBUSY : 0;
235 static const struct nouveau_enum nv50_mp_exec_error_names[] = {
236 { 3,
"STACK_UNDERFLOW",
NULL },
237 { 4,
"QUADON_ACTIVE",
NULL },
238 { 8,
"TIMEOUT",
NULL },
239 { 0x10,
"INVALID_OPCODE",
NULL },
240 { 0x40,
"BREAKPOINT",
NULL },
245 { 0x00000001,
"NOTIFY" },
246 { 0x00000002,
"IN" },
247 { 0x00000004,
"OUT" },
252 { 0x00000001,
"FAULT" },
257 { 0x00000001,
"FAULT" },
262 { 0x00000001,
"FAULT" },
268 { 0x00000003,
"INVALID_OPERATION",
NULL },
269 { 0x00000004,
"INVALID_VALUE",
NULL },
270 { 0x00000005,
"INVALID_ENUM",
NULL },
271 { 0x00000008,
"INVALID_OBJECT",
NULL },
272 { 0x00000009,
"READ_ONLY_OBJECT",
NULL },
273 { 0x0000000a,
"SUPERVISOR_OBJECT",
NULL },
274 { 0x0000000b,
"INVALID_ADDRESS_ALIGNMENT",
NULL },
275 { 0x0000000c,
"INVALID_BITFIELD",
NULL },
276 { 0x0000000d,
"BEGIN_END_ACTIVE",
NULL },
277 { 0x0000000e,
"SEMANTIC_COLOR_BACK_OVER_LIMIT",
NULL },
278 { 0x0000000f,
"VIEWPORT_ID_NEEDS_GP",
NULL },
279 { 0x00000010,
"RT_DOUBLE_BIND",
NULL },
280 { 0x00000011,
"RT_TYPES_MISMATCH",
NULL },
281 { 0x00000012,
"RT_LINEAR_WITH_ZETA",
NULL },
282 { 0x00000015,
"FP_TOO_FEW_REGS",
NULL },
283 { 0x00000016,
"ZETA_FORMAT_CSAA_MISMATCH",
NULL },
284 { 0x00000017,
"RT_LINEAR_WITH_MSAA",
NULL },
285 { 0x00000018,
"FP_INTERPOLANT_START_OVER_LIMIT",
NULL },
286 { 0x00000019,
"SEMANTIC_LAYER_OVER_LIMIT",
NULL },
287 { 0x0000001a,
"RT_INVALID_ALIGNMENT",
NULL },
288 { 0x0000001b,
"SAMPLER_OVER_LIMIT",
NULL },
289 { 0x0000001c,
"TEXTURE_OVER_LIMIT",
NULL },
290 { 0x0000001e,
"GP_TOO_MANY_OUTPUTS",
NULL },
291 { 0x0000001f,
"RT_BPP128_WITH_MS8",
NULL },
292 { 0x00000021,
"Z_OUT_OF_BOUNDS",
NULL },
293 { 0x00000023,
"XY_OUT_OF_BOUNDS",
NULL },
294 { 0x00000024,
"VP_ZERO_INPUTS",
NULL },
295 { 0x00000027,
"CP_MORE_PARAMS_THAN_SHARED",
NULL },
296 { 0x00000028,
"CP_NO_REG_SPACE_STRIPED",
NULL },
297 { 0x00000029,
"CP_NO_REG_SPACE_PACKED",
NULL },
298 { 0x0000002a,
"CP_NOT_ENOUGH_WARPS",
NULL },
299 { 0x0000002b,
"CP_BLOCK_SIZE_MISMATCH",
NULL },
300 { 0x0000002c,
"CP_NOT_ENOUGH_LOCAL_WARPS",
NULL },
301 { 0x0000002d,
"CP_NOT_ENOUGH_STACK_WARPS",
NULL },
302 { 0x0000002e,
"CP_NO_BLOCKDIM_LATCH",
NULL },
303 { 0x00000031,
"ENG2D_FORMAT_MISMATCH",
NULL },
304 { 0x0000003f,
"PRIMITIVE_ID_NEEDS_GP",
NULL },
305 { 0x00000044,
"SEMANTIC_VIEWPORT_OVER_LIMIT",
NULL },
306 { 0x00000045,
"SEMANTIC_COLOR_FRONT_OVER_LIMIT",
NULL },
307 { 0x00000046,
"LAYER_ID_NEEDS_GP",
NULL },
308 { 0x00000047,
"SEMANTIC_CLIP_OVER_LIMIT",
NULL },
309 { 0x00000048,
"SEMANTIC_PTSZ_OVER_LIMIT",
NULL },
314 { 0x00000001,
"NOTIFY" },
315 { 0x00000002,
"COMPUTE_QUERY" },
316 { 0x00000010,
"ILLEGAL_MTHD" },
317 { 0x00000020,
"ILLEGAL_CLASS" },
318 { 0x00000040,
"DOUBLE_NOTIFY" },
319 { 0x00001000,
"CONTEXT_SWITCH" },
320 { 0x00010000,
"BUFFER_NOTIFY" },
321 { 0x00100000,
"DATA_ERROR" },
322 { 0x00200000,
"TRAP" },
323 { 0x01000000,
"SINGLE_STEP" },
334 for (i = 0; i < 4; i++) {
335 if (!(units & 1 << (i+24)))
337 if (nv_device(priv)->
chipset < 0xa0)
338 addr = 0x408200 + (tpid << 12) + (i << 7);
340 addr = 0x408100 + (tpid << 11) + (i << 7);
341 mp10 = nv_rd32(priv, addr + 0x10);
342 status = nv_rd32(priv, addr + 0x14);
346 nv_rd32(priv, addr + 0x20);
347 pc = nv_rd32(priv, addr + 0x24);
348 oplow = nv_rd32(priv, addr + 0x70);
349 ophigh = nv_rd32(priv, addr + 0x74);
351 "TP %d MP %d: ", tpid, i);
353 printk(
" at %06x warp %d, opcode %08x %08x\n",
354 pc&0xffffff, pc >> 24,
357 nv_wr32(priv, addr + 0x10, mp10);
358 nv_wr32(priv, addr + 0x14, 0);
362 nv_error(priv,
"TRAP_MP_EXEC - TP %d: "
363 "No MPs claiming errors?\n", tpid);
368 u32 ustatus_new,
int display,
const char *
name)
371 u32 units = nv_rd32(priv, 0x1540);
373 u32 ustatus_addr, ustatus;
374 for (i = 0; i < 16; i++) {
375 if (!(units & (1 << i)))
377 if (nv_device(priv)->
chipset < 0xa0)
378 ustatus_addr = ustatus_old + (i << 12);
380 ustatus_addr = ustatus_new + (i << 11);
381 ustatus = nv_rd32(priv, ustatus_addr) & 0x7fffffff;
388 nv_error(priv,
"magic set %d:\n", i);
389 for (r = ustatus_addr + 4; r <= ustatus_addr + 0x10; r += 4)
390 nv_error(priv,
"\t0x%08x: 0x%08x\n", r,
395 if (ustatus & 0x04030000) {
396 nv50_priv_mp_trap(priv, i, display);
397 ustatus &= ~0x04030000;
402 u32 e0c = nv_rd32(priv, ustatus_addr + 4);
403 u32 e10 = nv_rd32(priv, ustatus_addr + 8);
404 u32 e14 = nv_rd32(priv, ustatus_addr + 0
xc);
405 u32 e18 = nv_rd32(priv, ustatus_addr + 0x10);
406 u32 e1c = nv_rd32(priv, ustatus_addr + 0x14);
407 u32 e20 = nv_rd32(priv, ustatus_addr + 0x18);
408 u32 e24 = nv_rd32(priv, ustatus_addr + 0x1c);
410 if (ustatus & 0x00000010) {
412 nv_error(priv,
"TRAP_TPDMA_2D - TP %d - Unknown fault at address %02x%08x\n",
414 nv_error(priv,
"TRAP_TPDMA_2D - TP %d - e0c: %08x, e18: %08x, e1c: %08x, e20: %08x, e24: %08x\n",
415 i, e0c, e18, e1c, e20, e24);
417 ustatus &= ~0x00000010;
420 if (ustatus & 0x00000040) {
422 nv_error(priv,
"TRAP_TPDMA_RT - TP %d - Unknown fault at address %02x%08x\n",
424 nv_error(priv,
"TRAP_TPDMA_RT - TP %d - e0c: %08x, e18: %08x, e1c: %08x, e20: %08x, e24: %08x\n",
425 i, e0c, e18, e1c, e20, e24);
427 ustatus &= ~0x00000040;
430 if (ustatus & 0x00000080) {
432 if (e18 & 0x80000000) {
434 nv_error(priv,
"TRAP_TPDMA - TP %d - Global read fault at address %02x%08x\n",
435 i, e14, e10 | ((e18 >> 24) & 0x1f));
437 }
else if (e18 & 0
xc) {
439 nv_error(priv,
"TRAP_TPDMA - TP %d - Global write fault at address %02x%08x\n",
440 i, e14, e10 | ((e18 >> 7) & 0x1f));
443 nv_error(priv,
"TRAP_TPDMA - TP %d - Unknown CUDA fault at address %02x%08x\n",
446 nv_error(priv,
"TRAP_TPDMA - TP %d - e0c: %08x, e18: %08x, e1c: %08x, e20: %08x, e24: %08x\n",
447 i, e0c, e18, e1c, e20, e24);
449 ustatus &= ~0x00000080;
456 nv_info(priv,
"%s - TP%d: Unhandled ustatus 0x%08x\n", name, i, ustatus);
458 nv_wr32(priv, ustatus_addr, 0xc0000000);
462 nv_info(priv,
"%s - No TPs claiming errors?\n", name);
469 u32 status = nv_rd32(priv, 0x400108);
472 if (!status && display) {
473 nv_error(priv,
"TRAP: no units reporting traps?\n");
480 if (status & 0x001) {
481 ustatus = nv_rd32(priv, 0x400804) & 0x7fffffff;
482 if (!ustatus && display) {
483 nv_error(priv,
"TRAP_DISPATCH - no ustatus?\n");
486 nv_wr32(priv, 0x400500, 0x00000000);
489 if (ustatus & 0x00000001) {
490 u32 addr = nv_rd32(priv, 0x400808);
491 u32 subc = (addr & 0x00070000) >> 16;
492 u32 mthd = (addr & 0x00001ffc);
493 u32 datal = nv_rd32(priv, 0x40080c);
494 u32 datah = nv_rd32(priv, 0x400810);
495 u32 class = nv_rd32(priv, 0x400814);
496 u32 r848 = nv_rd32(priv, 0x400848);
498 nv_error(priv,
"TRAP DISPATCH_FAULT\n");
499 if (display && (addr & 0x80000000)) {
501 "subc %d class 0x%04x mthd 0x%04x "
503 "400808 0x%08x 400848 0x%08x\n",
504 chid, inst, subc,
class, mthd, datah,
508 nv_error(priv,
"no stuck command?\n");
511 nv_wr32(priv, 0x400808, 0);
512 nv_wr32(priv, 0x4008e8, nv_rd32(priv, 0x4008e8) & 3);
513 nv_wr32(priv, 0x400848, 0);
514 ustatus &= ~0x00000001;
517 if (ustatus & 0x00000002) {
518 u32 addr = nv_rd32(priv, 0x40084c);
519 u32 subc = (addr & 0x00070000) >> 16;
520 u32 mthd = (addr & 0x00001ffc);
521 u32 data = nv_rd32(priv, 0x40085c);
522 u32 class = nv_rd32(priv, 0x400814);
524 nv_error(priv,
"TRAP DISPATCH_QUERY\n");
525 if (display && (addr & 0x80000000)) {
527 "subc %d class 0x%04x mthd 0x%04x "
528 "data 0x%08x 40084c 0x%08x\n",
529 chid, inst, subc,
class, mthd,
533 nv_error(priv,
"no stuck command?\n");
536 nv_wr32(priv, 0x40084c, 0);
537 ustatus &= ~0x00000002;
540 if (ustatus && display) {
541 nv_error(priv,
"TRAP_DISPATCH (unknown "
542 "0x%08x)\n", ustatus);
545 nv_wr32(priv, 0x400804, 0xc0000000);
546 nv_wr32(priv, 0x400108, 0x001);
553 if (status & 0x002) {
554 u32 ustatus = nv_rd32(priv, 0x406800) & 0x7fffffff;
559 nv_error(priv,
"TRAP_M2MF %08x %08x %08x %08x\n",
560 nv_rd32(priv, 0x406804), nv_rd32(priv, 0x406808),
561 nv_rd32(priv, 0x40680c), nv_rd32(priv, 0x406810));
566 nv_wr32(priv, 0x400040, 2);
567 nv_wr32(priv, 0x400040, 0);
568 nv_wr32(priv, 0x406800, 0xc0000000);
569 nv_wr32(priv, 0x400108, 0x002);
574 if (status & 0x004) {
575 u32 ustatus = nv_rd32(priv, 0x400c04) & 0x7fffffff;
580 nv_error(priv,
"TRAP_VFETCH %08x %08x %08x %08x\n",
581 nv_rd32(priv, 0x400c00), nv_rd32(priv, 0x400c08),
582 nv_rd32(priv, 0x400c0c), nv_rd32(priv, 0x400c10));
585 nv_wr32(priv, 0x400c04, 0xc0000000);
586 nv_wr32(priv, 0x400108, 0x004);
591 if (status & 0x008) {
592 ustatus = nv_rd32(priv, 0x401800) & 0x7fffffff;
597 nv_error(priv,
"TRAP_STRMOUT %08x %08x %08x %08x\n",
598 nv_rd32(priv, 0x401804), nv_rd32(priv, 0x401808),
599 nv_rd32(priv, 0x40180c), nv_rd32(priv, 0x401810));
604 nv_wr32(priv, 0x400040, 0x80);
605 nv_wr32(priv, 0x400040, 0);
606 nv_wr32(priv, 0x401800, 0xc0000000);
607 nv_wr32(priv, 0x400108, 0x008);
612 if (status & 0x010) {
613 ustatus = nv_rd32(priv, 0x405018) & 0x7fffffff;
618 nv_error(priv,
"TRAP_CCACHE %08x %08x %08x %08x"
620 nv_rd32(priv, 0x405000), nv_rd32(priv, 0x405004),
621 nv_rd32(priv, 0x405008), nv_rd32(priv, 0x40500c),
622 nv_rd32(priv, 0x405010), nv_rd32(priv, 0x405014),
623 nv_rd32(priv, 0x40501c));
627 nv_wr32(priv, 0x405018, 0xc0000000);
628 nv_wr32(priv, 0x400108, 0x010);
636 ustatus = nv_rd32(priv, 0x402000) & 0x7fffffff;
638 nv_error(priv,
"TRAP_UNKC04 0x%08x\n", ustatus);
639 nv_wr32(priv, 0x402000, 0xc0000000);
644 if (status & 0x040) {
645 nv50_priv_tp_trap(priv, 6, 0x408900, 0x408600, display,
647 nv_wr32(priv, 0x400108, 0x040);
652 if (status & 0x080) {
653 nv50_priv_tp_trap(priv, 7, 0x408314, 0x40831c, display,
655 nv_wr32(priv, 0x400108, 0x080);
661 if (status & 0x100) {
662 nv50_priv_tp_trap(priv, 8, 0x408e08, 0x408708, display,
664 nv_wr32(priv, 0x400108, 0x100);
670 nv_error(priv,
"TRAP: unknown 0x%08x\n", status);
671 nv_wr32(priv, 0x400108, status);
685 u32 stat = nv_rd32(priv, 0x400100);
686 u32 inst = nv_rd32(priv, 0x40032c) & 0x0fffffff;
687 u32 addr = nv_rd32(priv, 0x400704);
688 u32 subc = (addr & 0x00070000) >> 16;
689 u32 mthd = (addr & 0x00001ffc);
690 u32 data = nv_rd32(priv, 0x400708);
691 u32 class = nv_rd32(priv, 0x400814);
696 chid = pfifo->
chid(pfifo, engctx);
698 if (stat & 0x00000010) {
700 if (handle && !nv_call(handle->
object, mthd, data))
705 if (show & 0x00100000) {
706 u32 ecode = nv_rd32(priv, 0x400110);
712 if (stat & 0x00200000) {
713 if (!nv50_graph_trap_handler(priv, show, chid, (
u64)inst << 12))
717 nv_wr32(priv, 0x400100, stat);
718 nv_wr32(priv, 0x400500, 0x00010001);
724 nv_error(priv,
"ch %d [0x%010llx] subc %d class 0x%04x "
725 "mthd 0x%04x data 0x%08x\n",
726 chid, (
u64)inst << 12, subc,
class, mthd, data);
730 if (nv_rd32(priv, 0x400824) & (1 << 31))
731 nv_wr32(priv, 0x400824, nv_rd32(priv, 0x400824) & ~(1 << 31));
745 *pobject = nv_object(priv);
749 nv_subdev(priv)->unit = 0x00201000;
750 nv_subdev(priv)->intr = nv50_graph_intr;
751 nv_engine(priv)->cclass = &nv50_graph_cclass;
753 switch (nv_device(priv)->
chipset) {
755 nv_engine(priv)->sclass = nv50_graph_sclass;
763 nv_engine(priv)->sclass = nv84_graph_sclass;
768 nv_engine(priv)->sclass = nva0_graph_sclass;
773 nv_engine(priv)->sclass = nva3_graph_sclass;
776 nv_engine(priv)->sclass = nvaf_graph_sclass;
781 if (nv_device(priv)->
chipset == 0x50 ||
782 nv_device(priv)->
chipset == 0xac)
783 nv_engine(priv)->tlb_flush = nv50_graph_tlb_flush;
785 nv_engine(priv)->tlb_flush = nv84_graph_tlb_flush;
802 nv_wr32(priv, 0x40008c, 0x00000004);
805 nv_wr32(priv, 0x400804, 0xc0000000);
806 nv_wr32(priv, 0x406800, 0xc0000000);
807 nv_wr32(priv, 0x400c04, 0xc0000000);
808 nv_wr32(priv, 0x401800, 0xc0000000);
809 nv_wr32(priv, 0x405018, 0xc0000000);
810 nv_wr32(priv, 0x402000, 0xc0000000);
812 units = nv_rd32(priv, 0x001540);
813 for (i = 0; i < 16; i++) {
814 if (!(units & (1 << i)))
817 if (nv_device(priv)->
chipset < 0xa0) {
818 nv_wr32(priv, 0x408900 + (i << 12), 0xc0000000);
819 nv_wr32(priv, 0x408e08 + (i << 12), 0xc0000000);
820 nv_wr32(priv, 0x408314 + (i << 12), 0xc0000000);
822 nv_wr32(priv, 0x408600 + (i << 11), 0xc0000000);
823 nv_wr32(priv, 0x408708 + (i << 11), 0xc0000000);
824 nv_wr32(priv, 0x40831c + (i << 11), 0xc0000000);
828 nv_wr32(priv, 0x400108, 0xffffffff);
829 nv_wr32(priv, 0x400138, 0xffffffff);
830 nv_wr32(priv, 0x400100, 0xffffffff);
831 nv_wr32(priv, 0x40013c, 0xffffffff);
832 nv_wr32(priv, 0x400500, 0x00010001);
839 nv_wr32(priv, 0x400824, 0x00000000);
840 nv_wr32(priv, 0x400828, 0x00000000);
841 nv_wr32(priv, 0x40082c, 0x00000000);
842 nv_wr32(priv, 0x400830, 0x00000000);
843 nv_wr32(priv, 0x400724, 0x00000000);
844 nv_wr32(priv, 0x40032c, 0x00000000);
845 nv_wr32(priv, 0x400320, 4);
848 switch (nv_device(priv)->
chipset & 0xf0) {
852 nv_wr32(priv, 0x402ca8, 0x00000800);
856 nv_wr32(priv, 0x402cc0, 0x00000000);
857 if (nv_device(priv)->
chipset == 0xa0 ||
858 nv_device(priv)->
chipset == 0xaa ||
859 nv_device(priv)->
chipset == 0xac) {
860 nv_wr32(priv, 0x402ca8, 0x00000802);
862 nv_wr32(priv, 0x402cc0, 0x00000000);
863 nv_wr32(priv, 0x402ca8, 0x00000002);
870 for (i = 0; i < 8; i++) {
871 nv_wr32(priv, 0x402c20 + (i * 8), 0x00000000);
872 nv_wr32(priv, 0x402c24 + (i * 8), 0x00000000);
873 nv_wr32(priv, 0x402c28 + (i * 8), 0x00000000);
874 nv_wr32(priv, 0x402c2c + (i * 8), 0x00000000);
883 .ctor = nv50_graph_ctor,
885 .init = nv50_graph_init,