Commit 9c28abb7 authored by Ben Skeggs's avatar Ben Skeggs

drm/nouveau/subdev: store full subdev name in struct

Much easier to store this to avoid having to reconstruct a string for a
specific subdev, taking into account whether it's instanced or not.
Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
Reviewed-by: default avatarLyude Paul <lyude@redhat.com>
parent 54d10db1
...@@ -21,11 +21,11 @@ void nvkm_falcon_v1_disable(struct nvkm_falcon *); ...@@ -21,11 +21,11 @@ void nvkm_falcon_v1_disable(struct nvkm_falcon *);
void gp102_sec2_flcn_bind_context(struct nvkm_falcon *, struct nvkm_memory *); void gp102_sec2_flcn_bind_context(struct nvkm_falcon *, struct nvkm_memory *);
int gp102_sec2_flcn_enable(struct nvkm_falcon *); int gp102_sec2_flcn_enable(struct nvkm_falcon *);
#define FLCN_PRINTK(t,f,fmt,a...) do { \ #define FLCN_PRINTK(t,f,fmt,a...) do { \
if (nvkm_subdev_name[(f)->owner->index] != (f)->name) \ if ((f)->owner->name != (f)->name) \
nvkm_##t((f)->owner, "%s: "fmt"\n", (f)->name, ##a); \ nvkm_##t((f)->owner, "%s: "fmt"\n", (f)->name, ##a); \
else \ else \
nvkm_##t((f)->owner, fmt"\n", ##a); \ nvkm_##t((f)->owner, fmt"\n", ##a); \
} while(0) } while(0)
#define FLCN_DBG(f,fmt,a...) FLCN_PRINTK(debug, (f), fmt, ##a) #define FLCN_DBG(f,fmt,a...) FLCN_PRINTK(debug, (f), fmt, ##a)
#define FLCN_ERR(f,fmt,a...) FLCN_PRINTK(error, (f), fmt, ##a) #define FLCN_ERR(f,fmt,a...) FLCN_PRINTK(error, (f), fmt, ##a)
......
...@@ -7,6 +7,7 @@ struct nvkm_subdev { ...@@ -7,6 +7,7 @@ struct nvkm_subdev {
const struct nvkm_subdev_func *func; const struct nvkm_subdev_func *func;
struct nvkm_device *device; struct nvkm_device *device;
enum nvkm_devidx index; enum nvkm_devidx index;
char name[16];
u32 debug; u32 debug;
struct list_head head; struct list_head head;
...@@ -23,7 +24,7 @@ struct nvkm_subdev_func { ...@@ -23,7 +24,7 @@ struct nvkm_subdev_func {
void (*intr)(struct nvkm_subdev *); void (*intr)(struct nvkm_subdev *);
}; };
extern const char *nvkm_subdev_name[NVKM_SUBDEV_NR]; extern const char *nvkm_subdev_type[NVKM_SUBDEV_NR];
int nvkm_subdev_new_(const struct nvkm_subdev_func *, struct nvkm_device *, int nvkm_subdev_new_(const struct nvkm_subdev_func *, struct nvkm_device *,
int index, struct nvkm_subdev **); int index, struct nvkm_subdev **);
void nvkm_subdev_ctor(const struct nvkm_subdev_func *, struct nvkm_device *, void nvkm_subdev_ctor(const struct nvkm_subdev_func *, struct nvkm_device *,
...@@ -38,10 +39,8 @@ void nvkm_subdev_intr(struct nvkm_subdev *); ...@@ -38,10 +39,8 @@ void nvkm_subdev_intr(struct nvkm_subdev *);
/* subdev logging */ /* subdev logging */
#define nvkm_printk_(s,l,p,f,a...) do { \ #define nvkm_printk_(s,l,p,f,a...) do { \
const struct nvkm_subdev *_subdev = (s); \ const struct nvkm_subdev *_subdev = (s); \
if (CONFIG_NOUVEAU_DEBUG >= (l) && _subdev->debug >= (l)) { \ if (CONFIG_NOUVEAU_DEBUG >= (l) && _subdev->debug >= (l)) \
dev_##p(_subdev->device->dev, "%s: "f, \ dev_##p(_subdev->device->dev, "%s: "f, _subdev->name, ##a); \
nvkm_subdev_name[_subdev->index], ##a); \
} \
} while(0) } while(0)
#define nvkm_printk(s,l,p,f,a...) nvkm_printk_((s), NV_DBG_##l, p, f, ##a) #define nvkm_printk(s,l,p,f,a...) nvkm_printk_((s), NV_DBG_##l, p, f, ##a)
#define nvkm_fatal(s,f,a...) nvkm_printk((s), FATAL, crit, f, ##a) #define nvkm_fatal(s,f,a...) nvkm_printk((s), FATAL, crit, f, ##a)
......
...@@ -185,7 +185,7 @@ nvkm_engine_ctor(const struct nvkm_engine_func *func, ...@@ -185,7 +185,7 @@ nvkm_engine_ctor(const struct nvkm_engine_func *func,
refcount_set(&engine->use.refcount, 0); refcount_set(&engine->use.refcount, 0);
mutex_init(&engine->use.mutex); mutex_init(&engine->use.mutex);
if (!nvkm_boolopt(device->cfgopt, nvkm_subdev_name[index], enable)) { if (!nvkm_boolopt(device->cfgopt, engine->subdev.name, enable)) {
nvkm_debug(&engine->subdev, "disabled\n"); nvkm_debug(&engine->subdev, "disabled\n");
return -ENODEV; return -ENODEV;
} }
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
#include <subdev/mc.h> #include <subdev/mc.h>
const char * const char *
nvkm_subdev_name[NVKM_SUBDEV_NR] = { nvkm_subdev_type[NVKM_SUBDEV_NR] = {
[NVKM_SUBDEV_ACR ] = "acr", [NVKM_SUBDEV_ACR ] = "acr",
[NVKM_SUBDEV_BAR ] = "bar", [NVKM_SUBDEV_BAR ] = "bar",
[NVKM_SUBDEV_VBIOS ] = "bios", [NVKM_SUBDEV_VBIOS ] = "bios",
...@@ -212,11 +212,11 @@ nvkm_subdev_ctor(const struct nvkm_subdev_func *func, ...@@ -212,11 +212,11 @@ nvkm_subdev_ctor(const struct nvkm_subdev_func *func,
struct nvkm_device *device, int index, struct nvkm_device *device, int index,
struct nvkm_subdev *subdev) struct nvkm_subdev *subdev)
{ {
const char *name = nvkm_subdev_name[index];
subdev->func = func; subdev->func = func;
subdev->device = device; subdev->device = device;
subdev->index = index; subdev->index = index;
subdev->debug = nvkm_dbgopt(device->dbgopt, name); strscpy(subdev->name, nvkm_subdev_type[index], sizeof(subdev->name));
subdev->debug = nvkm_dbgopt(device->dbgopt, subdev->name);
list_add_tail(&subdev->head, &device->subdev); list_add_tail(&subdev->head, &device->subdev);
} }
......
...@@ -3269,7 +3269,7 @@ nvkm_device_ctor(const struct nvkm_device_func *func, ...@@ -3269,7 +3269,7 @@ nvkm_device_ctor(const struct nvkm_device_func *func,
device->m = NULL; \ device->m = NULL; \
if (ret != -ENODEV) { \ if (ret != -ENODEV) { \
nvdev_error(device, "%s ctor failed, %d\n", \ nvdev_error(device, "%s ctor failed, %d\n", \
nvkm_subdev_name[s], ret); \ nvkm_subdev_type[(s)], ret); \
goto done; \ goto done; \
} \ } \
} \ } \
......
...@@ -43,7 +43,7 @@ nvkm_fifo_chan_child_fini(struct nvkm_oproxy *base, bool suspend) ...@@ -43,7 +43,7 @@ nvkm_fifo_chan_child_fini(struct nvkm_oproxy *base, bool suspend)
struct nvkm_engine *engine = object->oproxy.object->engine; struct nvkm_engine *engine = object->oproxy.object->engine;
struct nvkm_fifo_chan *chan = object->chan; struct nvkm_fifo_chan *chan = object->chan;
struct nvkm_fifo_engn *engn = &chan->engn[engine->subdev.index]; struct nvkm_fifo_engn *engn = &chan->engn[engine->subdev.index];
const char *name = nvkm_subdev_name[engine->subdev.index]; const char *name = engine->subdev.name;
int ret = 0; int ret = 0;
if (--engn->usecount) if (--engn->usecount)
...@@ -76,7 +76,7 @@ nvkm_fifo_chan_child_init(struct nvkm_oproxy *base) ...@@ -76,7 +76,7 @@ nvkm_fifo_chan_child_init(struct nvkm_oproxy *base)
struct nvkm_engine *engine = object->oproxy.object->engine; struct nvkm_engine *engine = object->oproxy.object->engine;
struct nvkm_fifo_chan *chan = object->chan; struct nvkm_fifo_chan *chan = object->chan;
struct nvkm_fifo_engn *engn = &chan->engn[engine->subdev.index]; struct nvkm_fifo_engn *engn = &chan->engn[engine->subdev.index];
const char *name = nvkm_subdev_name[engine->subdev.index]; const char *name = engine->subdev.name;
int ret; int ret;
if (engn->usecount++) if (engn->usecount++)
......
...@@ -181,7 +181,7 @@ gf100_fifo_recover(struct gf100_fifo *fifo, struct nvkm_engine *engine, ...@@ -181,7 +181,7 @@ gf100_fifo_recover(struct gf100_fifo *fifo, struct nvkm_engine *engine,
u32 chid = chan->base.chid; u32 chid = chan->base.chid;
nvkm_error(subdev, "%s engine fault on channel %d, recovering...\n", nvkm_error(subdev, "%s engine fault on channel %d, recovering...\n",
nvkm_subdev_name[engine->subdev.index], chid); engine->subdev.name, chid);
assert_spin_locked(&fifo->base.lock); assert_spin_locked(&fifo->base.lock);
nvkm_mask(device, 0x003004 + (chid * 0x08), 0x00000001, 0x00000000); nvkm_mask(device, 0x003004 + (chid * 0x08), 0x00000001, 0x00000000);
......
...@@ -491,7 +491,7 @@ gk104_fifo_fault(struct nvkm_fifo *base, struct nvkm_fault_data *info) ...@@ -491,7 +491,7 @@ gk104_fifo_fault(struct nvkm_fifo *base, struct nvkm_fault_data *info)
if (ee == NULL) { if (ee == NULL) {
enum nvkm_devidx engidx = nvkm_top_fault(device, info->engine); enum nvkm_devidx engidx = nvkm_top_fault(device, info->engine);
if (engidx < NVKM_SUBDEV_NR) { if (engidx < NVKM_SUBDEV_NR) {
const char *src = nvkm_subdev_name[engidx]; const char *src = nvkm_subdev_type[engidx];
char *dst = en; char *dst = en;
do { do {
*dst++ = toupper(*src++); *dst++ = toupper(*src++);
...@@ -919,7 +919,7 @@ gk104_fifo_oneinit(struct nvkm_fifo *base) ...@@ -919,7 +919,7 @@ gk104_fifo_oneinit(struct nvkm_fifo *base)
} }
nvkm_debug(subdev, "engine %2d: runlist %2d pbdma %2d (%s)\n", nvkm_debug(subdev, "engine %2d: runlist %2d pbdma %2d (%s)\n",
engn, runl, pbid, nvkm_subdev_name[engidx]); engn, runl, pbid, nvkm_subdev_type[engidx]);
fifo->engine[engn].engine = nvkm_device_engine(device, engidx); fifo->engine[engn].engine = nvkm_device_engine(device, engidx);
fifo->engine[engn].runl = runl; fifo->engine[engn].runl = runl;
......
...@@ -312,7 +312,7 @@ tu102_fifo_fault(struct nvkm_fifo *base, struct nvkm_fault_data *info) ...@@ -312,7 +312,7 @@ tu102_fifo_fault(struct nvkm_fifo *base, struct nvkm_fault_data *info)
enum nvkm_devidx engidx = nvkm_top_fault(device, info->engine); enum nvkm_devidx engidx = nvkm_top_fault(device, info->engine);
if (engidx < NVKM_SUBDEV_NR) { if (engidx < NVKM_SUBDEV_NR) {
const char *src = nvkm_subdev_name[engidx]; const char *src = nvkm_subdev_type[engidx];
char *dst = en; char *dst = en;
do { do {
......
...@@ -57,5 +57,5 @@ nvkm_nvdec_new_(const struct nvkm_nvdec_fwif *fwif, struct nvkm_device *device, ...@@ -57,5 +57,5 @@ nvkm_nvdec_new_(const struct nvkm_nvdec_fwif *fwif, struct nvkm_device *device,
nvdec->func = fwif->func; nvdec->func = fwif->func;
return nvkm_falcon_ctor(nvdec->func->flcn, &nvdec->engine.subdev, return nvkm_falcon_ctor(nvdec->func->flcn, &nvdec->engine.subdev,
nvkm_subdev_name[index], 0, &nvdec->falcon); nvdec->engine.subdev.name, 0, &nvdec->falcon);
}; };
...@@ -59,5 +59,5 @@ nvkm_nvenc_new_(const struct nvkm_nvenc_fwif *fwif, struct nvkm_device *device, ...@@ -59,5 +59,5 @@ nvkm_nvenc_new_(const struct nvkm_nvenc_fwif *fwif, struct nvkm_device *device,
nvenc->func = fwif->func; nvenc->func = fwif->func;
return nvkm_falcon_ctor(nvenc->func->flcn, &nvenc->engine.subdev, return nvkm_falcon_ctor(nvenc->func->flcn, &nvenc->engine.subdev,
nvkm_subdev_name[index], 0, &nvenc->falcon); nvenc->engine.subdev.name, 0, &nvenc->falcon);
}; };
...@@ -104,7 +104,7 @@ nvkm_sec2_new_(const struct nvkm_sec2_fwif *fwif, struct nvkm_device *device, ...@@ -104,7 +104,7 @@ nvkm_sec2_new_(const struct nvkm_sec2_fwif *fwif, struct nvkm_device *device,
sec2->func = fwif->func; sec2->func = fwif->func;
ret = nvkm_falcon_ctor(sec2->func->flcn, &sec2->engine.subdev, ret = nvkm_falcon_ctor(sec2->func->flcn, &sec2->engine.subdev,
nvkm_subdev_name[index], addr, &sec2->falcon); sec2->engine.subdev.name, addr, &sec2->falcon);
if (ret) if (ret)
return ret; return ret;
......
...@@ -188,7 +188,7 @@ nvkm_falcon_get(struct nvkm_falcon *falcon, const struct nvkm_subdev *user) ...@@ -188,7 +188,7 @@ nvkm_falcon_get(struct nvkm_falcon *falcon, const struct nvkm_subdev *user)
mutex_lock(&falcon->mutex); mutex_lock(&falcon->mutex);
if (falcon->user) { if (falcon->user) {
nvkm_error(user, "%s falcon already acquired by %s!\n", nvkm_error(user, "%s falcon already acquired by %s!\n",
falcon->name, nvkm_subdev_name[falcon->user->index]); falcon->name, falcon->user->name);
mutex_unlock(&falcon->mutex); mutex_unlock(&falcon->mutex);
return -EBUSY; return -EBUSY;
} }
......
...@@ -53,7 +53,5 @@ nvkm_gsp_new_(const struct nvkm_gsp_fwif *fwif, struct nvkm_device *device, ...@@ -53,7 +53,5 @@ nvkm_gsp_new_(const struct nvkm_gsp_fwif *fwif, struct nvkm_device *device,
if (IS_ERR(fwif)) if (IS_ERR(fwif))
return PTR_ERR(fwif); return PTR_ERR(fwif);
return nvkm_falcon_ctor(fwif->flcn, &gsp->subdev, return nvkm_falcon_ctor(fwif->flcn, &gsp->subdev, gsp->subdev.name, 0, &gsp->falcon);
nvkm_subdev_name[gsp->subdev.index], 0,
&gsp->falcon);
} }
...@@ -217,8 +217,7 @@ nv50_vmm_flush(struct nvkm_vmm *vmm, int level) ...@@ -217,8 +217,7 @@ nv50_vmm_flush(struct nvkm_vmm *vmm, int level)
if (!(nvkm_rd32(device, 0x100c80) & 0x00000001)) if (!(nvkm_rd32(device, 0x100c80) & 0x00000001))
break; break;
) < 0) ) < 0)
nvkm_error(subdev, "%s mmu invalidate timeout\n", nvkm_error(subdev, "%s mmu invalidate timeout\n", nvkm_subdev_type[i]);
nvkm_subdev_name[i]);
} }
mutex_unlock(&vmm->mmu->mutex); mutex_unlock(&vmm->mmu->mutex);
} }
......
...@@ -180,9 +180,8 @@ nvkm_pmu_ctor(const struct nvkm_pmu_fwif *fwif, struct nvkm_device *device, ...@@ -180,9 +180,8 @@ nvkm_pmu_ctor(const struct nvkm_pmu_fwif *fwif, struct nvkm_device *device,
pmu->func = fwif->func; pmu->func = fwif->func;
ret = nvkm_falcon_ctor(pmu->func->flcn, &pmu->subdev, ret = nvkm_falcon_ctor(pmu->func->flcn, &pmu->subdev, pmu->subdev.name,
nvkm_subdev_name[pmu->subdev.index], 0x10a000, 0x10a000, &pmu->falcon);
&pmu->falcon);
if (ret) if (ret)
return ret; return ret;
......
...@@ -97,8 +97,7 @@ gk104_top_oneinit(struct nvkm_top *top) ...@@ -97,8 +97,7 @@ gk104_top_oneinit(struct nvkm_top *top)
nvkm_debug(subdev, "%02x.%d (%8s): addr %06x fault %2d " nvkm_debug(subdev, "%02x.%d (%8s): addr %06x fault %2d "
"engine %2d runlist %2d intr %2d " "engine %2d runlist %2d intr %2d "
"reset %2d\n", type, inst, "reset %2d\n", type, inst,
info->index == NVKM_SUBDEV_NR ? NULL : info->index == NVKM_SUBDEV_NR ? NULL : nvkm_subdev_type[info->index],
nvkm_subdev_name[info->index],
info->addr, info->fault, info->engine, info->runlist, info->addr, info->fault, info->engine, info->runlist,
info->intr, info->reset); info->intr, info->reset);
info = NULL; info = NULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment