Re: [PATCH v3 1/3] firmware: xilinx: Add support to clear TF-A PM state
From: Sudeep Holla <sudeep.holla@kernel.org>
Date: 2026-07-24 11:13:17
Also in:
lkml
On Fri, Jul 24, 2026 at 03:19:46AM -0700, Jay Buddhabhatti wrote:
Currently, during a kexec restart, only the kernel is reloaded, while the TF-A specific data remain unchanged. This leads to a mismatch between the kernel state and the TF-A firmware state like SGI number and shutdown scope variable.
Avoid using TF-A in general as it can be any other firmware as well. You can always generalise as PSCI or EL3 firmware.
For example, the kernel registers an SGI number with TF-A so that TF-A can notify the kernel of events via that SGI. TF-A stores this SGI number in its internal state. After a kexec, the newly loaded kernel re-registers and may request a different SGI number, but the stale value programmed in TF-A remains, so event notifications are delivered on the old SGI and are missed by the new kernel. The shutdown scope variable has a similar stale state problem.
Doesn't it reset it every time CPU_OFF or CPU_ON is called ?
To resolve this, the TF_A_CLEAR_PM_STATE PM API is introduced to clear TF-A-specific state during kexec. On a graceful reboot, this API is triggered by zynqmp_firmware_shutdown(), while in a crash kernel scenario, it is invoked by zynqmp_firmware_probe() in the reloaded kernel.
I don't see the need for such an API just for kexec needs. You must deal with it as part of CPU_ON as it should start with clean slate as SGIs are per CPU, no ? -- Regards, Sudeep