From: Jay Buddhabhatti <jay.buddhabhatti@amd.com>
To: <michal.simek@amd.com>, <git@amd.com>
Cc: <linux-arm-kernel@lists.infradead.org>,
<linux-kernel@vger.kernel.org>,
Jay Buddhabhatti <jay.buddhabhatti@amd.com>
Subject: [PATCH 2/4] firmware: xilinx: Release all peripheral devices from firmware
Date: Thu, 23 Jul 2026 05:48:39 -0700 [thread overview]
Message-ID: <20260723124841.2567827-3-jay.buddhabhatti@amd.com> (raw)
In-Reply-To: <20260723124841.2567827-1-jay.buddhabhatti@amd.com>
During a kexec restart, only the kernel is reloaded while devices
allocated in firmware persist, causing state mismatches between the
kernel and firmware.
Introduce PM_DEV_ALL_PERIPH node ID (0x18224FFFU) to release all
peripheral devices during kexec. On graceful restarts, this happens in
zynqmp_firmware_shutdown(). On crash kernel restarts, it happens in
zynqmp_firmware_probe() of the reloaded kernel.
Releasing all peripherals depends on firmware support for the
PM_DEV_ALL_PERIPH node ID. On firmware that does not implement it (the
feature check reports a version below PM_API_VERSION_3) the release is
skipped and a warning such as "Bulk device release is not supported by
firmware" is logged, e.g. on Versal NET firmware that predates this API.
Signed-off-by: Jay Buddhabhatti <jay.buddhabhatti@amd.com>
---
drivers/firmware/xilinx/zynqmp.c | 15 ++++++++++++++-
include/linux/firmware/xlnx-zynqmp.h | 4 ++++
2 files changed, 18 insertions(+), 1 deletion(-)
diff --git a/drivers/firmware/xilinx/zynqmp.c b/drivers/firmware/xilinx/zynqmp.c
index 95ffd8f33ce9..64d2109eefd2 100644
--- a/drivers/firmware/xilinx/zynqmp.c
+++ b/drivers/firmware/xilinx/zynqmp.c
@@ -2070,7 +2070,7 @@ ATTRIBUTE_GROUPS(zynqmp_firmware);
* zynqmp_clear_pm_state() - Clear subsystem state
* @dev: Device pointer used for logging
*
- * Clears PM specific data in TF-A.
+ * Clears PM specific data in TF-A and firmware.
*
* Return: Returns status, either success or error
*/
@@ -2097,6 +2097,19 @@ static int zynqmp_clear_pm_state(struct device *dev)
dev_warn(dev, "TF_A_CLEAR_PM_STATE is not supported in TF-A: %d\n", ret);
ret = 0;
}
+
+ /* Check if the firmware supports the PM_DEV_ALL_PERIPH node ID */
+ ret = do_feature_check_call(PM_RELEASE_NODE);
+ if (ret >= 0 && ((ret & FIRMWARE_VERSION_MASK) >= PM_API_VERSION_3)) {
+ /* Attempt to release all peripheral devices via firmware */
+ ret = zynqmp_pm_release_node(PM_DEV_ALL_PERIPH);
+ if (ret)
+ dev_err(dev, "Failed to release all peripheral devices: %d\n", ret);
+ } else {
+ dev_warn(dev,
+ "Bulk device release is not supported by firmware: %d\n", ret);
+ ret = 0;
+ }
}
return ret;
diff --git a/include/linux/firmware/xlnx-zynqmp.h b/include/linux/firmware/xlnx-zynqmp.h
index baaa88b0b197..ac39e5492961 100644
--- a/include/linux/firmware/xlnx-zynqmp.h
+++ b/include/linux/firmware/xlnx-zynqmp.h
@@ -50,6 +50,7 @@
/* PM API versions */
#define PM_API_VERSION_1 1
#define PM_API_VERSION_2 2
+#define PM_API_VERSION_3 3
#define PM_PINCTRL_PARAM_SET_VERSION 2
@@ -145,6 +146,9 @@
#define XPM_EVENT_ERROR_MASK_NOC_NCR BIT(13)
#define XPM_EVENT_ERROR_MASK_NOC_CR BIT(12)
+/* Node ID for all peripheral devices */
+#define PM_DEV_ALL_PERIPH 0x18224FFFU
+
enum pm_module_id {
PM_MODULE_ID = 0x0,
XPM_MODULE_ID = 0x2,
--
2.34.1
next prev parent reply other threads:[~2026-07-23 12:51 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-23 12:48 [PATCH 0/4] firmware: xilinx: Clean up firmware and TF-A state on kexec Jay Buddhabhatti
2026-07-23 12:48 ` [PATCH 1/4] firmware: xilinx: Add support to clear TF-A PM state Jay Buddhabhatti
2026-07-23 16:25 ` Pandey, Radhey Shyam
2026-07-23 12:48 ` Jay Buddhabhatti [this message]
2026-07-23 16:25 ` [PATCH 2/4] firmware: xilinx: Release all peripheral devices from firmware Pandey, Radhey Shyam
2026-07-23 12:48 ` [PATCH 3/4] firmware: xilinx: Clear firmware notifiers across kexec transitions Jay Buddhabhatti
2026-07-23 16:27 ` Pandey, Radhey Shyam
2026-07-23 12:48 ` [PATCH 4/4] firmware: xilinx: Use TF-A feature check for TF-A specific APIs Jay Buddhabhatti
2026-07-23 16:28 ` Pandey, Radhey Shyam
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260723124841.2567827-3-jay.buddhabhatti@amd.com \
--to=jay.buddhabhatti@amd.com \
--cc=git@amd.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=michal.simek@amd.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox