]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
drm/nouveau/fifo/gk104-: add interfaces to support different runlist layouts
authorBen Skeggs <bskeggs@redhat.com>
Tue, 8 May 2018 10:39:46 +0000 (20:39 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Fri, 18 May 2018 05:01:21 +0000 (15:01 +1000)
This will be required to support features on newer hardware.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/nvkm/engine/fifo/gk104.c
drivers/gpu/drm/nouveau/nvkm/engine/fifo/gk104.h
drivers/gpu/drm/nouveau/nvkm/engine/fifo/gk110.c
drivers/gpu/drm/nouveau/nvkm/engine/fifo/gk208.c
drivers/gpu/drm/nouveau/nvkm/engine/fifo/gk20a.c
drivers/gpu/drm/nouveau/nvkm/engine/fifo/gm107.c
drivers/gpu/drm/nouveau/nvkm/engine/fifo/gm200.c
drivers/gpu/drm/nouveau/nvkm/engine/fifo/gm20b.c
drivers/gpu/drm/nouveau/nvkm/engine/fifo/gp100.c
drivers/gpu/drm/nouveau/nvkm/engine/fifo/gp10b.c

index 316b2b1d08e830c7227c4517dadace3561eb65ec..afb3ed06ec89e10f79bb6ccf7f86a27d2f08ebf6 100644 (file)
@@ -140,6 +140,7 @@ gk104_fifo_uevent_init(struct nvkm_fifo *fifo)
 void
 gk104_fifo_runlist_commit(struct gk104_fifo *fifo, int runl)
 {
+       const struct gk104_fifo_runlist_func *func = fifo->func->runlist;
        struct gk104_fifo_chan *chan;
        struct nvkm_subdev *subdev = &fifo->base.engine.subdev;
        struct nvkm_device *device = subdev->device;
@@ -153,9 +154,7 @@ gk104_fifo_runlist_commit(struct gk104_fifo *fifo, int runl)
 
        nvkm_kmap(mem);
        list_for_each_entry(chan, &fifo->runlist[runl].chan, head) {
-               nvkm_wo32(mem, (nr * 8) + 0, chan->base.chid);
-               nvkm_wo32(mem, (nr * 8) + 4, 0x00000000);
-               nr++;
+               func->chan(chan, mem, nr++ * func->size);
        }
        nvkm_done(mem);
 
@@ -196,6 +195,20 @@ gk104_fifo_runlist_insert(struct gk104_fifo *fifo, struct gk104_fifo_chan *chan)
        mutex_unlock(&fifo->base.engine.subdev.mutex);
 }
 
+void
+gk104_fifo_runlist_chan(struct gk104_fifo_chan *chan,
+                       struct nvkm_memory *memory, u32 offset)
+{
+       nvkm_wo32(memory, offset + 0, chan->base.chid);
+       nvkm_wo32(memory, offset + 4, 0x00000000);
+}
+
+const struct gk104_fifo_runlist_func
+gk104_fifo_runlist = {
+       .size = 8,
+       .chan = gk104_fifo_runlist_chan,
+};
+
 static void
 gk104_fifo_recover_work(struct work_struct *w)
 {
@@ -874,17 +887,15 @@ gk104_fifo_oneinit(struct nvkm_fifo *base)
        kfree(map);
 
        for (i = 0; i < fifo->runlist_nr; i++) {
-               ret = nvkm_memory_new(device, NVKM_MEM_TARGET_INST,
-                                     0x8000, 0x1000, false,
-                                     &fifo->runlist[i].mem[0]);
-               if (ret)
-                       return ret;
-
-               ret = nvkm_memory_new(device, NVKM_MEM_TARGET_INST,
-                                     0x8000, 0x1000, false,
-                                     &fifo->runlist[i].mem[1]);
-               if (ret)
-                       return ret;
+               for (j = 0; j < ARRAY_SIZE(fifo->runlist[i].mem); j++) {
+                       ret = nvkm_memory_new(device, NVKM_MEM_TARGET_INST,
+                                             fifo->base.nr * 2/* TSG+chan */ *
+                                             fifo->func->runlist->size,
+                                             0x1000, false,
+                                             &fifo->runlist[i].mem[j]);
+                       if (ret)
+                               return ret;
+               }
 
                init_waitqueue_head(&fifo->runlist[i].wait);
                INIT_LIST_HEAD(&fifo->runlist[i].chan);
@@ -1111,6 +1122,7 @@ gk104_fifo = {
        .fault.reason = gk104_fifo_fault_reason,
        .fault.hubclient = gk104_fifo_fault_hubclient,
        .fault.gpcclient = gk104_fifo_fault_gpcclient,
+       .runlist = &gk104_fifo_runlist,
        .chan = {{0,0,KEPLER_CHANNEL_GPFIFO_A}, gk104_fifo_gpfifo_new },
 };
 
index 41f1f367eaebbf826c031b3b498b3e4d6d38366b..c32ea45f945648de376a2f514966108c7c2fed72 100644 (file)
@@ -51,6 +51,12 @@ struct gk104_fifo_func {
                const struct nvkm_enum *gpcclient;
        } fault;
 
+       const struct gk104_fifo_runlist_func {
+               u8 size;
+               void (*chan)(struct gk104_fifo_chan *,
+                            struct nvkm_memory *, u32 offset);
+       } *runlist;
+
        struct gk104_fifo_chan_user {
                struct nvkm_sclass user;
                int (*ctor)(struct gk104_fifo *, const struct nvkm_oclass *,
@@ -65,10 +71,14 @@ void gk104_fifo_runlist_remove(struct gk104_fifo *, struct gk104_fifo_chan *);
 void gk104_fifo_runlist_commit(struct gk104_fifo *, int runl);
 
 extern const struct nvkm_enum gk104_fifo_fault_access[];
+
 extern const struct nvkm_enum gk104_fifo_fault_engine[];
 extern const struct nvkm_enum gk104_fifo_fault_reason[];
 extern const struct nvkm_enum gk104_fifo_fault_hubclient[];
 extern const struct nvkm_enum gk104_fifo_fault_gpcclient[];
+extern const struct gk104_fifo_runlist_func gk104_fifo_runlist;
+void gk104_fifo_runlist_chan(struct gk104_fifo_chan *,
+                            struct nvkm_memory *, u32);
 
 extern const struct nvkm_enum gm107_fifo_fault_engine[];
 extern const struct nvkm_enum gp100_fifo_fault_engine[];
index 9611bf1ad0b0a53888671bcc366666c0021a703c..f7e160479558292793cdbee8f091081d5bb4216e 100644 (file)
@@ -33,6 +33,7 @@ gk110_fifo = {
        .fault.reason = gk104_fifo_fault_reason,
        .fault.hubclient = gk104_fifo_fault_hubclient,
        .fault.gpcclient = gk104_fifo_fault_gpcclient,
+       .runlist = &gk104_fifo_runlist,
        .chan = {{0,0,KEPLER_CHANNEL_GPFIFO_B}, gk104_fifo_gpfifo_new },
 };
 
index fabc690ddd56e88bfd3a3eed6698863066f4ff3b..ff936ab6bf87074390fbebb494c236448d4f57ba 100644 (file)
@@ -33,6 +33,7 @@ gk208_fifo = {
        .fault.reason = gk104_fifo_fault_reason,
        .fault.hubclient = gk104_fifo_fault_hubclient,
        .fault.gpcclient = gk104_fifo_fault_gpcclient,
+       .runlist = &gk104_fifo_runlist,
        .chan = {{0,0,KEPLER_CHANNEL_GPFIFO_A}, gk104_fifo_gpfifo_new },
 };
 
index dee1bd76882a4b6c290198f0f654956e5048575a..cb78d4df91822bb8f152fcef710789442504fea9 100644 (file)
@@ -31,6 +31,7 @@ gk20a_fifo = {
        .fault.reason = gk104_fifo_fault_reason,
        .fault.hubclient = gk104_fifo_fault_hubclient,
        .fault.gpcclient = gk104_fifo_fault_gpcclient,
+       .runlist = &gk104_fifo_runlist,
        .chan = {{0,0,KEPLER_CHANNEL_GPFIFO_A}, gk104_fifo_gpfifo_new },
 };
 
index 09f97827167aba14ec7e53224826d04903a2a061..f749d93a51c1870a419f3fba77cf511710815bcb 100644 (file)
@@ -56,6 +56,7 @@ gm107_fifo = {
        .fault.reason = gk104_fifo_fault_reason,
        .fault.hubclient = gk104_fifo_fault_hubclient,
        .fault.gpcclient = gk104_fifo_fault_gpcclient,
+       .runlist = &gk104_fifo_runlist,
        .chan = {{0,0,KEPLER_CHANNEL_GPFIFO_B}, gk104_fifo_gpfifo_new },
 };
 
index 052b7c2c5d7644bc257194368fed91a20a93461b..3b97bd48697d3b14341bc2eab34dec850b825553 100644 (file)
@@ -33,6 +33,7 @@ gm200_fifo = {
        .fault.reason = gk104_fifo_fault_reason,
        .fault.hubclient = gk104_fifo_fault_hubclient,
        .fault.gpcclient = gk104_fifo_fault_gpcclient,
+       .runlist = &gk104_fifo_runlist,
        .chan = {{0,0,MAXWELL_CHANNEL_GPFIFO_A}, gk104_fifo_gpfifo_new },
 };
 
index 844787c6fb62ba834c59b495f21d33b67fe2c6cd..c7e11a40f016d1baf08cc83b436ea45a1a5ee433 100644 (file)
@@ -31,6 +31,7 @@ gm20b_fifo = {
        .fault.reason = gk104_fifo_fault_reason,
        .fault.hubclient = gk104_fifo_fault_hubclient,
        .fault.gpcclient = gk104_fifo_fault_gpcclient,
+       .runlist = &gk104_fifo_runlist,
        .chan = {{0,0,MAXWELL_CHANNEL_GPFIFO_A}, gk104_fifo_gpfifo_new },
 };
 
index 2e31847e2e4fd616fae336a83f73805c751ee438..5c0cc40f7e3e0848e657187fcbc799176c2b748e 100644 (file)
@@ -57,6 +57,7 @@ gp100_fifo = {
        .fault.reason = gk104_fifo_fault_reason,
        .fault.hubclient = gk104_fifo_fault_hubclient,
        .fault.gpcclient = gk104_fifo_fault_gpcclient,
+       .runlist = &gk104_fifo_runlist,
        .chan = {{0,0,PASCAL_CHANNEL_GPFIFO_A}, gk104_fifo_gpfifo_new },
 };
 
index 38ab6e17ec157827880a3300fcb451d842668c5e..fe3a8fad86208fbaaf94dc70025b0cc31f4c86d1 100644 (file)
@@ -31,6 +31,7 @@ gp10b_fifo = {
        .fault.reason = gk104_fifo_fault_reason,
        .fault.hubclient = gk104_fifo_fault_hubclient,
        .fault.gpcclient = gk104_fifo_fault_gpcclient,
+       .runlist = &gk104_fifo_runlist,
        .chan = {{0,0,PASCAL_CHANNEL_GPFIFO_A}, gk104_fifo_gpfifo_new },
 };