Commit d8cc37d8 authored by Ben Skeggs's avatar Ben Skeggs

drm/nouveau: request notifications for channels that have been killed

These will be used to improve error recovery behaviour.
Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent ff9f29ab
...@@ -45,6 +45,16 @@ MODULE_PARM_DESC(vram_pushbuf, "Create DMA push buffers in VRAM"); ...@@ -45,6 +45,16 @@ MODULE_PARM_DESC(vram_pushbuf, "Create DMA push buffers in VRAM");
int nouveau_vram_pushbuf; int nouveau_vram_pushbuf;
module_param_named(vram_pushbuf, nouveau_vram_pushbuf, int, 0400); module_param_named(vram_pushbuf, nouveau_vram_pushbuf, int, 0400);
static int
nouveau_channel_killed(struct nvif_notify *ntfy)
{
struct nouveau_channel *chan = container_of(ntfy, 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);
return NVIF_NOTIFY_DROP;
}
int int
nouveau_channel_idle(struct nouveau_channel *chan) nouveau_channel_idle(struct nouveau_channel *chan)
{ {
...@@ -78,6 +88,7 @@ nouveau_channel_del(struct nouveau_channel **pchan) ...@@ -78,6 +88,7 @@ nouveau_channel_del(struct nouveau_channel **pchan)
nvif_object_fini(&chan->nvsw); nvif_object_fini(&chan->nvsw);
nvif_object_fini(&chan->gart); nvif_object_fini(&chan->gart);
nvif_object_fini(&chan->vram); nvif_object_fini(&chan->vram);
nvif_notify_fini(&chan->kill);
nvif_object_fini(&chan->user); nvif_object_fini(&chan->user);
nvif_object_fini(&chan->push.ctxdma); nvif_object_fini(&chan->push.ctxdma);
nouveau_bo_vma_del(chan->push.buffer, &chan->push.vma); nouveau_bo_vma_del(chan->push.buffer, &chan->push.vma);
...@@ -107,6 +118,7 @@ nouveau_channel_prep(struct nouveau_drm *drm, struct nvif_device *device, ...@@ -107,6 +118,7 @@ nouveau_channel_prep(struct nouveau_drm *drm, struct nvif_device *device,
chan->device = device; chan->device = device;
chan->drm = drm; chan->drm = drm;
atomic_set(&chan->killed, 0);
/* allocate memory for dma push buffer */ /* allocate memory for dma push buffer */
target = TTM_PL_FLAG_TT | TTM_PL_FLAG_UNCACHED; target = TTM_PL_FLAG_TT | TTM_PL_FLAG_UNCACHED;
...@@ -301,12 +313,26 @@ nouveau_channel_init(struct nouveau_channel *chan, u32 vram, u32 gart) ...@@ -301,12 +313,26 @@ nouveau_channel_init(struct nouveau_channel *chan, u32 vram, u32 gart)
{ {
struct nvif_device *device = chan->device; struct nvif_device *device = chan->device;
struct nouveau_cli *cli = (void *)chan->user.client; struct nouveau_cli *cli = (void *)chan->user.client;
struct nouveau_drm *drm = chan->drm;
struct nvkm_mmu *mmu = nvxx_mmu(device); struct nvkm_mmu *mmu = nvxx_mmu(device);
struct nv_dma_v0 args = {}; struct nv_dma_v0 args = {};
int ret, i; int ret, i;
nvif_object_map(&chan->user); nvif_object_map(&chan->user);
if (chan->user.oclass >= FERMI_CHANNEL_GPFIFO) {
ret = nvif_notify_init(&chan->user, nouveau_channel_killed,
true, NV906F_V0_NTFY_KILLED,
NULL, 0, 0, &chan->kill);
if (ret == 0)
ret = nvif_notify_get(&chan->kill);
if (ret) {
NV_ERROR(drm, "Failed to request channel kill "
"notification: %d\n", ret);
return ret;
}
}
/* allocate dma objects to cover all allowed vram, and gart */ /* allocate dma objects to cover all allowed vram, and gart */
if (device->info.family < NV_DEVICE_INFO_V0_FERMI) { if (device->info.family < NV_DEVICE_INFO_V0_FERMI) {
if (device->info.family >= NV_DEVICE_INFO_V0_TESLA) { if (device->info.family >= NV_DEVICE_INFO_V0_TESLA) {
......
#ifndef __NOUVEAU_CHAN_H__ #ifndef __NOUVEAU_CHAN_H__
#define __NOUVEAU_CHAN_H__ #define __NOUVEAU_CHAN_H__
#include <nvif/object.h> #include <nvif/object.h>
#include <nvif/notify.h>
struct nvif_device; struct nvif_device;
struct nouveau_channel { struct nouveau_channel {
...@@ -38,6 +38,9 @@ struct nouveau_channel { ...@@ -38,6 +38,9 @@ struct nouveau_channel {
u32 user_put; u32 user_put;
struct nvif_object user; struct nvif_object user;
struct nvif_notify kill;
atomic_t killed;
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment