Commit f7cc47e4 authored by Ben Skeggs's avatar Ben Skeggs

drm/nouveau/fifo/gm200-: read pbdma count more directly

The trick we used (and still use for older GPUs) doesn't work on Turing.
Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent f37a302e
...@@ -256,8 +256,18 @@ gk104_fifo_pbdma_init(struct gk104_fifo *fifo) ...@@ -256,8 +256,18 @@ gk104_fifo_pbdma_init(struct gk104_fifo *fifo)
nvkm_wr32(device, 0x000204, (1 << fifo->pbdma_nr) - 1); nvkm_wr32(device, 0x000204, (1 << fifo->pbdma_nr) - 1);
} }
int
gk104_fifo_pbdma_nr(struct gk104_fifo *fifo)
{
struct nvkm_device *device = fifo->base.engine.subdev.device;
/* Determine number of PBDMAs by checking valid enable bits. */
nvkm_wr32(device, 0x000204, 0xffffffff);
return hweight32(nvkm_rd32(device, 0x000204));
}
const struct gk104_fifo_pbdma_func const struct gk104_fifo_pbdma_func
gk104_fifo_pbdma = { gk104_fifo_pbdma = {
.nr = gk104_fifo_pbdma_nr,
.init = gk104_fifo_pbdma_init, .init = gk104_fifo_pbdma_init,
}; };
...@@ -925,9 +935,7 @@ gk104_fifo_oneinit(struct nvkm_fifo *base) ...@@ -925,9 +935,7 @@ gk104_fifo_oneinit(struct nvkm_fifo *base)
enum nvkm_devidx engidx; enum nvkm_devidx engidx;
u32 *map; u32 *map;
/* Determine number of PBDMAs by checking valid enable bits. */ fifo->pbdma_nr = fifo->func->pbdma->nr(fifo);
nvkm_wr32(device, 0x000204, 0xffffffff);
fifo->pbdma_nr = hweight32(nvkm_rd32(device, 0x000204));
nvkm_debug(subdev, "%d PBDMA(s)\n", fifo->pbdma_nr); nvkm_debug(subdev, "%d PBDMA(s)\n", fifo->pbdma_nr);
/* Read PBDMA->runlist(s) mapping from HW. */ /* Read PBDMA->runlist(s) mapping from HW. */
......
...@@ -46,6 +46,7 @@ struct gk104_fifo { ...@@ -46,6 +46,7 @@ struct gk104_fifo {
struct gk104_fifo_func { struct gk104_fifo_func {
const struct gk104_fifo_pbdma_func { const struct gk104_fifo_pbdma_func {
int (*nr)(struct gk104_fifo *);
void (*init)(struct gk104_fifo *); void (*init)(struct gk104_fifo *);
void (*init_timeout)(struct gk104_fifo *); void (*init_timeout)(struct gk104_fifo *);
} *pbdma; } *pbdma;
...@@ -89,6 +90,7 @@ void gk104_fifo_runlist_remove(struct gk104_fifo *, struct gk104_fifo_chan *); ...@@ -89,6 +90,7 @@ 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);
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 *);
void gk104_fifo_pbdma_init(struct gk104_fifo *); void gk104_fifo_pbdma_init(struct gk104_fifo *);
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[];
...@@ -111,5 +113,8 @@ void gk208_fifo_pbdma_init_timeout(struct gk104_fifo *); ...@@ -111,5 +113,8 @@ void gk208_fifo_pbdma_init_timeout(struct gk104_fifo *);
extern const struct nvkm_enum gm107_fifo_fault_engine[]; extern const struct nvkm_enum gm107_fifo_fault_engine[];
extern const struct gk104_fifo_runlist_func gm107_fifo_runlist; extern const struct gk104_fifo_runlist_func gm107_fifo_runlist;
extern const struct gk104_fifo_pbdma_func gm200_fifo_pbdma;
int gm200_fifo_pbdma_nr(struct gk104_fifo *);
extern const struct nvkm_enum gp100_fifo_fault_engine[]; extern const struct nvkm_enum gp100_fifo_fault_engine[];
#endif #endif
...@@ -38,6 +38,7 @@ gk208_fifo_pbdma_init_timeout(struct gk104_fifo *fifo) ...@@ -38,6 +38,7 @@ gk208_fifo_pbdma_init_timeout(struct gk104_fifo *fifo)
const struct gk104_fifo_pbdma_func const struct gk104_fifo_pbdma_func
gk208_fifo_pbdma = { gk208_fifo_pbdma = {
.nr = gk104_fifo_pbdma_nr,
.init = gk104_fifo_pbdma_init, .init = gk104_fifo_pbdma_init,
.init_timeout = gk208_fifo_pbdma_init_timeout, .init_timeout = gk208_fifo_pbdma_init_timeout,
}; };
......
...@@ -26,9 +26,23 @@ ...@@ -26,9 +26,23 @@
#include <nvif/class.h> #include <nvif/class.h>
int
gm200_fifo_pbdma_nr(struct gk104_fifo *fifo)
{
struct nvkm_device *device = fifo->base.engine.subdev.device;
return nvkm_rd32(device, 0x002004) & 0x000000ff;
}
const struct gk104_fifo_pbdma_func
gm200_fifo_pbdma = {
.nr = gm200_fifo_pbdma_nr,
.init = gk104_fifo_pbdma_init,
.init_timeout = gk208_fifo_pbdma_init_timeout,
};
static const struct gk104_fifo_func static const struct gk104_fifo_func
gm200_fifo = { gm200_fifo = {
.pbdma = &gk208_fifo_pbdma, .pbdma = &gm200_fifo_pbdma,
.fault.access = gk104_fifo_fault_access, .fault.access = gk104_fifo_fault_access,
.fault.engine = gm107_fifo_fault_engine, .fault.engine = gm107_fifo_fault_engine,
.fault.reason = gk104_fifo_fault_reason, .fault.reason = gk104_fifo_fault_reason,
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
static const struct gk104_fifo_func static const struct gk104_fifo_func
gm20b_fifo = { gm20b_fifo = {
.pbdma = &gk208_fifo_pbdma, .pbdma = &gm200_fifo_pbdma,
.fault.access = gk104_fifo_fault_access, .fault.access = gk104_fifo_fault_access,
.fault.engine = gm107_fifo_fault_engine, .fault.engine = gm107_fifo_fault_engine,
.fault.reason = gk104_fifo_fault_reason, .fault.reason = gk104_fifo_fault_reason,
......
...@@ -52,7 +52,7 @@ gp100_fifo_fault_engine[] = { ...@@ -52,7 +52,7 @@ gp100_fifo_fault_engine[] = {
static const struct gk104_fifo_func static const struct gk104_fifo_func
gp100_fifo = { gp100_fifo = {
.pbdma = &gk208_fifo_pbdma, .pbdma = &gm200_fifo_pbdma,
.fault.access = gk104_fifo_fault_access, .fault.access = gk104_fifo_fault_access,
.fault.engine = gp100_fifo_fault_engine, .fault.engine = gp100_fifo_fault_engine,
.fault.reason = gk104_fifo_fault_reason, .fault.reason = gk104_fifo_fault_reason,
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
static const struct gk104_fifo_func static const struct gk104_fifo_func
gp10b_fifo = { gp10b_fifo = {
.pbdma = &gk208_fifo_pbdma, .pbdma = &gm200_fifo_pbdma,
.fault.access = gk104_fifo_fault_access, .fault.access = gk104_fifo_fault_access,
.fault.engine = gp100_fifo_fault_engine, .fault.engine = gp100_fifo_fault_engine,
.fault.reason = gk104_fifo_fault_reason, .fault.reason = gk104_fifo_fault_reason,
......
...@@ -288,7 +288,7 @@ gv100_fifo_fault_access[] = { ...@@ -288,7 +288,7 @@ gv100_fifo_fault_access[] = {
static const struct gk104_fifo_func static const struct gk104_fifo_func
gv100_fifo = { gv100_fifo = {
.pbdma = &gk208_fifo_pbdma, .pbdma = &gm200_fifo_pbdma,
.fault.access = gv100_fifo_fault_access, .fault.access = gv100_fifo_fault_access,
.fault.engine = gv100_fifo_fault_engine, .fault.engine = gv100_fifo_fault_engine,
.fault.reason = gv100_fifo_fault_reason, .fault.reason = gv100_fifo_fault_reason,
......
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