Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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

These will be used to improve error recovery behaviour.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>

+30 -1
+26
drivers/gpu/drm/nouveau/nouveau_chan.c
··· 45 45 int nouveau_vram_pushbuf; 46 46 module_param_named(vram_pushbuf, nouveau_vram_pushbuf, int, 0400); 47 47 48 + static int 49 + nouveau_channel_killed(struct nvif_notify *ntfy) 50 + { 51 + struct nouveau_channel *chan = container_of(ntfy, typeof(*chan), kill); 52 + struct nouveau_cli *cli = (void *)chan->user.client; 53 + NV_PRINTK(warn, cli, "channel %d killed!\n", chan->chid); 54 + atomic_set(&chan->killed, 1); 55 + return NVIF_NOTIFY_DROP; 56 + } 57 + 48 58 int 49 59 nouveau_channel_idle(struct nouveau_channel *chan) 50 60 { ··· 88 78 nvif_object_fini(&chan->nvsw); 89 79 nvif_object_fini(&chan->gart); 90 80 nvif_object_fini(&chan->vram); 81 + nvif_notify_fini(&chan->kill); 91 82 nvif_object_fini(&chan->user); 92 83 nvif_object_fini(&chan->push.ctxdma); 93 84 nouveau_bo_vma_del(chan->push.buffer, &chan->push.vma); ··· 118 107 119 108 chan->device = device; 120 109 chan->drm = drm; 110 + atomic_set(&chan->killed, 0); 121 111 122 112 /* allocate memory for dma push buffer */ 123 113 target = TTM_PL_FLAG_TT | TTM_PL_FLAG_UNCACHED; ··· 313 301 { 314 302 struct nvif_device *device = chan->device; 315 303 struct nouveau_cli *cli = (void *)chan->user.client; 304 + struct nouveau_drm *drm = chan->drm; 316 305 struct nvkm_mmu *mmu = nvxx_mmu(device); 317 306 struct nv_dma_v0 args = {}; 318 307 int ret, i; 319 308 320 309 nvif_object_map(&chan->user); 310 + 311 + if (chan->user.oclass >= FERMI_CHANNEL_GPFIFO) { 312 + ret = nvif_notify_init(&chan->user, nouveau_channel_killed, 313 + true, NV906F_V0_NTFY_KILLED, 314 + NULL, 0, 0, &chan->kill); 315 + if (ret == 0) 316 + ret = nvif_notify_get(&chan->kill); 317 + if (ret) { 318 + NV_ERROR(drm, "Failed to request channel kill " 319 + "notification: %d\n", ret); 320 + return ret; 321 + } 322 + } 321 323 322 324 /* allocate dma objects to cover all allowed vram, and gart */ 323 325 if (device->info.family < NV_DEVICE_INFO_V0_FERMI) {
+4 -1
drivers/gpu/drm/nouveau/nouveau_chan.h
··· 1 1 #ifndef __NOUVEAU_CHAN_H__ 2 2 #define __NOUVEAU_CHAN_H__ 3 - 4 3 #include <nvif/object.h> 4 + #include <nvif/notify.h> 5 5 struct nvif_device; 6 6 7 7 struct nouveau_channel { ··· 38 38 u32 user_put; 39 39 40 40 struct nvif_object user; 41 + 42 + struct nvif_notify kill; 43 + atomic_t killed; 41 44 }; 42 45 43 46