Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C356BC35263 for ; Mon, 10 Jan 2022 07:41:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242513AbiAJHk4 (ORCPT ); Mon, 10 Jan 2022 02:40:56 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:40974 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239360AbiAJHeN (ORCPT ); Mon, 10 Jan 2022 02:34:13 -0500 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 F1FC3611B7; Mon, 10 Jan 2022 07:34:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D164EC36AEF; Mon, 10 Jan 2022 07:34:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1641800052; bh=pU364gwTipAGmNVJZzf1xKh13FbSWd0RN/HkMR0i3PU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mXD/yjH0YaI+/Y++TiFpq9M+/F+bZ0zRf3xD8KWksCU51pfuharhyIUf0Dj/aUGZM 0wdSGkHVoEJCagNF12TBPORvt6iYL39yvoqQ/oHNlomb1Vx9O7I2i+1Is3aBx6TRoL 6AfaDi4SJR0mla5t28DSBwKAUspft5Q18Pof8CIM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Luben Tuikov , Evan Quan , Alex Deucher , Sasha Levin Subject: [PATCH 5.15 62/72] drm/amdgpu: always reset the asic in suspend (v2) Date: Mon, 10 Jan 2022 08:23:39 +0100 Message-Id: <20220110071823.658590687@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220110071821.500480371@linuxfoundation.org> References: <20220110071821.500480371@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: Alex Deucher [ Upstream commit daf8de0874ab5b74b38a38726fdd3d07ef98a7ee ] If the platform suspend happens to fail and the power rail is not turned off, the GPU will be in an unknown state on resume, so reset the asic so that it will be in a known good state on resume even if the platform suspend failed. v2: handle s0ix Acked-by: Luben Tuikov Acked-by: Evan Quan Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c index 70e8a86c3a69f..9dfd9d70812cb 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c @@ -1526,7 +1526,10 @@ static int amdgpu_pmops_suspend(struct device *dev) adev->in_s3 = true; r = amdgpu_device_suspend(drm_dev, true); adev->in_s3 = false; - + if (r) + return r; + if (!adev->in_s0ix) + r = amdgpu_asic_reset(adev); return r; } -- 2.34.1