[PATCH 1/6] firmware: xilinx: Use late_initcall for pm_init_finalize

From: Michal Simek

Date: Thu Nov 19 2026 - 08:17:57 EST


The current implementation uses the driver sync_state callback to call
zynqmp_pm_init_finalize(). This callback only fires when all consumers
of the firmware node have probed their drivers. If any consumer device
has its driver disabled or built as a never-loaded module, sync_state
never fires and pm_init_finalize is never called.

This causes PMUFW to remain in UNINITIALIZED state, leading to IPI
deadlock during CPU idle on ZynqMP platforms.

Replace sync_state with late_initcall to guarantee pm_init_finalize is
called. By late_initcall time, all built-in drivers including the
console UART have probed and requested their power domains, avoiding
any race with early console.

Removing of_genpd_sync_state() from the firmware driver is safe
because the genpd framework automatically sets up its own sync_state
handler on the firmware driver via dev_set_drv_sync_state() when the
PM domain driver registers with of_genpd_add_provider_onecell().
Power domain cleanup continues to work independently without the
firmware driver explicitly calling of_genpd_sync_state().

Fixes: 3da405ead651 ("firmware/pmdomain: xilinx: Move ->sync_state() support to firmware driver")
Signed-off-by: Ronak Jain <ronak.jain@xxxxxxx>
Signed-off-by: Michal Simek <michal.simek@xxxxxxx>
---

drivers/firmware/xilinx/zynqmp.c | 41 ++++++++++++++++++++------------
1 file changed, 26 insertions(+), 15 deletions(-)

diff --git a/drivers/firmware/xilinx/zynqmp.c b/drivers/firmware/xilinx/zynqmp.c
index d76660c55354..22ee6ccdb02c 100644
--- a/drivers/firmware/xilinx/zynqmp.c
+++ b/drivers/firmware/xilinx/zynqmp.c
@@ -21,7 +21,6 @@
#include <linux/of.h>
#include <linux/of_platform.h>
#include <linux/platform_device.h>
-#include <linux/pm_domain.h>
#include <linux/slab.h>
#include <linux/uaccess.h>
#include <linux/hashtable.h>
@@ -2370,19 +2369,6 @@ static void zynqmp_firmware_remove(struct platform_device *pdev)
platform_device_unregister(em_dev);
}

-static void zynqmp_firmware_sync_state(struct device *dev)
-{
- struct device_node *np = dev->of_node;
-
- if (!of_device_is_compatible(np, "xlnx,zynqmp-firmware"))
- return;
-
- of_genpd_sync_state(np);
-
- if (zynqmp_pm_init_finalize())
- dev_warn(dev, "failed to release power management to firmware\n");
-}
-
static const struct platform_fw_data platform_fw_data_versal = {
.family_code = PM_VERSAL_FAMILY_CODE,
};
@@ -2408,10 +2394,35 @@ static struct platform_driver zynqmp_firmware_driver = {
.name = "zynqmp_firmware",
.of_match_table = zynqmp_firmware_of_match,
.dev_groups = zynqmp_firmware_groups,
- .sync_state = zynqmp_firmware_sync_state,
},
.probe = zynqmp_firmware_probe,
.remove = zynqmp_firmware_remove,
.shutdown = zynqmp_firmware_shutdown,
};
module_platform_driver(zynqmp_firmware_driver);
+
+/*
+ * pm_init_finalize was previously called from the firmware driver's
+ * sync_state callback, but sync_state can be blocked indefinitely if
+ * any device consumer never probes. Use late_initcall to ensure
+ * pm_init_finalize is called reliably regardless of consumer
+ * probe status.
+ */
+static int __init zynqmp_pm_init_finalize_late(void)
+{
+ u32 pm_family_code;
+ int ret;
+
+ ret = zynqmp_pm_get_family_info(&pm_family_code);
+ if (ret)
+ return ret;
+
+ if (pm_family_code != PM_ZYNQMP_FAMILY_CODE)
+ return 0;
+
+ if (zynqmp_pm_init_finalize())
+ pr_warn("zynqmp: failed to release power management to firmware\n");
+
+ return 0;
+}
+late_initcall(zynqmp_pm_init_finalize_late);
--
2.43.0