diff options
author | Xia Yang <xiay@nvidia.com> | 2015-12-07 16:37:08 -0800 |
---|---|---|
committer | Alexandre Courbot <acourbot@nvidia.com> | 2016-07-11 15:12:19 +0900 |
commit | f8c6331a85e5b2b58d2f76bed25737a32f625662 (patch) | |
tree | a0d2373350485851776e7e4201c0ff34b81f14f3 | |
parent | 75d0260076f77d74cedf3631d5a89185dd64a0e4 (diff) | |
download | nouveau-staging/fixes.tar.gz |
gr: rename gf100_gr_wait_idle for gk104_*staging/fixes
The status bit used in gf100_gr_wait_idle only exists starting gk104.
As the function is currently used in gk20a and later, rename the function
to use gk104 prefix to reflex correct supported chip version.
Signed-off-by: Xia Yang <xiay@nvidia.com>
Reviewed-by: Alexandre Courbot <acourbot@nvidia.com>
-rw-r--r-- | drm/nouveau/nvkm/engine/gr/ctxgk20a.c | 8 | ||||
-rw-r--r-- | drm/nouveau/nvkm/engine/gr/ctxgm20b.c | 8 | ||||
-rw-r--r-- | drm/nouveau/nvkm/engine/gr/gf100.c | 36 | ||||
-rw-r--r-- | drm/nouveau/nvkm/engine/gr/gf100.h | 3 | ||||
-rw-r--r-- | drm/nouveau/nvkm/engine/gr/gk104.c | 34 | ||||
-rw-r--r-- | drm/nouveau/nvkm/engine/gr/gk20a.c | 2 |
6 files changed, 46 insertions, 45 deletions
diff --git a/drm/nouveau/nvkm/engine/gr/ctxgk20a.c b/drm/nouveau/nvkm/engine/gr/ctxgk20a.c index da7c35a6a..6786ed3a3 100644 --- a/drm/nouveau/nvkm/engine/gr/ctxgk20a.c +++ b/drm/nouveau/nvkm/engine/gr/ctxgk20a.c @@ -34,7 +34,7 @@ gk20a_grctx_generate_main(struct gf100_gr *gr, struct gf100_grctx *info) gf100_gr_mmio(gr, gr->fuc_sw_ctx); - gf100_gr_wait_idle(gr); + gk104_gr_wait_idle(gr); idle_timeout = nvkm_mask(device, 0x404154, 0xffffffff, 0x00000000); @@ -54,13 +54,13 @@ gk20a_grctx_generate_main(struct gf100_gr *gr, struct gf100_grctx *info) nvkm_mask(device, 0x5044b0, 0x08000000, 0x08000000); - gf100_gr_wait_idle(gr); + gk104_gr_wait_idle(gr); nvkm_wr32(device, 0x404154, idle_timeout); - gf100_gr_wait_idle(gr); + gk104_gr_wait_idle(gr); gf100_gr_mthd(gr, gr->fuc_method); - gf100_gr_wait_idle(gr); + gk104_gr_wait_idle(gr); gf100_gr_icmd(gr, gr->fuc_bundle); grctx->pagepool(info); diff --git a/drm/nouveau/nvkm/engine/gr/ctxgm20b.c b/drm/nouveau/nvkm/engine/gr/ctxgm20b.c index e5702e3e0..4b22b6a2d 100644 --- a/drm/nouveau/nvkm/engine/gr/ctxgm20b.c +++ b/drm/nouveau/nvkm/engine/gr/ctxgm20b.c @@ -45,7 +45,7 @@ gm20b_grctx_generate_main(struct gf100_gr *gr, struct gf100_grctx *info) gf100_gr_mmio(gr, gr->fuc_sw_ctx); - gf100_gr_wait_idle(gr); + gk104_gr_wait_idle(gr); idle_timeout = nvkm_mask(device, 0x404154, 0xffffffff, 0x00000000); @@ -70,13 +70,13 @@ gm20b_grctx_generate_main(struct gf100_gr *gr, struct gf100_grctx *info) gm200_grctx_generate_405b60(gr); - gf100_gr_wait_idle(gr); + gk104_gr_wait_idle(gr); nvkm_wr32(device, 0x404154, idle_timeout); - gf100_gr_wait_idle(gr); + gk104_gr_wait_idle(gr); gf100_gr_mthd(gr, gr->fuc_method); - gf100_gr_wait_idle(gr); + gk104_gr_wait_idle(gr); gf100_gr_icmd(gr, gr->fuc_bundle); grctx->pagepool(info); diff --git a/drm/nouveau/nvkm/engine/gr/gf100.c b/drm/nouveau/nvkm/engine/gr/gf100.c index 157919c78..bb3345887 100644 --- a/drm/nouveau/nvkm/engine/gr/gf100.c +++ b/drm/nouveau/nvkm/engine/gr/gf100.c @@ -738,40 +738,6 @@ gf100_gr_zbc_init(struct gf100_gr *gr) gf100_gr_zbc_clear_depth(gr, index); } -/** - * Wait until GR goes idle. GR is considered idle if it is disabled by the - * MC (0x200) register, or GR is not busy and a context switch is not in - * progress. - */ -int -gf100_gr_wait_idle(struct gf100_gr *gr) -{ - struct nvkm_subdev *subdev = &gr->base.engine.subdev; - struct nvkm_device *device = subdev->device; - unsigned long end_jiffies = jiffies + msecs_to_jiffies(2000); - bool gr_enabled, ctxsw_active, gr_busy; - - do { - /* - * required to make sure FIFO_ENGINE_STATUS (0x2640) is - * up-to-date - */ - nvkm_rd32(device, 0x400700); - - gr_enabled = nvkm_rd32(device, 0x200) & 0x1000; - ctxsw_active = nvkm_rd32(device, 0x2640) & 0x8000; - gr_busy = nvkm_rd32(device, 0x40060c) & 0x1; - - if (!gr_enabled || (!gr_busy && !ctxsw_active)) - return 0; - } while (time_before(jiffies, end_jiffies)); - - nvkm_error(subdev, - "wait for idle timeout (en: %d, ctxsw: %d, busy: %d)\n", - gr_enabled, ctxsw_active, gr_busy); - return -EAGAIN; -} - void gf100_gr_mmio(struct gf100_gr *gr, const struct gf100_gr_pack *p) { @@ -815,7 +781,7 @@ gf100_gr_icmd(struct gf100_gr *gr, const struct gf100_gr_pack *p) * GO_IDLE bundle */ if ((addr & 0xffff) == 0xe100) - gf100_gr_wait_idle(gr); + gk104_gr_wait_idle(gr); nvkm_msec(device, 2000, if (!(nvkm_rd32(device, 0x400700) & 0x00000004)) break; diff --git a/drm/nouveau/nvkm/engine/gr/gf100.h b/drm/nouveau/nvkm/engine/gr/gf100.h index 268b8d60f..5347c5204 100644 --- a/drm/nouveau/nvkm/engine/gr/gf100.h +++ b/drm/nouveau/nvkm/engine/gr/gf100.h @@ -200,12 +200,13 @@ extern struct gf100_gr_ucode gf100_gr_gpccs_ucode; extern struct gf100_gr_ucode gk110_gr_fecs_ucode; extern struct gf100_gr_ucode gk110_gr_gpccs_ucode; -int gf100_gr_wait_idle(struct gf100_gr *); void gf100_gr_mmio(struct gf100_gr *, const struct gf100_gr_pack *); void gf100_gr_icmd(struct gf100_gr *, const struct gf100_gr_pack *); void gf100_gr_mthd(struct gf100_gr *, const struct gf100_gr_pack *); int gf100_gr_init_ctxctl(struct gf100_gr *); +int gk104_gr_wait_idle(struct gf100_gr *); + /* external bundles loading functions */ int gk20a_gr_av_to_init(struct gf100_gr *, const char *, struct gf100_gr_pack **); diff --git a/drm/nouveau/nvkm/engine/gr/gk104.c b/drm/nouveau/nvkm/engine/gr/gk104.c index ec22da6c9..94d263c29 100644 --- a/drm/nouveau/nvkm/engine/gr/gk104.c +++ b/drm/nouveau/nvkm/engine/gr/gk104.c @@ -203,6 +203,40 @@ gk104_gr_init_ppc_exceptions(struct gf100_gr *gr) } } +/** + * Wait until GR goes idle. GR is considered idle if it is disabled by the + * MC (0x200) register, or GR is not busy and a context switch is not in + * progress. + */ +int +gk104_gr_wait_idle(struct gf100_gr *gr) +{ + struct nvkm_subdev *subdev = &gr->base.engine.subdev; + struct nvkm_device *device = subdev->device; + unsigned long end_jiffies = jiffies + msecs_to_jiffies(2000); + bool gr_enabled, ctxsw_active, gr_busy; + + do { + /* + * required to make sure FIFO_ENGINE_STATUS (0x2640) is + * up-to-date + */ + nvkm_rd32(device, 0x400700); + + gr_enabled = nvkm_rd32(device, 0x200) & 0x1000; + ctxsw_active = nvkm_rd32(device, 0x2640) & 0x8000; + gr_busy = nvkm_rd32(device, 0x40060c) & 0x1; + + if (!gr_enabled || (!gr_busy && !ctxsw_active)) + return 0; + } while (time_before(jiffies, end_jiffies)); + + nvkm_error(subdev, + "wait for idle timeout (en: %d, ctxsw: %d, busy: %d)\n", + gr_enabled, ctxsw_active, gr_busy); + return -EAGAIN; +} + int gk104_gr_init(struct gf100_gr *gr) { diff --git a/drm/nouveau/nvkm/engine/gr/gk20a.c b/drm/nouveau/nvkm/engine/gr/gk20a.c index de8b806b8..4aad414f7 100644 --- a/drm/nouveau/nvkm/engine/gr/gk20a.c +++ b/drm/nouveau/nvkm/engine/gr/gk20a.c @@ -234,7 +234,7 @@ gk20a_gr_init(struct gf100_gr *gr) if (ret) return ret; - ret = gf100_gr_wait_idle(gr); + ret = gk104_gr_wait_idle(gr); if (ret) return ret; |