From e51f75d5012e88c90b3a05b6706475d83cb7a6eb Mon Sep 17 00:00:00 2001 From: Ben Skeggs Date: Tue, 8 May 2018 20:39:46 +1000 Subject: [PATCH] drm/nouveau/gr/gf100-: virtualise tpc_per_gpc GM20B now also shares the same code, as NVGPU shows it doesn't need special treatment. Signed-off-by: Ben Skeggs --- .../gpu/drm/nouveau/nvkm/engine/gr/ctxgf100.c | 25 ++++++++----------- .../gpu/drm/nouveau/nvkm/engine/gr/ctxgf100.h | 1 - .../gpu/drm/nouveau/nvkm/engine/gr/ctxgf117.c | 1 - .../gpu/drm/nouveau/nvkm/engine/gr/ctxgk104.c | 1 - .../gpu/drm/nouveau/nvkm/engine/gr/ctxgk20a.c | 1 - .../gpu/drm/nouveau/nvkm/engine/gr/ctxgm107.c | 1 - .../gpu/drm/nouveau/nvkm/engine/gr/ctxgm200.c | 1 - .../gpu/drm/nouveau/nvkm/engine/gr/ctxgm20b.c | 15 ----------- .../gpu/drm/nouveau/nvkm/engine/gr/ctxgp100.c | 1 - 9 files changed, 10 insertions(+), 37 deletions(-) diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgf100.c b/drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgf100.c index 14e6bf07535a..a4865f7b9071 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgf100.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgf100.c @@ -1079,19 +1079,6 @@ gf100_grctx_generate_unkn(struct gf100_gr *gr) { } -void -gf100_grctx_generate_r406028(struct gf100_gr *gr) -{ - struct nvkm_device *device = gr->base.engine.subdev.device; - u32 tmp[GPC_MAX / 8] = {}, i = 0; - for (i = 0; i < gr->gpc_nr; i++) - tmp[i / 8] |= gr->tpc_nr[i] << ((i % 8) * 4); - for (i = 0; i < 4; i++) { - nvkm_wr32(device, 0x406028 + (i * 4), tmp[i]); - nvkm_wr32(device, 0x405870 + (i * 4), tmp[i]); - } -} - void gf100_grctx_generate_r4060a8(struct gf100_gr *gr) { @@ -1229,8 +1216,10 @@ gf100_grctx_generate_sm_id(struct gf100_gr *gr, int gpc, int tpc, int sm) void gf100_grctx_generate_floorsweep(struct gf100_gr *gr) { + struct nvkm_device *device = gr->base.engine.subdev.device; const struct gf100_grctx_func *func = gr->func->grctx; - int tpc, gpc, sm; + int tpc, gpc, sm, i, j; + u32 data; for (tpc = 0, sm = 0; tpc < gr->tpc_max; tpc++) { for (gpc = 0; gpc < gr->gpc_nr; gpc++) { @@ -1240,6 +1229,13 @@ gf100_grctx_generate_floorsweep(struct gf100_gr *gr) func->tpc_nr(gr, gpc); } } + + for (gpc = 0, i = 0; i < 4; i++) { + for (data = 0, j = 0; j < 8 && gpc < gr->gpc_nr; j++, gpc++) + data |= gr->tpc_nr[gpc] << (j * 4); + nvkm_wr32(device, 0x406028 + (i * 4), data); + nvkm_wr32(device, 0x405870 + (i * 4), data); + } } void @@ -1271,7 +1267,6 @@ gf100_grctx_generate_main(struct gf100_gr *gr, struct gf100_grctx *info) grctx->unkn(gr); gf100_grctx_generate_floorsweep(gr); - gf100_grctx_generate_r406028(gr); gf100_grctx_generate_r4060a8(gr); gf100_grctx_generate_r418bb8(gr); gf100_grctx_generate_r406800(gr); diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgf100.h b/drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgf100.h index 6fa9b629367b..b9e287985e67 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgf100.h +++ b/drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgf100.h @@ -63,7 +63,6 @@ void gf100_grctx_generate_pagepool(struct gf100_grctx *); void gf100_grctx_generate_attrib(struct gf100_grctx *); void gf100_grctx_generate_unkn(struct gf100_gr *); void gf100_grctx_generate_floorsweep(struct gf100_gr *); -void gf100_grctx_generate_r406028(struct gf100_gr *); void gf100_grctx_generate_r4060a8(struct gf100_gr *); void gf100_grctx_generate_r418bb8(struct gf100_gr *); void gf100_grctx_generate_r406800(struct gf100_gr *); diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgf117.c b/drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgf117.c index 806102a54a0c..a091485426b0 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgf117.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgf117.c @@ -241,7 +241,6 @@ gf117_grctx_generate_main(struct gf100_gr *gr, struct gf100_grctx *info) grctx->unkn(gr); gf100_grctx_generate_floorsweep(gr); - gf100_grctx_generate_r406028(gr); gf100_grctx_generate_r4060a8(gr); gk104_grctx_generate_r418bb8(gr); gf100_grctx_generate_r406800(gr); diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgk104.c b/drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgk104.c index 2be72fd58b1c..cb6c15686adb 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgk104.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgk104.c @@ -975,7 +975,6 @@ gk104_grctx_generate_main(struct gf100_gr *gr, struct gf100_grctx *info) grctx->unkn(gr); gf100_grctx_generate_floorsweep(gr); - gf100_grctx_generate_r406028(gr); gk104_grctx_generate_r418bb8(gr); gf100_grctx_generate_r406800(gr); diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgk20a.c b/drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgk20a.c index faa5f18a1da5..dda305116772 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgk20a.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgk20a.c @@ -43,7 +43,6 @@ gk20a_grctx_generate_main(struct gf100_gr *gr, struct gf100_grctx *info) grctx->unkn(gr); gf100_grctx_generate_floorsweep(gr); - gf100_grctx_generate_r406028(gr); gk104_grctx_generate_r418bb8(gr); gf100_grctx_generate_r406800(gr); diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgm107.c b/drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgm107.c index e5c0273e0374..77cce9bffd79 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgm107.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgm107.c @@ -961,7 +961,6 @@ gm107_grctx_generate_main(struct gf100_gr *gr, struct gf100_grctx *info) grctx->unkn(gr); gf100_grctx_generate_floorsweep(gr); - gf100_grctx_generate_r406028(gr); gk104_grctx_generate_r418bb8(gr); gf100_grctx_generate_r406800(gr); diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgm200.c b/drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgm200.c index be5e25ab4361..ac6724b61e50 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgm200.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgm200.c @@ -77,7 +77,6 @@ gm200_grctx_generate_main(struct gf100_gr *gr, struct gf100_grctx *info) grctx->unkn(gr); gf100_grctx_generate_floorsweep(gr); - gf100_grctx_generate_r406028(gr); gk104_grctx_generate_r418bb8(gr); for (i = 0; i < 8; i++) diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgm20b.c b/drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgm20b.c index 363d198dda60..6420d1391573 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgm20b.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgm20b.c @@ -21,20 +21,6 @@ */ #include "ctxgf100.h" -static void -gm20b_grctx_generate_r406028(struct gf100_gr *gr) -{ - struct nvkm_device *device = gr->base.engine.subdev.device; - u32 tpc_per_gpc = 0; - int i; - - for (i = 0; i < gr->gpc_nr; i++) - tpc_per_gpc |= gr->tpc_nr[i] << (4 * i); - - nvkm_wr32(device, 0x406028, tpc_per_gpc); - nvkm_wr32(device, 0x405870, tpc_per_gpc); -} - static void gm20b_grctx_generate_main(struct gf100_gr *gr, struct gf100_grctx *info) { @@ -54,7 +40,6 @@ gm20b_grctx_generate_main(struct gf100_gr *gr, struct gf100_grctx *info) grctx->unkn(gr); gf100_grctx_generate_floorsweep(gr); - gm20b_grctx_generate_r406028(gr); gk104_grctx_generate_r418bb8(gr); for (i = 0; i < 8; i++) diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgp100.c b/drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgp100.c index ac8618f849a5..701341d8b39c 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgp100.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgp100.c @@ -139,7 +139,6 @@ gp100_grctx_generate_main(struct gf100_gr *gr, struct gf100_grctx *info) grctx->unkn(gr); gf100_grctx_generate_floorsweep(gr); - gf100_grctx_generate_r406028(gr); gk104_grctx_generate_r418bb8(gr); for (i = 0; i < 8; i++) -- 2.30.2