Linux PCI subsystem development
 help / color / mirror / Atom feed
From: Niklas Cassel <cassel@kernel.org>
To: sashiko-reviews@lists.linux.dev
Cc: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>,
	linux-pci@vger.kernel.org
Subject: Re: [PATCH v9 1/5] PCI: dwc: ep: Clear MSI iATU mapping in dw_pcie_ep_cleanup()
Date: Wed, 29 Jul 2026 23:37:09 +0200	[thread overview]
Message-ID: <ampyhZmYPQl3U8HT@ryzen> (raw)
In-Reply-To: <20260729051542.DC2741F000E9@smtp.kernel.org>

On Wed, Jul 29, 2026 at 05:15:42AM +0000, sashiko-bot@kernel.org wrote:
> [Severity: High]
> This is a pre-existing issue, but does the persistent MSI iATU mapping
> conflict with dynamic MSI-X iATU mapping?
> 
> Both MSI and MSI-X use the same physical address (ep->msi_mem_phys). If
> dw_pcie_ep_raise_msi_irq() caches the ATU mapping, and then
> dw_pcie_ep_raise_msix_irq() is called, it maps the same address to a new
> window:
> 
> drivers/pci/controller/dwc/pcie-designware-ep.c:dw_pcie_ep_raise_msix_irq() {
>     ...
>     ret = dw_pcie_ep_map_addr(epc, func_no, 0, ep->msi_mem_phys, msg_addr,
>                               map_size);
>     ...
> }
> 
> When dw_pcie_ep_raise_msix_irq() later calls dw_pcie_ep_unmap_addr(), the
> lookup function returns the first matching address:
> 
> drivers/pci/controller/dwc/pcie-designware-ep.c:dw_pcie_find_index() {
>     ...
>     if (ep->outbound_addr[index] != addr)
>         continue;
>     *atu_index = index;
>     return 0;
> }
> 
> Could this unmap the cached MSI window instead of the newly allocated MSI-X
> window, permanently leaking the MSI-X window?

This pre-existing bug sounds a bit nasty.

I sent a proposed fix, please review:
https://lore.kernel.org/linux-pci/20260729213520.1187704-2-cassel@kernel.org/T/#u


Kind regards,
Niklas

  reply	other threads:[~2026-07-29 21:37 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-29  4:52 [PATCH v9 0/5] PCI: Add support for resetting the Root Ports in a platform specific way Manivannan Sadhasivam via B4 Relay
2026-07-29  4:52 ` [PATCH v9 1/5] PCI: dwc: ep: Clear MSI iATU mapping in dw_pcie_ep_cleanup() Manivannan Sadhasivam via B4 Relay
2026-07-29  5:15   ` sashiko-bot
2026-07-29 21:37     ` Niklas Cassel [this message]
2026-07-29  4:52 ` [PATCH v9 2/5] PCI/ERR: Add support for resetting the Root Ports in a platform specific way Manivannan Sadhasivam via B4 Relay
2026-07-29  5:07   ` sashiko-bot
2026-07-29  4:52 ` [PATCH v9 3/5] PCI: host-common: Add link down handling for Root Ports Manivannan Sadhasivam via B4 Relay
2026-07-29  5:07   ` sashiko-bot
2026-07-29  4:52 ` [PATCH v9 4/5] PCI: qcom: Add support for resetting the Root Port due to link down event Manivannan Sadhasivam via B4 Relay
2026-07-29  5:20   ` sashiko-bot
2026-07-29  4:52 ` [PATCH v9 5/5] misc: pci_endpoint_test: Add AER error handlers Manivannan Sadhasivam via B4 Relay
2026-07-29  5:07   ` sashiko-bot

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=ampyhZmYPQl3U8HT@ryzen \
    --to=cassel@kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=manivannan.sadhasivam@oss.qualcomm.com \
    --cc=sashiko-reviews@lists.linux.dev \
    /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