Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3676452pxb; Mon, 24 Jan 2022 15:06:21 -0800 (PST) X-Google-Smtp-Source: ABdhPJxQ5YZi0+nOMu7YT1Jo0QRGbsUXZbCMbgREFOKKX/MXngQgqqG0gtY93rm/Pqhz9PmJRo8r X-Received: by 2002:a63:5d0e:: with SMTP id r14mr13621996pgb.110.1643065580780; Mon, 24 Jan 2022 15:06:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643065580; cv=none; d=google.com; s=arc-20160816; b=H0Ry7aJen66Pq8UOd5MlQF9uXEiRJVIH70Jt3cJOQYRM+lFK2CB1XpVJEASYwmj4al x/wVxBH1YuXyuERcw1XJbYDYx4zzqPf/le9eBLH+CXrjw9KPYw+X6GJFjIq8z6ROLnT6 XbnAocbOvqWFMVZoDwuQ6dhWJtU2ifXKeeWZpvt1ROQfO1uvcYCcG+Cmn7cCKQgmd0w8 ycxPj9WFi7lnhy5AHm/BSR9p+9rZDHMC3miQOQJcvhJ8EQo1Y+p2JxoAKFgyiOpanVCX yT034MqX+msQj8Kx1/2tUd/UYVeV+stYEwWMU0e6CavtJxDg3+Nssn9brbSSjscWjhfM JtdQ== 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=RsI2jBHG28zTA08MgyBepf4Ek9i+Rf6v3DwPMfRLQRE=; b=hYE365HJfd0W/dFOZQ+RJ+7/LNAUWPSbgw0RckwyNhqHxYGjpzMnS66UmbS8Gm59JR 4VFBRGucSOUZgV3ggsJqvmp9qs/12SVWui81LHYsf5iYy0J8q1ofatVYrorOnWKDrowt BowCWMEwkMzN/D5/kbm9XagAsW2re4ZooAjPP92s1VZMVGsrLsZCbDl+8krdRKYW3wOZ do03YqBYnShNQerOResw+oYOWwJeh+hcfsLDGf1ttInwnw12VXU4P8JbIikv7hJAYgCu Voakt8woNPSBAYeVfxzDbrKnxgvktrcyYavSiMKdljOKnu5Qipqa+FQGjPb8ft8G1ylf AQdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=EY9fdFZ4; 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 g27si10707121pgn.371.2022.01.24.15.06.07; Mon, 24 Jan 2022 15:06:20 -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=EY9fdFZ4; 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 S1842376AbiAXXBp (ORCPT + 99 others); Mon, 24 Jan 2022 18:01:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59098 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1458139AbiAXVzI (ORCPT ); Mon, 24 Jan 2022 16:55:08 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D78A5C061780; Mon, 24 Jan 2022 12:37:37 -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 ams.source.kernel.org (Postfix) with ESMTPS id 9E511B80FA3; Mon, 24 Jan 2022 20:37:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BD06FC340E5; Mon, 24 Jan 2022 20:37:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643056655; bh=vtWjHQg35ZYsG3cvoxDYlP7bz7YRDF4DFA/Z3UcxwWw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EY9fdFZ4ZIA3Nk/UwUMBt2MTnlP7wu12khgE0Yk+aLk9/2qbXQjeInf/Y77bXeOXO uy1/p7ts6AbJ9mKndpq6iw7L69GZPyaWRbCxrRIiWyKwi9EAKEITjEWrrmJ9lN4AA7 K4wBOKRf1oxe/Bltr4ROcMaxHMH9TzHdXSHl4X8w= 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.15 557/846] drm/amd/amdgpu: fix psp tmr bo pin count leak in SRIOV Date: Mon, 24 Jan 2022 19:41:14 +0100 Message-Id: <20220124184120.240229713@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184100.867127425@linuxfoundation.org> References: <20220124184100.867127425@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 9b41cb8c3de54..86e2090bbd6e0 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c @@ -2207,12 +2207,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