| .. | .. |
|---|
| 24 | 24 | * |
|---|
| 25 | 25 | */ |
|---|
| 26 | 26 | |
|---|
| 27 | | -#include <drm/drmP.h> |
|---|
| 28 | | - |
|---|
| 29 | 27 | #include <linux/ktime.h> |
|---|
| 30 | 28 | #include <linux/hrtimer.h> |
|---|
| 29 | +#include <linux/sched/signal.h> |
|---|
| 31 | 30 | #include <trace/events/dma_fence.h> |
|---|
| 32 | 31 | |
|---|
| 33 | 32 | #include <nvif/cl826e.h> |
|---|
| .. | .. |
|---|
| 88 | 87 | } |
|---|
| 89 | 88 | |
|---|
| 90 | 89 | void |
|---|
| 91 | | -nouveau_fence_context_del(struct nouveau_fence_chan *fctx) |
|---|
| 90 | +nouveau_fence_context_kill(struct nouveau_fence_chan *fctx, int error) |
|---|
| 92 | 91 | { |
|---|
| 93 | 92 | struct nouveau_fence *fence; |
|---|
| 94 | 93 | |
|---|
| .. | .. |
|---|
| 96 | 95 | while (!list_empty(&fctx->pending)) { |
|---|
| 97 | 96 | fence = list_entry(fctx->pending.next, typeof(*fence), head); |
|---|
| 98 | 97 | |
|---|
| 98 | + if (error) |
|---|
| 99 | + dma_fence_set_error(&fence->base, error); |
|---|
| 100 | + |
|---|
| 99 | 101 | if (nouveau_fence_signal(fence)) |
|---|
| 100 | 102 | nvif_notify_put(&fctx->notify); |
|---|
| 101 | 103 | } |
|---|
| 102 | 104 | spin_unlock_irq(&fctx->lock); |
|---|
| 105 | +} |
|---|
| 103 | 106 | |
|---|
| 104 | | - nvif_notify_fini(&fctx->notify); |
|---|
| 107 | +void |
|---|
| 108 | +nouveau_fence_context_del(struct nouveau_fence_chan *fctx) |
|---|
| 109 | +{ |
|---|
| 110 | + nouveau_fence_context_kill(fctx, 0); |
|---|
| 111 | + nvif_notify_dtor(&fctx->notify); |
|---|
| 105 | 112 | fctx->dead = 1; |
|---|
| 106 | 113 | |
|---|
| 107 | 114 | /* |
|---|
| .. | .. |
|---|
| 188 | 195 | if (!priv->uevent) |
|---|
| 189 | 196 | return; |
|---|
| 190 | 197 | |
|---|
| 191 | | - ret = nvif_notify_init(&chan->user, nouveau_fence_wait_uevent_handler, |
|---|
| 198 | + ret = nvif_notify_ctor(&chan->user, "fenceNonStallIntr", |
|---|
| 199 | + nouveau_fence_wait_uevent_handler, |
|---|
| 192 | 200 | false, NV826E_V0_NTFY_NON_STALL_INTERRUPT, |
|---|
| 193 | 201 | &(struct nvif_notify_uevent_req) { }, |
|---|
| 194 | 202 | sizeof(struct nvif_notify_uevent_req), |
|---|
| .. | .. |
|---|
| 335 | 343 | { |
|---|
| 336 | 344 | struct nouveau_fence_chan *fctx = chan->fence; |
|---|
| 337 | 345 | struct dma_fence *fence; |
|---|
| 338 | | - struct reservation_object *resv = nvbo->bo.resv; |
|---|
| 339 | | - struct reservation_object_list *fobj; |
|---|
| 346 | + struct dma_resv *resv = nvbo->bo.base.resv; |
|---|
| 347 | + struct dma_resv_list *fobj; |
|---|
| 340 | 348 | struct nouveau_fence *f; |
|---|
| 341 | 349 | int ret = 0, i; |
|---|
| 342 | 350 | |
|---|
| 343 | 351 | if (!exclusive) { |
|---|
| 344 | | - ret = reservation_object_reserve_shared(resv); |
|---|
| 352 | + ret = dma_resv_reserve_shared(resv, 1); |
|---|
| 345 | 353 | |
|---|
| 346 | 354 | if (ret) |
|---|
| 347 | 355 | return ret; |
|---|
| 348 | 356 | } |
|---|
| 349 | 357 | |
|---|
| 350 | | - fobj = reservation_object_get_list(resv); |
|---|
| 351 | | - fence = reservation_object_get_excl(resv); |
|---|
| 358 | + fobj = dma_resv_get_list(resv); |
|---|
| 359 | + fence = dma_resv_get_excl(resv); |
|---|
| 352 | 360 | |
|---|
| 353 | 361 | if (fence && (!exclusive || !fobj || !fobj->shared_count)) { |
|---|
| 354 | 362 | struct nouveau_channel *prev = NULL; |
|---|
| .. | .. |
|---|
| 377 | 385 | bool must_wait = true; |
|---|
| 378 | 386 | |
|---|
| 379 | 387 | fence = rcu_dereference_protected(fobj->shared[i], |
|---|
| 380 | | - reservation_object_held(resv)); |
|---|
| 388 | + dma_resv_held(resv)); |
|---|
| 381 | 389 | |
|---|
| 382 | 390 | f = nouveau_local_fence(fence, chan->drm); |
|---|
| 383 | 391 | if (f) { |
|---|
| .. | .. |
|---|
| 526 | 534 | .get_timeline_name = nouveau_fence_get_timeline_name, |
|---|
| 527 | 535 | .enable_signaling = nouveau_fence_enable_signaling, |
|---|
| 528 | 536 | .signaled = nouveau_fence_is_signaled, |
|---|
| 529 | | - .wait = dma_fence_default_wait, |
|---|
| 530 | 537 | .release = nouveau_fence_release |
|---|
| 531 | 538 | }; |
|---|