mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Eugen Hristev <ehristev@kernel.org>
To: "Lorenzo Pieralisi" <lpieralisi@kernel.org>,
	"Krzysztof Wilczyński" <kwilczynski@kernel.org>,
	"Manivannan Sadhasivam" <mani@kernel.org>,
	"Rob Herring" <robh@kernel.org>,
	"Bjorn Helgaas" <bhelgaas@google.com>,
	"Ray Jui" <rjui@broadcom.com>,
	"Scott Branden" <sbranden@broadcom.com>,
	"Broadcom internal kernel review list"
	<bcm-kernel-feedback-list@broadcom.com>,
	"Marc Zyngier" <maz@kernel.org>,
	"Vikram Prakash" <vikramp@broadcom.com>
Cc: Anup Patel <anup.patel@broadcom.com>,
	linux-pci@vger.kernel.org,  linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org,
	 Eugen Hristev <ehristev@kernel.org>
Subject: [PATCH] PCI: iproc: Fix MSI shutdown operations
Date: Thu, 29 Oct 2026 09:25:19 +0200	[thread overview]
Message-ID: <20261029-iproc-shutdown-v1-1-05f828561116@kernel.org> (raw)

On reboot, shutting down iPROC leaves MSI irqs enabled and not
cleaned up. This can lead to IRQs being served after the iPROC
was shutdown.
Fix it by implementing an MSI shutdown procedure, and call it
before the iPROC shutdown.

Assisted-by: Github Copilot
Fixes: 3bc2b2348835 ("PCI: iproc: Add iProc PCIe MSI support")
Signed-off-by: Eugen Hristev <ehristev@kernel.org>
---
 drivers/pci/controller/pcie-iproc-msi.c | 16 ++++++++++++++++
 drivers/pci/controller/pcie-iproc.c     |  3 +++
 drivers/pci/controller/pcie-iproc.h     |  4 ++++
 3 files changed, 23 insertions(+)

diff --git a/drivers/pci/controller/pcie-iproc-msi.c b/drivers/pci/controller/pcie-iproc-msi.c
index 9ba242ab9596..1d19db67f314 100644
--- a/drivers/pci/controller/pcie-iproc-msi.c
+++ b/drivers/pci/controller/pcie-iproc-msi.c
@@ -651,6 +651,22 @@ int iproc_msi_init(struct iproc_pcie *pcie, struct device_node *node)
 }
 EXPORT_SYMBOL(iproc_msi_init);
 
+void iproc_msi_shutdown(struct iproc_pcie *pcie)
+{
+	struct iproc_msi *msi = pcie->msi;
+	unsigned int index;
+
+	if (!msi)
+		return;
+
+	iproc_msi_disable(msi);
+	iproc_msi_read_reg(msi, IPROC_MSI_CTRL, msi->nr_irqs - 1);
+
+	for (index = 0; index < msi->nr_irqs; index++)
+		disable_irq(msi->grps[index].gic_irq);
+}
+EXPORT_SYMBOL(iproc_msi_shutdown);
+
 void iproc_msi_exit(struct iproc_pcie *pcie)
 {
 	struct iproc_msi *msi = pcie->msi;
diff --git a/drivers/pci/controller/pcie-iproc.c b/drivers/pci/controller/pcie-iproc.c
index afb3aa38ac6b..6f3dc2f81a1c 100644
--- a/drivers/pci/controller/pcie-iproc.c
+++ b/drivers/pci/controller/pcie-iproc.c
@@ -756,8 +756,11 @@ static void iproc_pcie_perst_ctrl(struct iproc_pcie *pcie, bool assert)
 
 int iproc_pcie_shutdown(struct iproc_pcie *pcie)
 {
+	dev_dbg(pcie->dev, "quiescing MSI before PCIe reset\n");
+	iproc_msi_shutdown(pcie);
 	iproc_pcie_perst_ctrl(pcie, true);
 	msleep(500);
+	dev_dbg(pcie->dev, "PCIe shutdown complete\n");
 
 	return 0;
 }
diff --git a/drivers/pci/controller/pcie-iproc.h b/drivers/pci/controller/pcie-iproc.h
index c4443f236ca3..54e6e365774e 100644
--- a/drivers/pci/controller/pcie-iproc.h
+++ b/drivers/pci/controller/pcie-iproc.h
@@ -114,6 +114,7 @@ int iproc_pcie_shutdown(struct iproc_pcie *pcie);
 
 #ifdef CONFIG_PCIE_IPROC_MSI
 int iproc_msi_init(struct iproc_pcie *pcie, struct device_node *node);
+void iproc_msi_shutdown(struct iproc_pcie *pcie);
 void iproc_msi_exit(struct iproc_pcie *pcie);
 #else
 static inline int iproc_msi_init(struct iproc_pcie *pcie,
@@ -121,6 +122,9 @@ static inline int iproc_msi_init(struct iproc_pcie *pcie,
 {
 	return -ENODEV;
 }
+static inline void iproc_msi_shutdown(struct iproc_pcie *pcie)
+{
+}
 static inline void iproc_msi_exit(struct iproc_pcie *pcie)
 {
 }

---
base-commit: 6d0933ae9d46674a6ea63a87e9e9ab4e662670c9
change-id: 20261029-iproc-shutdown-abbbce302daa

Best regards,
--  
Eugen Hristev <ehristev@kernel.org>


                 reply	other threads:[~2026-10-29  7:36 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20261029-iproc-shutdown-v1-1-05f828561116@kernel.org \
    --to=ehristev@kernel.org \
    --cc=anup.patel@broadcom.com \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=bhelgaas@google.com \
    --cc=kwilczynski@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lpieralisi@kernel.org \
    --cc=mani@kernel.org \
    --cc=maz@kernel.org \
    --cc=rjui@broadcom.com \
    --cc=robh@kernel.org \
    --cc=sbranden@broadcom.com \
    --cc=vikramp@broadcom.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

all inboxes | Powered by JetHome®