From f7a7d22ad6781a34ffc718865700883d3cbf6c06 Mon Sep 17 00:00:00 2001 From: Ben Skeggs Date: Mon, 8 Jun 2020 14:47:37 +1000 Subject: [PATCH] drm/nouveau/nvif: give every notify object a human-readable name Signed-off-by: Ben Skeggs Reviewed-by: Lyude Paul --- drivers/gpu/drm/nouveau/dispnv04/crtc.c | 4 ++-- drivers/gpu/drm/nouveau/dispnv04/disp.c | 4 ++-- drivers/gpu/drm/nouveau/dispnv50/base507c.c | 5 +++-- drivers/gpu/drm/nouveau/dispnv50/head.c | 4 ++-- drivers/gpu/drm/nouveau/dispnv50/ovly507e.c | 3 ++- drivers/gpu/drm/nouveau/dispnv50/wndw.c | 2 +- drivers/gpu/drm/nouveau/include/nvif/notify.h | 9 +++++---- drivers/gpu/drm/nouveau/nouveau_chan.c | 5 +++-- drivers/gpu/drm/nouveau/nouveau_connector.c | 5 +++-- drivers/gpu/drm/nouveau/nouveau_fence.c | 5 +++-- drivers/gpu/drm/nouveau/nouveau_svm.c | 6 +++--- drivers/gpu/drm/nouveau/nvif/notify.c | 11 ++++++----- 12 files changed, 35 insertions(+), 28 deletions(-) diff --git a/drivers/gpu/drm/nouveau/dispnv04/crtc.c b/drivers/gpu/drm/nouveau/dispnv04/crtc.c index 4989627b7802..3d3348478549 100644 --- a/drivers/gpu/drm/nouveau/dispnv04/crtc.c +++ b/drivers/gpu/drm/nouveau/dispnv04/crtc.c @@ -759,7 +759,7 @@ static void nv_crtc_destroy(struct drm_crtc *crtc) nouveau_bo_unmap(nv_crtc->cursor.nvbo); nouveau_bo_unpin(nv_crtc->cursor.nvbo); nouveau_bo_ref(NULL, &nv_crtc->cursor.nvbo); - nvif_notify_fini(&nv_crtc->vblank); + nvif_notify_dtor(&nv_crtc->vblank); kfree(nv_crtc); } @@ -1351,7 +1351,7 @@ nv04_crtc_create(struct drm_device *dev, int crtc_num) nv04_cursor_init(nv_crtc); - ret = nvif_notify_init(&disp->disp.object, nv04_crtc_vblank_handler, + ret = nvif_notify_ctor(&disp->disp.object, "kmsVbl", nv04_crtc_vblank_handler, false, NV04_DISP_NTFY_VBLANK, &(struct nvif_notify_head_req_v0) { .head = nv_crtc->index, diff --git a/drivers/gpu/drm/nouveau/dispnv04/disp.c b/drivers/gpu/drm/nouveau/dispnv04/disp.c index 76be805fc488..075fe017915d 100644 --- a/drivers/gpu/drm/nouveau/dispnv04/disp.c +++ b/drivers/gpu/drm/nouveau/dispnv04/disp.c @@ -178,7 +178,7 @@ nv04_display_destroy(struct drm_device *dev) nouveau_hw_save_vga_fonts(dev, 0); - nvif_notify_fini(&disp->flip); + nvif_notify_dtor(&disp->flip); nouveau_display(dev)->priv = NULL; kfree(disp); @@ -215,7 +215,7 @@ nv04_display_create(struct drm_device *dev) /* Request page flip completion event. */ if (drm->nvsw.client) { - nvif_notify_init(&drm->nvsw, nv04_flip_complete, + nvif_notify_ctor(&drm->nvsw, "kmsFlip", nv04_flip_complete, false, NV04_NVSW_NTFY_UEVENT, NULL, 0, 0, &disp->flip); } diff --git a/drivers/gpu/drm/nouveau/dispnv50/base507c.c b/drivers/gpu/drm/nouveau/dispnv50/base507c.c index ba20a7722900..c37f2278ce3e 100644 --- a/drivers/gpu/drm/nouveau/dispnv50/base507c.c +++ b/drivers/gpu/drm/nouveau/dispnv50/base507c.c @@ -282,8 +282,9 @@ base507c_new_(const struct nv50_wndw_func *func, const u32 *format, return ret; } - ret = nvif_notify_init(&wndw->wndw.base.user, wndw->notify.func, - false, NV50_DISP_BASE_CHANNEL_DMA_V0_NTFY_UEVENT, + ret = nvif_notify_ctor(&wndw->wndw.base.user, "kmsBaseNtfy", + wndw->notify.func, false, + NV50_DISP_BASE_CHANNEL_DMA_V0_NTFY_UEVENT, &(struct nvif_notify_uevent_req) {}, sizeof(struct nvif_notify_uevent_req), sizeof(struct nvif_notify_uevent_rep), diff --git a/drivers/gpu/drm/nouveau/dispnv50/head.c b/drivers/gpu/drm/nouveau/dispnv50/head.c index 9a10ec267d1f..2d84eafd7b3e 100644 --- a/drivers/gpu/drm/nouveau/dispnv50/head.c +++ b/drivers/gpu/drm/nouveau/dispnv50/head.c @@ -489,7 +489,7 @@ nv50_head_destroy(struct drm_crtc *crtc) { struct nv50_head *head = nv50_head(crtc); - nvif_notify_fini(&head->base.vblank); + nvif_notify_dtor(&head->base.vblank); nv50_lut_fini(&head->olut); drm_crtc_cleanup(crtc); kfree(head); @@ -598,7 +598,7 @@ nv50_head_create(struct drm_device *dev, int index) } } - ret = nvif_notify_init(&disp->disp->object, nv50_head_vblank_handler, + ret = nvif_notify_ctor(&disp->disp->object, "kmsVbl", nv50_head_vblank_handler, false, NV04_DISP_NTFY_VBLANK, &(struct nvif_notify_head_req_v0) { .head = nv_crtc->index, diff --git a/drivers/gpu/drm/nouveau/dispnv50/ovly507e.c b/drivers/gpu/drm/nouveau/dispnv50/ovly507e.c index 4cce1078140a..1371225996e9 100644 --- a/drivers/gpu/drm/nouveau/dispnv50/ovly507e.c +++ b/drivers/gpu/drm/nouveau/dispnv50/ovly507e.c @@ -192,7 +192,8 @@ ovly507e_new_(const struct nv50_wndw_func *func, const u32 *format, return ret; } - ret = nvif_notify_init(&wndw->wndw.base.user, wndw->notify.func, false, + ret = nvif_notify_ctor(&wndw->wndw.base.user, "kmsOvlyNtfy", + wndw->notify.func, false, NV50_DISP_OVERLAY_CHANNEL_DMA_V0_NTFY_UEVENT, &(struct nvif_notify_uevent_req) {}, sizeof(struct nvif_notify_uevent_req), diff --git a/drivers/gpu/drm/nouveau/dispnv50/wndw.c b/drivers/gpu/drm/nouveau/dispnv50/wndw.c index be67ef0785d8..baf693e5641c 100644 --- a/drivers/gpu/drm/nouveau/dispnv50/wndw.c +++ b/drivers/gpu/drm/nouveau/dispnv50/wndw.c @@ -609,7 +609,7 @@ nv50_wndw_destroy(struct drm_plane *plane) nv50_wndw_ctxdma_del(ctxdma); } - nvif_notify_fini(&wndw->notify); + nvif_notify_dtor(&wndw->notify); nv50_dmac_destroy(&wndw->wimm); nv50_dmac_destroy(&wndw->wndw); diff --git a/drivers/gpu/drm/nouveau/include/nvif/notify.h b/drivers/gpu/drm/nouveau/include/nvif/notify.h index 6863732eb286..39f6b7ee1719 100644 --- a/drivers/gpu/drm/nouveau/include/nvif/notify.h +++ b/drivers/gpu/drm/nouveau/include/nvif/notify.h @@ -4,6 +4,7 @@ struct nvif_notify { struct nvif_object *object; + const char *name; int index; #define NVIF_NOTIFY_USER 0 @@ -24,10 +25,10 @@ struct nvif_notify { struct work_struct work; }; -int nvif_notify_init(struct nvif_object *, int (*func)(struct nvif_notify *), - bool work, u8 type, void *data, u32 size, u32 reply, - struct nvif_notify *); -int nvif_notify_fini(struct nvif_notify *); +int nvif_notify_ctor(struct nvif_object *, const char *name, + int (*func)(struct nvif_notify *), bool work, u8 type, + void *data, u32 size, u32 reply, struct nvif_notify *); +int nvif_notify_dtor(struct nvif_notify *); int nvif_notify_get(struct nvif_notify *); int nvif_notify_put(struct nvif_notify *); int nvif_notify(const void *, u32, const void *, u32); diff --git a/drivers/gpu/drm/nouveau/nouveau_chan.c b/drivers/gpu/drm/nouveau/nouveau_chan.c index 59dbea9eab36..d208ef4b158c 100644 --- a/drivers/gpu/drm/nouveau/nouveau_chan.c +++ b/drivers/gpu/drm/nouveau/nouveau_chan.c @@ -105,7 +105,7 @@ nouveau_channel_del(struct nouveau_channel **pchan) nvif_object_dtor(&chan->nvsw); nvif_object_dtor(&chan->gart); nvif_object_dtor(&chan->vram); - nvif_notify_fini(&chan->kill); + nvif_notify_dtor(&chan->kill); nvif_object_dtor(&chan->user); nvif_object_dtor(&chan->push.ctxdma); nouveau_vma_del(&chan->push.vma); @@ -366,7 +366,8 @@ nouveau_channel_init(struct nouveau_channel *chan, u32 vram, u32 gart) nvif_object_map(&chan->user, NULL, 0); if (chan->user.oclass >= FERMI_CHANNEL_GPFIFO) { - ret = nvif_notify_init(&chan->user, nouveau_channel_killed, + ret = nvif_notify_ctor(&chan->user, "abi16ChanKilled", + nouveau_channel_killed, true, NV906F_V0_NTFY_KILLED, NULL, 0, 0, &chan->kill); if (ret == 0) diff --git a/drivers/gpu/drm/nouveau/nouveau_connector.c b/drivers/gpu/drm/nouveau/nouveau_connector.c index 471fd5ca5352..7674025a4bfe 100644 --- a/drivers/gpu/drm/nouveau/nouveau_connector.c +++ b/drivers/gpu/drm/nouveau/nouveau_connector.c @@ -409,7 +409,7 @@ static void nouveau_connector_destroy(struct drm_connector *connector) { struct nouveau_connector *nv_connector = nouveau_connector(connector); - nvif_notify_fini(&nv_connector->hpd); + nvif_notify_dtor(&nv_connector->hpd); kfree(nv_connector->edid); drm_connector_unregister(connector); drm_connector_cleanup(connector); @@ -1450,7 +1450,8 @@ nouveau_connector_create(struct drm_device *dev, break; } - ret = nvif_notify_init(&disp->disp.object, nouveau_connector_hotplug, + ret = nvif_notify_ctor(&disp->disp.object, "kmsHotplug", + nouveau_connector_hotplug, true, NV04_DISP_NTFY_CONN, &(struct nvif_notify_conn_req_v0) { .mask = NVIF_NOTIFY_CONN_V0_ANY, diff --git a/drivers/gpu/drm/nouveau/nouveau_fence.c b/drivers/gpu/drm/nouveau/nouveau_fence.c index 666f2090d92b..e5dcbf67de7e 100644 --- a/drivers/gpu/drm/nouveau/nouveau_fence.c +++ b/drivers/gpu/drm/nouveau/nouveau_fence.c @@ -108,7 +108,7 @@ void nouveau_fence_context_del(struct nouveau_fence_chan *fctx) { nouveau_fence_context_kill(fctx, 0); - nvif_notify_fini(&fctx->notify); + nvif_notify_dtor(&fctx->notify); fctx->dead = 1; /* @@ -195,7 +195,8 @@ nouveau_fence_context_new(struct nouveau_channel *chan, struct nouveau_fence_cha if (!priv->uevent) return; - ret = nvif_notify_init(&chan->user, nouveau_fence_wait_uevent_handler, + ret = nvif_notify_ctor(&chan->user, "fenceNonStallIntr", + nouveau_fence_wait_uevent_handler, false, NV826E_V0_NTFY_NON_STALL_INTERRUPT, &(struct nvif_notify_uevent_req) { }, sizeof(struct nvif_notify_uevent_req), diff --git a/drivers/gpu/drm/nouveau/nouveau_svm.c b/drivers/gpu/drm/nouveau/nouveau_svm.c index 6f65fa73e1cd..d4b4f866ab78 100644 --- a/drivers/gpu/drm/nouveau/nouveau_svm.c +++ b/drivers/gpu/drm/nouveau/nouveau_svm.c @@ -905,7 +905,7 @@ nouveau_svm_fault_buffer_dtor(struct nouveau_svm *svm, int id) nouveau_svm_fault_buffer_fini(svm, id); - nvif_notify_fini(&buffer->notify); + nvif_notify_dtor(&buffer->notify); nvif_object_dtor(&buffer->object); } @@ -932,8 +932,8 @@ nouveau_svm_fault_buffer_ctor(struct nouveau_svm *svm, s32 oclass, int id) buffer->getaddr = args.get; buffer->putaddr = args.put; - ret = nvif_notify_init(&buffer->object, nouveau_svm_fault, true, - NVB069_V0_NTFY_FAULT, NULL, 0, 0, + ret = nvif_notify_ctor(&buffer->object, "svmFault", nouveau_svm_fault, + true, NVB069_V0_NTFY_FAULT, NULL, 0, 0, &buffer->notify); if (ret) return ret; diff --git a/drivers/gpu/drm/nouveau/nvif/notify.c b/drivers/gpu/drm/nouveau/nvif/notify.c index 278b3933dc96..143c8dc6889e 100644 --- a/drivers/gpu/drm/nouveau/nvif/notify.c +++ b/drivers/gpu/drm/nouveau/nvif/notify.c @@ -142,7 +142,7 @@ nvif_notify(const void *header, u32 length, const void *data, u32 size) } int -nvif_notify_fini(struct nvif_notify *notify) +nvif_notify_dtor(struct nvif_notify *notify) { struct nvif_object *object = notify->object; struct { @@ -162,9 +162,9 @@ nvif_notify_fini(struct nvif_notify *notify) } int -nvif_notify_init(struct nvif_object *object, int (*func)(struct nvif_notify *), - bool work, u8 event, void *data, u32 size, u32 reply, - struct nvif_notify *notify) +nvif_notify_ctor(struct nvif_object *object, const char *name, + int (*func)(struct nvif_notify *), bool work, u8 event, + void *data, u32 size, u32 reply, struct nvif_notify *notify) { struct { struct nvif_ioctl_v0 ioctl; @@ -174,6 +174,7 @@ nvif_notify_init(struct nvif_object *object, int (*func)(struct nvif_notify *), int ret = -ENOMEM; notify->object = object; + notify->name = name ? name : "nvifNotify"; notify->flags = 0; atomic_set(¬ify->putcnt, 1); notify->func = func; @@ -204,6 +205,6 @@ nvif_notify_init(struct nvif_object *object, int (*func)(struct nvif_notify *), kfree(args); done: if (ret) - nvif_notify_fini(notify); + nvif_notify_dtor(notify); return ret; } -- 2.39.5