Skip to contentSkip to conversation

drm/amd/pm/smu11: BACO is supported when it's in BACO state

PATCH In review Guchun Chen 2 participants 3 messages Nov 23, 2022 – Dec 28, 2022

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/3 drm/amd/pm/smu11: BACO is supported when it's in BACO state

Return true early if ASIC is in BACO state already, no need to talk to SMU. It can fix the issue that driver was not calling BACO exit at all in runtime pm resume, and a timing issue leading to a PCI AER error happened eventually.

Fixes 8795e182b02d ("PCI/portdrv: Don't disable AER reporting in get_port_device_capability()")
---
 drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +4 -0
index 70b560737687..ad5f6a15a1d7 100644
@@ -1588,6 +1588,10 @@ bool smu_v11_0_baco_is_support(struct smu_context *smu)
 	if (amdgpu_sriov_vf(smu->adev) || !smu_baco->platform_support)
 		return false;
 
+	/* return true if ASIC is in BACO state already */
+	if (smu_v11_0_baco_get_state(smu) == SMU_BACO_STATE_ENTER)
+		return true;
+
 	/* Arcturus does not support this bit mask */
 	if (smu_cmn_feature_is_supported(smu, SMU_FEATURE_BACO_BIT) &&
 	   !smu_cmn_feature_is_enabled(smu, SMU_FEATURE_BACO_BIT))
Signature · 1 line
2.25.1
#1 lore raw

[+cc Stefan, linux-pci]

Quoted 4 lines · Guchun Chen

Return true early if ASIC is in BACO state already, no need to talk to SMU. It can fix the issue that driver was not calling BACO exit at all in runtime pm resume, and a timing issue leading to a PCI AER error happened eventually.

This sounds suspiciously racy.

Quoted 1 line
Fixes 8795e182b02d ("PCI/portdrv: Don't disable AER reporting in get_port_device_capability()")

To clarify, this patch avoids a driver problem, not a problem with 8795e182b02d.

See question below.

Quoted 11 lines
---
 drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +0 -0
index 70b560737687..ad5f6a15a1d7 100644

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c bool smu_v11_0_baco_is_support(struct smu_context *smu) · line 1593

Quoted 6 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +3 -0
@@ -1588,6 +1588,10 @@ bool smu_v11_0_baco_is_support(struct smu_context *smu)
 	if (amdgpu_sriov_vf(smu->adev) || !smu_baco->platform_support)
 		return false;
 
+	/* return true if ASIC is in BACO state already */
+	if (smu_v11_0_baco_get_state(smu) == SMU_BACO_STATE_ENTER)
+		return true;

smu_v13_0_baco_is_support() is essentially identical to smu_v11_0_baco_is_support(). Does it need a similar change?

Quoted 6 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +0 -0
 	/* Arcturus does not support this bit mask */
 	if (smu_cmn_feature_is_supported(smu, SMU_FEATURE_BACO_BIT) &&
 	   !smu_cmn_feature_is_enabled(smu, SMU_FEATURE_BACO_BIT))
Signature · 1 line
2.25.1
#2 lore raw

Hi Bjorn,

Thanks for your comments.

Exactly, this patch actually fixes an amdgpu driver issue, however it's only exposed by 8795e182b02d. Without it, it was running well over the past.

Regarding the question, I will provide a similar change in smu13 later on.

Regards,
Guchun

-----Original Message-----
From: Bjorn Helgaas <[email protected]>
Sent: Wednesday, December 28, 2022 2:24 AM
To: Chen, Guchun <[email protected]>
Cc: [email protected]; Deucher, Alexander <[email protected]>; Zhang, Hawking <[email protected]>; Lazar, Lijo <[email protected]>; Quan, Evan <[email protected]>; Stefan Roese <[email protected]>; [email protected]
Subject: Re: [PATCH 1/3] drm/amd/pm/smu11: BACO is supported when it's in BACO state

[+cc Stefan, linux-pci]

Quoted 4 lines · Guchun Chen

Return true early if ASIC is in BACO state already, no need to talk to SMU. It can fix the issue that driver was not calling BACO exit at all in runtime pm resume, and a timing issue leading to a PCI AER error happened eventually.

This sounds suspiciously racy.

Quoted 2 lines
Fixes 8795e182b02d ("PCI/portdrv: Don't disable AER reporting in

get_port_device_capability()")

To clarify, this patch avoids a driver problem, not a problem with 8795e182b02d.

See question below.

Quoted 12 lines
---
 drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +0 -0
index 70b560737687..ad5f6a15a1d7 100644

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c bool smu_v11_0_baco_is_support(struct smu_context *smu) · line 1593

Quoted 6 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +3 -0
@@ -1588,6 +1588,10 @@ bool smu_v11_0_baco_is_support(struct smu_context *smu)
 	if (amdgpu_sriov_vf(smu->adev) || !smu_baco->platform_support)
 		return false;
 
+	/* return true if ASIC is in BACO state already */
+	if (smu_v11_0_baco_get_state(smu) == SMU_BACO_STATE_ENTER)
+		return true;

smu_v13_0_baco_is_support() is essentially identical to smu_v11_0_baco_is_support(). Does it need a similar change?

Quoted 6 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +0 -1
 	/* Arcturus does not support this bit mask */
 	if (smu_cmn_feature_is_supported(smu, SMU_FEATURE_BACO_BIT) &&
 	   !smu_cmn_feature_is_enabled(smu, SMU_FEATURE_BACO_BIT))
--

2.25.1