Samuel Pitoiset
2015-Jun-19 15:37 UTC
[Nouveau] [PATCH 1/2] pm/gk104: re-use gf100_pm_ctor()
gk104_pm_ctor() is equal to gf100_pm_ctor(). Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com> --- drm/nouveau/include/nvkm/engine/pm.h | 2 +- drm/nouveau/nvkm/engine/device/gk104.c | 8 ++--- drm/nouveau/nvkm/engine/pm/gk104.c | 60 +++++----------------------------- 3 files changed, 14 insertions(+), 56 deletions(-) diff --git a/drm/nouveau/include/nvkm/engine/pm.h b/drm/nouveau/include/nvkm/engine/pm.h index ed36daf..c4c704b 100644 --- a/drm/nouveau/include/nvkm/engine/pm.h +++ b/drm/nouveau/include/nvkm/engine/pm.h @@ -29,6 +29,6 @@ extern struct nvkm_oclass *gt215_pm_oclass; extern struct nvkm_oclass *gf100_pm_oclass; extern struct nvkm_oclass *gf108_pm_oclass; extern struct nvkm_oclass *gf117_pm_oclass; -extern struct nvkm_oclass gk104_pm_oclass; +extern struct nvkm_oclass *gk104_pm_oclass; extern struct nvkm_oclass gk110_pm_oclass; #endif diff --git a/drm/nouveau/nvkm/engine/device/gk104.c b/drm/nouveau/nvkm/engine/device/gk104.c index 6a9483f..2b1fce2 100644 --- a/drm/nouveau/nvkm/engine/device/gk104.c +++ b/drm/nouveau/nvkm/engine/device/gk104.c @@ -91,7 +91,7 @@ gk104_identify(struct nvkm_device *device) device->oclass[NVDEV_ENGINE_MSVLD ] = &gk104_msvld_oclass; device->oclass[NVDEV_ENGINE_MSPDEC ] = &gk104_mspdec_oclass; device->oclass[NVDEV_ENGINE_MSPPP ] = &gf100_msppp_oclass; - device->oclass[NVDEV_ENGINE_PM ] = &gk104_pm_oclass; + device->oclass[NVDEV_ENGINE_PM ] = gk104_pm_oclass; break; case 0xe7: device->cname = "GK107"; @@ -125,7 +125,7 @@ gk104_identify(struct nvkm_device *device) device->oclass[NVDEV_ENGINE_MSVLD ] = &gk104_msvld_oclass; device->oclass[NVDEV_ENGINE_MSPDEC ] = &gk104_mspdec_oclass; device->oclass[NVDEV_ENGINE_MSPPP ] = &gf100_msppp_oclass; - device->oclass[NVDEV_ENGINE_PM ] = &gk104_pm_oclass; + device->oclass[NVDEV_ENGINE_PM ] = gk104_pm_oclass; break; case 0xe6: device->cname = "GK106"; @@ -159,7 +159,7 @@ gk104_identify(struct nvkm_device *device) device->oclass[NVDEV_ENGINE_MSVLD ] = &gk104_msvld_oclass; device->oclass[NVDEV_ENGINE_MSPDEC ] = &gk104_mspdec_oclass; device->oclass[NVDEV_ENGINE_MSPPP ] = &gf100_msppp_oclass; - device->oclass[NVDEV_ENGINE_PM ] = &gk104_pm_oclass; + device->oclass[NVDEV_ENGINE_PM ] = gk104_pm_oclass; break; case 0xea: device->cname = "GK20A"; @@ -179,7 +179,7 @@ gk104_identify(struct nvkm_device *device) device->oclass[NVDEV_ENGINE_SW ] = gf100_sw_oclass; device->oclass[NVDEV_ENGINE_GR ] = gk20a_gr_oclass; device->oclass[NVDEV_ENGINE_CE2 ] = &gk104_ce2_oclass; - device->oclass[NVDEV_ENGINE_PM ] = &gk104_pm_oclass; + device->oclass[NVDEV_ENGINE_PM ] = gk104_pm_oclass; device->oclass[NVDEV_SUBDEV_VOLT ] = &gk20a_volt_oclass; device->oclass[NVDEV_SUBDEV_PMU ] = gk20a_pmu_oclass; break; diff --git a/drm/nouveau/nvkm/engine/pm/gk104.c b/drm/nouveau/nvkm/engine/pm/gk104.c index 3565f29..7462dff 100644 --- a/drm/nouveau/nvkm/engine/pm/gk104.c +++ b/drm/nouveau/nvkm/engine/pm/gk104.c @@ -85,58 +85,16 @@ gk104_pm_part[] = { {} }; -static int -gk104_pm_ctor(struct nvkm_object *parent, struct nvkm_object *engine, - struct nvkm_oclass *oclass, void *data, u32 size, - struct nvkm_object **pobject) -{ - struct gf100_pm_priv *priv; - u32 mask; - int ret; - - ret = nvkm_pm_create(parent, engine, oclass, &priv); - *pobject = nv_object(priv); - if (ret) - return ret; - - /* HUB */ - ret = nvkm_perfdom_new(&priv->base, "hub", 0, 0x1b0000, 0, 0x200, - gk104_pm_hub); - if (ret) - return ret; - - /* GPC */ - mask = (1 << nv_rd32(priv, 0x022430)) - 1; - mask &= ~nv_rd32(priv, 0x022504); - mask &= ~nv_rd32(priv, 0x022584); - - ret = nvkm_perfdom_new(&priv->base, "gpc", mask, 0x180000, - 0x1000, 0x200, gk104_pm_gpc); - if (ret) - return ret; - - /* PART */ - mask = (1 << nv_rd32(priv, 0x022438)) - 1; - mask &= ~nv_rd32(priv, 0x022548); - mask &= ~nv_rd32(priv, 0x0225c8); - - ret = nvkm_perfdom_new(&priv->base, "part", mask, 0x1a0000, - 0x1000, 0x200, gk104_pm_part); - if (ret) - return ret; - - nv_engine(priv)->cclass = &nvkm_pm_cclass; - nv_engine(priv)->sclass = nvkm_pm_sclass; - return 0; -} - -struct nvkm_oclass -gk104_pm_oclass = { - .handle = NV_ENGINE(PM, 0xe0), - .ofuncs = &(struct nvkm_ofuncs) { - .ctor = gk104_pm_ctor, +struct nvkm_oclass * +gk104_pm_oclass = &(struct gf100_pm_oclass) { + .base.handle = NV_ENGINE(PM, 0xe0), + .base.ofuncs = &(struct nvkm_ofuncs) { + .ctor = gf100_pm_ctor, .dtor = _nvkm_pm_dtor, .init = _nvkm_pm_init, .fini = gf100_pm_fini, }, -}; + .doms_gpc = gk104_pm_gpc, + .doms_hub = gk104_pm_hub, + .doms_part = gk104_pm_part, +}.base; -- 2.4.3
Samuel Pitoiset
2015-Jun-19 15:37 UTC
[Nouveau] [PATCH 2/2] pm/gk104: add compute signals/sources
These signals and sources have been reverse engineered from CUPTI (Linux). Graphics signals exposed by PerfKit (Windows only) will be added later. I need to reverse engineer them and it's a bit painful. Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com> --- drm/nouveau/nvkm/engine/pm/gf100.h | 1 + drm/nouveau/nvkm/engine/pm/gf117.c | 8 +++- drm/nouveau/nvkm/engine/pm/gk104.c | 85 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 93 insertions(+), 1 deletion(-) diff --git a/drm/nouveau/nvkm/engine/pm/gf100.h b/drm/nouveau/nvkm/engine/pm/gf100.h index 40ced89..d73f0ca 100644 --- a/drm/nouveau/nvkm/engine/pm/gf100.h +++ b/drm/nouveau/nvkm/engine/pm/gf100.h @@ -27,5 +27,6 @@ int gf100_pm_fini(struct nvkm_object *, bool); extern const struct nvkm_specdom gf100_pm_gpc[]; extern const struct nvkm_specsrc gf100_pmfb_sources[]; +extern const struct nvkm_specsrc gf117_pbfb_sources[]; #endif diff --git a/drm/nouveau/nvkm/engine/pm/gf117.c b/drm/nouveau/nvkm/engine/pm/gf117.c index 911ff3f..01d3a48 100644 --- a/drm/nouveau/nvkm/engine/pm/gf117.c +++ b/drm/nouveau/nvkm/engine/pm/gf117.c @@ -39,7 +39,7 @@ gf117_pmfb_sources[] = { {} }; -static const struct nvkm_specsrc +const struct nvkm_specsrc gf117_pbfb_sources[] = { { 0x110100, (const struct nvkm_specmux[]) { { 0x1, 0, "unk0" }, @@ -47,6 +47,12 @@ gf117_pbfb_sources[] = { { 0x3, 8, "unk8" }, {} }, "pbfb0_pm_unk100" }, + { 0x10f100, (const struct nvkm_specmux[]) { + { 0x1, 0, "unk0" }, + { 0xf, 4, "unk4" }, + { 0x3, 8, "unk8" }, + {} + }, "pbfb_broadcast_pm_unk100" }, {} }; diff --git a/drm/nouveau/nvkm/engine/pm/gk104.c b/drm/nouveau/nvkm/engine/pm/gk104.c index 7462dff..5067f72 100644 --- a/drm/nouveau/nvkm/engine/pm/gk104.c +++ b/drm/nouveau/nvkm/engine/pm/gk104.c @@ -23,6 +23,52 @@ */ #include "gf100.h" +static const struct nvkm_specsrc +gk104_pmfb_sources[] = { + { 0x140028, (const struct nvkm_specmux[]) { + { 0x3fff, 0, "unk0" }, + { 0x7, 16, "unk16" }, + { 0x3, 24, "unk24" }, + { 0x2, 28, "unk28" }, + {} + }, "pmfb0_pm_unk28" }, + { 0x14125c, (const struct nvkm_specmux[]) { + { 0x3fff, 0, "unk0" }, + {} + }, "pmfb0_subp0_pm_unk25c" }, + { 0x14165c, (const struct nvkm_specmux[]) { + { 0x3fff, 0, "unk0" }, + {} + }, "pmfb0_subp1_pm_unk25c" }, + { 0x141a5c, (const struct nvkm_specmux[]) { + { 0x3fff, 0, "unk0" }, + {} + }, "pmfb0_subp2_pm_unk25c" }, + { 0x141e5c, (const struct nvkm_specmux[]) { + { 0x3fff, 0, "unk0" }, + {} + }, "pmfb0_subp3_pm_unk25c" }, + {} +}; + +static const struct nvkm_specsrc +gk104_tex_sources[] = { + { 0x5042c0, (const struct nvkm_specmux[]) { + { 0xf, 0, "sel0", true }, + { 0x7, 8, "sel1", true }, + {} + }, "pgraph_gpc0_tpc0_tex_pm_mux_c_d" }, + { 0x5042c8, (const struct nvkm_specmux[]) { + { 0x1f, 0, "sel", true }, + {} + }, "pgraph_gpc0_tpc0_tex_pm_unkc8" }, + { 0x5042b8, (const struct nvkm_specmux[]) { + { 0xff, 0, "sel", true }, + {} + }, "pgraph_gpc0_tpc0_tex_pm_unkb8" }, + {} +}; + static const struct nvkm_specdom gk104_pm_hub[] = { { 0x60, (const struct nvkm_specsig[]) { @@ -69,12 +115,51 @@ gk104_pm_gpc[] = { { 0xc7, "gpc00_user_0" }, {} }, &gf100_perfctr_func }, + { 0x20, (const struct nvkm_specsig[]) { + {} + }, &gf100_perfctr_func }, + { 0x20, (const struct nvkm_specsig[]) { + { 0x00, "gpc02_tex_00", gk104_tex_sources }, + { 0x01, "gpc02_tex_01", gk104_tex_sources }, + { 0x02, "gpc02_tex_02", gk104_tex_sources }, + { 0x03, "gpc02_tex_03", gk104_tex_sources }, + { 0x04, "gpc02_tex_04", gk104_tex_sources }, + { 0x05, "gpc02_tex_05", gk104_tex_sources }, + { 0x06, "gpc02_tex_06", gk104_tex_sources }, + { 0x07, "gpc02_tex_07", gk104_tex_sources }, + { 0x08, "gpc02_tex_08", gk104_tex_sources }, + { 0x0a, "gpc02_tex_0a", gk104_tex_sources }, + { 0x0b, "gpc02_tex_0b", gk104_tex_sources }, + { 0x0d, "gpc02_tex_0c", gk104_tex_sources }, + { 0x0c, "gpc02_tex_0d", gk104_tex_sources }, + { 0x0e, "gpc02_tex_0e", gk104_tex_sources }, + { 0x0f, "gpc02_tex_0f", gk104_tex_sources }, + { 0x10, "gpc02_tex_10", gk104_tex_sources }, + { 0x11, "gpc02_tex_11", gk104_tex_sources }, + { 0x12, "gpc02_tex_12", gk104_tex_sources }, + {} + }, &gf100_perfctr_func }, {} }; static const struct nvkm_specdom gk104_pm_part[] = { { 0x60, (const struct nvkm_specsig[]) { + { 0x00, "part00_pbfb_00", gf117_pbfb_sources }, + { 0x01, "part00_pbfb_01", gf117_pbfb_sources }, + { 0x0c, "part00_pmfb_00", gk104_pmfb_sources }, + { 0x0d, "part00_pmfb_01", gk104_pmfb_sources }, + { 0x0e, "part00_pmfb_02", gk104_pmfb_sources }, + { 0x0f, "part00_pmfb_03", gk104_pmfb_sources }, + { 0x10, "part00_pmfb_04", gk104_pmfb_sources }, + { 0x12, "part00_pmfb_05", gk104_pmfb_sources }, + { 0x15, "part00_pmfb_06", gk104_pmfb_sources }, + { 0x16, "part00_pmfb_07", gk104_pmfb_sources }, + { 0x18, "part00_pmfb_08", gk104_pmfb_sources }, + { 0x21, "part00_pmfb_09", gk104_pmfb_sources }, + { 0x25, "part00_pmfb_0a", gk104_pmfb_sources }, + { 0x26, "part00_pmfb_0b", gk104_pmfb_sources }, + { 0x27, "part00_pmfb_0c", gk104_pmfb_sources }, { 0x47, "part00_user_0" }, {} }, &gf100_perfctr_func }, -- 2.4.3