[PATCH v4 0/3] firmware: xilinx: Clean up firmware and EL3 state on kexec

From: Jay Buddhabhatti

Date: Wed Jul 29 2026 - 08:59:33 EST


During a kexec restart, only the kernel is reloaded while the state held
in EL3 and platform firmware persists. This leaves the freshly booted
kernel out of sync with secure firmware for things like the SGI number,
shutdown scope, allocated peripheral devices and registered notifier
callbacks, which can lead to unexpected behaviour after a kexec.

Introduce a mechanism to clear the stale EL3 and platform firmware state
so the reloaded kernel starts from a clean baseline:

- Add TF_A_CLEAR_PM_STATE to clear EL3 PM subsystem state.
- Add PM_DEV_ALL_PERIPH to release all peripheral devices in one call.
- Add PM_ALL_NOTIFIERS to unregister all notifier callbacks in one call.

On a graceful kexec reboot the cleanup is performed from
zynqmp_firmware_shutdown(); on a crash (kdump) restart it is performed
from zynqmp_firmware_probe() of the reloaded kernel. Each cleanup step
is guarded by a feature check so it degrades gracefully on firmware
versions that do not implement the new APIs.

Changes in v4:
- Modified platform check to restrict kexec cleanup to Versal and
Versal Net platforms only
- Used EL3 firmware instead of TF-A in descriptions and comments

Changes in v3:
- Corrected subject prefix

Changes in v2:
- Drop patch 4/4 (feature check improvements) from this series per
review feedback. Those changes are sent separately as:
"[PATCH 1/2] firmware: xilinx: Use TF-A feature check for
TF-A-specific APIs" and "[PATCH 2/2] firmware: xilinx: Propagate
actual error from feature check"

Jay Buddhabhatti (3):
firmware: xilinx: Add support to clear EL3 PM state
firmware: xilinx: Release all peripheral devices from firmware
firmware: xilinx: Clear firmware notifiers across kexec transitions

drivers/firmware/xilinx/zynqmp.c | 86 +++++++++++++++++++++++++++-
include/linux/firmware/xlnx-zynqmp.h | 10 +++-
2 files changed, 94 insertions(+), 2 deletions(-)

--
2.34.1