During a kexec restart, only the kernel is reloaded while the state held
in TF-A and the platform firmware persists. This leaves the freshly
booted kernel out of sync with the 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 firmware/TF-A state so the
reloaded kernel starts from a clean baseline:
- Add TF_A_CLEAR_PM_STATE to clear TF-A specific PM 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/TF-A
versions that do not implement the new APIs.
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 TF-A PM state
firmware: xilinx: Release all peripheral devices from firmware
firmware: xilinx: Clear firmware notifiers across kexec transitions
drivers/firmware/xilinx/zynqmp.c | 75 +++++++++++++++++++++++++++-
include/linux/firmware/xlnx-zynqmp.h | 10 +++-
2 files changed, 83 insertions(+), 2 deletions(-)
--
2.34.1