Commit b8ab4b45 authored by Alistair Popple's avatar Alistair Popple Committed by Ben Skeggs

drm/nouveau/fifo/tu102: Move Turing specific FIFO functions

Turing requires some changes to FIFO interrupt handling due to changes
in HW register layout. It also requires some changes to implement robust
channel (RC) recovery. This preparatory patch moves the functions
requiring changes into nvkm/engine/fifo/tu102.c so they can be altered
without affecting gk104 and other users. It should not introduce any
functional changes.
Signed-off-by: default avatarAlistair Popple <apopple@nvidia.com>
Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent c81a51f0
...@@ -36,19 +36,7 @@ ...@@ -36,19 +36,7 @@
#include <nvif/class.h> #include <nvif/class.h>
#include <nvif/cl0080.h> #include <nvif/cl0080.h>
struct gk104_fifo_engine_status { void
bool busy;
bool faulted;
bool chsw;
bool save;
bool load;
struct {
bool tsg;
u32 id;
} prev, next, *chan;
};
static void
gk104_fifo_engine_status(struct gk104_fifo *fifo, int engn, gk104_fifo_engine_status(struct gk104_fifo *fifo, int engn,
struct gk104_fifo_engine_status *status) struct gk104_fifo_engine_status *status)
{ {
...@@ -95,7 +83,7 @@ gk104_fifo_engine_status(struct gk104_fifo *fifo, int engn, ...@@ -95,7 +83,7 @@ gk104_fifo_engine_status(struct gk104_fifo *fifo, int engn,
status->chan == &status->next ? "*" : " "); status->chan == &status->next ? "*" : " ");
} }
static int int
gk104_fifo_class_new(struct nvkm_fifo *base, const struct nvkm_oclass *oclass, gk104_fifo_class_new(struct nvkm_fifo *base, const struct nvkm_oclass *oclass,
void *argv, u32 argc, struct nvkm_object **pobject) void *argv, u32 argc, struct nvkm_object **pobject)
{ {
...@@ -112,7 +100,7 @@ gk104_fifo_class_new(struct nvkm_fifo *base, const struct nvkm_oclass *oclass, ...@@ -112,7 +100,7 @@ gk104_fifo_class_new(struct nvkm_fifo *base, const struct nvkm_oclass *oclass,
return -EINVAL; return -EINVAL;
} }
static int int
gk104_fifo_class_get(struct nvkm_fifo *base, int index, gk104_fifo_class_get(struct nvkm_fifo *base, int index,
struct nvkm_oclass *oclass) struct nvkm_oclass *oclass)
{ {
...@@ -134,14 +122,14 @@ gk104_fifo_class_get(struct nvkm_fifo *base, int index, ...@@ -134,14 +122,14 @@ gk104_fifo_class_get(struct nvkm_fifo *base, int index,
return c; return c;
} }
static void void
gk104_fifo_uevent_fini(struct nvkm_fifo *fifo) gk104_fifo_uevent_fini(struct nvkm_fifo *fifo)
{ {
struct nvkm_device *device = fifo->engine.subdev.device; struct nvkm_device *device = fifo->engine.subdev.device;
nvkm_mask(device, 0x002140, 0x80000000, 0x00000000); nvkm_mask(device, 0x002140, 0x80000000, 0x00000000);
} }
static void void
gk104_fifo_uevent_init(struct nvkm_fifo *fifo) gk104_fifo_uevent_init(struct nvkm_fifo *fifo)
{ {
struct nvkm_device *device = fifo->engine.subdev.device; struct nvkm_device *device = fifo->engine.subdev.device;
...@@ -556,7 +544,7 @@ gk104_fifo_bind_reason[] = { ...@@ -556,7 +544,7 @@ gk104_fifo_bind_reason[] = {
{} {}
}; };
static void void
gk104_fifo_intr_bind(struct gk104_fifo *fifo) gk104_fifo_intr_bind(struct gk104_fifo *fifo)
{ {
struct nvkm_subdev *subdev = &fifo->base.engine.subdev; struct nvkm_subdev *subdev = &fifo->base.engine.subdev;
...@@ -627,7 +615,7 @@ gk104_fifo_intr_sched(struct gk104_fifo *fifo) ...@@ -627,7 +615,7 @@ gk104_fifo_intr_sched(struct gk104_fifo *fifo)
} }
} }
static void void
gk104_fifo_intr_chsw(struct gk104_fifo *fifo) gk104_fifo_intr_chsw(struct gk104_fifo *fifo)
{ {
struct nvkm_subdev *subdev = &fifo->base.engine.subdev; struct nvkm_subdev *subdev = &fifo->base.engine.subdev;
...@@ -637,7 +625,7 @@ gk104_fifo_intr_chsw(struct gk104_fifo *fifo) ...@@ -637,7 +625,7 @@ gk104_fifo_intr_chsw(struct gk104_fifo *fifo)
nvkm_wr32(device, 0x00256c, stat); nvkm_wr32(device, 0x00256c, stat);
} }
static void void
gk104_fifo_intr_dropped_fault(struct gk104_fifo *fifo) gk104_fifo_intr_dropped_fault(struct gk104_fifo *fifo)
{ {
struct nvkm_subdev *subdev = &fifo->base.engine.subdev; struct nvkm_subdev *subdev = &fifo->base.engine.subdev;
...@@ -680,7 +668,7 @@ static const struct nvkm_bitfield gk104_fifo_pbdma_intr_0[] = { ...@@ -680,7 +668,7 @@ static const struct nvkm_bitfield gk104_fifo_pbdma_intr_0[] = {
{} {}
}; };
static void void
gk104_fifo_intr_pbdma_0(struct gk104_fifo *fifo, int unit) gk104_fifo_intr_pbdma_0(struct gk104_fifo *fifo, int unit)
{ {
struct nvkm_subdev *subdev = &fifo->base.engine.subdev; struct nvkm_subdev *subdev = &fifo->base.engine.subdev;
...@@ -729,7 +717,7 @@ static const struct nvkm_bitfield gk104_fifo_pbdma_intr_1[] = { ...@@ -729,7 +717,7 @@ static const struct nvkm_bitfield gk104_fifo_pbdma_intr_1[] = {
{} {}
}; };
static void void
gk104_fifo_intr_pbdma_1(struct gk104_fifo *fifo, int unit) gk104_fifo_intr_pbdma_1(struct gk104_fifo *fifo, int unit)
{ {
struct nvkm_subdev *subdev = &fifo->base.engine.subdev; struct nvkm_subdev *subdev = &fifo->base.engine.subdev;
...@@ -750,7 +738,7 @@ gk104_fifo_intr_pbdma_1(struct gk104_fifo *fifo, int unit) ...@@ -750,7 +738,7 @@ gk104_fifo_intr_pbdma_1(struct gk104_fifo *fifo, int unit)
nvkm_wr32(device, 0x040148 + (unit * 0x2000), stat); nvkm_wr32(device, 0x040148 + (unit * 0x2000), stat);
} }
static void void
gk104_fifo_intr_runlist(struct gk104_fifo *fifo) gk104_fifo_intr_runlist(struct gk104_fifo *fifo)
{ {
struct nvkm_device *device = fifo->base.engine.subdev.device; struct nvkm_device *device = fifo->base.engine.subdev.device;
...@@ -763,7 +751,7 @@ gk104_fifo_intr_runlist(struct gk104_fifo *fifo) ...@@ -763,7 +751,7 @@ gk104_fifo_intr_runlist(struct gk104_fifo *fifo)
} }
} }
static void void
gk104_fifo_intr_engine(struct gk104_fifo *fifo) gk104_fifo_intr_engine(struct gk104_fifo *fifo)
{ {
nvkm_fifo_uevent(&fifo->base); nvkm_fifo_uevent(&fifo->base);
...@@ -861,7 +849,7 @@ gk104_fifo_intr(struct nvkm_fifo *base) ...@@ -861,7 +849,7 @@ gk104_fifo_intr(struct nvkm_fifo *base)
} }
} }
static void void
gk104_fifo_fini(struct nvkm_fifo *base) gk104_fifo_fini(struct nvkm_fifo *base)
{ {
struct gk104_fifo *fifo = gk104_fifo(base); struct gk104_fifo *fifo = gk104_fifo(base);
...@@ -871,7 +859,7 @@ gk104_fifo_fini(struct nvkm_fifo *base) ...@@ -871,7 +859,7 @@ gk104_fifo_fini(struct nvkm_fifo *base)
nvkm_mask(device, 0x002140, 0x10000000, 0x10000000); nvkm_mask(device, 0x002140, 0x10000000, 0x10000000);
} }
static int int
gk104_fifo_info(struct nvkm_fifo *base, u64 mthd, u64 *data) gk104_fifo_info(struct nvkm_fifo *base, u64 mthd, u64 *data)
{ {
struct gk104_fifo *fifo = gk104_fifo(base); struct gk104_fifo *fifo = gk104_fifo(base);
...@@ -899,7 +887,7 @@ gk104_fifo_info(struct nvkm_fifo *base, u64 mthd, u64 *data) ...@@ -899,7 +887,7 @@ gk104_fifo_info(struct nvkm_fifo *base, u64 mthd, u64 *data)
} }
} }
static int int
gk104_fifo_oneinit(struct nvkm_fifo *base) gk104_fifo_oneinit(struct nvkm_fifo *base)
{ {
struct gk104_fifo *fifo = gk104_fifo(base); struct gk104_fifo *fifo = gk104_fifo(base);
...@@ -974,7 +962,7 @@ gk104_fifo_oneinit(struct nvkm_fifo *base) ...@@ -974,7 +962,7 @@ gk104_fifo_oneinit(struct nvkm_fifo *base)
return nvkm_memory_map(fifo->user.mem, 0, bar, fifo->user.bar, NULL, 0); return nvkm_memory_map(fifo->user.mem, 0, bar, fifo->user.bar, NULL, 0);
} }
static void void
gk104_fifo_init(struct nvkm_fifo *base) gk104_fifo_init(struct nvkm_fifo *base)
{ {
struct gk104_fifo *fifo = gk104_fifo(base); struct gk104_fifo *fifo = gk104_fifo(base);
...@@ -1006,7 +994,7 @@ gk104_fifo_init(struct nvkm_fifo *base) ...@@ -1006,7 +994,7 @@ gk104_fifo_init(struct nvkm_fifo *base)
nvkm_wr32(device, 0x002140, 0x7fffffff); nvkm_wr32(device, 0x002140, 0x7fffffff);
} }
static void * void *
gk104_fifo_dtor(struct nvkm_fifo *base) gk104_fifo_dtor(struct nvkm_fifo *base)
{ {
struct gk104_fifo *fifo = gk104_fifo(base); struct gk104_fifo *fifo = gk104_fifo(base);
......
...@@ -87,11 +87,43 @@ struct gk104_fifo_func { ...@@ -87,11 +87,43 @@ struct gk104_fifo_func {
bool cgrp_force; bool cgrp_force;
}; };
struct gk104_fifo_engine_status {
bool busy;
bool faulted;
bool chsw;
bool save;
bool load;
struct {
bool tsg;
u32 id;
} prev, next, *chan;
};
int gk104_fifo_new_(const struct gk104_fifo_func *, struct nvkm_device *, int gk104_fifo_new_(const struct gk104_fifo_func *, struct nvkm_device *,
int index, int nr, struct nvkm_fifo **); int index, int nr, struct nvkm_fifo **);
void gk104_fifo_runlist_insert(struct gk104_fifo *, struct gk104_fifo_chan *); void gk104_fifo_runlist_insert(struct gk104_fifo *, struct gk104_fifo_chan *);
void gk104_fifo_runlist_remove(struct gk104_fifo *, struct gk104_fifo_chan *); void gk104_fifo_runlist_remove(struct gk104_fifo *, struct gk104_fifo_chan *);
void gk104_fifo_runlist_update(struct gk104_fifo *, int runl); void gk104_fifo_runlist_update(struct gk104_fifo *, int runl);
void gk104_fifo_engine_status(struct gk104_fifo *fifo, int engn,
struct gk104_fifo_engine_status *status);
void gk104_fifo_intr_bind(struct gk104_fifo *fifo);
void gk104_fifo_intr_chsw(struct gk104_fifo *fifo);
void gk104_fifo_intr_dropped_fault(struct gk104_fifo *fifo);
void gk104_fifo_intr_pbdma_0(struct gk104_fifo *fifo, int unit);
void gk104_fifo_intr_pbdma_1(struct gk104_fifo *fifo, int unit);
void gk104_fifo_intr_runlist(struct gk104_fifo *fifo);
void gk104_fifo_intr_engine(struct gk104_fifo *fifo);
void *gk104_fifo_dtor(struct nvkm_fifo *base);
int gk104_fifo_oneinit(struct nvkm_fifo *base);
int gk104_fifo_info(struct nvkm_fifo *base, u64 mthd, u64 *data);
void gk104_fifo_init(struct nvkm_fifo *base);
void gk104_fifo_fini(struct nvkm_fifo *base);
int gk104_fifo_class_new(struct nvkm_fifo *base, const struct nvkm_oclass *oclass,
void *argv, u32 argc, struct nvkm_object **pobject);
int gk104_fifo_class_get(struct nvkm_fifo *base, int index,
struct nvkm_oclass *oclass);
void gk104_fifo_uevent_fini(struct nvkm_fifo *fifo);
void gk104_fifo_uevent_init(struct nvkm_fifo *fifo);
extern const struct gk104_fifo_pbdma_func gk104_fifo_pbdma; extern const struct gk104_fifo_pbdma_func gk104_fifo_pbdma;
int gk104_fifo_pbdma_nr(struct gk104_fifo *); int gk104_fifo_pbdma_nr(struct gk104_fifo *);
......
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