__u64 ioffset;
__u64 vmm;
};
-
-#define NV906F_V0_NTFY_KILLED 0x01
#endif
__u64 vmm;
__u64 inst;
};
-
-#define NVA06F_V0_NTFY_KILLED 0x01
#endif
__u64 inst;
__u32 token;
};
-
-#define NVC36F_V0_NTFY_KILLED 0x01
#endif
struct nvif_chan_event_v0 {
__u8 version;
#define NVIF_CHAN_EVENT_V0_NON_STALL_INTR 0x00
+#define NVIF_CHAN_EVENT_V0_KILLED 0x01
__u8 type;
} v0;
};
#define NVKM_FIFO_EVENT_NON_STALL_INTR BIT(0)
struct nvkm_event uevent; /* async user trigger */
+#define NVKM_FIFO_EVENT_KILLED BIT(0)
struct nvkm_event kevent; /* channel killed */
};
#include <nvif/cl906f.h>
#include <nvif/cla06f.h>
#include <nvif/clc36f.h>
+#include <nvif/if0020.h>
#include <nvif/ioctl.h>
#include "nouveau_drv.h"
module_param_named(vram_pushbuf, nouveau_vram_pushbuf, int, 0400);
static int
-nouveau_channel_killed(struct nvif_notify *ntfy)
+nouveau_channel_killed(struct nvif_event *event, void *repv, u32 repc)
{
- struct nouveau_channel *chan = container_of(ntfy, typeof(*chan), kill);
+ struct nouveau_channel *chan = container_of(event, typeof(*chan), kill);
struct nouveau_cli *cli = (void *)chan->user.client;
+
NV_PRINTK(warn, cli, "channel %d killed!\n", chan->chid);
atomic_set(&chan->killed, 1);
if (chan->fence)
nouveau_fence_context_kill(chan->fence, -ENODEV);
- return NVIF_NOTIFY_DROP;
+
+ return NVIF_EVENT_DROP;
}
int
nvif_object_dtor(&chan->nvsw);
nvif_object_dtor(&chan->gart);
nvif_object_dtor(&chan->vram);
- nvif_notify_dtor(&chan->kill);
+ nvif_event_dtor(&chan->kill);
nvif_object_dtor(&chan->user);
nvif_object_dtor(&chan->push.ctxdma);
nouveau_vma_del(&chan->push.vma);
if (chan->user.oclass >= FERMI_CHANNEL_GPFIFO &&
chan->user.oclass < AMPERE_CHANNEL_GPFIFO_B) {
- ret = nvif_notify_ctor(&chan->user, "abi16ChanKilled",
- nouveau_channel_killed,
- true, NV906F_V0_NTFY_KILLED,
- NULL, 0, 0, &chan->kill);
+ struct {
+ struct nvif_event_v0 base;
+ struct nvif_chan_event_v0 host;
+ } args;
+
+ args.host.version = 0;
+ args.host.type = NVIF_CHAN_EVENT_V0_KILLED;
+
+ ret = nvif_event_ctor(&chan->user, "abi16ChanKilled", chan->chid,
+ nouveau_channel_killed, false,
+ &args.base, sizeof(args), &chan->kill);
if (ret == 0)
- ret = nvif_notify_get(&chan->kill);
+ ret = nvif_event_allow(&chan->kill);
if (ret) {
NV_ERROR(drm, "Failed to request channel kill "
"notification: %d\n", ret);
#ifndef __NOUVEAU_CHAN_H__
#define __NOUVEAU_CHAN_H__
#include <nvif/object.h>
-#include <nvif/notify.h>
+#include <nvif/event.h>
#include <nvif/push.h>
struct nvif_device;
struct nvif_object user;
- struct nvif_notify kill;
+ struct nvif_event kill;
atomic_t killed;
};
nouveau_fence_context_kill(struct nouveau_fence_chan *fctx, int error)
{
struct nouveau_fence *fence;
+ unsigned long flags;
- spin_lock_irq(&fctx->lock);
+ spin_lock_irqsave(&fctx->lock, flags);
while (!list_empty(&fctx->pending)) {
fence = list_entry(fctx->pending.next, typeof(*fence), head);
if (nouveau_fence_signal(fence))
nvif_event_block(&fctx->event);
}
- spin_unlock_irq(&fctx->lock);
+ spin_unlock_irqrestore(&fctx->lock, flags);
}
void
#include <core/client.h>
#include <core/gpuobj.h>
-#include <core/notify.h>
#include <subdev/mc.h>
#include <nvif/event.h>
void
nvkm_fifo_kevent(struct nvkm_fifo *fifo, int chid)
{
- nvkm_event_send(&fifo->kevent, 1, chid, NULL, 0);
-}
-
-static int
-nvkm_fifo_kevent_ctor(struct nvkm_object *object, void *data, u32 size,
- struct nvkm_notify *notify)
-{
- struct nvkm_fifo_chan *chan = nvkm_fifo_chan(object);
- if (size == 0) {
- notify->size = 0;
- notify->types = 1;
- notify->index = chan->chid;
- return 0;
- }
- return -ENOSYS;
+ nvkm_event_send(&fifo->kevent, NVKM_FIFO_EVENT_KILLED, chid, NULL, 0);
}
static const struct nvkm_event_func
nvkm_fifo_kevent_func = {
- .ctor = nvkm_fifo_kevent_ctor,
};
static void
case NVIF_CHAN_EVENT_V0_NON_STALL_INTR:
return nvkm_uevent_add(uevent, &chan->fifo->uevent, 0,
NVKM_FIFO_EVENT_NON_STALL_INTR, NULL);
+ case NVIF_CHAN_EVENT_V0_KILLED:
+ return nvkm_uevent_add(uevent, &chan->fifo->kevent, chan->chid,
+ NVKM_FIFO_EVENT_KILLED, NULL);
default:
break;
}
return -ENOSYS;
}
-static int
-nvkm_fifo_chan_ntfy(struct nvkm_object *object, u32 type,
- struct nvkm_event **pevent)
-{
- struct nvkm_fifo_chan *chan = nvkm_fifo_chan(object);
- if (chan->func->ntfy)
- return chan->func->ntfy(chan, type, pevent);
- return -ENODEV;
-}
-
static int
nvkm_fifo_chan_map(struct nvkm_object *object, void *argv, u32 argc,
enum nvkm_object_map *type, u64 *addr, u64 *size)
.dtor = nvkm_fifo_chan_dtor,
.init = nvkm_fifo_chan_init,
.fini = nvkm_fifo_chan_fini,
- .ntfy = nvkm_fifo_chan_ntfy,
.map = nvkm_fifo_chan_map,
.sclass = nvkm_fifo_chan_child_get,
.uevent = nvkm_fifo_chan_uevent,
void *(*dtor)(struct nvkm_fifo_chan *);
void (*init)(struct nvkm_fifo_chan *);
void (*fini)(struct nvkm_fifo_chan *);
- int (*ntfy)(struct nvkm_fifo_chan *, u32 type, struct nvkm_event **);
int (*engine_ctor)(struct nvkm_fifo_chan *, struct nvkm_engine *,
struct nvkm_object *);
void (*engine_dtor)(struct nvkm_fifo_chan *, struct nvkm_engine *);
#include <nvif/cl906f.h>
#include <nvif/unpack.h>
-int
-gf100_fifo_chan_ntfy(struct nvkm_fifo_chan *chan, u32 type,
- struct nvkm_event **pevent)
-{
- switch (type) {
- case NV906F_V0_NTFY_KILLED:
- *pevent = &chan->fifo->kevent;
- return 0;
- default:
- break;
- }
- return -EINVAL;
-}
-
static u32
gf100_fifo_gpfifo_engine_addr(struct nvkm_engine *engine)
{
.dtor = gf100_fifo_gpfifo_dtor,
.init = gf100_fifo_gpfifo_init,
.fini = gf100_fifo_gpfifo_fini,
- .ntfy = gf100_fifo_chan_ntfy,
.engine_ctor = gf100_fifo_gpfifo_engine_ctor,
.engine_dtor = gf100_fifo_gpfifo_engine_dtor,
.engine_init = gf100_fifo_gpfifo_engine_init,
.dtor = gk104_fifo_gpfifo_dtor,
.init = gk104_fifo_gpfifo_init,
.fini = gk104_fifo_gpfifo_fini,
- .ntfy = gf100_fifo_chan_ntfy,
.engine_ctor = gk104_fifo_gpfifo_engine_ctor,
.engine_dtor = gk104_fifo_gpfifo_engine_dtor,
.engine_init = gk104_fifo_gpfifo_engine_init,
.dtor = gk104_fifo_gpfifo_dtor,
.init = gk104_fifo_gpfifo_init,
.fini = gk104_fifo_gpfifo_fini,
- .ntfy = gf100_fifo_chan_ntfy,
.engine_ctor = gk104_fifo_gpfifo_engine_ctor,
.engine_dtor = gk104_fifo_gpfifo_engine_dtor,
.engine_init = gv100_fifo_gpfifo_engine_init,
.dtor = gk104_fifo_gpfifo_dtor,
.init = gk104_fifo_gpfifo_init,
.fini = gk104_fifo_gpfifo_fini,
- .ntfy = gf100_fifo_chan_ntfy,
.engine_ctor = gk104_fifo_gpfifo_engine_ctor,
.engine_dtor = gk104_fifo_gpfifo_engine_dtor,
.engine_init = gv100_fifo_gpfifo_engine_init,