76 for (i = 0, p = 0; i < 128; i++) {
77 if (!(nv_rd32(priv, 0x003004 + (i * 8)) & 1))
79 nv_wo32(cur, p + 0, i);
80 nv_wo32(cur, p + 4, 0x00000004);
85 nv_wr32(priv, 0x002270, cur->
addr >> 12);
86 nv_wr32(priv, 0x002274, 0x01f00000 | (p >> 3));
87 if (!
nv_wait(priv, 0x00227c, 0x00100000, 0x00000000))
88 nv_error(priv,
"playlist update failed\n");
101 switch (nv_engidx(object->
engine)) {
110 if (!ectx->vma.node) {
116 nv_engctx(ectx)->addr = nv_gpuobj(base)->addr >> 12;
119 nv_wo32(base, addr + 0x00,
lower_32_bits(ectx->vma.offset) | 4);
135 switch (nv_engidx(object->
engine)) {
144 nv_wo32(base, addr + 0x00, 0x00000000);
145 nv_wo32(base, addr + 0x04, 0x00000000);
148 nv_wr32(priv, 0x002634, chan->
base.chid);
149 if (!
nv_wait(priv, 0x002634, 0xffffffff, chan->
base.chid)) {
150 nv_error(priv,
"channel %d kick timeout\n", chan->
base.chid);
172 if (size <
sizeof(*args))
176 priv->
user.bar.offset, 0x1000,
182 *pobject = nv_object(chan);
186 nv_parent(chan)->context_attach = nvc0_fifo_context_attach;
187 nv_parent(chan)->context_detach = nvc0_fifo_context_detach;
189 usermem = chan->
base.chid * 0x1000;
191 ilength = log2i(args->
ilength / 8);
193 for (i = 0; i < 0x1000; i += 4)
194 nv_wo32(priv->
user.mem, usermem + i, 0x00000000);
198 nv_wo32(base, 0x10, 0x0000face);
199 nv_wo32(base, 0x30, 0xfffff902);
201 nv_wo32(base, 0x4c,
upper_32_bits(ioffset) | (ilength << 16));
202 nv_wo32(base, 0x54, 0x00000002);
203 nv_wo32(base, 0x84, 0x20400000);
204 nv_wo32(base, 0x94, 0x30000001);
205 nv_wo32(base, 0x9c, 0x00000100);
206 nv_wo32(base, 0xa4, 0x1f1f1f1f);
207 nv_wo32(base, 0xa8, 0x1f1f1f1f);
208 nv_wo32(base, 0xac, 0x0000001f);
209 nv_wo32(base, 0xb8, 0xf8000000);
210 nv_wo32(base, 0xf8, 0x10003080);
211 nv_wo32(base, 0xfc, 0x10000010);
229 nv_wr32(priv, 0x003000 + (chid * 8), 0xc0000000 | base->
addr >> 12);
230 nv_wr32(priv, 0x003004 + (chid * 8), 0x001f0001);
231 nvc0_fifo_playlist_update(priv);
242 nv_mask(priv, 0x003004 + (chid * 8), 0x00000001, 0x00000000);
243 nvc0_fifo_playlist_update(priv);
244 nv_wr32(priv, 0x003000 + (chid * 8), 0x00000000);
251 .ctor = nvc0_fifo_chan_ctor,
253 .init = nvc0_fifo_chan_init,
254 .fini = nvc0_fifo_chan_fini,
260 nvc0_fifo_sclass[] = {
281 *pobject = nv_object(base);
291 nv_wo32(base, 0x0208, 0xffffffff);
292 nv_wo32(base, 0x020c, 0x000000ff);
306 nouveau_gpuobj_ref(
NULL, &base->
pgd);
314 .ctor = nvc0_fifo_context_ctor,
315 .dtor = nvc0_fifo_context_dtor,
327 static const struct nouveau_enum nvc0_fifo_fault_unit[] = {
329 { 0x03,
"PEEPHOLE" },
335 { 0x13,
"PCOUNTER" },
343 static const struct nouveau_enum nvc0_fifo_fault_reason[] = {
344 { 0x00,
"PT_NOT_PRESENT" },
345 { 0x01,
"PT_TOO_SHORT" },
346 { 0x02,
"PAGE_NOT_PRESENT" },
347 { 0x03,
"VM_LIMIT_EXCEEDED" },
348 { 0x04,
"NO_CHANNEL" },
349 { 0x05,
"PAGE_SYSTEM_ONLY" },
350 { 0x06,
"PAGE_READ_ONLY" },
351 { 0x0a,
"COMPRESSED_SYSRAM" },
352 { 0x0c,
"INVALID_STORAGE_TYPE" },
356 static const struct nouveau_enum nvc0_fifo_fault_hubclient[] = {
359 { 0x04,
"DISPATCH" },
362 { 0x07,
"BAR_READ" },
363 { 0x08,
"BAR_WRITE" },
367 { 0x11,
"PCOUNTER" },
370 { 0x15,
"CCACHE_POST" },
374 static const struct nouveau_enum nvc0_fifo_fault_gpcclient[] = {
384 { 0x00200000,
"ILLEGAL_MTHD" },
385 { 0x00800000,
"EMPTY_SUBC" },
392 u32 inst = nv_rd32(priv, 0x002800 + (unit * 0x10));
393 u32 valo = nv_rd32(priv, 0x002804 + (unit * 0x10));
394 u32 vahi = nv_rd32(priv, 0x002808 + (unit * 0x10));
395 u32 stat = nv_rd32(priv, 0x00280c + (unit * 0x10));
400 nv_mask(priv, 0x001718, 0x00000000, 0x00000000);
403 nv_mask(priv, 0x001704, 0x00000000, 0x00000000);
406 nv_mask(priv, 0x001714, 0x00000000, 0x00000000);
412 nv_error(priv,
"%s fault at 0x%010llx [", (stat & 0x00000080) ?
413 "write" :
"read", (
u64)vahi << 32 | valo);
417 if (stat & 0x00000040) {
421 printk(
"/GPC%d/", (stat & 0x1f000000) >> 24);
424 printk(
" on channel 0x%010llx\n", (
u64)inst << 12);
436 if (
likely(chid >= priv->
base.min && chid <= priv->base.max))
437 chan = (
void *)priv->
base.channel[chid];
443 if (!mthd || !nv_call(bind->
object, mthd, data))
449 spin_unlock_irqrestore(&priv->
base.lock, flags);
456 u32 stat = nv_rd32(priv, 0x040108 + (unit * 0x2000));
457 u32 addr = nv_rd32(priv, 0x0400c0 + (unit * 0x2000));
458 u32 data = nv_rd32(priv, 0x0400c4 + (unit * 0x2000));
459 u32 chid = nv_rd32(priv, 0x040120 + (unit * 0x2000)) & 0x7f;
460 u32 subc = (addr & 0x00070000) >> 16;
461 u32 mthd = (addr & 0x00003ffc);
464 if (stat & 0x00200000) {
465 if (mthd == 0x0054) {
466 if (!nvc0_fifo_swmthd(priv, chid, 0x0500, 0x00000000))
471 if (stat & 0x00800000) {
472 if (!nvc0_fifo_swmthd(priv, chid, mthd, data))
480 nv_error(priv,
"SUBFIFO%d: ch %d subc %d mthd 0x%04x "
482 unit, chid, subc, mthd, data);
485 nv_wr32(priv, 0x0400c0 + (unit * 0x2000), 0x80600008);
486 nv_wr32(priv, 0x040108 + (unit * 0x2000), stat);
493 u32 mask = nv_rd32(priv, 0x002140);
494 u32 stat = nv_rd32(priv, 0x002100) &
mask;
496 if (stat & 0x00000100) {
497 nv_info(priv,
"unknown status 0x00000100\n");
498 nv_wr32(priv, 0x002100, 0x00000100);
502 if (stat & 0x10000000) {
503 u32 units = nv_rd32(priv, 0x00259c);
508 nvc0_fifo_isr_vm_fault(priv, i);
512 nv_wr32(priv, 0x00259c, units);
516 if (stat & 0x20000000) {
517 u32 units = nv_rd32(priv, 0x0025a0);
522 nvc0_fifo_isr_subfifo_intr(priv, i);
526 nv_wr32(priv, 0x0025a0, units);
530 if (stat & 0x40000000) {
531 nv_warn(priv,
"unknown status 0x40000000\n");
532 nv_mask(priv, 0x002a00, 0x00000000, 0x00000000);
537 nv_fatal(priv,
"unhandled status 0x%08x\n", stat);
538 nv_wr32(priv, 0x002100, stat);
539 nv_wr32(priv, 0x002140, 0);
552 *pobject = nv_object(priv);
576 nv_subdev(priv)->unit = 0x00000100;
577 nv_subdev(priv)->intr = nvc0_fifo_intr;
578 nv_engine(priv)->cclass = &nvc0_fifo_cclass;
579 nv_engine(priv)->sclass = nvc0_fifo_sclass;
589 nouveau_gpuobj_ref(
NULL, &priv->
user.mem);
606 nv_wr32(priv, 0x000204, 0xffffffff);
607 nv_wr32(priv, 0x002204, 0xffffffff);
614 nv_wr32(priv, 0x002208, ~(1 << 0));
615 nv_wr32(priv, 0x00220c, ~(1 << 1));
616 nv_wr32(priv, 0x002210, ~(1 << 1));
617 nv_wr32(priv, 0x002214, ~(1 << 1));
618 nv_wr32(priv, 0x002218, ~(1 << 2));
619 nv_wr32(priv, 0x00221c, ~(1 << 1));
623 for (i = 0; i < priv->
spoon_nr; i++) {
624 nv_mask(priv, 0x04013c + (i * 0x2000), 0x10000100, 0x00000000);
625 nv_wr32(priv, 0x040108 + (i * 0x2000), 0xffffffff);
626 nv_wr32(priv, 0x04010c + (i * 0x2000), 0xfffffeff);
629 nv_mask(priv, 0x002200, 0x00000001, 0x00000001);
630 nv_wr32(priv, 0x002254, 0x10000000 | priv->
user.bar.offset >> 12);
632 nv_wr32(priv, 0x002a00, 0xffffffff);
633 nv_wr32(priv, 0x002100, 0xffffffff);
634 nv_wr32(priv, 0x002140, 0xbfffffff);
642 .ctor = nvc0_fifo_ctor,
643 .dtor = nvc0_fifo_dtor,
644 .init = nvc0_fifo_init,