accel/amdxdna: aie4: restore power override across suspend/resume - #1537
Open
NishadSaraf wants to merge 1 commit into
Open
accel/amdxdna: aie4: restore power override across suspend/resume#1537NishadSaraf wants to merge 1 commit into
NishadSaraf wants to merge 1 commit into
Conversation
The AIE4 power override was silently lost on any suspend/resume (S3/S4 or
runtime PM). Two coupled issues caused this:
- aie4_query_aie() runs on every VF/Classic resume and unconditionally
reset ndev->pw_mode to POWER_MODE_DEFAULT, wiping the cached user
setting reported by DRM_AMDXDNA_GET_POWER_MODE.
- Firmware always reboots in POWER_MODE_DEFAULT and no resume path
re-sent AIE4_MSG_OP_POWER_OVERRIDE, so even the PF path (which keeps
its cache) left the firmware at DEFAULT, diverging from the cache.
Power override is a per-VF property: firmware stores each supervisor's
requested mode and the hypervisor arbitrates globally by taking the
highest mode across all supervisors. A full firmware reload on suspend
clears every supervisor override, so each device type (PF, VF and classic)
must re-send its own cached override on resume to preserve its contribution
to that arbitration.
Set the probe-time default explicitly in aie4m_pcidev_init(), stop
clobbering the cache in aie4_query_aie(), and add aie4_restore_power_mode()
to re-send the cached override to firmware from all three hw_start paths
once the mailbox is up. On a fresh probe pw_mode is DEFAULT so it is a
no-op; on resume it re-applies the user's override. A failure only warns
and does not fail hw start, mirroring the ctx hysteresis handling.
Signed-off-by: Nishad Saraf <nishad.saraf@amd.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes AIE4 power override persistence across suspend/resume and runtime PM by ensuring the driver’s cached power mode isn’t clobbered during resume and by re-applying the cached override to firmware whenever hardware is started (PF, VF, and classic paths).
Changes:
- Stop resetting
ndev->pw_modeinsideaie4_query_aie()(which runs on resume), preserving the user’s cached override. - Initialize the probe-time default explicitly (
ndev->pw_mode = POWER_MODE_DEFAULT) inaie4m_pcidev_init(). - Add
aie4_restore_power_mode()and call it from all three*_hw_start()paths to re-sendAIE4_MSG_OP_POWER_OVERRIDEafter firmware/mailbox is up.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The AIE4 power override was silently lost on any suspend/resume (S3/S4 or runtime PM). Two coupled issues caused this:
Power override is a per-VF property: firmware stores each supervisor's requested mode and the hypervisor arbitrates globally by taking the highest mode across all supervisors. A full firmware reload on suspend clears every supervisor override, so each device type (PF, VF and classic) must re-send its own cached override on resume to preserve its contribution to that arbitration.
Set the probe-time default explicitly in aie4m_pcidev_init(), stop clobbering the cache in aie4_query_aie(), and add aie4_restore_power_mode() to re-send the cached override to firmware from all three hw_start paths once the mailbox is up. On a fresh probe pw_mode is DEFAULT so it is a no-op; on resume it re-applies the user's override. A failure only warns and does not fail hw start, mirroring the ctx hysteresis handling.