Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3715828pxb; Mon, 24 Jan 2022 16:09:41 -0800 (PST) X-Google-Smtp-Source: ABdhPJyNTBmhVrdoqX0Fhd7NWCMhz7anfLQq8Q3TRpR9zdQ6K0At1lX8Sg8Thj4LCQ7U245sW1F9 X-Received: by 2002:a17:90b:1881:: with SMTP id mn1mr732955pjb.236.1643069381663; Mon, 24 Jan 2022 16:09:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643069381; cv=none; d=google.com; s=arc-20160816; b=hmM2Pz0CMalfOUxqnzYxdY3Civ58CWyQcH90bJEif8FobdFx4DD3GTCwRwAb7Ou5mC +wx5n+7helR1KR8LttGfZlyh10nAx91x9PLZbNtp13zxKPhplQ0hxN9y8P0zLJiSkpBB FlqYetSaDhWLv5dN03RElk1Hzs+fI37+2Kps8SkKNFLjPZdr8nwgOXEbNVhCpJT0TGuR euaqunJbrU7Sh7sstQmaM6F7ebMIqBfGEC3HPxUI1QTGsTXZ9CfFU3RxcOE+I7mQVWNk GspIsjg3X2xv/AZ4cprcFJ6ocg3/oGUaaI24ihGKwSxzdNur9lVTRQS2QySEeF0ZODqp N3aA== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=VfG1AHEllAnUQqhZfVbP4he/w6cCfQfAhucgMUnGooU=; b=kzUBj9tqd4abRSXwhY++IEoKlCqQvZtd+Ltsv1+fRzNCV7e46xG8MeWNGgkoMzG4wx d6HxzZmnK2wchuC1Mn2K/IYZ1NNpLYWOB4q8f4qAwP9uiQkcVD1h8jCNa9x+MtRld0x3 uUkii4Mbfz4lbfA/9otS5g9Bhe1TfixNVr5IiIXQUGKk91Vz30jEiVe4PfZLXSo4w3I8 d3dh1qeYDSdVuzUPPt6xlt+cXi/6whSJRTLWLRPFzd0QxPS4pfiXkAur/7dVCHrWI8gn lTUCOwZ81QBz5ZxOb7T1X7P9Tb7i56+wKp++I8JLErOO54kUsy0iXXWtJOjnUI5/ztQZ aKOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=N3lw26p6; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l70si8372739pgd.707.2022.01.24.16.09.29; Mon, 24 Jan 2022 16:09:41 -0800 (PST) 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=@linuxfoundation.org header.s=korg header.b=N3lw26p6; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2370825AbiAYAGQ (ORCPT + 99 others); Mon, 24 Jan 2022 19:06:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51460 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1847533AbiAXXT7 (ORCPT ); Mon, 24 Jan 2022 18:19:59 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BAB45C06F8FD; Mon, 24 Jan 2022 13:27:43 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 58A1661490; Mon, 24 Jan 2022 21:27:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 32F10C340E4; Mon, 24 Jan 2022 21:27:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059662; bh=P6eFo3h9qX3r6YCHPSkuPE/RNoXMNV1Mnn7M6uecedU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=N3lw26p6aQ1Hj4Z3y9cV57qYeVMJDllBK7VX0EoFPkiKtSKJZa1XN4XFha0CU6Y3Z C3AvWagQL10P9eidMGSNoS6odpK8QNHNc7kK6q0E+wrF+N4EfEIy+CXIOICROof+ST jivP42Ae9JZDq/K89YlD030tJFO07mzhyF1mSEXo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jingwen Chen , Horace Chen , Alex Deucher , Sasha Levin Subject: [PATCH 5.16 0658/1039] drm/amd/amdgpu: fix psp tmr bo pin count leak in SRIOV Date: Mon, 24 Jan 2022 19:40:47 +0100 Message-Id: <20220124184147.486025851@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jingwen Chen [ Upstream commit 85dfc1d692c9434c37842e610be37cd4ae4e0081 ] [Why] psp tmr bo will be pinned during loading amdgpu and reset in SRIOV while only unpinned in unload amdgpu [How] add amdgpu_in_reset and sriov judgement to skip pin bo v2: fix wrong judgement Signed-off-by: Jingwen Chen Reviewed-by: Horace Chen Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c index c641f84649d6b..d011ae7e50a54 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c @@ -2017,12 +2017,16 @@ static int psp_hw_start(struct psp_context *psp) return ret; } + if (amdgpu_sriov_vf(adev) && amdgpu_in_reset(adev)) + goto skip_pin_bo; + ret = psp_tmr_init(psp); if (ret) { DRM_ERROR("PSP tmr init failed!\n"); return ret; } +skip_pin_bo: /* * For ASICs with DF Cstate management centralized * to PMFW, TMR setup should be performed after PMFW -- 2.34.1