Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp3836997pxv; Mon, 28 Jun 2021 14:16:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxo3pR0dxK8uQKJTf+cLrAyLjE/yRqXDNDJoj6aVid+SMzAdFpQTjXT8PCulc/77BkSUoEB X-Received: by 2002:a5d:80c8:: with SMTP id h8mr1150488ior.120.1624914992421; Mon, 28 Jun 2021 14:16:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624914992; cv=none; d=google.com; s=arc-20160816; b=qmkuoKD9FDyzUqsL3Nw6g+uCL/wZpSUeJX135cyqiyf33NjVJTl+avwY8eNJGYOepn jukDd3ssGrMUIAHeDNwRgsPfleduyyIDVenWFWxzz46VAWI5xqytiotlQH3wo19ZRyCh eJFnyZw1TYlIyk98XmZXPHIq2WOYnJedPnFm7QoU7HRYx4oQFTCFmOIJwFk4AbxCHcOx j7v0YL/14l90mirefeLUbGgKsSbhtULZ2wnCG4L0nOfnlFwWT1QgmWeu/b1c0HrksdcE kYNVDOaQGYyEwdaS4hL99cCTC2omSw5G3sDErEMwi4osjAJ/xzDk62Tbp3H4c+3i10Xi /s7Q== 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=r7pf07w2lEINWwCAWCXf0rUI6Cejs0ClVD3TgQui2cY=; b=XkFTfcN7roC2Xti3cnwcWspr4EMCu2LG9Om3dkNjpswqwNm6+4uCpb9vtr+9daWwR1 A23TFi497ebU48bTlv/vju/wpCQKIQvCmz0tiyGHDGQ0pgyXQoN7+JgwwS5I/bhPd89n MWvaBf8nzmGBdOjK66X1Qiglbk4f83sqh4Al8U6C8pfYaDDRzNhbINWE9gYeBIXuUap9 sWPzH9Biz9fxWumdensESKMjJbsphSqQHi2q7FkXRqIXLL3xUprreRU5H0JAn8d/IqPp MlACNcI9xAcx/DAuBzbsezVKXQOn/L6L5lNa7WI4o/JpuIMLeSjElaaEq+6HR1CA1NiZ FlnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="rrH2v/H0"; 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 r4si21983599ilb.18.2021.06.28.14.16.15; Mon, 28 Jun 2021 14:16:32 -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="rrH2v/H0"; 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 S234112AbhF1POp (ORCPT + 99 others); Mon, 28 Jun 2021 11:14:45 -0400 Received: from mail.kernel.org ([198.145.29.99]:57926 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232633AbhF1OxT (ORCPT ); Mon, 28 Jun 2021 10:53:19 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 8CE8061D3F; Mon, 28 Jun 2021 14:37:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1624891047; bh=u9S9ZUXnYem/UEMKI6Ucu33qh1Zhd3RCsTz0D6C3tNs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rrH2v/H0qhOK1b1/4mqx5BjoEhIzXwG7SsG9QOIkP8Atr2mvyiMBEyw+EaTOkha6q OIAruUf0WPIlJeFq5C9y8ETaZ94JaKkn+TLA+AGlezR1RNva9UuJGcxVDXROyyBF5Q yGfyojjAcQYCZuAS3NdHbvYMuozj+hiTDcU9Db9qdDtzZYpMvTCTdf1vwq/FidLV1H BcN7GrgZhKwNk+cuQqhwGFAnkDDasKYdrBnFXp1b8C0nhX/iY/83Uz374dU8y9hc3i hg8Dcu33+myS7LHKVHRNiRWMrL6G2MLb8biDsTm303C5qDkK1AX11X2pflhwfAu8L8 2OmuCOQ8p0o/w== 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 66/88] drm/radeon: wait for moving fence after pinning Date: Mon, 28 Jun 2021 10:36:06 -0400 Message-Id: <20210628143628.33342-67-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 4b41726aae563273bb4b4a9462ba51ce4d372f78 upstream. We actually need to wait for the moving fence after pinning the BO to make sure that the pin is completed. 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-2-christian.koenig@amd.com Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/radeon/radeon_prime.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/radeon/radeon_prime.c b/drivers/gpu/drm/radeon/radeon_prime.c index 7110d403322c..c138e07f51a3 100644 --- a/drivers/gpu/drm/radeon/radeon_prime.c +++ b/drivers/gpu/drm/radeon/radeon_prime.c @@ -92,9 +92,19 @@ int radeon_gem_prime_pin(struct drm_gem_object *obj) /* pin buffer into GTT */ ret = radeon_bo_pin(bo, RADEON_GEM_DOMAIN_GTT, NULL); - if (likely(ret == 0)) - bo->prime_shared_count++; - + if (unlikely(ret)) + goto error; + + if (bo->tbo.moving) { + ret = dma_fence_wait(bo->tbo.moving, false); + if (unlikely(ret)) { + radeon_bo_unpin(bo); + goto error; + } + } + + bo->prime_shared_count++; +error: radeon_bo_unreserve(bo); return ret; } -- 2.30.2