From: Samuel Pitoiset Date: Sun, 7 Jun 2015 20:40:18 +0000 (+0200) Subject: drm/nouveau/pm: allow to query signals by domain X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=3e1b33571ab4937cbd400976a115e4922797559a;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git drm/nouveau/pm: allow to query signals by domain This will allow to configure performance counters with hardware signal indexes instead of user-readable names in an upcoming patch. Signed-off-by: Samuel Pitoiset Signed-off-by: Ben Skeggs --- diff --git a/drivers/gpu/drm/nouveau/include/nvif/class.h b/drivers/gpu/drm/nouveau/include/nvif/class.h index 0b28929f5be6..cf2af89b7112 100644 --- a/drivers/gpu/drm/nouveau/include/nvif/class.h +++ b/drivers/gpu/drm/nouveau/include/nvif/class.h @@ -264,7 +264,8 @@ struct nvif_perfmon_query_domain_v0 { struct nvif_perfmon_query_signal_v0 { __u8 version; - __u8 pad01[3]; + __u8 domain; + __u8 pad02[2]; __u32 iter; char name[64]; }; diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/pm/base.c b/drivers/gpu/drm/nouveau/nvkm/engine/pm/base.c index 3d9bcbc1064c..d61beffd2404 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/pm/base.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/pm/base.c @@ -174,29 +174,22 @@ nvkm_perfmon_mthd_query_signal(struct nvkm_object *object, void *data, u32 size) } *args = data; struct nvkm_device *device = nv_device(object); struct nvkm_pm *ppm = (void *)object->engine; - struct nvkm_perfdom *dom = NULL, *chk; + struct nvkm_perfdom *dom; const bool all = nvkm_boolopt(device->cfgopt, "NvPmShowAll", false); const bool raw = nvkm_boolopt(device->cfgopt, "NvPmUnnamed", all); const char *name; - int tmp = 0, di, si; - int ret; + int ret, si; nv_ioctl(object, "perfmon query signal size %d\n", size); if (nvif_unpack(args->v0, 0, 0, false)) { - nv_ioctl(object, "perfmon query signal vers %d iter %08x\n", - args->v0.version, args->v0.iter); - di = (args->v0.iter & 0xff000000) >> 24; - si = (args->v0.iter & 0x00ffffff) - 1; + nv_ioctl(object, + "perfmon query signal vers %d dom %d iter %08x\n", + args->v0.version, args->v0.domain, args->v0.iter); + si = (args->v0.iter & 0xffffffff) - 1; } else return ret; - list_for_each_entry(chk, &ppm->domains, head) { - if (tmp++ == di) { - dom = chk; - break; - } - } - + dom = nvkm_perfdom_find(ppm, args->v0.domain); if (dom == NULL || si >= (int)dom->signal_nr) return -EINVAL; @@ -209,17 +202,12 @@ nvkm_perfmon_mthd_query_signal(struct nvkm_object *object, void *data, u32 size) } } - do { - while (++si < dom->signal_nr) { - if (all || dom->signal[si].name) { - args->v0.iter = (di << 24) | ++si; - return 0; - } + while (++si < dom->signal_nr) { + if (all || dom->signal[si].name) { + args->v0.iter = ++si; + return 0; } - si = -1; - di = di + 1; - dom = list_entry(dom->head.next, typeof(*dom), head); - } while (&dom->head != &ppm->domains); + } args->v0.iter = 0xffffffff; return 0;