Re: [PATCH 2/2] soc: xilinx: Fix event manager CPU hotplug state cleanup

From: Srivatsa S. Bhat

Date: Wed Nov 18 2026 - 01:34:01 EST


On Mon, Nov 02, 2026 at 10:35:15PM -0800, Prasanna Kumar T S M wrote:
> On driver removal, the event manager removes the CPUHP_AP_ONLINE_DYN
> CPU hotplug state instead of the its actual state. This can leave the
> event manager callbacks dangling. Use the actual CPU hotplug state
> during driver removal.
>
> Hotplug registration failures are also ignored, allowing probe to
> succeed without the callbacks needed to enable event interrupts on
> CPUs brought online later.
>
> Fixes: c7fdb2404f66 ("drivers: soc: xilinx: add xilinx event management driver")
> Signed-off-by: Prasanna Kumar T S M <ptsm@xxxxxxxxxxxxxxxxxxx>
> ---
> drivers/soc/xilinx/xlnx_event_manager.c | 14 ++++++++++----
> 1 file changed, 10 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/soc/xilinx/xlnx_event_manager.c b/drivers/soc/xilinx/xlnx_event_manager.c
> index f733dc42b3b1..2d8bfeab4190 100644
> --- a/drivers/soc/xilinx/xlnx_event_manager.c
> +++ b/drivers/soc/xilinx/xlnx_event_manager.c
> @@ -24,6 +24,7 @@ static DEFINE_PER_CPU_READ_MOSTLY(int, dummy_cpu_number);
>
> static int virq_sgi;
> static int event_manager_availability = -EACCES;
> +static enum cpuhp_state hp_state;
>
> /* SGI number used for Event management driver */
> #define XLNX_EVENT_SGI_NUM (15)
> @@ -625,8 +626,6 @@ static int xlnx_event_init_sgi(struct platform_device *pdev)
>
> static void xlnx_event_cleanup_sgi(struct platform_device *pdev)
> {
> - cpuhp_remove_state(CPUHP_AP_ONLINE_DYN);
> -
> on_each_cpu(xlnx_disable_percpu_irq, NULL, 1);
>
> irq_clear_status_flags(virq_sgi, IRQ_PER_CPU);
> @@ -660,8 +659,13 @@ static int xlnx_event_manager_probe(struct platform_device *pdev)
> }
>
> /* Setup function for the CPU hot-plug cases */
> - cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "soc/event:starting",
> - xlnx_event_cpuhp_start, xlnx_event_cpuhp_down);
> + hp_state = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN,
> + "soc/event:starting", xlnx_event_cpuhp_start,

Let's change :starting to :online as per convention, as this is
associated with the ONLINE_DYN state.

Can we also edit the callback names for symmetry similar to the
suggestion for patch 1/2?

> + xlnx_event_cpuhp_down);
> + if (hp_state < 0) {
> + xlnx_event_cleanup_sgi(pdev);
> + return hp_state;
> + }
>
> ret = zynqmp_pm_register_sgi(sgi_num, 0);
> if (ret) {
> @@ -670,6 +674,7 @@ static int xlnx_event_manager_probe(struct platform_device *pdev)
> else
> dev_err(&pdev->dev, "SGI %d registration failed, err %d\n", sgi_num, ret);
>
> + cpuhp_remove_state(hp_state);
> xlnx_event_cleanup_sgi(pdev);
> return ret;
> }
> @@ -704,6 +709,7 @@ static void xlnx_event_manager_remove(struct platform_device *pdev)
> if (ret)
> dev_err(&pdev->dev, "SGI unregistration over TF-A failed with %d\n", ret);
>
> + cpuhp_remove_state(hp_state);
> xlnx_event_cleanup_sgi(pdev);
>
> event_manager_availability = -EACCES;

It looks like this patch 2/2 doesn't have the kind of bugs in the
cleanup path that affected patch 1/2, so that's good.

Regards,
Srivatsa