Skip to content

Commit ea13e5a

Browse files
author
Ben Skeggs
committed
drm/nouveau: signal pending fences when channel has been killed
Signed-off-by: Ben Skeggs <[email protected]>
1 parent 0181f4b commit ea13e5a

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

drivers/gpu/drm/nouveau/nouveau_chan.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ nouveau_channel_killed(struct nvif_notify *ntfy)
5555
struct nouveau_cli *cli = (void *)chan->user.client;
5656
NV_PRINTK(warn, cli, "channel %d killed!\n", chan->chid);
5757
atomic_set(&chan->killed, 1);
58+
if (chan->fence)
59+
nouveau_fence_context_kill(chan->fence, -ENODEV);
5860
return NVIF_NOTIFY_DROP;
5961
}
6062

drivers/gpu/drm/nouveau/nouveau_fence.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,19 +87,27 @@ nouveau_local_fence(struct dma_fence *fence, struct nouveau_drm *drm)
8787
}
8888

8989
void
90-
nouveau_fence_context_del(struct nouveau_fence_chan *fctx)
90+
nouveau_fence_context_kill(struct nouveau_fence_chan *fctx, int error)
9191
{
9292
struct nouveau_fence *fence;
9393

9494
spin_lock_irq(&fctx->lock);
9595
while (!list_empty(&fctx->pending)) {
9696
fence = list_entry(fctx->pending.next, typeof(*fence), head);
9797

98+
if (error)
99+
dma_fence_set_error(&fence->base, error);
100+
98101
if (nouveau_fence_signal(fence))
99102
nvif_notify_put(&fctx->notify);
100103
}
101104
spin_unlock_irq(&fctx->lock);
105+
}
102106

107+
void
108+
nouveau_fence_context_del(struct nouveau_fence_chan *fctx)
109+
{
110+
nouveau_fence_context_kill(fctx, 0);
103111
nvif_notify_fini(&fctx->notify);
104112
fctx->dead = 1;
105113

drivers/gpu/drm/nouveau/nouveau_fence.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ struct nouveau_fence_priv {
6363
void nouveau_fence_context_new(struct nouveau_channel *, struct nouveau_fence_chan *);
6464
void nouveau_fence_context_del(struct nouveau_fence_chan *);
6565
void nouveau_fence_context_free(struct nouveau_fence_chan *);
66+
void nouveau_fence_context_kill(struct nouveau_fence_chan *, int error);
6667

6768
int nv04_fence_create(struct nouveau_drm *);
6869
int nv04_fence_mthd(struct nouveau_channel *, u32, u32, u32);

0 commit comments

Comments
 (0)