Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2553652lqp; Mon, 25 Mar 2024 02:21:28 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWtKcQFofOIQOcavPzC+UJjFBZzZjW1txq4TlIzvs2rOKlqYh5KooZQ7EJPm5CeQs3T7NudGvzTZiHNn6/jEiiTlrcgDJi0ZA80XtBZnw== X-Google-Smtp-Source: AGHT+IE7qxIyz7gSE9rVjIkMTMQv5JhbSuHqfbcQ65Pr2FCzW5TEW2udXlApj4J1+SdW6nROUWb8 X-Received: by 2002:a05:6a00:139b:b0:6e7:8322:ff8e with SMTP id t27-20020a056a00139b00b006e78322ff8emr9533973pfg.30.1711358487695; Mon, 25 Mar 2024 02:21:27 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711358487; cv=pass; d=google.com; s=arc-20160816; b=YOcqGiAn0fTxuFL0J7T1aI5Eg2ffCd409gZx1+PKEhJLdjZZdlrVR71oeJqAGp/RGr nVkCIi/3OlmIlDjXAvTj7vgaEqTofM/U0RxSVCyhf7hlv28oJn2OmVA5eVlQ4ALM63XW pePV1efwyYLFZ7SszP98zbelTddNGqoYCLqggSB62UopXvnIkrRfWMq3gbvevWamOIHz sPRe16KwuxWVtAQOPXZeFdoZ356ZV6vxGjTPZGw0mQ/hz/ClZNdON/SDN35tYso0ar8t toGKCQvVOQIi5GTRrd47XBW1eTsc26tkPZdXVFK6aIb2SdBVQzF1K+ZYhrhB5tLJDm3i K7og== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=nbsNwQHyjap9J7u+7Cl/xCvtnd/1kZRc3n+rMtMwvFM=; fh=++frzZ9DvDAI+8mhQ/wiVRLMzdQJhVQHcxgSBcgB+TI=; b=LRAw5fbxpawXdfyAS28TqqPZa8HLHRzgC1SFj+cT2ZUxyzVluA5zL33UhfTPujSgFn dfYw0eBn+co/LW3FzTKkGQsPoZCNCNvRvCPsnXK5YSBDoo/Lsj56nopIzzsMykOhiA23 eN0E/VgvK9WLUwFTtx1aOTNpzlPx66eQlLx0xCkkQG1yu7G6olvrmWwRnxc2qZDl6dtw gegs/lpCEWE+amhD2JSlo5871loiI8qZAKhGMbG7fBcwdvIW4g0LT21hRD0rJqfDmazr 7rjotf+dLru1OSprCl4rvvT4dNeNN1tiNP50Khr/oC4mo+zj13OGgIn7Arc95E9qE1ob zNYA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=GxpFwEsj; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-115778-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-115778-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id r17-20020a638f51000000b005e858e2dbefsi7279910pgn.224.2024.03.25.02.21.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 02:21:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-115778-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=GxpFwEsj; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-115778-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-115778-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 75CF429D09B for ; Mon, 25 Mar 2024 09:21:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C57C236F327; Mon, 25 Mar 2024 03:00:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="GxpFwEsj" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 25BBB145334; Sun, 24 Mar 2024 23:12:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711321975; cv=none; b=YCtCoiMVlEy6eprn2xZkvPYNk/FFuDdjOgX4a7zKSQH6/65MrXAm2AIYv1W+SywyA+5+ogG+RkeTcgqe/ueXxC40sJV1Y4eoi5lQiKrekE4cJyD1kqmw/ix43UAJIOGq+fIG2CSnYHSDjbN9uhdgqCyLF0JR1rBYJOt6mpiV5Rs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711321975; c=relaxed/simple; bh=QJUVeH+AgvcFJfM6dMz3jy0Gjst7gZR+ohiyjAPqPPA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=DKm6KdDzjGO+pvEMsFZRwfwyHqUkGwjknfPbO+v3OuXU30oRQ6n0TacNuw7IuJuAcVbwPuMVGLhSGMpyueunHI80jLMpsDLI24U4cDdS3AoxufG6fBGCZF99rrE2oYdrNM1km80bzYbY61FD986X28LUrgZ3jKFF+PJkgbjS/dU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=GxpFwEsj; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 621CEC43394; Sun, 24 Mar 2024 23:12:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711321975; bh=QJUVeH+AgvcFJfM6dMz3jy0Gjst7gZR+ohiyjAPqPPA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GxpFwEsjmx/zgvV75KzX1pBxPWWWaD17I2O1O3xxLo1ZnKZHfzxxksuLbDZtnBoW1 otf0Q8RJC0LVe7SSxCCSaL8cteMuE/2uiCGMiaV4jeUSNaY3qSLRQWiUr8LHfJDrwh pMZeEBhjr5ajMbabaLZfFrDRHhqc1JQmDj3HQE+dQHEJle/VHzsTx5rJUapj3ZEjHX ZvV15Bru2XashBsIqn7S9e/3HAQncL2BrKymt4+XzjumYr4BH+9Sr5a9Ap41JFK9ei eUpCfgcPgDM/liM7dsptf/P0DVSN58nsKFe9lcIeBaCauZzV7lCio04QWlnXGuY7CD Hm3WmvI643QvQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Prike Liang , Alex Deucher , Sasha Levin Subject: [PATCH 6.1 047/451] drm/amdgpu: Enable gpu reset for S3 abort cases on Raven series Date: Sun, 24 Mar 2024 19:05:23 -0400 Message-ID: <20240324231207.1351418-48-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324231207.1351418-1-sashal@kernel.org> References: <20240324231207.1351418-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit From: Prike Liang [ Upstream commit c671ec01311b4744b377f98b0b4c6d033fe569b3 ] Currently, GPU resets can now be performed successfully on the Raven series. While GPU reset is required for the S3 suspend abort case. So now can enable gpu reset for S3 abort cases on the Raven series. Signed-off-by: Prike Liang Acked-by: Alex Deucher Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/amdgpu/soc15.c | 45 +++++++++++++++++------------- 1 file changed, 25 insertions(+), 20 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/soc15.c b/drivers/gpu/drm/amd/amdgpu/soc15.c index 489c89465c78b..c373a2a3248eb 100644 --- a/drivers/gpu/drm/amd/amdgpu/soc15.c +++ b/drivers/gpu/drm/amd/amdgpu/soc15.c @@ -584,11 +584,34 @@ soc15_asic_reset_method(struct amdgpu_device *adev) return AMD_RESET_METHOD_MODE1; } +static bool soc15_need_reset_on_resume(struct amdgpu_device *adev) +{ + u32 sol_reg; + + sol_reg = RREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_81); + + /* Will reset for the following suspend abort cases. + * 1) Only reset limit on APU side, dGPU hasn't checked yet. + * 2) S3 suspend abort and TOS already launched. + */ + if (adev->flags & AMD_IS_APU && adev->in_s3 && + !adev->suspend_complete && + sol_reg) + return true; + + return false; +} + static int soc15_asic_reset(struct amdgpu_device *adev) { /* original raven doesn't have full asic reset */ - if ((adev->apu_flags & AMD_APU_IS_RAVEN) || - (adev->apu_flags & AMD_APU_IS_RAVEN2)) + /* On the latest Raven, the GPU reset can be performed + * successfully. So now, temporarily enable it for the + * S3 suspend abort case. + */ + if (((adev->apu_flags & AMD_APU_IS_RAVEN) || + (adev->apu_flags & AMD_APU_IS_RAVEN2)) && + !soc15_need_reset_on_resume(adev)) return 0; switch (soc15_asic_reset_method(adev)) { @@ -1285,24 +1308,6 @@ static int soc15_common_suspend(void *handle) return soc15_common_hw_fini(adev); } -static bool soc15_need_reset_on_resume(struct amdgpu_device *adev) -{ - u32 sol_reg; - - sol_reg = RREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_81); - - /* Will reset for the following suspend abort cases. - * 1) Only reset limit on APU side, dGPU hasn't checked yet. - * 2) S3 suspend abort and TOS already launched. - */ - if (adev->flags & AMD_IS_APU && adev->in_s3 && - !adev->suspend_complete && - sol_reg) - return true; - - return false; -} - static int soc15_common_resume(void *handle) { struct amdgpu_device *adev = (struct amdgpu_device *)handle; -- 2.43.0