From f37a302e67195af7d5a410901c5e8ddbbe895182 Mon Sep 17 00:00:00 2001 From: Ben Skeggs Date: Tue, 11 Dec 2018 14:50:02 +1000 Subject: [PATCH] drm/nouveau/fifo/gk104-: virtualise pbdma enable function Turing will require different code. Signed-off-by: Ben Skeggs --- drivers/gpu/drm/nouveau/nvkm/engine/fifo/gk104.c | 10 +++++++++- drivers/gpu/drm/nouveau/nvkm/engine/fifo/gk104.h | 2 ++ drivers/gpu/drm/nouveau/nvkm/engine/fifo/gk208.c | 1 + 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gk104.c b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gk104.c index 1a6bafbc53ca..79e0b58c5de7 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gk104.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gk104.c @@ -249,8 +249,16 @@ gk104_fifo_runlist = { .commit = gk104_fifo_runlist_commit, }; +void +gk104_fifo_pbdma_init(struct gk104_fifo *fifo) +{ + struct nvkm_device *device = fifo->base.engine.subdev.device; + nvkm_wr32(device, 0x000204, (1 << fifo->pbdma_nr) - 1); +} + const struct gk104_fifo_pbdma_func gk104_fifo_pbdma = { + .init = gk104_fifo_pbdma_init, }; static void @@ -991,7 +999,7 @@ gk104_fifo_init(struct nvkm_fifo *base) int i; /* Enable PBDMAs. */ - nvkm_wr32(device, 0x000204, (1 << fifo->pbdma_nr) - 1); + fifo->func->pbdma->init(fifo); /* PBDMA[n] */ for (i = 0; i < fifo->pbdma_nr; i++) { diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gk104.h b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gk104.h index c069183c20f8..61d7eee516af 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gk104.h +++ b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gk104.h @@ -46,6 +46,7 @@ struct gk104_fifo { struct gk104_fifo_func { const struct gk104_fifo_pbdma_func { + void (*init)(struct gk104_fifo *); void (*init_timeout)(struct gk104_fifo *); } *pbdma; @@ -88,6 +89,7 @@ void gk104_fifo_runlist_remove(struct gk104_fifo *, struct gk104_fifo_chan *); void gk104_fifo_runlist_update(struct gk104_fifo *, int runl); extern const struct gk104_fifo_pbdma_func gk104_fifo_pbdma; +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_engine[]; extern const struct nvkm_enum gk104_fifo_fault_reason[]; diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gk208.c b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gk208.c index c0c1606656df..45952292c436 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gk208.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gk208.c @@ -38,6 +38,7 @@ gk208_fifo_pbdma_init_timeout(struct gk104_fifo *fifo) const struct gk104_fifo_pbdma_func gk208_fifo_pbdma = { + .init = gk104_fifo_pbdma_init, .init_timeout = gk208_fifo_pbdma_init_timeout, }; -- 2.30.2