drm/amd/pm: track BACO state in the SMU v11 ArmD3 sequence
Alex Deucher
maintainerPATCH 1/1 drm/amd/pm: track BACO state in the SMU v11 ArmD3 sequence
From: Mario Limonciello <[email protected]>
On Navi1x/Sienna Cichlid with runtime PM, when the audio function is enabled, BACO entry and exit are delegated to PMFW by sending SMU_MSG_ArmD3 instead of going through smu_v11_0_baco_set_state(). Unlike the v13/v14/v15 helpers, smu_v11_0_baco_set_armd3_sequence() does not update smu_baco->state, so the driver keeps reporting SMU_BACO_STATE_EXIT while the ASIC is armed for / sitting in BACO.
At runtime resume amdgpu_device_baco_exit() checks amdgpu_device_supports_baco(), which ends up in smu_v11_0_get_bamaco_support(). Since the state never reads ENTER, the "already in BACO" shortcut is skipped and the live BACO feature bit is consulted instead. PMFW clears that bit once ArmD3(BACO) is armed, so the check reports "supported but not enabled", the exit fails with -ENOTSUPP and the ULPS ArmD3 message is never sent. The runtime resume caller ignores the error, and a later secondary bus reset leaves the device unreachable. This shows up on a Navi 23 being handed from amdgpu to vfio-pci:
baco_enter: in_runpm=1 audio_enabled=1 armd3=1 baco_state=1 ret=0
bamaco: state=1 ... feat supported=1 enabled=0 in_runpm=1
baco_exit: supports=0 ...
runtime resume: baco_exit ret=-524
Update smu_baco->state in the helper, mirroring the v13 implementation, so the capability check short-circuits while in BACO.
--- .../gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +19 -1
@@ -1421,7 +1421,25 @@ int smu_v11_0_get_max_sustainable_clocks_by_dc(struct smu_context *smu,int smu_v11_0_baco_set_armd3_sequence (struct smu_context *smu,enum smu_baco_seq baco_seq) { -return smu_cmn_send_smc_msg_with_param (smu, SMU_MSG_ArmD3, baco_seq,NULL ); +struct smu_baco_context *smu_baco = &smu->smu_baco; +int ret; + + ret =smu_cmn_send_smc_msg_with_param (smu, SMU_MSG_ArmD3, baco_seq,NULL ); +if (ret) +return ret; + +/* +* PMFW owns the BACO transition once armed, so keep the driver's view +* in sync. Otherwise smu_v11_0_get_bamaco_support() falls back to the +* live BACO feature bit, which PMFW clears when armed, and the runtime +* resume wrongly concludes BACO is unsupported and skips the exit. +*/ +if (baco_seq ==BACO_SEQ_BAMACO || baco_seq ==BACO_SEQ_BACO ) + smu_baco->state =SMU_BACO_STATE_ENTER ; +else + smu_baco->state =SMU_BACO_STATE_EXIT ; + +return 0 ; }int smu_v11_0_get_bamaco_support (struct smu_context *smu)
Signature · 1 line
2.56.1
Greg KH
maintainerQuoted 28 lines · Alex Deucher
From: Mario Limonciello <[email protected]>
On Navi1x/Sienna Cichlid with runtime PM, when the audio function is enabled, BACO entry and exit are delegated to PMFW by sending
SMU_MSG_ArmD3instead of going throughsmu_v11_0_baco_set_state(). Unlike the v13/v14/v15 helpers,smu_v11_0_baco_set_armd3_sequence()does not updatesmu_baco->state, so the driver keeps reportingSMU_BACO_STATE_EXITwhile the ASIC is armed for / sitting in BACO.At runtime resume
amdgpu_device_baco_exit()checksamdgpu_device_supports_baco(), which ends up insmu_v11_0_get_bamaco_support(). Since the state never reads ENTER, the "already in BACO" shortcut is skipped and the live BACO feature bit is consulted instead. PMFW clears that bit once ArmD3(BACO) is armed, so the check reports "supported but not enabled", the exit fails with-ENOTSUPPand the ULPS ArmD3 message is never sent. The runtime resume caller ignores the error, and a later secondary bus reset leaves the device unreachable. This shows up on a Navi 23 being handed from amdgpu to vfio-pci:
baco_enter: in_runpm=1 audio_enabled=1 armd3=1 baco_state=1 ret=0
bamaco: state=1 ... feat supported=1 enabled=0 in_runpm=1
baco_exit: supports=0 ...
runtime resume:baco_exitret=-524Update
smu_baco->statein the helper, mirroring the v13 implementation, so the capability check short-circuits while in BACO.
Quoted 10 lines
Reported-by Nathan Blomquist <[email protected]>Tested-by Nathan Blomquist <[email protected]>Fixes 13d75eadfa1a ("drm/amd/pm: correct the runpm handling for BACO supported ASIC")Acked-by Alex Deucher <[email protected]>Signed-off-by Mario Limonciello <[email protected]>Signed-off-by Alex Deucher <[email protected]>(cherry picked from commit d515b2694eab5b35533c7fb7af5bddff53ff60d3)(cherry picked from commit a26ec190925733dd205507493e936e59dbcd2b19)
Really?
:)
What stable tree(s) is this for?
thanks,
greg "I hate the drm git tree" k-h
Quoted 40 lines · Greg KH
Quoted 28 lines · Alex Deucher
From: Mario Limonciello <[email protected]>
On Navi1x/Sienna Cichlid with runtime PM, when the audio function is enabled, BACO entry and exit are delegated to PMFW by sending
SMU_MSG_ArmD3instead of going throughsmu_v11_0_baco_set_state(). Unlike the v13/v14/v15 helpers,smu_v11_0_baco_set_armd3_sequence()does not updatesmu_baco->state, so the driver keeps reportingSMU_BACO_STATE_EXITwhile the ASIC is armed for / sitting in BACO.At runtime resume
amdgpu_device_baco_exit()checksamdgpu_device_supports_baco(), which ends up insmu_v11_0_get_bamaco_support(). Since the state never reads ENTER, the "already in BACO" shortcut is skipped and the live BACO feature bit is consulted instead. PMFW clears that bit once ArmD3(BACO) is armed, so the check reports "supported but not enabled", the exit fails with-ENOTSUPPand the ULPS ArmD3 message is never sent. The runtime resume caller ignores the error, and a later secondary bus reset leaves the device unreachable. This shows up on a Navi 23 being handed from amdgpu to vfio-pci:
baco_enter: in_runpm=1 audio_enabled=1 armd3=1 baco_state=1 ret=0
bamaco: state=1 ... feat supported=1 enabled=0 in_runpm=1
baco_exit: supports=0 ...
runtime resume:baco_exitret=-524Update
smu_baco->statein the helper, mirroring the v13 implementation, so the capability check short-circuits while in BACO.Quoted 10 lines
Reported-by Nathan Blomquist <[email protected]>Tested-by Nathan Blomquist <[email protected]>Fixes 13d75eadfa1a ("drm/amd/pm: correct the runpm handling for BACO supported ASIC")Acked-by Alex Deucher <[email protected]>Signed-off-by Mario Limonciello <[email protected]>Signed-off-by Alex Deucher <[email protected]>(cherry picked from commit d515b2694eab5b35533c7fb7af5bddff53ff60d3)(cherry picked from commit a26ec190925733dd205507493e936e59dbcd2b19)
Quoted 6 lines
Really?
:)
What stable tree(s) is this for?
Original commit it fixes is 5.14, so I did a backport and test build on all the remaining stable trees and they all worked.
┌────────┬──────────┬───────────────────────┬─────────────┬─────────────┐ │ Tree │ Base │ Branch │ Cherry-pick │ Module build ├────────┼──────────┼───────────────────────┼─────────────┼─────────────┤ │ 7.3.y │ 7.3.5 │ superm1/stable-7.3.y │ clean │ OK ├────────┼──────────┼───────────────────────┼─────────────┼─────────────┤ │ 6.18.y │ 6.18.64 │ superm1/stable-6.18.y │ clean │ OK ├────────┼──────────┼───────────────────────┼─────────────┼─────────────┤ │ 6.12.y │ 6.12.118 │ superm1/stable-6.12.y │ clean │ OK ├────────┼──────────┼───────────────────────┼─────────────┼─────────────┤ │ 6.6.y │ 6.6.162 │ superm1/stable-6.6.y │ clean │ OK ├────────┼──────────┼───────────────────────┼─────────────┼─────────────┤ │ 6.1.y │ 6.1.192 │ superm1/stable-6.1.y │ clean │ OK ├────────┼──────────┼───────────────────────┼─────────────┼─────────────┤ │ 5.15.y │ 5.15.225 │ superm1/stable-5.15.y │ clean │ OK └────────┴──────────┴───────────────────────┴─────────────┴─────────────┘