From: Prasanna Kumar T S M <ptsm@linux.microsoft.com>
To: ptsm@linux.microsoft.com, jassisinghbrar@gmail.com,
michal.simek@amd.com, tanmay.shah@amd.com,
saeed.nowshadi@amd.com, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
ssengar@linux.microsoft.com, tgopinath@linux.microsoft.com,
srivatsa@csail.mit.edu, jay.buddhabhatti@amd.com,
gregkh@linuxfoundation.org, radheys@amd.com
Subject: [PATCH v3 2/5] mailbox: zynqmp-ipi: Fix SGI cleanup on request_percpu_irq() failure
Date: Thu, 3 Dec 2026 21:04:50 -0800 [thread overview]
Message-ID: <20261204050453.18005-3-ptsm@linux.microsoft.com> (raw)
In-Reply-To: <20261204050453.18005-1-ptsm@linux.microsoft.com>
When xlnx_mbox_init_sgi() fails before or during request_percpu_irq(),
zynqmp_ipi_probe() still invokes xlnx_mbox_cleanup_sgi() through
zynqmp_ipi_free_mboxes(). This causes cleanup to run on an unmapped
virq_sgi or dispose the IRQ mapping a second time.
Clear virq_sgi after disposing the mapping on request_percpu_irq()
failure and teardown IRQ in xlnx_mbox_cleanup_sgi() only when virq_sgi
is valid.
Fixes: 6ffb1635341b ("mailbox: zynqmp: handle SGI for shared IPI")
Cc: stable@vger.kernel.org
Signed-off-by: Prasanna Kumar T S M <ptsm@linux.microsoft.com>
---
drivers/mailbox/zynqmp-ipi-mailbox.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/drivers/mailbox/zynqmp-ipi-mailbox.c b/drivers/mailbox/zynqmp-ipi-mailbox.c
index 179f361d04b3..b978f4e9f830 100644
--- a/drivers/mailbox/zynqmp-ipi-mailbox.c
+++ b/drivers/mailbox/zynqmp-ipi-mailbox.c
@@ -859,6 +859,7 @@ static int xlnx_mbox_init_sgi(struct platform_device *pdev,
WARN_ON(ret);
if (ret) {
irq_dispose_mapping(pdata->virq_sgi);
+ pdata->virq_sgi = 0;
return ret;
}
@@ -880,11 +881,13 @@ static void xlnx_mbox_cleanup_sgi(struct zynqmp_ipi_pdata *pdata)
if (pdata->hp_state >= CPUHP_AP_ONLINE_DYN)
cpuhp_remove_state(pdata->hp_state);
- on_each_cpu(xlnx_disable_percpu_irq, NULL, 1);
+ if (pdata->virq_sgi) {
+ on_each_cpu(xlnx_disable_percpu_irq, NULL, 1);
- irq_clear_status_flags(pdata->virq_sgi, IRQ_PER_CPU);
- free_percpu_irq(pdata->virq_sgi, &per_cpu_pdata);
- irq_dispose_mapping(pdata->virq_sgi);
+ irq_clear_status_flags(pdata->virq_sgi, IRQ_PER_CPU);
+ free_percpu_irq(pdata->virq_sgi, &per_cpu_pdata);
+ irq_dispose_mapping(pdata->virq_sgi);
+ }
}
/**
--
2.49.0
next prev parent reply other threads:[~2026-12-04 5:05 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-04 5:04 [PATCH v3 0/5] Fix CPU hotplug and SGI cleanup in Xilinx drivers Prasanna Kumar T S M
2026-12-04 5:04 ` [PATCH v3 1/5] mailbox: zynqmp-ipi: Fix CPU hotplug state cleanup Prasanna Kumar T S M
2026-12-04 5:04 ` Prasanna Kumar T S M [this message]
2026-12-04 5:04 ` [PATCH v3 3/5] mailbox: zynqmp-ipi: Remove redundant percpu IRQ disable Prasanna Kumar T S M
2026-12-04 5:04 ` [PATCH v3 4/5] soc: xilinx: Fix event manager CPU hotplug state cleanup Prasanna Kumar T S M
2026-12-04 5:04 ` [PATCH v3 5/5] soc: xilinx: Remove redundant percpu IRQ disable Prasanna Kumar T S M
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=20261204050453.18005-3-ptsm@linux.microsoft.com \
--to=ptsm@linux.microsoft.com \
--cc=gregkh@linuxfoundation.org \
--cc=jassisinghbrar@gmail.com \
--cc=jay.buddhabhatti@amd.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=michal.simek@amd.com \
--cc=radheys@amd.com \
--cc=saeed.nowshadi@amd.com \
--cc=srivatsa@csail.mit.edu \
--cc=ssengar@linux.microsoft.com \
--cc=tanmay.shah@amd.com \
--cc=tgopinath@linux.microsoft.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