Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp3597522pxv; Mon, 28 Jun 2021 08:14:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyhOtZwib0BQ/gpGkbxIv1dQ1M/QHePg+Sk8C1uyZbeGXFhwxoOMRmo7dcERD5BCCaTcDsf X-Received: by 2002:a05:6402:4cf:: with SMTP id n15mr34833912edw.162.1624893292205; Mon, 28 Jun 2021 08:14:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624893292; cv=none; d=google.com; s=arc-20160816; b=hxu+afGZxN0xF2+UoMaJtGpQA56L2NJZManVjM9MTraAZUh2SgoSRQYixnVEqCb0qQ Aw8lPDWWs4AaYA84190YALBqmgjGT7FCkQhEqHisBegrlSH3lyZO9F11V45GZNT76J+i L65SaZsEdtBhLE4iyI2kVAHWwB/fAfg8b6fO556Hk3L2V0rIpyds9z6eqfrnG7GQ/0v4 9GSj0WC1pMvFXVQqUoL5ZykRr7ayYB88LNq0vnnNf0qOn/iPSktbi6HFOJpYS0duA8Sb bp+4EkIlQLOhX6TYiSB3gZMa5eCRfqv3UHf1AhWeKQKO4lHEm4UWlOwApVC0FtB20mve zNpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=xLCaNscamRXgr9HzY0QK+de61oJz1DeG90cHWuzsAo0=; b=NWuFXGCv2Fkf+7F7YuaAkbnD5dTkGbpV3NEIezZBI6grq2Id8Jaij+XOMYtsHeufly cMpa04t2LQqme1NXyRJS+tE6GGkUgJ6aUCux0cb8Nxc5FLRDEF9G5kAa2DRVtDKKuYcw 6uyOaqurxw21PSNby7WKIUILS74GwJticGjdEU1K8IKEyKYLYMbaesQ0UOOlIahOja1C pbpJuLIzLcN8Qlq0/EvqF/r9urtgQE4zfGD7+q22onByP0p9Rz7qerIlS9HIFQPgqsWT 8Pevem5vkGYB54y8xsp+knpJhV3UcY9oJ65gogSxzue2RocfgrGjGINRLCW2rIwFKkJd 5ptQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=gCINEutL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p2si15118372edu.249.2021.06.28.08.14.27; Mon, 28 Jun 2021 08:14:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=gCINEutL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237914AbhF1PO5 (ORCPT + 99 others); Mon, 28 Jun 2021 11:14:57 -0400 Received: from mail.kernel.org ([198.145.29.99]:60294 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234567AbhF1OxT (ORCPT ); Mon, 28 Jun 2021 10:53:19 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id B15E161D41; Mon, 28 Jun 2021 14:37:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1624891046; bh=TTNoOWy/W2/+OH9FQG92HKqHLAhFB645HhLAwb+PQsk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gCINEutLBX/6izc5yR6i7WiZDpmm53K1zTLRwFL0dl1U7iNUYZzZB2dSAjtoq8rlH 6bFuQ90Fu+MZC5V8xtZLDUddQH3neIrd7CSOV7y7XwKlGilR6hukNvjGth9Dg1ynQT 122MvWKzRfV5dhO9DkXL6SOCKoRs3e/6kjojB6PXLOTIAdc6N5bYGcCqZNm1E+oaO7 OqvRzqF9KO//0p49irZblbJr6U43nlvoPNwOXyXU+ix5OTJ1O7fkiocEHBcsnOYpfZ yhlxi3gpo4d6GHjN5S4msNpG6RC040cYZZtoofKA5KUUxUIBFcT4fKr1Vo/QgCyR0Y CrI0Om4pmqpyA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: =?UTF-8?q?Christian=20K=C3=B6nig?= , Daniel Vetter , stable@kernel.org, Greg Kroah-Hartman Subject: [PATCH 4.14 65/88] drm/nouveau: wait for moving fence after pinning v2 Date: Mon, 28 Jun 2021 10:36:05 -0400 Message-Id: <20210628143628.33342-66-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210628143628.33342-1-sashal@kernel.org> References: <20210628143628.33342-1-sashal@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-KernelTest-Patch: http://kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.14.238-rc1.gz X-KernelTest-Tree: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git X-KernelTest-Branch: linux-4.14.y X-KernelTest-Patches: git://git.kernel.org/pub/scm/linux/kernel/git/stable/stable-queue.git X-KernelTest-Version: 4.14.238-rc1 X-KernelTest-Deadline: 2021-06-30T14:36+00:00 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Christian König commit 17b11f71795abdce46f62a808f906857e525cea8 upstream. We actually need to wait for the moving fence after pinning the BO to make sure that the pin is completed. v2: grab the lock while waiting Signed-off-by: Christian König Reviewed-by: Daniel Vetter References: https://lore.kernel.org/dri-devel/20210621151758.2347474-1-daniel.vetter@ffwll.ch/ CC: stable@kernel.org Link: https://patchwork.freedesktop.org/patch/msgid/20210622114506.106349-1-christian.koenig@amd.com Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/nouveau/nouveau_prime.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/nouveau/nouveau_prime.c b/drivers/gpu/drm/nouveau/nouveau_prime.c index 1fefc93af1d7..bbfce7b9d03e 100644 --- a/drivers/gpu/drm/nouveau/nouveau_prime.c +++ b/drivers/gpu/drm/nouveau/nouveau_prime.c @@ -98,7 +98,22 @@ int nouveau_gem_prime_pin(struct drm_gem_object *obj) if (ret) return -EINVAL; - return 0; + ret = ttm_bo_reserve(&nvbo->bo, false, false, NULL); + if (ret) + goto error; + + if (nvbo->bo.moving) + ret = dma_fence_wait(nvbo->bo.moving, true); + + ttm_bo_unreserve(&nvbo->bo); + if (ret) + goto error; + + return ret; + +error: + nouveau_bo_unpin(nvbo); + return ret; } void nouveau_gem_prime_unpin(struct drm_gem_object *obj) -- 2.30.2