From: Alex Deucher <alexdeucher@gmail.com>
To: amd-gfx@lists.freedesktop.org
Cc: Alex Deucher <alexander.deucher@amd.com>
Subject: [PATCH 2/3] drm/amdgpu/smu: properly handle runpm/suspend/reset
Date: Fri, 7 Feb 2020 10:18:41 -0500 [thread overview]
Message-ID: <20200207151842.802638-2-alexander.deucher@amd.com> (raw)
In-Reply-To: <20200207151842.802638-1-alexander.deucher@amd.com>
We need some special handling when using baco vs. other
things.
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 35 ++++++++++++----------
1 file changed, 19 insertions(+), 16 deletions(-)
diff --git a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
index 0e9d33ee08ab..53ea5343fbed 100644
--- a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
+++ b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
@@ -1454,11 +1454,15 @@ int smu_reset(struct smu_context *smu)
return ret;
}
-static int smu_disabled_dpms(struct smu_context *smu)
+static int smu_disable_dpm(struct smu_context *smu)
{
struct amdgpu_device *adev = smu->adev;
uint32_t smu_version;
int ret = 0;
+ bool use_baco = !smu->is_apu &&
+ ((adev->in_gpu_reset &&
+ (amdgpu_asic_reset_method(adev) == AMD_RESET_METHOD_BACO)) ||
+ (adev->in_runpm && amdgpu_asic_supports_baco(adev)));
ret = smu_get_smc_version(smu, NULL, &smu_version);
if (ret) {
@@ -1467,13 +1471,13 @@ static int smu_disabled_dpms(struct smu_context *smu)
}
/*
- * For baco reset on Arcturus, this operation
+ * For baco on Arcturus, this operation
* (disable all smu feature) will be handled by SMU FW.
*/
- if (adev->in_gpu_reset &&
- (amdgpu_asic_reset_method(adev) == AMD_RESET_METHOD_BACO) &&
- (adev->asic_type == CHIP_ARCTURUS && smu_version > 0x360e00))
- return 0;
+ if (adev->asic_type == CHIP_ARCTURUS) {
+ if (use_baco && (smu_version > 0x360e00))
+ return 0;
+ }
/* Disable all enabled SMU features */
ret = smu_system_features_control(smu, false);
@@ -1482,15 +1486,14 @@ static int smu_disabled_dpms(struct smu_context *smu)
return ret;
}
- /* For baco reset, need to leave BACO feature enabled */
- if (adev->in_gpu_reset &&
- (amdgpu_asic_reset_method(adev) == AMD_RESET_METHOD_BACO) &&
- !smu->is_apu &&
- smu_feature_is_enabled(smu, SMU_FEATURE_BACO_BIT)) {
- ret = smu_feature_set_enabled(smu, SMU_FEATURE_BACO_BIT, true);
- if (ret) {
- pr_warn("set BACO feature enabled failed, return %d\n", ret);
- return ret;
+ /* For baco, need to leave BACO feature enabled */
+ if (use_baco) {
+ if (smu_feature_is_enabled(smu, SMU_FEATURE_BACO_BIT)) {
+ ret = smu_feature_set_enabled(smu, SMU_FEATURE_BACO_BIT, true);
+ if (ret) {
+ pr_warn("set BACO feature enabled failed, return %d\n", ret);
+ return ret;
+ }
}
}
@@ -1510,7 +1513,7 @@ static int smu_suspend(void *handle)
return 0;
if(!amdgpu_sriov_vf(adev)) {
- ret = smu_disabled_dpms(smu);
+ ret = smu_disable_dpm(smu);
if (ret)
return ret;
}
--
2.24.1
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
next prev parent reply other threads:[~2020-02-07 15:19 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-07 15:18 [PATCH 1/3] drm/amdgpu: add flag for runtime suspend Alex Deucher
2020-02-07 15:18 ` Alex Deucher [this message]
2020-02-07 15:18 ` [PATCH 3/3] drm/amdgpu/powerplay: fix baco check for vega20 Alex Deucher
2020-02-10 2:58 ` Quan, Evan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200207151842.802638-2-alexander.deucher@amd.com \
--to=alexdeucher@gmail.com \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).