2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-20 19:23:57 +08:00

drm/nouveau: use dev_* for logging

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
This commit is contained in:
Ben Skeggs 2015-08-20 14:54:13 +10:00
parent 9e3911e5b2
commit 9ad97ede4b
7 changed files with 55 additions and 47 deletions

View File

@ -217,7 +217,7 @@ nouveau_abi16_ioctl_getparam(ABI16_IOCTL_ARGS)
getparam->value = gr->units ? gr->units(gr) : 0; getparam->value = gr->units ? gr->units(gr) : 0;
break; break;
default: default:
NV_PRINTK(debug, cli, "unknown parameter %lld\n", getparam->param); NV_PRINTK(dbg, cli, "unknown parameter %lld\n", getparam->param);
return -EINVAL; return -EINVAL;
} }

View File

@ -1891,11 +1891,12 @@ parse_dcb_table(struct drm_device *dev, struct nvbios *bios)
idx = -1; idx = -1;
while ((conn = olddcb_conn(dev, ++idx))) { while ((conn = olddcb_conn(dev, ++idx))) {
if (conn[0] != 0xff) { if (conn[0] != 0xff) {
NV_INFO(drm, "DCB conn %02d: ", idx);
if (olddcb_conntab(dev)[3] < 4) if (olddcb_conntab(dev)[3] < 4)
pr_cont("%04x\n", ROM16(conn[0])); NV_INFO(drm, "DCB conn %02d: %04x\n",
idx, ROM16(conn[0]));
else else
pr_cont("%08x\n", ROM32(conn[0])); NV_INFO(drm, "DCB conn %02d: %08x\n",
idx, ROM32(conn[0]));
} }
} }
dcb_fake_connectors(bios); dcb_fake_connectors(bios);

View File

@ -53,7 +53,7 @@ nouveau_channel_idle(struct nouveau_channel *chan)
} }
if (ret) if (ret)
NV_PRINTK(error, cli, "failed to idle channel 0x%08x [%s]\n", NV_PRINTK(err, cli, "failed to idle channel 0x%08x [%s]\n",
chan->object->handle, nvxx_client(&cli->base)->name); chan->object->handle, nvxx_client(&cli->base)->name);
return ret; return ret;
} }
@ -405,17 +405,17 @@ nouveau_channel_new(struct nouveau_drm *drm, struct nvif_device *device,
ret = nouveau_channel_ind(drm, device, handle, arg0, pchan); ret = nouveau_channel_ind(drm, device, handle, arg0, pchan);
if (ret) { if (ret) {
NV_PRINTK(debug, cli, "ib channel create, %d\n", ret); NV_PRINTK(dbg, cli, "ib channel create, %d\n", ret);
ret = nouveau_channel_dma(drm, device, handle, pchan); ret = nouveau_channel_dma(drm, device, handle, pchan);
if (ret) { if (ret) {
NV_PRINTK(debug, cli, "dma channel create, %d\n", ret); NV_PRINTK(dbg, cli, "dma channel create, %d\n", ret);
goto done; goto done;
} }
} }
ret = nouveau_channel_init(*pchan, arg0, arg1); ret = nouveau_channel_init(*pchan, arg0, arg1);
if (ret) { if (ret) {
NV_PRINTK(error, cli, "channel failed to initialise, %d\n", ret); NV_PRINTK(err, cli, "channel failed to initialise, %d\n", ret);
nouveau_channel_del(pchan); nouveau_channel_del(pchan);
} }

View File

@ -105,14 +105,18 @@ nouveau_name(struct drm_device *dev)
} }
static int static int
nouveau_cli_create(u64 name, const char *sname, nouveau_cli_create(struct drm_device *dev, const char *sname,
int size, void **pcli) int size, void **pcli)
{ {
struct nouveau_cli *cli = *pcli = kzalloc(size, GFP_KERNEL); struct nouveau_cli *cli = *pcli = kzalloc(size, GFP_KERNEL);
int ret;
if (cli) { if (cli) {
int ret = nvif_client_init(NULL, NULL, sname, name, snprintf(cli->name, sizeof(cli->name), "%s", sname);
nouveau_config, nouveau_debug, cli->dev = dev;
&cli->base);
ret = nvif_client_init(NULL, NULL, cli->name, nouveau_name(dev),
nouveau_config, nouveau_debug,
&cli->base);
if (ret == 0) { if (ret == 0) {
mutex_init(&cli->mutex); mutex_init(&cli->mutex);
usif_client_init(cli); usif_client_init(cli);
@ -375,8 +379,7 @@ nouveau_drm_load(struct drm_device *dev, unsigned long flags)
struct nouveau_drm *drm; struct nouveau_drm *drm;
int ret; int ret;
ret = nouveau_cli_create(nouveau_name(dev), "DRM", sizeof(*drm), ret = nouveau_cli_create(dev, "DRM", sizeof(*drm), (void **)&drm);
(void **)&drm);
if (ret) if (ret)
return ret; return ret;
@ -826,8 +829,7 @@ nouveau_drm_open(struct drm_device *dev, struct drm_file *fpriv)
get_task_comm(tmpname, current); get_task_comm(tmpname, current);
snprintf(name, sizeof(name), "%s[%d]", tmpname, pid_nr(fpriv->pid)); snprintf(name, sizeof(name), "%s[%d]", tmpname, pid_nr(fpriv->pid));
ret = nouveau_cli_create(nouveau_name(dev), name, sizeof(*cli), ret = nouveau_cli_create(dev, name, sizeof(*cli), (void **)&cli);
(void **)&cli);
if (ret) if (ret)
goto out_suspend; goto out_suspend;

View File

@ -88,6 +88,8 @@ struct nouveau_cli {
void *abi16; void *abi16;
struct list_head objects; struct list_head objects;
struct list_head notifys; struct list_head notifys;
char name[32];
struct drm_device *dev;
}; };
static inline struct nouveau_cli * static inline struct nouveau_cli *
@ -189,13 +191,16 @@ void nouveau_drm_device_remove(struct drm_device *dev);
#define NV_PRINTK(l,c,f,a...) do { \ #define NV_PRINTK(l,c,f,a...) do { \
struct nouveau_cli *_cli = (c); \ struct nouveau_cli *_cli = (c); \
nv_##l(_cli->base.base.priv, f, ##a); \ dev_##l(_cli->dev->dev, "%s: "f, _cli->name, ##a); \
} while(0) } while(0)
#define NV_FATAL(drm,f,a...) NV_PRINTK(fatal, &(drm)->client, f, ##a) #define NV_FATAL(drm,f,a...) NV_PRINTK(crit, &(drm)->client, f, ##a)
#define NV_ERROR(drm,f,a...) NV_PRINTK(error, &(drm)->client, f, ##a) #define NV_ERROR(drm,f,a...) NV_PRINTK(err, &(drm)->client, f, ##a)
#define NV_WARN(drm,f,a...) NV_PRINTK(warn, &(drm)->client, f, ##a) #define NV_WARN(drm,f,a...) NV_PRINTK(warn, &(drm)->client, f, ##a)
#define NV_INFO(drm,f,a...) NV_PRINTK(info, &(drm)->client, f, ##a) #define NV_INFO(drm,f,a...) NV_PRINTK(info, &(drm)->client, f, ##a)
#define NV_DEBUG(drm,f,a...) NV_PRINTK(debug, &(drm)->client, f, ##a) #define NV_DEBUG(drm,f,a...) do { \
if (unlikely(drm_debug & DRM_UT_DRIVER)) \
NV_PRINTK(info, &(drm)->client, f, ##a); \
} while(0)
extern int nouveau_modeset; extern int nouveau_modeset;

View File

@ -260,7 +260,7 @@ nouveau_gem_ioctl_new(struct drm_device *dev, void *data,
int ret = 0; int ret = 0;
if (!fb->memtype_valid(fb, req->info.tile_flags)) { if (!fb->memtype_valid(fb, req->info.tile_flags)) {
NV_PRINTK(error, cli, "bad page flags: 0x%08x\n", req->info.tile_flags); NV_PRINTK(err, cli, "bad page flags: 0x%08x\n", req->info.tile_flags);
return -EINVAL; return -EINVAL;
} }
@ -376,7 +376,7 @@ validate_init(struct nouveau_channel *chan, struct drm_file *file_priv,
ww_acquire_init(&op->ticket, &reservation_ww_class); ww_acquire_init(&op->ticket, &reservation_ww_class);
retry: retry:
if (++trycnt > 100000) { if (++trycnt > 100000) {
NV_PRINTK(error, cli, "%s failed and gave up.\n", __func__); NV_PRINTK(err, cli, "%s failed and gave up.\n", __func__);
return -EINVAL; return -EINVAL;
} }
@ -387,7 +387,7 @@ retry:
gem = drm_gem_object_lookup(dev, file_priv, b->handle); gem = drm_gem_object_lookup(dev, file_priv, b->handle);
if (!gem) { if (!gem) {
NV_PRINTK(error, cli, "Unknown handle 0x%08x\n", b->handle); NV_PRINTK(err, cli, "Unknown handle 0x%08x\n", b->handle);
ret = -ENOENT; ret = -ENOENT;
break; break;
} }
@ -399,7 +399,7 @@ retry:
} }
if (nvbo->reserved_by && nvbo->reserved_by == file_priv) { if (nvbo->reserved_by && nvbo->reserved_by == file_priv) {
NV_PRINTK(error, cli, "multiple instances of buffer %d on " NV_PRINTK(err, cli, "multiple instances of buffer %d on "
"validation list\n", b->handle); "validation list\n", b->handle);
drm_gem_object_unreference_unlocked(gem); drm_gem_object_unreference_unlocked(gem);
ret = -EINVAL; ret = -EINVAL;
@ -420,7 +420,7 @@ retry:
} }
if (unlikely(ret)) { if (unlikely(ret)) {
if (ret != -ERESTARTSYS) if (ret != -ERESTARTSYS)
NV_PRINTK(error, cli, "fail reserve\n"); NV_PRINTK(err, cli, "fail reserve\n");
break; break;
} }
} }
@ -438,7 +438,7 @@ retry:
if (b->valid_domains & NOUVEAU_GEM_DOMAIN_GART) if (b->valid_domains & NOUVEAU_GEM_DOMAIN_GART)
list_add_tail(&nvbo->entry, &gart_list); list_add_tail(&nvbo->entry, &gart_list);
else { else {
NV_PRINTK(error, cli, "invalid valid domains: 0x%08x\n", NV_PRINTK(err, cli, "invalid valid domains: 0x%08x\n",
b->valid_domains); b->valid_domains);
list_add_tail(&nvbo->entry, &both_list); list_add_tail(&nvbo->entry, &both_list);
ret = -EINVAL; ret = -EINVAL;
@ -476,21 +476,21 @@ validate_list(struct nouveau_channel *chan, struct nouveau_cli *cli,
b->write_domains, b->write_domains,
b->valid_domains); b->valid_domains);
if (unlikely(ret)) { if (unlikely(ret)) {
NV_PRINTK(error, cli, "fail set_domain\n"); NV_PRINTK(err, cli, "fail set_domain\n");
return ret; return ret;
} }
ret = nouveau_bo_validate(nvbo, true, false); ret = nouveau_bo_validate(nvbo, true, false);
if (unlikely(ret)) { if (unlikely(ret)) {
if (ret != -ERESTARTSYS) if (ret != -ERESTARTSYS)
NV_PRINTK(error, cli, "fail ttm_validate\n"); NV_PRINTK(err, cli, "fail ttm_validate\n");
return ret; return ret;
} }
ret = nouveau_fence_sync(nvbo, chan, !!b->write_domains, true); ret = nouveau_fence_sync(nvbo, chan, !!b->write_domains, true);
if (unlikely(ret)) { if (unlikely(ret)) {
if (ret != -ERESTARTSYS) if (ret != -ERESTARTSYS)
NV_PRINTK(error, cli, "fail post-validate sync\n"); NV_PRINTK(err, cli, "fail post-validate sync\n");
return ret; return ret;
} }
@ -537,14 +537,14 @@ nouveau_gem_pushbuf_validate(struct nouveau_channel *chan,
ret = validate_init(chan, file_priv, pbbo, nr_buffers, op); ret = validate_init(chan, file_priv, pbbo, nr_buffers, op);
if (unlikely(ret)) { if (unlikely(ret)) {
if (ret != -ERESTARTSYS) if (ret != -ERESTARTSYS)
NV_PRINTK(error, cli, "validate_init\n"); NV_PRINTK(err, cli, "validate_init\n");
return ret; return ret;
} }
ret = validate_list(chan, cli, &op->list, pbbo, user_buffers); ret = validate_list(chan, cli, &op->list, pbbo, user_buffers);
if (unlikely(ret < 0)) { if (unlikely(ret < 0)) {
if (ret != -ERESTARTSYS) if (ret != -ERESTARTSYS)
NV_PRINTK(error, cli, "validating bo list\n"); NV_PRINTK(err, cli, "validating bo list\n");
validate_fini(op, NULL, NULL); validate_fini(op, NULL, NULL);
return ret; return ret;
} }
@ -600,7 +600,7 @@ nouveau_gem_pushbuf_reloc_apply(struct nouveau_cli *cli,
uint32_t data; uint32_t data;
if (unlikely(r->bo_index > req->nr_buffers)) { if (unlikely(r->bo_index > req->nr_buffers)) {
NV_PRINTK(error, cli, "reloc bo index invalid\n"); NV_PRINTK(err, cli, "reloc bo index invalid\n");
ret = -EINVAL; ret = -EINVAL;
break; break;
} }
@ -610,7 +610,7 @@ nouveau_gem_pushbuf_reloc_apply(struct nouveau_cli *cli,
continue; continue;
if (unlikely(r->reloc_bo_index > req->nr_buffers)) { if (unlikely(r->reloc_bo_index > req->nr_buffers)) {
NV_PRINTK(error, cli, "reloc container bo index invalid\n"); NV_PRINTK(err, cli, "reloc container bo index invalid\n");
ret = -EINVAL; ret = -EINVAL;
break; break;
} }
@ -618,7 +618,7 @@ nouveau_gem_pushbuf_reloc_apply(struct nouveau_cli *cli,
if (unlikely(r->reloc_bo_offset + 4 > if (unlikely(r->reloc_bo_offset + 4 >
nvbo->bo.mem.num_pages << PAGE_SHIFT)) { nvbo->bo.mem.num_pages << PAGE_SHIFT)) {
NV_PRINTK(error, cli, "reloc outside of bo\n"); NV_PRINTK(err, cli, "reloc outside of bo\n");
ret = -EINVAL; ret = -EINVAL;
break; break;
} }
@ -627,7 +627,7 @@ nouveau_gem_pushbuf_reloc_apply(struct nouveau_cli *cli,
ret = ttm_bo_kmap(&nvbo->bo, 0, nvbo->bo.mem.num_pages, ret = ttm_bo_kmap(&nvbo->bo, 0, nvbo->bo.mem.num_pages,
&nvbo->kmap); &nvbo->kmap);
if (ret) { if (ret) {
NV_PRINTK(error, cli, "failed kmap for reloc\n"); NV_PRINTK(err, cli, "failed kmap for reloc\n");
break; break;
} }
nvbo->validate_mapped = true; nvbo->validate_mapped = true;
@ -650,7 +650,7 @@ nouveau_gem_pushbuf_reloc_apply(struct nouveau_cli *cli,
ret = ttm_bo_wait(&nvbo->bo, true, false, false); ret = ttm_bo_wait(&nvbo->bo, true, false, false);
if (ret) { if (ret) {
NV_PRINTK(error, cli, "reloc wait_idle failed: %d\n", ret); NV_PRINTK(err, cli, "reloc wait_idle failed: %d\n", ret);
break; break;
} }
@ -696,19 +696,19 @@ nouveau_gem_ioctl_pushbuf(struct drm_device *dev, void *data,
goto out_next; goto out_next;
if (unlikely(req->nr_push > NOUVEAU_GEM_MAX_PUSH)) { if (unlikely(req->nr_push > NOUVEAU_GEM_MAX_PUSH)) {
NV_PRINTK(error, cli, "pushbuf push count exceeds limit: %d max %d\n", NV_PRINTK(err, cli, "pushbuf push count exceeds limit: %d max %d\n",
req->nr_push, NOUVEAU_GEM_MAX_PUSH); req->nr_push, NOUVEAU_GEM_MAX_PUSH);
return nouveau_abi16_put(abi16, -EINVAL); return nouveau_abi16_put(abi16, -EINVAL);
} }
if (unlikely(req->nr_buffers > NOUVEAU_GEM_MAX_BUFFERS)) { if (unlikely(req->nr_buffers > NOUVEAU_GEM_MAX_BUFFERS)) {
NV_PRINTK(error, cli, "pushbuf bo count exceeds limit: %d max %d\n", NV_PRINTK(err, cli, "pushbuf bo count exceeds limit: %d max %d\n",
req->nr_buffers, NOUVEAU_GEM_MAX_BUFFERS); req->nr_buffers, NOUVEAU_GEM_MAX_BUFFERS);
return nouveau_abi16_put(abi16, -EINVAL); return nouveau_abi16_put(abi16, -EINVAL);
} }
if (unlikely(req->nr_relocs > NOUVEAU_GEM_MAX_RELOCS)) { if (unlikely(req->nr_relocs > NOUVEAU_GEM_MAX_RELOCS)) {
NV_PRINTK(error, cli, "pushbuf reloc count exceeds limit: %d max %d\n", NV_PRINTK(err, cli, "pushbuf reloc count exceeds limit: %d max %d\n",
req->nr_relocs, NOUVEAU_GEM_MAX_RELOCS); req->nr_relocs, NOUVEAU_GEM_MAX_RELOCS);
return nouveau_abi16_put(abi16, -EINVAL); return nouveau_abi16_put(abi16, -EINVAL);
} }
@ -726,7 +726,7 @@ nouveau_gem_ioctl_pushbuf(struct drm_device *dev, void *data,
/* Ensure all push buffers are on validate list */ /* Ensure all push buffers are on validate list */
for (i = 0; i < req->nr_push; i++) { for (i = 0; i < req->nr_push; i++) {
if (push[i].bo_index >= req->nr_buffers) { if (push[i].bo_index >= req->nr_buffers) {
NV_PRINTK(error, cli, "push %d buffer not in list\n", i); NV_PRINTK(err, cli, "push %d buffer not in list\n", i);
ret = -EINVAL; ret = -EINVAL;
goto out_prevalid; goto out_prevalid;
} }
@ -737,7 +737,7 @@ nouveau_gem_ioctl_pushbuf(struct drm_device *dev, void *data,
req->nr_buffers, &op, &do_reloc); req->nr_buffers, &op, &do_reloc);
if (ret) { if (ret) {
if (ret != -ERESTARTSYS) if (ret != -ERESTARTSYS)
NV_PRINTK(error, cli, "validate: %d\n", ret); NV_PRINTK(err, cli, "validate: %d\n", ret);
goto out_prevalid; goto out_prevalid;
} }
@ -745,7 +745,7 @@ nouveau_gem_ioctl_pushbuf(struct drm_device *dev, void *data,
if (do_reloc) { if (do_reloc) {
ret = nouveau_gem_pushbuf_reloc_apply(cli, req, bo); ret = nouveau_gem_pushbuf_reloc_apply(cli, req, bo);
if (ret) { if (ret) {
NV_PRINTK(error, cli, "reloc apply: %d\n", ret); NV_PRINTK(err, cli, "reloc apply: %d\n", ret);
goto out; goto out;
} }
} }
@ -753,7 +753,7 @@ nouveau_gem_ioctl_pushbuf(struct drm_device *dev, void *data,
if (chan->dma.ib_max) { if (chan->dma.ib_max) {
ret = nouveau_dma_wait(chan, req->nr_push + 1, 16); ret = nouveau_dma_wait(chan, req->nr_push + 1, 16);
if (ret) { if (ret) {
NV_PRINTK(error, cli, "nv50cal_space: %d\n", ret); NV_PRINTK(err, cli, "nv50cal_space: %d\n", ret);
goto out; goto out;
} }
@ -768,7 +768,7 @@ nouveau_gem_ioctl_pushbuf(struct drm_device *dev, void *data,
if (drm->device.info.chipset >= 0x25) { if (drm->device.info.chipset >= 0x25) {
ret = RING_SPACE(chan, req->nr_push * 2); ret = RING_SPACE(chan, req->nr_push * 2);
if (ret) { if (ret) {
NV_PRINTK(error, cli, "cal_space: %d\n", ret); NV_PRINTK(err, cli, "cal_space: %d\n", ret);
goto out; goto out;
} }
@ -782,7 +782,7 @@ nouveau_gem_ioctl_pushbuf(struct drm_device *dev, void *data,
} else { } else {
ret = RING_SPACE(chan, req->nr_push * (2 + NOUVEAU_DMA_SKIPS)); ret = RING_SPACE(chan, req->nr_push * (2 + NOUVEAU_DMA_SKIPS));
if (ret) { if (ret) {
NV_PRINTK(error, cli, "jmp_space: %d\n", ret); NV_PRINTK(err, cli, "jmp_space: %d\n", ret);
goto out; goto out;
} }
@ -820,7 +820,7 @@ nouveau_gem_ioctl_pushbuf(struct drm_device *dev, void *data,
ret = nouveau_fence_new(chan, false, &fence); ret = nouveau_fence_new(chan, false, &fence);
if (ret) { if (ret) {
NV_PRINTK(error, cli, "error fencing pushbuf: %d\n", ret); NV_PRINTK(err, cli, "error fencing pushbuf: %d\n", ret);
WIND_RING(chan); WIND_RING(chan);
goto out; goto out;
} }

View File

@ -426,7 +426,7 @@ evo_wait(void *evoc, int nr)
break; break;
) < 0) { ) < 0) {
mutex_unlock(&dmac->lock); mutex_unlock(&dmac->lock);
nv_error(nvxx_object(&dmac->base.user), "channel stalled\n"); printk(KERN_ERR "nouveau: evo channel stalled\n");
return NULL; return NULL;
} }