mirror of
https://github.com/torvalds/linux.git
synced 2026-05-31 02:24:24 +02:00
drm/nouveau: fix incorrect conversion to dma_resv_wait_timeout()
Commit41d351f295("drm/nouveau: stop using ttm_bo_wait") converted from ttm_bo_wait_ctx() to dma_resv_wait_timeout(). However, dma_resv_wait_timeout() returns greater than zero on success as opposed to ttm_bo_wait_ctx(). As a result, relocs will fail and log errors even when it was a success. Change the return code handling to match that of nouveau_gem_ioctl_cpu_prep(), which was already using dma_resv_wait_timeout() correctly. Fixes:41d351f295("drm/nouveau: stop using ttm_bo_wait") Reported-by: Tanmay Bhushan <007047221b@gmail.com> Link: https://lore.kernel.org/lkml/20230119225351.71657-1-007047221b@gmail.com Signed-off-by: John Ogness <john.ogness@linutronix.de> Reviewed-by: Christian König <christian.koenig@amd.com> Reviewed-by: Karol Herbst <kherbst@redhat.com> Signed-off-by: Karol Herbst <kherbst@redhat.com> Link: https://patchwork.freedesktop.org/patch/msgid/87edolaomt.fsf@jogness.linutronix.de
This commit is contained in:
parent
afa965a45e
commit
7363d6bedc
|
|
@ -645,7 +645,7 @@ nouveau_gem_pushbuf_reloc_apply(struct nouveau_cli *cli,
|
|||
struct drm_nouveau_gem_pushbuf_reloc *reloc,
|
||||
struct drm_nouveau_gem_pushbuf_bo *bo)
|
||||
{
|
||||
long ret = 0;
|
||||
int ret = 0;
|
||||
unsigned i;
|
||||
|
||||
for (i = 0; i < req->nr_relocs; i++) {
|
||||
|
|
@ -653,6 +653,7 @@ nouveau_gem_pushbuf_reloc_apply(struct nouveau_cli *cli,
|
|||
struct drm_nouveau_gem_pushbuf_bo *b;
|
||||
struct nouveau_bo *nvbo;
|
||||
uint32_t data;
|
||||
long lret;
|
||||
|
||||
if (unlikely(r->bo_index >= req->nr_buffers)) {
|
||||
NV_PRINTK(err, cli, "reloc bo index invalid\n");
|
||||
|
|
@ -703,13 +704,18 @@ nouveau_gem_pushbuf_reloc_apply(struct nouveau_cli *cli,
|
|||
data |= r->vor;
|
||||
}
|
||||
|
||||
ret = dma_resv_wait_timeout(nvbo->bo.base.resv,
|
||||
DMA_RESV_USAGE_BOOKKEEP,
|
||||
false, 15 * HZ);
|
||||
if (ret == 0)
|
||||
lret = dma_resv_wait_timeout(nvbo->bo.base.resv,
|
||||
DMA_RESV_USAGE_BOOKKEEP,
|
||||
false, 15 * HZ);
|
||||
if (!lret)
|
||||
ret = -EBUSY;
|
||||
else if (lret > 0)
|
||||
ret = 0;
|
||||
else
|
||||
ret = lret;
|
||||
|
||||
if (ret) {
|
||||
NV_PRINTK(err, cli, "reloc wait_idle failed: %ld\n",
|
||||
NV_PRINTK(err, cli, "reloc wait_idle failed: %d\n",
|
||||
ret);
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user