firmware: arm_scmi: power_control: Ensure SCMI_SYSPOWER_IDLE is set early during...
authorPeng Fan <peng.fan@nxp.com>
Fri, 4 Jul 2025 03:09:36 +0000 (11:09 +0800)
committerSudeep Holla <sudeep.holla@arm.com>
Mon, 7 Jul 2025 15:53:16 +0000 (16:53 +0100)
commit9a0658d3991e6c82df87584b253454842f22f965
tree6fe075be0cf2e7780994261839fbc5ce664211c4
parent76e65f7a0e0fb41d636c11b688db6393676f4bf4
firmware: arm_scmi: power_control: Ensure SCMI_SYSPOWER_IDLE is set early during resume

Fix a race condition where a second suspend notification from another
SCMI agent wakes the system before SCMI_SYSPOWER_IDLE is set, leading
to ignored suspend requests. This is due to interrupts triggering early
execution of `scmi_userspace_notifier()` before the SCMI state is updated.

To resolve this, set SCMI_SYSPOWER_IDLE earlier in the device resume
path, prior to `thaw_processes()`. This ensures the SCMI state is
correct when the notifier runs, allowing the system to suspend again
as expected.

On some platforms using SCMI, SCP cannot distinguish between CPU idle
and suspend since both result in cluster power-off. By explicitly setting
the idle state early, the Linux SCMI agent can correctly re-suspend in
response to external notifications.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Message-Id: <20250704-scmi-pm-v2-2-9316cec2f9cc@nxp.com>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
drivers/firmware/arm_scmi/scmi_power_control.c