lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250523201935.1586198-1-helgaas@kernel.org>
Date: Fri, 23 May 2025 15:17:59 -0500
From: Bjorn Helgaas <helgaas@...nel.org>
To: linux-pci@...r.kernel.org
Cc: Manivannan Sadhasivam <manivannan.sadhasivam@...aro.org>,
	Cyril Brulebois <kibi@...ian.org>,
	Nicolas Saenz Julienne <nsaenz@...nel.org>,
	Lorenzo Pieralisi <lorenzo.pieralisi@....com>,
	Krzysztof WilczyƄski <kwilczynski@...nel.org>,
	Bartosz Golaszewski <brgl@...ev.pl>,
	Jim Quinlan <james.quinlan@...adcom.com>,
	bcm-kernel-feedback-list@...adcom.com,
	linux-kernel@...r.kernel.org,
	Bjorn Helgaas <bhelgaas@...gle.com>
Subject: [PATCH] PCI/pwrctrl: Skip creating platform device unless CONFIG_PCI_PWRCTL enabled

From: Bjorn Helgaas <bhelgaas@...gle.com>

If devicetree describes power supplies related to a PCI device,
pci_pwrctrl_create_device() previously created a pwrctrl platform device
even if CONFIG_PCI_PWRCTL was not enabled.

When pci_pwrctrl_create_device() creates a pwrctrl device and returns it,
pci_scan_device() doesn't enumerating the PCI device on the assumption that
the pwrctrl core will rescan the bus after turning on the power.  If
CONFIG_PCI_PWRCTL is not enabled, the rescan never happens.

This breaks PCI enumeration on any system that describes power supplies in
devicetree but does not use pwrctrl.  Jim reported that some brcmstb
platforms break this way.

If CONFIG_PCI_PWRCTL is not enabled, skip creating the pwrctrl platform
device and scan the device normally.

Fixes: 957f40d039a9 ("PCI/pwrctrl: Move creation of pwrctrl devices to pci_scan_device()")
Reported-by: Jim Quinlan <james.quinlan@...adcom.com>
Closes: https://lore.kernel.org/r/CA+-6iNwgaByXEYD3j=-+H_PKAxXRU78svPMRHDKKci8AGXAUPg@mail.gmail.com
Signed-off-by: Bjorn Helgaas <bhelgaas@...gle.com>
---
This an alternate to
https://lore.kernel.org/r/20250522140326.93869-1-manivannan.sadhasivam@linaro.org

It should accomplish the same thing but I think using #ifdef makes it a
little more visible and easier to see that pci_pwrctrl_create_device() is
only relevant when CONFIG_PCI_PWRCTL is enabled.

 drivers/pci/probe.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 364fa2a514f8..855da472b608 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -2510,6 +2510,7 @@ EXPORT_SYMBOL(pci_bus_read_dev_vendor_id);
 
 static struct platform_device *pci_pwrctrl_create_device(struct pci_bus *bus, int devfn)
 {
+#if defined(CONFIG_PCI_PWRCTL) || defined(CONFIG_PCI_PWRCTL_MODULE)
 	struct pci_host_bridge *host = pci_find_host_bridge(bus);
 	struct platform_device *pdev;
 	struct device_node *np;
@@ -2536,6 +2537,9 @@ static struct platform_device *pci_pwrctrl_create_device(struct pci_bus *bus, in
 	}
 
 	return pdev;
+#else
+	return NULL;
+#endif
 }
 
 /*
-- 
2.43.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ