Skip to contentSkip to conversation

drm/amd/pm: allow the user to force BACO on smu v13.0.0/7

PATCH In review Kenneth Feng 2 participants 4 messages Aug 15, 2023 – Aug 16, 2023

Subsystems (3)
lore
Share & tools
lore

Kenneth Feng

author maintainer
#0 lore raw

PATCH 1/1 drm/amd/pm: allow the user to force BACO on smu v13.0.0/7

allow the user to force BACO on smu v13.0.0/7

---
 drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c       | 2 +-
 drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c | 3 ++-
 drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c | 3 ++-
 3 files changed, 5 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +1 -1
index 895cda8e6934..52e9c7611013 100644
@@ -2263,7 +2263,7 @@ int smu_v13_0_baco_set_state(struct smu_context *smu,
 	if (state == SMU_BACO_STATE_ENTER) {
 		ret = smu_cmn_send_smc_msg_with_param(smu,
 						      SMU_MSG_EnterBaco,
-						      smu_baco->maco_support ?
+						      (smu_baco->maco_support && amdgpu_runtime_pm != 1) ?
 						      BACO_SEQ_BAMACO : BACO_SEQ_BACO,
 						      NULL);
 	} else {
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c +2 -1
index a5857acee641..12ccc12657d7 100644
@@ -2211,7 +2211,8 @@ static int smu_v13_0_0_baco_enter(struct smu_context *smu)
 
 	if (adev->in_runpm && smu_cmn_is_audio_func_enabled(adev))
 		return smu_v13_0_baco_set_armd3_sequence(smu,
-				smu_baco->maco_support ? BACO_SEQ_BAMACO : BACO_SEQ_BACO);
+				(smu_baco->maco_support && amdgpu_runtime_pm != 1) ?
+					BACO_SEQ_BAMACO : BACO_SEQ_BACO);
 	else
 		return smu_v13_0_baco_enter(smu);
 }
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c +2 -1
index 93b3e8fa8238..f0bcc7995983 100644
@@ -2139,7 +2139,8 @@ static int smu_v13_0_7_baco_enter(struct smu_context *smu)
 
 	if (adev->in_runpm && smu_cmn_is_audio_func_enabled(adev))
 		return smu_v13_0_baco_set_armd3_sequence(smu,
-				smu_baco->maco_support ? BACO_SEQ_BAMACO : BACO_SEQ_BACO);
+				(smu_baco->maco_support && amdgpu_runtime_pm != 1) ?
+					BACO_SEQ_BAMACO : BACO_SEQ_BACO);
 	else
 		return smu_v13_0_baco_enter(smu);
 }
Signature · 1 line
2.34.1
Acked-by on v1 1/1
#1 lore raw
Quoted 4 lines · Kenneth Feng

allow the user to force BACO on smu v13.0.0/7

Would it be better to default to BACO? It would save more power at the expense of resume latency.

Alex

Quoted 50 lines
---
 drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c       | 2 +-
 drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c | 3 ++-
 drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c | 3 ++-
 3 files changed, 5 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +1 -1
index 895cda8e6934..52e9c7611013 100644
@@ -2263,7 +2263,7 @@ int smu_v13_0_baco_set_state(struct smu_context *smu,
        if (state == SMU_BACO_STATE_ENTER) {
                ret = smu_cmn_send_smc_msg_with_param(smu,
                                                      SMU_MSG_EnterBaco,
-                                                     smu_baco->maco_support ?
+                                                     (smu_baco->maco_support && amdgpu_runtime_pm != 1) ?
                                                      BACO_SEQ_BAMACO : BACO_SEQ_BACO,
                                                      NULL);
        } else {
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c +2 -1
index a5857acee641..12ccc12657d7 100644
@@ -2211,7 +2211,8 @@ static int smu_v13_0_0_baco_enter(struct smu_context *smu)
 
        if (adev->in_runpm && smu_cmn_is_audio_func_enabled(adev))
                return smu_v13_0_baco_set_armd3_sequence(smu,
-                               smu_baco->maco_support ? BACO_SEQ_BAMACO : BACO_SEQ_BACO);
+                               (smu_baco->maco_support && amdgpu_runtime_pm != 1) ?
+                                       BACO_SEQ_BAMACO : BACO_SEQ_BACO);
        else
                return smu_v13_0_baco_enter(smu);
 }
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c +2 -2
index 93b3e8fa8238..f0bcc7995983 100644
@@ -2139,7 +2139,8 @@ static int smu_v13_0_7_baco_enter(struct smu_context *smu)
 
        if (adev->in_runpm && smu_cmn_is_audio_func_enabled(adev))
                return smu_v13_0_baco_set_armd3_sequence(smu,
-                               smu_baco->maco_support ? BACO_SEQ_BAMACO : BACO_SEQ_BACO);
+                               (smu_baco->maco_support && amdgpu_runtime_pm != 1) ?
+                                       BACO_SEQ_BAMACO : BACO_SEQ_BACO);
        else
                return smu_v13_0_baco_enter(smu);
 }
--

2.34.1

author maintainer Acked-by Alex Deucher
#2 lore raw

[AMD Official Use Only - General]

Hi Alex,
Right, just BAMACO has its advantage for the fast resume.
Maybe later we can further identify which sku needs to save more power vs faster resume time. For example, mobile device can by default use BACO and desktop/workstation device can by default use BAMACO. Thanks.

-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Wednesday, August 16, 2023 12:56 AM
To: Feng, Kenneth <[email protected]>
Cc: [email protected]
Subject: Re: [PATCH] drm/amd/pm: allow the user to force BACO on smu v13.0.0/7

Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.

Quoted 4 lines · Kenneth Feng

allow the user to force BACO on smu v13.0.0/7

Alex

Quoted 55 lines
---
 drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c       | 2 +-
 drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c | 3 ++-
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c | 3 ++-
 3 files changed, 5 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +1 -1
index 895cda8e6934..52e9c7611013 100644
@@ -2263,7 +2263,7 @@ int smu_v13_0_baco_set_state(struct smu_context *smu,
        if (state == SMU_BACO_STATE_ENTER) {
                ret = smu_cmn_send_smc_msg_with_param(smu,
                                                      SMU_MSG_EnterBaco,
-                                                     smu_baco->maco_support ?
+                                                     (smu_baco->maco_support && amdgpu_runtime_pm != 1) ?
                                                      BACO_SEQ_BAMACO : BACO_SEQ_BACO,
                                                      NULL);
        } else {
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c +3 -1
index a5857acee641..12ccc12657d7 100644
@@ -2211,7 +2211,8 @@ static int smu_v13_0_0_baco_enter(struct
 smu_context *smu)
 
        if (adev->in_runpm && smu_cmn_is_audio_func_enabled(adev))
                return smu_v13_0_baco_set_armd3_sequence(smu,
-                               smu_baco->maco_support ? BACO_SEQ_BAMACO : BACO_SEQ_BACO);
+                               (smu_baco->maco_support && amdgpu_runtime_pm != 1) ?
+                                       BACO_SEQ_BAMACO :
+ BACO_SEQ_BACO);
        else
                return smu_v13_0_baco_enter(smu);  } diff --git

a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c index 93b3e8fa8238..f0bcc7995983 100644

drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c +3 -2
@@ -2139,7 +2139,8 @@ static int smu_v13_0_7_baco_enter(struct
 smu_context *smu)
 
        if (adev->in_runpm && smu_cmn_is_audio_func_enabled(adev))
                return smu_v13_0_baco_set_armd3_sequence(smu,
-                               smu_baco->maco_support ? BACO_SEQ_BAMACO : BACO_SEQ_BACO);
+                               (smu_baco->maco_support && amdgpu_runtime_pm != 1) ?
+                                       BACO_SEQ_BAMACO :
+ BACO_SEQ_BACO);
        else
                return smu_v13_0_baco_enter(smu);  }
--

2.34.1

#3 lore raw
Quoted 7 lines · Kenneth

[AMD Official Use Only - General]

Hi Alex,
Right, just BAMACO has its advantage for the fast resume.
Maybe later we can further identify which sku needs to save more power vs faster resume time. For example, mobile device can by default use BACO and desktop/workstation device can by default use BAMACO.

Well, we don't really take advantage of it at the moment. We need to add a check in amdgpu_device_evict_resources() and if BAMACO is selected, we can skip evicting resources from vram. Otherwise we evict everything which pretty much nullifies the latency advantage of BAMACO. So unless we fix that, we should default to BACO to save the extra power.

Alex

Quoted 79 lines

Thanks.

-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Wednesday, August 16, 2023 12:56 AM
To: Feng, Kenneth <[email protected]>
Cc: [email protected]
Subject: Re: [PATCH] drm/amd/pm: allow the user to force BACO on smu v13.0.0/7

Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.

Quoted 4 lines · Kenneth Feng

allow the user to force BACO on smu v13.0.0/7

Alex

Quoted 55 lines
---
 drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c       | 2 +-
 drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c | 3 ++-
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c | 3 ++-
 3 files changed, 5 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +1 -1
index 895cda8e6934..52e9c7611013 100644
@@ -2263,7 +2263,7 @@ int smu_v13_0_baco_set_state(struct smu_context *smu,
        if (state == SMU_BACO_STATE_ENTER) {
                ret = smu_cmn_send_smc_msg_with_param(smu,
                                                      SMU_MSG_EnterBaco,
-                                                     smu_baco->maco_support ?
+                                                     (smu_baco->maco_support && amdgpu_runtime_pm != 1) ?
                                                      BACO_SEQ_BAMACO : BACO_SEQ_BACO,
                                                      NULL);
        } else {
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c +3 -1
index a5857acee641..12ccc12657d7 100644
@@ -2211,7 +2211,8 @@ static int smu_v13_0_0_baco_enter(struct
 smu_context *smu)
 
        if (adev->in_runpm && smu_cmn_is_audio_func_enabled(adev))
                return smu_v13_0_baco_set_armd3_sequence(smu,
-                               smu_baco->maco_support ? BACO_SEQ_BAMACO : BACO_SEQ_BACO);
+                               (smu_baco->maco_support && amdgpu_runtime_pm != 1) ?
+                                       BACO_SEQ_BAMACO :
+ BACO_SEQ_BACO);
        else
                return smu_v13_0_baco_enter(smu);  } diff --git

a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c index 93b3e8fa8238..f0bcc7995983 100644

drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c +3 -2
@@ -2139,7 +2139,8 @@ static int smu_v13_0_7_baco_enter(struct
 smu_context *smu)
 
        if (adev->in_runpm && smu_cmn_is_audio_func_enabled(adev))
                return smu_v13_0_baco_set_armd3_sequence(smu,
-                               smu_baco->maco_support ? BACO_SEQ_BAMACO : BACO_SEQ_BACO);
+                               (smu_baco->maco_support && amdgpu_runtime_pm != 1) ?
+                                       BACO_SEQ_BAMACO :
+ BACO_SEQ_BACO);
        else
                return smu_v13_0_baco_enter(smu);  }
--

2.34.1