diff --git a/drivers/gpu/drm/nouveau/include/nvkm/engine/gr.h b/drivers/gpu/drm/nouveau/include/nvkm/engine/gr.h index 87cc7370a216f888b1f4d0fe2fc2bc2b29ada125..1e924c7f7ba7318ad0c81498012b937dba678f86 100644 --- a/drivers/gpu/drm/nouveau/include/nvkm/engine/gr.h +++ b/drivers/gpu/drm/nouveau/include/nvkm/engine/gr.h @@ -12,6 +12,7 @@ u64 nvkm_gr_units(struct nvkm_gr *); int nvkm_gr_tlb_flush(struct nvkm_gr *); int nvkm_gr_ctxsw_pause(struct nvkm_device *); int nvkm_gr_ctxsw_resume(struct nvkm_device *); +u32 nvkm_gr_ctxsw_inst(struct nvkm_device *); int nv04_gr_new(struct nvkm_device *, int, struct nvkm_gr **); int nv10_gr_new(struct nvkm_device *, int, struct nvkm_gr **); diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/gr/base.c b/drivers/gpu/drm/nouveau/nvkm/engine/gr/base.c index 53f62827260b35f8007ecb6f9ac5c27e7fe9b62c..d41fb94524e948072b9048d4a432cecfbe34ed65 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/gr/base.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/gr/base.c @@ -25,6 +25,15 @@ #include +u32 +nvkm_gr_ctxsw_inst(struct nvkm_device *device) +{ + struct nvkm_gr *gr = device->gr; + if (gr && gr->func->ctxsw.inst) + return gr->func->ctxsw.inst(gr); + return 0; +} + int nvkm_gr_ctxsw_resume(struct nvkm_device *device) { diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/gr/gf100.c b/drivers/gpu/drm/nouveau/nvkm/engine/gr/gf100.c index 63802edf89d464bab36c4cce4293d4345302c953..81a13cf9a292fef896270d56e9d0eddcce127462 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/gr/gf100.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/gr/gf100.c @@ -715,6 +715,12 @@ gf100_gr_pack_mmio[] = { * PGRAPH engine/subdev functions ******************************************************************************/ +static u32 +gf100_gr_ctxsw_inst(struct nvkm_gr *gr) +{ + return nvkm_rd32(gr->engine.subdev.device, 0x409b00); +} + static int gf100_gr_fecs_ctrl_ctxsw(struct gf100_gr *gr, u32 mthd) { @@ -2058,6 +2064,7 @@ gf100_gr_ = { .chsw_load = gf100_gr_chsw_load, .ctxsw.pause = gf100_gr_fecs_stop_ctxsw, .ctxsw.resume = gf100_gr_fecs_start_ctxsw, + .ctxsw.inst = gf100_gr_ctxsw_inst, }; int diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/gr/priv.h b/drivers/gpu/drm/nouveau/nvkm/engine/gr/priv.h index b8023a6b77a181a09c568dfebe5b2d73539c4c9b..d4d5601c51e7576d8acfae8d903e3cbb45b16bc0 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/gr/priv.h +++ b/drivers/gpu/drm/nouveau/nvkm/engine/gr/priv.h @@ -30,6 +30,7 @@ struct nvkm_gr_func { struct { int (*pause)(struct nvkm_gr *); int (*resume)(struct nvkm_gr *); + u32 (*inst)(struct nvkm_gr *); } ctxsw; struct nvkm_sclass sclass[]; };