forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-01-04 1543e317f1da31b75942316931e8f491a8920811
kernel/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gpfifogk104.c
....@@ -85,7 +85,7 @@
8585 case NVKM_ENGINE_MSVLD : return 0x0270;
8686 case NVKM_ENGINE_VIC : return 0x0280;
8787 case NVKM_ENGINE_MSENC : return 0x0290;
88
- case NVKM_ENGINE_NVDEC : return 0x02100270;
88
+ case NVKM_ENGINE_NVDEC0: return 0x02100270;
8989 case NVKM_ENGINE_NVENC0: return 0x02100290;
9090 case NVKM_ENGINE_NVENC1: return 0x0210;
9191 default:
....@@ -192,7 +192,7 @@
192192 gk104_fifo_runlist_remove(fifo, chan);
193193 nvkm_mask(device, 0x800004 + coff, 0x00000800, 0x00000800);
194194 gk104_fifo_gpfifo_kick(chan);
195
- gk104_fifo_runlist_commit(fifo, chan->runl);
195
+ gk104_fifo_runlist_update(fifo, chan->runl);
196196 }
197197
198198 nvkm_wr32(device, 0x800000 + coff, 0x00000000);
....@@ -213,7 +213,7 @@
213213 if (list_empty(&chan->head) && !chan->killed) {
214214 gk104_fifo_runlist_insert(fifo, chan);
215215 nvkm_mask(device, 0x800004 + coff, 0x00000400, 0x00000400);
216
- gk104_fifo_runlist_commit(fifo, chan->runl);
216
+ gk104_fifo_runlist_update(fifo, chan->runl);
217217 nvkm_mask(device, 0x800004 + coff, 0x00000400, 0x00000400);
218218 }
219219 }
....@@ -222,6 +222,7 @@
222222 gk104_fifo_gpfifo_dtor(struct nvkm_fifo_chan *base)
223223 {
224224 struct gk104_fifo_chan *chan = gk104_fifo_chan(base);
225
+ nvkm_memory_unref(&chan->mthd);
225226 kfree(chan->cgrp);
226227 return chan;
227228 }
....@@ -240,7 +241,7 @@
240241
241242 static int
242243 gk104_fifo_gpfifo_new_(struct gk104_fifo *fifo, u64 *runlists, u16 *chid,
243
- u64 vmm, u64 ioffset, u64 ilength,
244
+ u64 vmm, u64 ioffset, u64 ilength, u64 *inst, bool priv,
244245 const struct nvkm_oclass *oclass,
245246 struct nvkm_object **pobject)
246247 {
....@@ -279,6 +280,7 @@
279280 return ret;
280281
281282 *chid = chan->base.chid;
283
+ *inst = chan->base.inst->addr;
282284
283285 /* Hack to support GPUs where even individual channels should be
284286 * part of a channel group.
....@@ -315,6 +317,7 @@
315317 nvkm_wo32(chan->base.inst, 0x94, 0x30000001);
316318 nvkm_wo32(chan->base.inst, 0x9c, 0x00000100);
317319 nvkm_wo32(chan->base.inst, 0xac, 0x0000001f);
320
+ nvkm_wo32(chan->base.inst, 0xe4, priv ? 0x00000020 : 0x00000000);
318321 nvkm_wo32(chan->base.inst, 0xe8, chan->base.chid);
319322 nvkm_wo32(chan->base.inst, 0xb8, 0xf8000000);
320323 nvkm_wo32(chan->base.inst, 0xf8, 0x10003080); /* 0x002310 */
....@@ -337,15 +340,19 @@
337340 if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, false))) {
338341 nvif_ioctl(parent, "create channel gpfifo vers %d vmm %llx "
339342 "ioffset %016llx ilength %08x "
340
- "runlist %016llx\n",
343
+ "runlist %016llx priv %d\n",
341344 args->v0.version, args->v0.vmm, args->v0.ioffset,
342
- args->v0.ilength, args->v0.runlist);
345
+ args->v0.ilength, args->v0.runlist, args->v0.priv);
346
+ if (args->v0.priv && !oclass->client->super)
347
+ return -EINVAL;
343348 return gk104_fifo_gpfifo_new_(fifo,
344349 &args->v0.runlist,
345350 &args->v0.chid,
346351 args->v0.vmm,
347352 args->v0.ioffset,
348353 args->v0.ilength,
354
+ &args->v0.inst,
355
+ args->v0.priv,
349356 oclass, pobject);
350357 }
351358