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: Ben Skeggs <bskeggs@redhat.com> Reviewed-by: Lyude Paul <lyude@redhat.com>
This commit is contained in:
parent
54d10db1f8
commit
9c28abb7db
@ -21,11 +21,11 @@ void nvkm_falcon_v1_disable(struct nvkm_falcon *);
|
||||
void gp102_sec2_flcn_bind_context(struct nvkm_falcon *, struct nvkm_memory *);
|
||||
int gp102_sec2_flcn_enable(struct nvkm_falcon *);
|
||||
|
||||
#define FLCN_PRINTK(t,f,fmt,a...) do { \
|
||||
if (nvkm_subdev_name[(f)->owner->index] != (f)->name) \
|
||||
nvkm_##t((f)->owner, "%s: "fmt"\n", (f)->name, ##a); \
|
||||
else \
|
||||
nvkm_##t((f)->owner, fmt"\n", ##a); \
|
||||
#define FLCN_PRINTK(t,f,fmt,a...) do { \
|
||||
if ((f)->owner->name != (f)->name) \
|
||||
nvkm_##t((f)->owner, "%s: "fmt"\n", (f)->name, ##a); \
|
||||
else \
|
||||
nvkm_##t((f)->owner, fmt"\n", ##a); \
|
||||
} while(0)
|
||||
#define FLCN_DBG(f,fmt,a...) FLCN_PRINTK(debug, (f), fmt, ##a)
|
||||
#define FLCN_ERR(f,fmt,a...) FLCN_PRINTK(error, (f), fmt, ##a)
|
||||
|
@ -7,6 +7,7 @@ struct nvkm_subdev {
|
||||
const struct nvkm_subdev_func *func;
|
||||
struct nvkm_device *device;
|
||||
enum nvkm_devidx index;
|
||||
char name[16];
|
||||
u32 debug;
|
||||
struct list_head head;
|
||||
|
||||
@ -23,7 +24,7 @@ struct nvkm_subdev_func {
|
||||
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 index, struct nvkm_subdev **);
|
||||
void nvkm_subdev_ctor(const struct nvkm_subdev_func *, struct nvkm_device *,
|
||||
@ -38,10 +39,8 @@ void nvkm_subdev_intr(struct nvkm_subdev *);
|
||||
/* subdev logging */
|
||||
#define nvkm_printk_(s,l,p,f,a...) do { \
|
||||
const struct nvkm_subdev *_subdev = (s); \
|
||||
if (CONFIG_NOUVEAU_DEBUG >= (l) && _subdev->debug >= (l)) { \
|
||||
dev_##p(_subdev->device->dev, "%s: "f, \
|
||||
nvkm_subdev_name[_subdev->index], ##a); \
|
||||
} \
|
||||
if (CONFIG_NOUVEAU_DEBUG >= (l) && _subdev->debug >= (l)) \
|
||||
dev_##p(_subdev->device->dev, "%s: "f, _subdev->name, ##a); \
|
||||
} while(0)
|
||||
#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)
|
||||
|
@ -185,7 +185,7 @@ nvkm_engine_ctor(const struct nvkm_engine_func *func,
|
||||
refcount_set(&engine->use.refcount, 0);
|
||||
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");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
@ -27,7 +27,7 @@
|
||||
#include <subdev/mc.h>
|
||||
|
||||
const char *
|
||||
nvkm_subdev_name[NVKM_SUBDEV_NR] = {
|
||||
nvkm_subdev_type[NVKM_SUBDEV_NR] = {
|
||||
[NVKM_SUBDEV_ACR ] = "acr",
|
||||
[NVKM_SUBDEV_BAR ] = "bar",
|
||||
[NVKM_SUBDEV_VBIOS ] = "bios",
|
||||
@ -212,11 +212,11 @@ nvkm_subdev_ctor(const struct nvkm_subdev_func *func,
|
||||
struct nvkm_device *device, int index,
|
||||
struct nvkm_subdev *subdev)
|
||||
{
|
||||
const char *name = nvkm_subdev_name[index];
|
||||
subdev->func = func;
|
||||
subdev->device = device;
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -3269,7 +3269,7 @@ nvkm_device_ctor(const struct nvkm_device_func *func,
|
||||
device->m = NULL; \
|
||||
if (ret != -ENODEV) { \
|
||||
nvdev_error(device, "%s ctor failed, %d\n", \
|
||||
nvkm_subdev_name[s], ret); \
|
||||
nvkm_subdev_type[(s)], ret); \
|
||||
goto done; \
|
||||
} \
|
||||
} \
|
||||
|
@ -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_fifo_chan *chan = object->chan;
|
||||
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;
|
||||
|
||||
if (--engn->usecount)
|
||||
@ -76,7 +76,7 @@ nvkm_fifo_chan_child_init(struct nvkm_oproxy *base)
|
||||
struct nvkm_engine *engine = object->oproxy.object->engine;
|
||||
struct nvkm_fifo_chan *chan = object->chan;
|
||||
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;
|
||||
|
||||
if (engn->usecount++)
|
||||
|
@ -181,7 +181,7 @@ gf100_fifo_recover(struct gf100_fifo *fifo, struct nvkm_engine *engine,
|
||||
u32 chid = chan->base.chid;
|
||||
|
||||
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);
|
||||
|
||||
nvkm_mask(device, 0x003004 + (chid * 0x08), 0x00000001, 0x00000000);
|
||||
|
@ -491,7 +491,7 @@ gk104_fifo_fault(struct nvkm_fifo *base, struct nvkm_fault_data *info)
|
||||
if (ee == NULL) {
|
||||
enum nvkm_devidx engidx = nvkm_top_fault(device, info->engine);
|
||||
if (engidx < NVKM_SUBDEV_NR) {
|
||||
const char *src = nvkm_subdev_name[engidx];
|
||||
const char *src = nvkm_subdev_type[engidx];
|
||||
char *dst = en;
|
||||
do {
|
||||
*dst++ = toupper(*src++);
|
||||
@ -919,7 +919,7 @@ gk104_fifo_oneinit(struct nvkm_fifo *base)
|
||||
}
|
||||
|
||||
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].runl = runl;
|
||||
|
@ -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);
|
||||
|
||||
if (engidx < NVKM_SUBDEV_NR) {
|
||||
const char *src = nvkm_subdev_name[engidx];
|
||||
const char *src = nvkm_subdev_type[engidx];
|
||||
char *dst = en;
|
||||
|
||||
do {
|
||||
|
@ -57,5 +57,5 @@ nvkm_nvdec_new_(const struct nvkm_nvdec_fwif *fwif, struct nvkm_device *device,
|
||||
nvdec->func = fwif->func;
|
||||
|
||||
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,
|
||||
nvenc->func = fwif->func;
|
||||
|
||||
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,
|
||||
sec2->func = fwif->func;
|
||||
|
||||
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)
|
||||
return ret;
|
||||
|
||||
|
@ -188,7 +188,7 @@ nvkm_falcon_get(struct nvkm_falcon *falcon, const struct nvkm_subdev *user)
|
||||
mutex_lock(&falcon->mutex);
|
||||
if (falcon->user) {
|
||||
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);
|
||||
return -EBUSY;
|
||||
}
|
||||
|
@ -53,7 +53,5 @@ nvkm_gsp_new_(const struct nvkm_gsp_fwif *fwif, struct nvkm_device *device,
|
||||
if (IS_ERR(fwif))
|
||||
return PTR_ERR(fwif);
|
||||
|
||||
return nvkm_falcon_ctor(fwif->flcn, &gsp->subdev,
|
||||
nvkm_subdev_name[gsp->subdev.index], 0,
|
||||
&gsp->falcon);
|
||||
return nvkm_falcon_ctor(fwif->flcn, &gsp->subdev, gsp->subdev.name, 0, &gsp->falcon);
|
||||
}
|
||||
|
@ -217,8 +217,7 @@ nv50_vmm_flush(struct nvkm_vmm *vmm, int level)
|
||||
if (!(nvkm_rd32(device, 0x100c80) & 0x00000001))
|
||||
break;
|
||||
) < 0)
|
||||
nvkm_error(subdev, "%s mmu invalidate timeout\n",
|
||||
nvkm_subdev_name[i]);
|
||||
nvkm_error(subdev, "%s mmu invalidate timeout\n", nvkm_subdev_type[i]);
|
||||
}
|
||||
mutex_unlock(&vmm->mmu->mutex);
|
||||
}
|
||||
|
@ -180,9 +180,8 @@ nvkm_pmu_ctor(const struct nvkm_pmu_fwif *fwif, struct nvkm_device *device,
|
||||
|
||||
pmu->func = fwif->func;
|
||||
|
||||
ret = nvkm_falcon_ctor(pmu->func->flcn, &pmu->subdev,
|
||||
nvkm_subdev_name[pmu->subdev.index], 0x10a000,
|
||||
&pmu->falcon);
|
||||
ret = nvkm_falcon_ctor(pmu->func->flcn, &pmu->subdev, pmu->subdev.name,
|
||||
0x10a000, &pmu->falcon);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
|
@ -97,8 +97,7 @@ gk104_top_oneinit(struct nvkm_top *top)
|
||||
nvkm_debug(subdev, "%02x.%d (%8s): addr %06x fault %2d "
|
||||
"engine %2d runlist %2d intr %2d "
|
||||
"reset %2d\n", type, inst,
|
||||
info->index == NVKM_SUBDEV_NR ? NULL :
|
||||
nvkm_subdev_name[info->index],
|
||||
info->index == NVKM_SUBDEV_NR ? NULL : nvkm_subdev_type[info->index],
|
||||
info->addr, info->fault, info->engine, info->runlist,
|
||||
info->intr, info->reset);
|
||||
info = NULL;
|
||||
|
Loading…
x
Reference in New Issue
Block a user