diff options
author | Dave Airlie <airlied@redhat.com> | 2022-07-13 14:26:24 +1000 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2022-07-13 14:27:12 +1000 |
commit | 0180290abb5ce5c870f84a00ffeda5802f641dce (patch) | |
tree | 48da2cf9b20cc7049c92dd4a7dd74be11add86e5 | |
parent | 1ebdc90eb71aad6463e83771fe05a1eac49164da (diff) | |
parent | 89ed996b888faaf11c69bb4cbc19f21475c9050e (diff) | |
download | linux-0180290abb5ce5c870f84a00ffeda5802f641dce.tar.gz linux-0180290abb5ce5c870f84a00ffeda5802f641dce.tar.bz2 linux-0180290abb5ce5c870f84a00ffeda5802f641dce.zip |
Merge tag 'topic/nouveau-misc-2022-07-13-1' of git://anongit.freedesktop.org/drm/drm into drm-next
drm/nouveau next misc
This is a set of misc nouveau patches skeggsb left queued up, just
flushing some of them out.
Signed-off-by: Dave Airlie <airlied@redhat.com>
From: Dave Airlie <airlied@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/CAPM=9txSS9Pdagpi=3JJeFOGy6ALWC31WZdQxLBkfGeL3O+T1A@mail.gmail.com
34 files changed, 112 insertions, 556 deletions
diff --git a/drivers/gpu/drm/nouveau/dispnv50/disp.c b/drivers/gpu/drm/nouveau/dispnv50/disp.c index 4347f0b61797..ade2988e85f3 100644 --- a/drivers/gpu/drm/nouveau/dispnv50/disp.c +++ b/drivers/gpu/drm/nouveau/dispnv50/disp.c @@ -2623,14 +2623,6 @@ nv50_display_fini(struct drm_device *dev, bool runtime, bool suspend) { struct nouveau_drm *drm = nouveau_drm(dev); struct drm_encoder *encoder; - struct drm_plane *plane; - - drm_for_each_plane(plane, dev) { - struct nv50_wndw *wndw = nv50_wndw(plane); - if (plane->funcs != &nv50_wndw) - continue; - nv50_wndw_fini(wndw); - } list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) { if (encoder->encoder_type != DRM_MODE_ENCODER_DPMST) @@ -2646,7 +2638,6 @@ nv50_display_init(struct drm_device *dev, bool resume, bool runtime) { struct nv50_core *core = nv50_disp(dev)->core; struct drm_encoder *encoder; - struct drm_plane *plane; if (resume || runtime) core->func->init(core); @@ -2659,13 +2650,6 @@ nv50_display_init(struct drm_device *dev, bool resume, bool runtime) } } - drm_for_each_plane(plane, dev) { - struct nv50_wndw *wndw = nv50_wndw(plane); - if (plane->funcs != &nv50_wndw) - continue; - nv50_wndw_init(wndw); - } - return 0; } diff --git a/drivers/gpu/drm/nouveau/dispnv50/wndw.c b/drivers/gpu/drm/nouveau/dispnv50/wndw.c index ef21cfa2b28e..b21f49f0eae5 100644 --- a/drivers/gpu/drm/nouveau/dispnv50/wndw.c +++ b/drivers/gpu/drm/nouveau/dispnv50/wndw.c @@ -694,18 +694,6 @@ nv50_wndw_notify(struct nvif_notify *notify) return NVIF_NOTIFY_KEEP; } -void -nv50_wndw_fini(struct nv50_wndw *wndw) -{ - nvif_notify_put(&wndw->notify); -} - -void -nv50_wndw_init(struct nv50_wndw *wndw) -{ - nvif_notify_get(&wndw->notify); -} - static const u64 nv50_cursor_format_modifiers[] = { DRM_FORMAT_MOD_LINEAR, DRM_FORMAT_MOD_INVALID, diff --git a/drivers/gpu/drm/nouveau/dispnv50/wndw.h b/drivers/gpu/drm/nouveau/dispnv50/wndw.h index 9c9f2c2a71a5..96542ce666fc 100644 --- a/drivers/gpu/drm/nouveau/dispnv50/wndw.h +++ b/drivers/gpu/drm/nouveau/dispnv50/wndw.h @@ -40,8 +40,6 @@ int nv50_wndw_new_(const struct nv50_wndw_func *, struct drm_device *, enum drm_plane_type, const char *name, int index, const u32 *format, enum nv50_disp_interlock_type, u32 interlock_data, u32 heads, struct nv50_wndw **); -void nv50_wndw_init(struct nv50_wndw *); -void nv50_wndw_fini(struct nv50_wndw *); void nv50_wndw_flush_set(struct nv50_wndw *, u32 *interlock, struct nv50_wndw_atom *); void nv50_wndw_flush_clr(struct nv50_wndw *, u32 *interlock, bool flush, diff --git a/drivers/gpu/drm/nouveau/include/nvif/object.h b/drivers/gpu/drm/nouveau/include/nvif/object.h index 1e4c158d20fa..f52399caee82 100644 --- a/drivers/gpu/drm/nouveau/include/nvif/object.h +++ b/drivers/gpu/drm/nouveau/include/nvif/object.h @@ -22,6 +22,12 @@ struct nvif_object { } map; }; +static inline bool +nvif_object_constructed(struct nvif_object *object) +{ + return object->client != NULL; +} + int nvif_object_ctor(struct nvif_object *, const char *name, u32 handle, s32 oclass, void *, u32, struct nvif_object *); void nvif_object_dtor(struct nvif_object *); diff --git a/drivers/gpu/drm/nouveau/include/nvkm/core/device.h b/drivers/gpu/drm/nouveau/include/nvkm/core/device.h index a18b6cfda07e..efede1f11e1d 100644 --- a/drivers/gpu/drm/nouveau/include/nvkm/core/device.h +++ b/drivers/gpu/drm/nouveau/include/nvkm/core/device.h @@ -2,7 +2,6 @@ #ifndef __NVKM_DEVICE_H__ #define __NVKM_DEVICE_H__ #include <core/oclass.h> -#include <core/event.h> enum nvkm_subdev_type; enum nvkm_device_type { @@ -28,8 +27,6 @@ struct nvkm_device { void __iomem *pri; - struct nvkm_event event; - u32 debug; const struct nvkm_device_chip *chip; diff --git a/drivers/gpu/drm/nouveau/include/nvkm/engine/falcon.h b/drivers/gpu/drm/nouveau/include/nvkm/engine/falcon.h index 306125d17ece..b593407b9e36 100644 --- a/drivers/gpu/drm/nouveau/include/nvkm/engine/falcon.h +++ b/drivers/gpu/drm/nouveau/include/nvkm/engine/falcon.h @@ -4,7 +4,6 @@ #define nvkm_falcon(p) container_of((p), struct nvkm_falcon, engine) #include <core/engine.h> struct nvkm_fifo_chan; -struct nvkm_gpuobj; enum nvkm_falcon_dmaidx { FALCON_DMAIDX_UCODE = 0, @@ -51,15 +50,6 @@ struct nvkm_falcon { struct nvkm_engine engine; }; -/* This constructor must be called from the owner's oneinit() hook and - * *not* its constructor. This is to ensure that DEVINIT has been - * completed, and that the device is correctly enabled before we touch - * falcon registers. - */ -int nvkm_falcon_v1_new(struct nvkm_subdev *owner, const char *name, u32 addr, - struct nvkm_falcon **); - -void nvkm_falcon_del(struct nvkm_falcon **); int nvkm_falcon_get(struct nvkm_falcon *, const struct nvkm_subdev *); void nvkm_falcon_put(struct nvkm_falcon *, const struct nvkm_subdev *); diff --git a/drivers/gpu/drm/nouveau/include/nvkm/engine/fifo.h b/drivers/gpu/drm/nouveau/include/nvkm/engine/fifo.h index 64ee82c7c1be..15099913504d 100644 --- a/drivers/gpu/drm/nouveau/include/nvkm/engine/fifo.h +++ b/drivers/gpu/drm/nouveau/include/nvkm/engine/fifo.h @@ -26,7 +26,6 @@ struct nvkm_fifo_chan { struct nvkm_gpuobj *inst; struct nvkm_gpuobj *push; struct nvkm_vmm *vmm; - void __iomem *user; u64 addr; u32 size; @@ -44,7 +43,6 @@ struct nvkm_fifo { struct mutex mutex; struct nvkm_event uevent; /* async user trigger */ - struct nvkm_event cevent; /* channel creation event */ struct nvkm_event kevent; /* channel killed */ }; diff --git a/drivers/gpu/drm/nouveau/include/nvkm/subdev/clk.h b/drivers/gpu/drm/nouveau/include/nvkm/subdev/clk.h index 05b99c9e9a26..d5d8877064a7 100644 --- a/drivers/gpu/drm/nouveau/include/nvkm/subdev/clk.h +++ b/drivers/gpu/drm/nouveau/include/nvkm/subdev/clk.h @@ -2,7 +2,6 @@ #ifndef __NVKM_CLK_H__ #define __NVKM_CLK_H__ #include <core/subdev.h> -#include <core/notify.h> #include <subdev/pci.h> struct nvbios_pll; struct nvkm_pll_vals; @@ -94,7 +93,6 @@ struct nvkm_clk { wait_queue_head_t wait; atomic_t waiting; - struct nvkm_notify pwrsrc_ntfy; int pwrsrc; int pstate; /* current */ int ustate_ac; /* user-requested (-1 disabled, -2 perfmon) */ @@ -124,6 +122,7 @@ int nvkm_clk_ustate(struct nvkm_clk *, int req, int pwr); int nvkm_clk_astate(struct nvkm_clk *, int req, int rel, bool wait); int nvkm_clk_dstate(struct nvkm_clk *, int req, int rel); int nvkm_clk_tstate(struct nvkm_clk *, u8 temperature); +int nvkm_clk_pwrsrc(struct nvkm_device *); int nv04_clk_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_clk **); int nv40_clk_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_clk **); diff --git a/drivers/gpu/drm/nouveau/include/nvkm/subdev/fault.h b/drivers/gpu/drm/nouveau/include/nvkm/subdev/fault.h index 581458ad38e0..9c78f072d62b 100644 --- a/drivers/gpu/drm/nouveau/include/nvkm/subdev/fault.h +++ b/drivers/gpu/drm/nouveau/include/nvkm/subdev/fault.h @@ -1,6 +1,7 @@ #ifndef __NVKM_FAULT_H__ #define __NVKM_FAULT_H__ #include <core/subdev.h> +#include <core/event.h> #include <core/notify.h> struct nvkm_fault { diff --git a/drivers/gpu/drm/nouveau/include/nvkm/subdev/secboot.h b/drivers/gpu/drm/nouveau/include/nvkm/subdev/secboot.h deleted file mode 100644 index b57fe4ae93ba..000000000000 --- a/drivers/gpu/drm/nouveau/include/nvkm/subdev/secboot.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ - -#ifndef __NVKM_SECURE_BOOT_H__ -#define __NVKM_SECURE_BOOT_H__ - -#include <core/subdev.h> - -enum nvkm_secboot_falcon { - NVKM_SECBOOT_FALCON_PMU = 0, - NVKM_SECBOOT_FALCON_RESERVED = 1, - NVKM_SECBOOT_FALCON_FECS = 2, - NVKM_SECBOOT_FALCON_GPCCS = 3, - NVKM_SECBOOT_FALCON_SEC2 = 7, - NVKM_SECBOOT_FALCON_END = 8, - NVKM_SECBOOT_FALCON_INVALID = 0xffffffff, -}; - -extern const char *nvkm_secboot_falcon_name[]; - -/** - * @wpr_set: whether the WPR region is currently set -*/ -struct nvkm_secboot { - const struct nvkm_secboot_func *func; - struct nvkm_acr *acr; - struct nvkm_subdev subdev; - struct nvkm_falcon *boot_falcon; - struct nvkm_falcon *halt_falcon; - - u64 wpr_addr; - u32 wpr_size; - - bool wpr_set; -}; -#define nvkm_secboot(p) container_of((p), struct nvkm_secboot, subdev) - -bool nvkm_secboot_is_managed(struct nvkm_secboot *, enum nvkm_secboot_falcon); -int nvkm_secboot_reset(struct nvkm_secboot *, unsigned long); - -int gm200_secboot_new(struct nvkm_device *, int, struct nvkm_secboot **); -int gm20b_secboot_new(struct nvkm_device *, int, struct nvkm_secboot **); -int gp102_secboot_new(struct nvkm_device *, int, struct nvkm_secboot **); -int gp108_secboot_new(struct nvkm_device *, int, struct nvkm_secboot **); -int gp10b_secboot_new(struct nvkm_device *, int, struct nvkm_secboot **); - -#endif diff --git a/drivers/gpu/drm/nouveau/nouveau_abi16.c b/drivers/gpu/drm/nouveau/nouveau_abi16.c index 4107b7006539..5bee655e7e63 100644 --- a/drivers/gpu/drm/nouveau/nouveau_abi16.c +++ b/drivers/gpu/drm/nouveau/nouveau_abi16.c @@ -126,9 +126,8 @@ nouveau_abi16_chan_fini(struct nouveau_abi16 *abi16, { struct nouveau_abi16_ntfy *ntfy, *temp; - /* wait for all activity to stop before releasing notify object, which - * may be still in use */ - if (chan->chan && chan->ntfy) + /* wait for all activity to stop before cleaning up */ + if (chan->chan) nouveau_channel_idle(chan->chan); /* cleanup notifier state */ @@ -147,7 +146,7 @@ nouveau_abi16_chan_fini(struct nouveau_abi16 *abi16, /* destroy channel object, all children will be killed too */ if (chan->chan) { - nouveau_channel_idle(chan->chan); + nvif_object_dtor(&chan->ce); nouveau_channel_del(&chan->chan); } @@ -325,6 +324,31 @@ nouveau_abi16_ioctl_channel_alloc(ABI16_IOCTL_ARGS) init->nr_subchan = 2; } + /* Workaround "nvc0" gallium driver using classes it doesn't allocate on + * Kepler and above. NVKM no longer always sets CE_CTX_VALID as part of + * channel init, now we know what that stuff actually is. + * + * Doesn't matter for Kepler/Pascal, CE context stored in NV_RAMIN. + * + * Userspace was fixed prior to adding Ampere support. + */ + switch (device->info.family) { + case NV_DEVICE_INFO_V0_VOLTA: + ret = nvif_object_ctor(&chan->chan->user, "abi16CeWar", 0, VOLTA_DMA_COPY_A, + NULL, 0, &chan->ce); + if (ret) + goto done; + break; + case NV_DEVICE_INFO_V0_TURING: + ret = nvif_object_ctor(&chan->chan->user, "abi16CeWar", 0, TURING_DMA_COPY_A, + NULL, 0, &chan->ce); + if (ret) + goto done; + break; + default: + break; + } + /* Named memory object area */ ret = nouveau_gem_new(cli, PAGE_SIZE, 0, NOUVEAU_GEM_DOMAIN_GART, 0, 0, &chan->ntfy); diff --git a/drivers/gpu/drm/nouveau/nouveau_abi16.h b/drivers/gpu/drm/nouveau/nouveau_abi16.h index 70f6aa5c9dd1..27eae85f33e6 100644 --- a/drivers/gpu/drm/nouveau/nouveau_abi16.h +++ b/drivers/gpu/drm/nouveau/nouveau_abi16.h @@ -21,6 +21,7 @@ struct nouveau_abi16_ntfy { struct nouveau_abi16_chan { struct list_head head; struct nouveau_channel *chan; + struct nvif_object ce; struct list_head notifiers; struct nouveau_bo *ntfy; struct nouveau_vma *ntfy_vma; diff --git a/drivers/gpu/drm/nouveau/nouveau_chan.c b/drivers/gpu/drm/nouveau/nouveau_chan.c index ea7769135b0d..48dea5d0c580 100644 --- a/drivers/gpu/drm/nouveau/nouveau_chan.c +++ b/drivers/gpu/drm/nouveau/nouveau_chan.c @@ -385,7 +385,9 @@ nouveau_channel_init(struct nouveau_channel *chan, u32 vram, u32 gart) struct nv_dma_v0 args = {}; int ret, i; - nvif_object_map(&chan->user, NULL, 0); + ret = nvif_object_map(&chan->user, NULL, 0); + if (ret) + return ret; if (chan->user.oclass >= FERMI_CHANNEL_GPFIFO && chan->user.oclass < AMPERE_CHANNEL_GPFIFO_B) { diff --git a/drivers/gpu/drm/nouveau/nouveau_drv.h b/drivers/gpu/drm/nouveau/nouveau_drv.h index b2a970aa9bf4..84df5ddae4d0 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drv.h +++ b/drivers/gpu/drm/nouveau/nouveau_drv.h @@ -102,7 +102,6 @@ struct nouveau_cli { struct list_head head; void *abi16; struct list_head objects; - struct list_head notifys; char name[32]; struct work_struct work; diff --git a/drivers/gpu/drm/nouveau/nouveau_nvif.c b/drivers/gpu/drm/nouveau/nouveau_nvif.c index 52f5793b7274..df0fe58ca3ab 100644 --- a/drivers/gpu/drm/nouveau/nouveau_nvif.c +++ b/drivers/gpu/drm/nouveau/nouveau_nvif.c @@ -72,39 +72,10 @@ nvkm_client_suspend(void *priv) } static int -nvkm_client_ntfy(const void *header, u32 length, const void *data, u32 size) -{ - const union { - struct nvif_notify_req_v0 v0; - } *args = header; - u8 route; - - if (length == sizeof(args->v0) && args->v0.version == 0) { - route = args->v0.route; - } else { - WARN_ON(1); - return NVKM_NOTIFY_DROP; - } - - switch (route) { - case NVDRM_NOTIFY_NVIF: - return nvif_notify(header, length, data, size); - case NVDRM_NOTIFY_USIF: - return usif_notify(header, length, data, size); - default: - WARN_ON(1); - break; - } - - return NVKM_NOTIFY_DROP; -} - -static int nvkm_client_driver_init(const char *name, u64 device, const char *cfg, const char *dbg, void **ppriv) { - return nvkm_client_new(name, device, cfg, dbg, nvkm_client_ntfy, - (struct nvkm_client **)ppriv); + return nvkm_client_new(name, device, cfg, dbg, nvif_notify, (struct nvkm_client **)ppriv); } const struct nvif_driver diff --git a/drivers/gpu/drm/nouveau/nouveau_usif.c b/drivers/gpu/drm/nouveau/nouveau_usif.c index 5da1f4d223d7..36df6840c099 100644 --- a/drivers/gpu/drm/nouveau/nouveau_usif.c +++ b/drivers/gpu/drm/nouveau/nouveau_usif.c @@ -26,232 +26,15 @@ #include "nouveau_usif.h" #include "nouveau_abi16.h" -#include <nvif/notify.h> #include <nvif/unpack.h> #include <nvif/client.h> -#include <nvif/event.h> #include <nvif/ioctl.h> #include <nvif/class.h> #include <nvif/cl0080.h> -struct usif_notify_p { - struct drm_pending_event base; - struct { - struct drm_event base; - u8 data[]; - } e; -}; - -struct usif_notify { - struct list_head head; - atomic_t enabled; - u32 handle; - u16 reply; - u8 route; - u64 token; - struct usif_notify_p *p; -}; - -static inline struct usif_notify * -usif_notify_find(struct drm_file *filp, u32 handle) -{ - struct nouveau_cli *cli = nouveau_cli(filp); - struct usif_notify *ntfy; - list_for_each_entry(ntfy, &cli->notifys, head) { - if (ntfy->handle == handle) - return ntfy; - } - return NULL; -} - -static inline void -usif_notify_dtor(struct usif_notify *ntfy) -{ - list_del(&ntfy->head); - kfree(ntfy); -} - -int -usif_notify(const void *header, u32 length, const void *data, u32 size) -{ - struct usif_notify *ntfy = NULL; - const union { - struct nvif_notify_rep_v0 v0; - } *rep = header; - struct drm_device *dev; - struct drm_file *filp; - unsigned long flags; - - if (length == sizeof(rep->v0) && rep->v0.version == 0) { - if (WARN_ON(!(ntfy = (void *)(unsigned long)rep->v0.token))) - return NVIF_NOTIFY_DROP; - BUG_ON(rep->v0.route != NVDRM_NOTIFY_USIF); - } else - if (WARN_ON(1)) - return NVIF_NOTIFY_DROP; - - if (WARN_ON(!ntfy->p || ntfy->reply != (length + size))) - return NVIF_NOTIFY_DROP; - filp = ntfy->p->base.file_priv; - dev = filp->minor->dev; - - memcpy(&ntfy->p->e.data[0], header, length); - memcpy(&ntfy->p->e.data[length], data, size); - switch (rep->v0.version) { - case 0: { - struct nvif_notify_rep_v0 *rep = (void *)ntfy->p->e.data; - rep->route = ntfy->route; - rep->token = ntfy->token; - } - break; - default: - BUG(); - break; - } - - spin_lock_irqsave(&dev->event_lock, flags); - if (!WARN_ON(filp->event_space < ntfy->p->e.base.length)) { - list_add_tail(&ntfy->p->base.link, &filp->event_list); - filp->event_space -= ntfy->p->e.base.length; - } - wake_up_interruptible(&filp->event_wait); - spin_unlock_irqrestore(&dev->event_lock, flags); - atomic_set(&ntfy->enabled, 0); - return NVIF_NOTIFY_DROP; -} - -static int -usif_notify_new(struct drm_file *f, void *data, u32 size, void *argv, u32 argc) -{ - struct nouveau_cli *cli = nouveau_cli(f); - struct nvif_client *client = &cli->base; - union { - struct nvif_ioctl_ntfy_new_v0 v0; - } *args = data; - union { - struct nvif_notify_req_v0 v0; - } *req; - struct usif_notify *ntfy; - int ret = -ENOSYS; - - if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, true))) { - if (usif_notify_find(f, args->v0.index)) - return -EEXIST; - } else - return ret; - req = data; - ret = -ENOSYS; - - if (!(ntfy = kmalloc(sizeof(*ntfy), GFP_KERNEL))) - return -ENOMEM; - atomic_set(&ntfy->enabled, 0); - - if (!(ret = nvif_unpack(ret, &data, &size, req->v0, 0, 0, true))) { - ntfy->reply = sizeof(struct nvif_notify_rep_v0) + req->v0.reply; - ntfy->route = req->v0.route; - ntfy->token = req->v0.token; - req->v0.route = NVDRM_NOTIFY_USIF; - req->v0.token = (unsigned long)(void *)ntfy; - ret = nvif_client_ioctl(client, argv, argc); - req->v0.token = ntfy->token; - req->v0.route = ntfy->route; - ntfy->handle = args->v0.index; - } - - if (ret == 0) - list_add(&ntfy->head, &cli->notifys); - if (ret) - kfree(ntfy); - return ret; -} - -static int -usif_notify_del(struct drm_file *f, void *data, u32 size, void *argv, u32 argc) -{ - struct nouveau_cli *cli = nouveau_cli(f); - struct nvif_client *client = &cli->base; - union { - struct nvif_ioctl_ntfy_del_v0 v0; - } *args = data; - struct usif_notify *ntfy; - int ret = -ENOSYS; - - if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, true))) { - if (!(ntfy = usif_notify_find(f, args->v0.index))) - return -ENOENT; - } else - return ret; - - ret = nvif_client_ioctl(client, argv, argc); - if (ret == 0) - usif_notify_dtor(ntfy); - return ret; -} - -static int -usif_notify_get(struct drm_file *f, void *data, u32 size, void *argv, u32 argc) -{ - struct nouveau_cli *cli = nouveau_cli(f); - struct nvif_client *client = &cli->base; - union { - struct nvif_ioctl_ntfy_del_v0 v0; - } *args = data; - struct usif_notify *ntfy; - int ret = -ENOSYS; - - if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, true))) { - if (!(ntfy = usif_notify_find(f, args->v0.index))) - return -ENOENT; - } else - return ret; - - if (atomic_xchg(&ntfy->enabled, 1)) - return 0; - - ntfy->p = kmalloc(sizeof(*ntfy->p) + ntfy->reply, GFP_KERNEL); - if (ret = -ENOMEM, !ntfy->p) - goto done; - ntfy->p->base.event = &ntfy->p->e.base; - ntfy->p->base.file_priv = f; - ntfy->p->e.base.type = DRM_NOUVEAU_EVENT_NVIF; - ntfy->p->e.base.length = sizeof(ntfy->p->e.base) + ntfy->reply; - - ret = nvif_client_ioctl(client, argv, argc); -done: - if (ret) { - atomic_set(&ntfy->enabled, 0); - kfree(ntfy->p); - } - return ret; -} - -static int -usif_notify_put(struct drm_file *f, void *data, u32 size, void *argv, u32 argc) -{ - struct nouveau_cli *cli = nouveau_cli(f); - struct nvif_client *client = &cli->base; - union { - struct nvif_ioctl_ntfy_put_v0 v0; - } *args = data; - struct usif_notify *ntfy; - int ret = -ENOSYS; - - if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, true))) { - if (!(ntfy = usif_notify_find(f, args->v0.index))) - return -ENOENT; - } else - return ret; - - ret = nvif_client_ioctl(client, argv, argc); - if (ret == 0 && atomic_xchg(&ntfy->enabled, 0)) - kfree(ntfy->p); - return ret; -} - struct usif_object { struct list_head head; - struct list_head ntfy; u8 route; u64 token; }; @@ -369,16 +152,10 @@ usif_ioctl(struct drm_file *filp, void __user *user, u32 argc) ret = usif_object_new(filp, data, size, argv, argc, abi16); break; case NVIF_IOCTL_V0_NTFY_NEW: - ret = usif_notify_new(filp, data, size, argv, argc); - break; case NVIF_IOCTL_V0_NTFY_DEL: - ret = usif_notify_del(filp, data, size, argv, argc); - break; case NVIF_IOCTL_V0_NTFY_GET: - ret = usif_notify_get(filp, data, size, argv, argc); - break; case NVIF_IOCTL_V0_NTFY_PUT: - ret = usif_notify_put(filp, data, size, argv, argc); + ret = -ENOSYS; break; default: ret = nvif_client_ioctl(client, argv, argc); @@ -410,11 +187,6 @@ void usif_client_fini(struct nouveau_cli *cli) { struct usif_object *object, *otemp; - struct usif_notify *notify, *ntemp; - - list_for_each_entry_safe(notify, ntemp, &cli->notifys, head) { - usif_notify_dtor(notify); - } list_for_each_entry_safe(object, otemp, &cli->objects, head) { usif_object_dtor(object); @@ -425,5 +197,4 @@ void usif_client_init(struct nouveau_cli *cli) { INIT_LIST_HEAD(&cli->objects); - INIT_LIST_HEAD(&cli->notifys); } diff --git a/drivers/gpu/drm/nouveau/nvif/object.c b/drivers/gpu/drm/nouveau/nvif/object.c index dce1ecee2af5..4d1aaee8fe15 100644 --- a/drivers/gpu/drm/nouveau/nvif/object.c +++ b/drivers/gpu/drm/nouveau/nvif/object.c @@ -250,7 +250,7 @@ nvif_object_dtor(struct nvif_object *object) .ioctl.type = NVIF_IOCTL_V0_DEL, }; - if (!object->client) + if (!nvif_object_constructed(object)) return; nvif_object_unmap(object); diff --git a/drivers/gpu/drm/nouveau/nvkm/core/ioctl.c b/drivers/gpu/drm/nouveau/nvkm/core/ioctl.c index 735cb6816f10..45f920da89af 100644 --- a/drivers/gpu/drm/nouveau/nvkm/core/ioctl.c +++ b/drivers/gpu/drm/nouveau/nvkm/core/ioctl.c @@ -24,6 +24,7 @@ #include <core/ioctl.h> #include <core/client.h> #include <core/engine.h> +#include <core/event.h> #include <nvif/unpack.h> #include <nvif/ioctl.h> @@ -128,7 +129,7 @@ nvkm_ioctl_new(struct nvkm_client *client, if (ret == 0) { ret = nvkm_object_init(object); if (ret == 0) { - list_add(&object->head, &parent->tree); + list_add_tail(&object->head, &parent->tree); if (nvkm_object_insert(object)) { client->data = object; return 0; diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/ce/gv100.c b/drivers/gpu/drm/nouveau/nvkm/engine/ce/gv100.c index cd5e9cdca |