Linux PCI subsystem development
 help / color / mirror / Atom feed
From: Bjorn Helgaas <helgaas@kernel.org>
To: Lukas Wunner <lukas@wunner.de>, Brian Norris <briannorris@chromium.org>
Cc: linux-kernel@vger.kernel.org,
	Manivannan Sadhasivam <mani@kernel.org>,
	linux-pci@vger.kernel.org, David Matlack <dmatlack@google.com>
Subject: Re: [PATCH v2] PCI/portdrv: Allow probing even without child services
Date: Mon, 20 Jul 2026 15:44:19 -0500	[thread overview]
Message-ID: <20260720204419.GA426578@bhelgaas> (raw)
In-Reply-To: <alnnTRldy-deNIFM@wunner.de>

On Fri, Jul 17, 2026 at 10:26:53AM +0200, Lukas Wunner wrote:
> On Thu, Jul 16, 2026 at 12:26:41PM -0500, Bjorn Helgaas wrote:
> > On Mon, Feb 09, 2026 at 05:15:35PM -0800, Brian Norris wrote:
> > > The PCIe port driver fails to probe if it finds no child services,
> > > presumably under the assumption that the driver is not useful in that
> > > case. However, the driver *can* still be useful for power management
> > > support -- namely, it still configures the port for runtime PM / D3,
> > > which may be important for allowing a bridge to enter low power modes.
> > > 
> > > Thus, allow probe to succeed even if no IRQs and no child services are
> > > available. This also mirrors existing behavior for ports that have no
> > > PCIe capabilities, where we'd also probe successfully.
> > > 
> > > This change is a bit more important after commit f5cd8a929c82 ("PCI:
> > > dwc: Remove MSI/MSIX capability for Root Port if iMSI-RX is used as MSI
> > > controller"), because it's common for some DWC-based systems to:
> > > 
> > > 1. have only have the "aer" and "pcie_pme" port services available and
> > > 2. not define legacy INTx interrupts properly in their device tree.
> > > 
> > > After commit f5cd8a929c82, such systems may fail
> > > pcie_init_service_irqs() and so exit with -ENODEV.
> > > 
> > > Link: https://lore.kernel.org/all/nyada24tqwlkzdceyoxbzitzygvp4elvj5oajnqdwb33xkcdwk@76vnrx45fsfd/
> > > Signed-off-by: Brian Norris <briannorris@chromium.org>
> > 
> > Applied to pci/portdrv for v7.3, thank you!
> 
> Some thoughts on the version now applied to pci/portdrv:
> 
> * After this patch, the return value of pcie_device_init() is no longer
>   evaluated, so that function should be changed to return void as part
>   of this patch.
> 
> * If no port services are initalized, e.g. because pcie_device_init()
>   failed for all of them, the allocated IRQ vectors are not freed.
>   They're hogged, which may be a problem on systems which only support
>   very few IRQ vectors such as Sophgo SG2042:
> 
>   https://lore.kernel.org/r/0f42afefd9322779af5463b696c55b08d2296ea8.camel@iscas.ac.cn

Seems like a good idea to free IRQ vectors we don't use.  It *looks*
like it should be safe to call pci_free_irq_vectors() here and then
again in pcie_port_device_remove() if a port is removed, but Brian
wasn't sure, and I didn't look any deeper than pci_disable_msix() and
pci_disable_msi().

I guess if we did this we'd need to retain the pcie_device_init().

> * It might be clearer to call pci_clear_master() directly in the
>   if-block which is amended to "goto out".  Then the "goto out"
>   can be changed to a "return 0".  It seems "if (!capabilities)"
>   cannot happen through any other code path, so it's unclear why
>   the "out" label is necessary.

It does look nicer that way.

> * There's a duplicate "have" in the commit message ("have only have").

I fixed this on pci/portdrv.

What do you think, Brian?

  reply	other threads:[~2026-07-20 20:44 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-10  1:15 [PATCH v2] PCI/portdrv: Allow probing even without child services Brian Norris
2026-02-19 22:25 ` Bjorn Helgaas
2026-02-20  2:35   ` Brian Norris
2026-02-20 16:40     ` Bjorn Helgaas
2026-04-09 23:20       ` Brian Norris
2026-04-09 23:41         ` Brian Norris
2026-07-16 17:26 ` Bjorn Helgaas
2026-07-17  8:26   ` Lukas Wunner
2026-07-20 20:44     ` Bjorn Helgaas [this message]
2026-07-21  0:25       ` Brian Norris
2026-07-22 20:49         ` Bjorn Helgaas
2026-07-22 23:16         ` Brian Norris

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=20260720204419.GA426578@bhelgaas \
    --to=helgaas@kernel.org \
    --cc=briannorris@chromium.org \
    --cc=dmatlack@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lukas@wunner.de \
    --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