From: Samuel Pitoiset Date: Sun, 7 Jun 2015 20:40:21 +0000 (+0200) Subject: drm/nouveau/pm: allow to monitor hardware signal index 0x00 X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=40a3b22c92ac3dad5adc818a84671bfb00303731;p=openwrt%2Fstaging%2Fblogic.git drm/nouveau/pm: allow to monitor hardware signal index 0x00 This signal index must be always allowed even if it's not clearly defined in a domain in order to monitor a counter like 0x03020100 because it's the default value of signals. Signed-off-by: Samuel Pitoiset Signed-off-by: Ben Skeggs --- diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/pm/base.c b/drivers/gpu/drm/nouveau/nvkm/engine/pm/base.c index 71834b96ca9e..610c0ca5c80b 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/pm/base.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/pm/base.c @@ -333,10 +333,10 @@ nvkm_perfctr_ctor(struct nvkm_object *parent, struct nvkm_object *engine, } else return ret; - for (i = 0; i < ARRAY_SIZE(args->v0.signal) && args->v0.signal[i]; i++) { + for (i = 0; i < ARRAY_SIZE(args->v0.signal); i++) { sig[i] = nvkm_perfsig_find(ppm, args->v0.domain, args->v0.signal[i], &dom); - if (!sig[i]) + if (args->v0.signal[i] && !sig[i]) return -EINVAL; } diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/pm/gf100.c b/drivers/gpu/drm/nouveau/nvkm/engine/pm/gf100.c index 69303b5dbcbc..41350d6199a5 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/pm/gf100.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/pm/gf100.c @@ -48,8 +48,10 @@ gf100_perfctr_init(struct nvkm_pm *ppm, struct nvkm_perfdom *dom, u32 src = 0x00000000; int i; - for (i = 0; i < 4 && ctr->signal[i]; i++) - src |= (ctr->signal[i] - dom->signal) << (i * 8); + for (i = 0; i < 4; i++) { + if (ctr->signal[i]) + src |= (ctr->signal[i] - dom->signal) << (i * 8); + } nv_wr32(priv, dom->addr + 0x09c, 0x00040002); nv_wr32(priv, dom->addr + 0x100, 0x00000000); diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/pm/nv40.c b/drivers/gpu/drm/nouveau/nvkm/engine/pm/nv40.c index ff22f06b22b8..603874ec0fba 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/pm/nv40.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/pm/nv40.c @@ -33,8 +33,10 @@ nv40_perfctr_init(struct nvkm_pm *ppm, struct nvkm_perfdom *dom, u32 src = 0x00000000; int i; - for (i = 0; i < 4 && ctr->signal[i]; i++) - src |= (ctr->signal[i] - dom->signal) << (i * 8); + for (i = 0; i < 4; i++) { + if (ctr->signal[i]) + src |= (ctr->signal[i] - dom->signal) << (i * 8); + } nv_wr32(priv, 0x00a7c0 + dom->addr, 0x00000001); nv_wr32(priv, 0x00a400 + dom->addr + (cntr->base.slot * 0x40), src);