Linux PCI subsystem development
 help / color / mirror / Atom feed
From: Shawn Lin <shawn.lin@rock-chips.com>
To: Manivannan Sadhasivam <mani@kernel.org>,
	Bjorn Helgaas <bhelgaas@google.com>
Cc: linux-rockchip@lists.infradead.org, linux-pci@vger.kernel.org,
	Niklas Cassel <cassel@kernel.org>,
	Shawn Lin <shawn.lin@rock-chips.com>
Subject: [PATCH v3 0/3] Small INTx fixes for Rockchip's dwc based PCIe controller driver
Date: Tue, 22 Sep 2026 10:36:59 +0800	[thread overview]
Message-ID: <1790044622-164744-1-git-send-email-shawn.lin@rock-chips.com> (raw)


This short series fixes the INTx handling around the newly introduced
.reset_root_port() (b376b3ff9cb0), and is split in three patches per
Niklas' suggestion:

Patch 1 stops .reset_root_port() from recreating the INTx irq domain
on every root port reset, which leaked the old domain and silently
broke INTx delivery afterwards, the downstream devices' virqs were
allocated in the previous domain and were never re-mapped. By moving
the of_irq_get_byname() lookup, the INTx irq domain creation and the
chained handler installation into rockchip_pcie_configure_rc(), right
after dw_pcie_host_init(). This leaves .init() with nothing but
idempotent register programming, so it can safely be re-run by
.reset_root_port() and dw_pcie_resume_noirq().

Patch 2 makes the irq domain and the chained handler devm-managed, so
that they are released with the device instead of leaking, which also
addresses the probe failure leak/use-after-free flagged by the Sashiko
review.

Patch 3 keeps the INTx IRQ masked while .reset_root_port() gates the
controller clocks, so the chained handler cannot read the unclocked
APB bus and raise a synchronous external abort.


Changes in v3:
- split devm-managed part into a seperate patch

Changes in v2:
- Moved the of_irq_get_byname() lookup, the INTx irq domain creation
  and the chained handler installation out of the host ops .init()
  callback into rockchip_pcie_configure_rc(), right after
  dw_pcie_host_init(), as suggested by Niklas Cassel. This supersedes
  v1 patch 1/2, as .init() no longer creates the irq domain, and
  removes the rockchip_pcie_host_hw_init() helper from v1.
- Made the INTx irq domain devm-managed with
  devm_irq_domain_instantiate() and uninstall the chained handler
  through a devres action, addressing the probe failure leak and
  use-after-free flagged by the Sashiko review.
- keep the INTx IRQ masked while .reset_root_port()
  gates the controller clocks, responding to the Sashiko review
  finding about accessing the unclocked APB bus.

Shawn Lin (3):
  PCI: dw-rockchip: Move the INTx irq setup to probe
  PCI: dw-rockchip: Make the INTx irq setup devm-managed
  PCI: dw-rockchip: Mask the INTx IRQ while the controller clocks are
    gated

 drivers/pci/controller/dwc/pcie-dw-rockchip.c | 77 ++++++++++++++++++++-------
 1 file changed, 57 insertions(+), 20 deletions(-)

-- 
2.7.4


             reply	other threads:[~2026-09-22  2:37 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-22  2:36 Shawn Lin [this message]
2026-09-22  2:37 ` [PATCH v3 1/3] PCI: dw-rockchip: Move the INTx irq setup to probe Shawn Lin
2026-09-22  2:51   ` sashiko-bot
2026-09-22 12:03     ` Niklas Cassel
2026-09-22  9:56   ` Niklas Cassel
2026-09-22  2:37 ` [PATCH v3 2/3] PCI: dw-rockchip: Make the INTx irq setup devm-managed Shawn Lin
2026-09-22  2:54   ` sashiko-bot
2026-09-22  9:58   ` Niklas Cassel
2026-09-22  2:37 ` [PATCH v3 3/3] PCI: dw-rockchip: Mask the INTx IRQ while the controller clocks are gated Shawn Lin
2026-09-22  2:51   ` sashiko-bot
2026-09-23  9:13 ` [PATCH v3 0/3] Small INTx fixes for Rockchip's dwc based PCIe controller driver Diederik de Haas
2026-09-23  9:21   ` Shawn Lin
2026-09-23 15:25     ` Niklas Cassel
2026-09-24  3:27       ` Shawn Lin

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=1790044622-164744-1-git-send-email-shawn.lin@rock-chips.com \
    --to=shawn.lin@rock-chips.com \
    --cc=bhelgaas@google.com \
    --cc=cassel@kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=mani@kernel.org \
    /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