Commit 66587083 authored by Ben Skeggs's avatar Ben Skeggs

drm/nouveau/fifo/gk104-: add interfaces to support different runlist layouts

This will be required to support features on newer hardware.
Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent f9360c3a
...@@ -140,6 +140,7 @@ gk104_fifo_uevent_init(struct nvkm_fifo *fifo) ...@@ -140,6 +140,7 @@ gk104_fifo_uevent_init(struct nvkm_fifo *fifo)
void void
gk104_fifo_runlist_commit(struct gk104_fifo *fifo, int runl) 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 gk104_fifo_chan *chan;
struct nvkm_subdev *subdev = &fifo->base.engine.subdev; struct nvkm_subdev *subdev = &fifo->base.engine.subdev;
struct nvkm_device *device = subdev->device; struct nvkm_device *device = subdev->device;
...@@ -153,9 +154,7 @@ gk104_fifo_runlist_commit(struct gk104_fifo *fifo, int runl) ...@@ -153,9 +154,7 @@ gk104_fifo_runlist_commit(struct gk104_fifo *fifo, int runl)
nvkm_kmap(mem); nvkm_kmap(mem);
list_for_each_entry(chan, &fifo->runlist[runl].chan, head) { list_for_each_entry(chan, &fifo->runlist[runl].chan, head) {
nvkm_wo32(mem, (nr * 8) + 0, chan->base.chid); func->chan(chan, mem, nr++ * func->size);
nvkm_wo32(mem, (nr * 8) + 4, 0x00000000);
nr++;
} }
nvkm_done(mem); nvkm_done(mem);
...@@ -196,6 +195,20 @@ gk104_fifo_runlist_insert(struct gk104_fifo *fifo, struct gk104_fifo_chan *chan) ...@@ -196,6 +195,20 @@ gk104_fifo_runlist_insert(struct gk104_fifo *fifo, struct gk104_fifo_chan *chan)
mutex_unlock(&fifo->base.engine.subdev.mutex); 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 static void
gk104_fifo_recover_work(struct work_struct *w) gk104_fifo_recover_work(struct work_struct *w)
{ {
...@@ -874,17 +887,15 @@ gk104_fifo_oneinit(struct nvkm_fifo *base) ...@@ -874,17 +887,15 @@ gk104_fifo_oneinit(struct nvkm_fifo *base)
kfree(map); kfree(map);
for (i = 0; i < fifo->runlist_nr; i++) { for (i = 0; i < fifo->runlist_nr; i++) {
ret = nvkm_memory_new(device, NVKM_MEM_TARGET_INST, for (j = 0; j < ARRAY_SIZE(fifo->runlist[i].mem); j++) {
0x8000, 0x1000, false, ret = nvkm_memory_new(device, NVKM_MEM_TARGET_INST,
&fifo->runlist[i].mem[0]); fifo->base.nr * 2/* TSG+chan */ *
if (ret) fifo->func->runlist->size,
return ret; 0x1000, false,
&fifo->runlist[i].mem[j]);
ret = nvkm_memory_new(device, NVKM_MEM_TARGET_INST, if (ret)
0x8000, 0x1000, false, return ret;
&fifo->runlist[i].mem[1]); }
if (ret)
return ret;
init_waitqueue_head(&fifo->runlist[i].wait); init_waitqueue_head(&fifo->runlist[i].wait);
INIT_LIST_HEAD(&fifo->runlist[i].chan); INIT_LIST_HEAD(&fifo->runlist[i].chan);
...@@ -1111,6 +1122,7 @@ gk104_fifo = { ...@@ -1111,6 +1122,7 @@ gk104_fifo = {
.fault.reason = gk104_fifo_fault_reason, .fault.reason = gk104_fifo_fault_reason,
.fault.hubclient = gk104_fifo_fault_hubclient, .fault.hubclient = gk104_fifo_fault_hubclient,
.fault.gpcclient = gk104_fifo_fault_gpcclient, .fault.gpcclient = gk104_fifo_fault_gpcclient,
.runlist = &gk104_fifo_runlist,
.chan = {{0,0,KEPLER_CHANNEL_GPFIFO_A}, gk104_fifo_gpfifo_new }, .chan = {{0,0,KEPLER_CHANNEL_GPFIFO_A}, gk104_fifo_gpfifo_new },
}; };
......
...@@ -51,6 +51,12 @@ struct gk104_fifo_func { ...@@ -51,6 +51,12 @@ struct gk104_fifo_func {
const struct nvkm_enum *gpcclient; const struct nvkm_enum *gpcclient;
} fault; } 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 gk104_fifo_chan_user {
struct nvkm_sclass user; struct nvkm_sclass user;
int (*ctor)(struct gk104_fifo *, const struct nvkm_oclass *, 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 *); ...@@ -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); 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_access[];
extern const struct nvkm_enum gk104_fifo_fault_engine[]; 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_reason[];
extern const struct nvkm_enum gk104_fifo_fault_hubclient[]; extern const struct nvkm_enum gk104_fifo_fault_hubclient[];
extern const struct nvkm_enum gk104_fifo_fault_gpcclient[]; 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 gm107_fifo_fault_engine[];
extern const struct nvkm_enum gp100_fifo_fault_engine[]; extern const struct nvkm_enum gp100_fifo_fault_engine[];
......
...@@ -33,6 +33,7 @@ gk110_fifo = { ...@@ -33,6 +33,7 @@ gk110_fifo = {
.fault.reason = gk104_fifo_fault_reason, .fault.reason = gk104_fifo_fault_reason,
.fault.hubclient = gk104_fifo_fault_hubclient, .fault.hubclient = gk104_fifo_fault_hubclient,
.fault.gpcclient = gk104_fifo_fault_gpcclient, .fault.gpcclient = gk104_fifo_fault_gpcclient,
.runlist = &gk104_fifo_runlist,
.chan = {{0,0,KEPLER_CHANNEL_GPFIFO_B}, gk104_fifo_gpfifo_new }, .chan = {{0,0,KEPLER_CHANNEL_GPFIFO_B}, gk104_fifo_gpfifo_new },
}; };
......
...@@ -33,6 +33,7 @@ gk208_fifo = { ...@@ -33,6 +33,7 @@ gk208_fifo = {
.fault.reason = gk104_fifo_fault_reason, .fault.reason = gk104_fifo_fault_reason,
.fault.hubclient = gk104_fifo_fault_hubclient, .fault.hubclient = gk104_fifo_fault_hubclient,
.fault.gpcclient = gk104_fifo_fault_gpcclient, .fault.gpcclient = gk104_fifo_fault_gpcclient,
.runlist = &gk104_fifo_runlist,
.chan = {{0,0,KEPLER_CHANNEL_GPFIFO_A}, gk104_fifo_gpfifo_new }, .chan = {{0,0,KEPLER_CHANNEL_GPFIFO_A}, gk104_fifo_gpfifo_new },
}; };
......
...@@ -31,6 +31,7 @@ gk20a_fifo = { ...@@ -31,6 +31,7 @@ gk20a_fifo = {
.fault.reason = gk104_fifo_fault_reason, .fault.reason = gk104_fifo_fault_reason,
.fault.hubclient = gk104_fifo_fault_hubclient, .fault.hubclient = gk104_fifo_fault_hubclient,
.fault.gpcclient = gk104_fifo_fault_gpcclient, .fault.gpcclient = gk104_fifo_fault_gpcclient,
.runlist = &gk104_fifo_runlist,
.chan = {{0,0,KEPLER_CHANNEL_GPFIFO_A}, gk104_fifo_gpfifo_new }, .chan = {{0,0,KEPLER_CHANNEL_GPFIFO_A}, gk104_fifo_gpfifo_new },
}; };
......
...@@ -56,6 +56,7 @@ gm107_fifo = { ...@@ -56,6 +56,7 @@ gm107_fifo = {
.fault.reason = gk104_fifo_fault_reason, .fault.reason = gk104_fifo_fault_reason,
.fault.hubclient = gk104_fifo_fault_hubclient, .fault.hubclient = gk104_fifo_fault_hubclient,
.fault.gpcclient = gk104_fifo_fault_gpcclient, .fault.gpcclient = gk104_fifo_fault_gpcclient,
.runlist = &gk104_fifo_runlist,
.chan = {{0,0,KEPLER_CHANNEL_GPFIFO_B}, gk104_fifo_gpfifo_new }, .chan = {{0,0,KEPLER_CHANNEL_GPFIFO_B}, gk104_fifo_gpfifo_new },
}; };
......
...@@ -33,6 +33,7 @@ gm200_fifo = { ...@@ -33,6 +33,7 @@ gm200_fifo = {
.fault.reason = gk104_fifo_fault_reason, .fault.reason = gk104_fifo_fault_reason,
.fault.hubclient = gk104_fifo_fault_hubclient, .fault.hubclient = gk104_fifo_fault_hubclient,
.fault.gpcclient = gk104_fifo_fault_gpcclient, .fault.gpcclient = gk104_fifo_fault_gpcclient,
.runlist = &gk104_fifo_runlist,
.chan = {{0,0,MAXWELL_CHANNEL_GPFIFO_A}, gk104_fifo_gpfifo_new }, .chan = {{0,0,MAXWELL_CHANNEL_GPFIFO_A}, gk104_fifo_gpfifo_new },
}; };
......
...@@ -31,6 +31,7 @@ gm20b_fifo = { ...@@ -31,6 +31,7 @@ gm20b_fifo = {
.fault.reason = gk104_fifo_fault_reason, .fault.reason = gk104_fifo_fault_reason,
.fault.hubclient = gk104_fifo_fault_hubclient, .fault.hubclient = gk104_fifo_fault_hubclient,
.fault.gpcclient = gk104_fifo_fault_gpcclient, .fault.gpcclient = gk104_fifo_fault_gpcclient,
.runlist = &gk104_fifo_runlist,
.chan = {{0,0,MAXWELL_CHANNEL_GPFIFO_A}, gk104_fifo_gpfifo_new }, .chan = {{0,0,MAXWELL_CHANNEL_GPFIFO_A}, gk104_fifo_gpfifo_new },
}; };
......
...@@ -57,6 +57,7 @@ gp100_fifo = { ...@@ -57,6 +57,7 @@ gp100_fifo = {
.fault.reason = gk104_fifo_fault_reason, .fault.reason = gk104_fifo_fault_reason,
.fault.hubclient = gk104_fifo_fault_hubclient, .fault.hubclient = gk104_fifo_fault_hubclient,
.fault.gpcclient = gk104_fifo_fault_gpcclient, .fault.gpcclient = gk104_fifo_fault_gpcclient,
.runlist = &gk104_fifo_runlist,
.chan = {{0,0,PASCAL_CHANNEL_GPFIFO_A}, gk104_fifo_gpfifo_new }, .chan = {{0,0,PASCAL_CHANNEL_GPFIFO_A}, gk104_fifo_gpfifo_new },
}; };
......
...@@ -31,6 +31,7 @@ gp10b_fifo = { ...@@ -31,6 +31,7 @@ gp10b_fifo = {
.fault.reason = gk104_fifo_fault_reason, .fault.reason = gk104_fifo_fault_reason,
.fault.hubclient = gk104_fifo_fault_hubclient, .fault.hubclient = gk104_fifo_fault_hubclient,
.fault.gpcclient = gk104_fifo_fault_gpcclient, .fault.gpcclient = gk104_fifo_fault_gpcclient,
.runlist = &gk104_fifo_runlist,
.chan = {{0,0,PASCAL_CHANNEL_GPFIFO_A}, gk104_fifo_gpfifo_new }, .chan = {{0,0,PASCAL_CHANNEL_GPFIFO_A}, gk104_fifo_gpfifo_new },
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment