Linux PCI subsystem development
 help / color / mirror / Atom feed
From: Bjorn Helgaas <helgaas@kernel.org>
To: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Cc: bhelgaas@google.com, lukas@wunner.de, linux-pci@vger.kernel.org,
	linux-kernel@vger.kernel.org, stable@vger.kernel.org,
	Jim Quinlan <james.quinlan@broadcom.com>,
	Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Subject: Re: [PATCH v2] PCI/pwrctrl: Skip creating pwrctrl device unless CONFIG_PCI_PWRCTRL is enabled
Date: Tue, 1 Jul 2025 15:35:26 -0500	[thread overview]
Message-ID: <20250701203526.GA1849466@bhelgaas> (raw)
In-Reply-To: <20250701064731.52901-1-manivannan.sadhasivam@linaro.org>

[+cc Bart]

On Tue, Jul 01, 2025 at 12:17:31PM +0530, Manivannan Sadhasivam wrote:
> If devicetree describes power supplies related to a PCI device, we
> previously created a pwrctrl device even if CONFIG_PCI_PWRCTL was
> not enabled.
> 
> When pci_pwrctrl_create_device() creates and returns a pwrctrl device,
> pci_scan_device() doesn't enumerate the PCI device. It assumes the pwrctrl
> core will rescan the bus after turning on the power. However, if
> CONFIG_PCI_PWRCTL is not enabled, the rescan never happens.

Separate from this patch, can we refine the comment in
pci_scan_device() to explain *why* we should skip scanning if a
pwrctrl device was created?  The current comment leaves me with two
questions:

  1) How do we know the pwrctrl device is currently off?  If it is
     already on, why should we defer enumerating the device?

  2) If the pwrctrl device is currently off, won't the Vendor ID read
     just fail like it does for every other non-existent device?  If
     so, why can't we just let that happen?

This behavior is from 2489eeb777af ("PCI/pwrctrl: Skip scanning for
the device further if pwrctrl device is created"), which just says
"there's no need to continue scanning."  Prior to 2489eeb777af, it
looks like we *did* what try to enumerate the device even if a pwrctrl
device was created, and 2489eeb777af doesn't mention a bug fix, so I
assume it's just an optimization.

Bjorn

  parent reply	other threads:[~2025-07-01 20:35 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-01  6:47 [PATCH v2] PCI/pwrctrl: Skip creating pwrctrl device unless CONFIG_PCI_PWRCTRL is enabled Manivannan Sadhasivam
2025-07-01  7:00 ` Lukas Wunner
2025-07-01 11:57   ` Manivannan Sadhasivam
2025-07-01 12:49     ` Lukas Wunner
2025-07-01 20:35 ` Bjorn Helgaas [this message]
2025-07-02  6:47   ` Manivannan Sadhasivam
2025-07-02 17:53     ` Bjorn Helgaas
2025-07-02 18:30       ` Manivannan Sadhasivam
2025-07-02 20:04         ` Bjorn Helgaas
2025-07-01 21:01 ` Bjorn Helgaas
2025-07-02  7:20   ` Manivannan Sadhasivam
2025-07-22 18:58 ` Bjorn Helgaas
2025-07-22 19:15   ` Bjorn Helgaas

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=20250701203526.GA1849466@bhelgaas \
    --to=helgaas@kernel.org \
    --cc=bartosz.golaszewski@linaro.org \
    --cc=bhelgaas@google.com \
    --cc=james.quinlan@broadcom.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lukas@wunner.de \
    --cc=manivannan.sadhasivam@linaro.org \
    --cc=stable@vger.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