public inbox for linux-pci@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/2] PCI/pwrctrl: A couple of fixes
@ 2026-02-23 14:45 Manivannan Sadhasivam via B4 Relay
  2026-02-23 14:45 ` [PATCH v2 1/2] PCI/pwrctrl: Ensure that the remote endpoint node parent has the supply requirement Manivannan Sadhasivam via B4 Relay
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Manivannan Sadhasivam via B4 Relay @ 2026-02-23 14:45 UTC (permalink / raw)
  To: Bartosz Golaszewski, Manivannan Sadhasivam, Bjorn Helgaas,
	Krishna Chaitanya Chundru
  Cc: linux-pci, linux-kernel, Bartosz Golaszewski,
	Manivannan Sadhasivam, Raj Kumar Bhagat, Bjorn Andersson

Hi,

This series fixes a couple of issues introduced in the recent pwrctrl rework
for v7.0. Both issues are due to some incorrect assumptions on deciding when to
create pwrctrl devices. First issue is due to assuming that all OF graph nodes
require pwrctrl and another one is due to assuming that all PCI child nodes are
PCI devices.

Both issues are fixed by changing the pwrctrl device creation logic in
pwrctrl/core.

Testing
=======

This series is tested on Lenovo Thinkpad T14s.

Note for Bjorn H
================

Even though only patch 1 is fixing a regression on the IPQ board which was not
part of the testbed of the pwrctrl rework went in for v7.0, patch 2 is also
fixing an actual issue, but it is not impacting any of the current upstream
supported platforms. But I'd like to get these two patches merged for v7.0 so
that both the issues are fixed in the same major release where the issues
originated.

Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
---
Changes in v2:
- Used the compatible match for detecting the PCI devices in DT
- Link to v1: https://lore.kernel.org/r/20260217-pwrctrl-fixes-7-0-v1-0-b5671e58934f@oss.qualcomm.com

---
Manivannan Sadhasivam (2):
      PCI/pwrctrl: Ensure that the remote endpoint node parent has the supply requirement
      PCI/pwrctrl: Only create pwrctrl device if the device node belongs to a PCI device

 drivers/pci/pwrctrl/core.c | 54 +++++++++++++++++++++++++++++++++++-----------
 1 file changed, 41 insertions(+), 13 deletions(-)
---
base-commit: 1c2b4a4c2bcb950f182eeeb33d94b565607608cf
change-id: 20260217-pwrctrl-fixes-7-0-b90eb30bbfe7

Best regards,
-- 
Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>



^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v2 1/2] PCI/pwrctrl: Ensure that the remote endpoint node parent has the supply requirement
  2026-02-23 14:45 [PATCH v2 0/2] PCI/pwrctrl: A couple of fixes Manivannan Sadhasivam via B4 Relay
@ 2026-02-23 14:45 ` Manivannan Sadhasivam via B4 Relay
  2026-02-23 14:46 ` [PATCH v2 2/2] PCI/pwrctrl: Only create pwrctrl device if the device node belongs to a PCI device Manivannan Sadhasivam via B4 Relay
  2026-03-16 22:32 ` [PATCH v2 0/2] PCI/pwrctrl: A couple of fixes Bjorn Helgaas
  2 siblings, 0 replies; 4+ messages in thread
From: Manivannan Sadhasivam via B4 Relay @ 2026-02-23 14:45 UTC (permalink / raw)
  To: Bartosz Golaszewski, Manivannan Sadhasivam, Bjorn Helgaas,
	Krishna Chaitanya Chundru
  Cc: linux-pci, linux-kernel, Bartosz Golaszewski,
	Manivannan Sadhasivam, Raj Kumar Bhagat

From: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>

If OF graph is used in the PCI device node, pwrctrl core currently creates
the pwrctrl device even if the remote endpoint doesn't have the power
supply requirements. Since the device doesn't have any power supply
requirements, there was no pwrctrl driver to probe, leading to PCI
controller driver probe deferral as it waits for all pwrctrl drivers to
probe before starting bus scan.

This issue happens with Qcom ath12k devices with WSI interface attached to
the Qcom IPQ platforms.

Fix this issue by checking for the existence of at least one power supply
property in the remote endpoint parent node. To consolidate all the checks,
create a new helper pci_pwrctrl_is_required() and move all the checks
there.

Fixes: 9db826206f9b ("PCI/pwrctrl: Create pwrctrl device if graph port is found")
Reported-by: Raj Kumar Bhagat <raj.bhagat@oss.qualcomm.com>
Tested-by: Raj Kumar Bhagat <raj.bhagat@oss.qualcomm.com>
Reviewed-by: Krishna Chaitanya Chundru <krishna.chundru@oss.qualcomm.com>
Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
---
 drivers/pci/pwrctrl/core.c | 47 +++++++++++++++++++++++++++++++++-------------
 1 file changed, 34 insertions(+), 13 deletions(-)

diff --git a/drivers/pci/pwrctrl/core.c b/drivers/pci/pwrctrl/core.c
index 6f7dea6746e0..8325858cc379 100644
--- a/drivers/pci/pwrctrl/core.c
+++ b/drivers/pci/pwrctrl/core.c
@@ -268,6 +268,39 @@ int pci_pwrctrl_power_on_devices(struct device *parent)
 }
 EXPORT_SYMBOL_GPL(pci_pwrctrl_power_on_devices);
 
+/*
+ * Check whether the pwrctrl device really needs to be created or not. The
+ * pwrctrl device will only be created if the node satisfies below requirements:
+ *
+ * 1. Presence of compatible property to match against the pwrctrl driver (AND)
+ * 2. At least one of the power supplies defined in the devicetree node of the
+ *    device (OR) in the remote endpoint parent node to indicate pwrctrl
+ *    requirement.
+ */
+static bool pci_pwrctrl_is_required(struct device_node *np)
+{
+	struct device_node *endpoint;
+
+	if (!of_property_present(np, "compatible"))
+		return false;
+
+	if (of_pci_supply_present(np))
+		return true;
+
+	if (of_graph_is_present(np)) {
+		for_each_endpoint_of_node(np, endpoint) {
+			struct device_node *remote __free(device_node) =
+				of_graph_get_remote_port_parent(endpoint);
+			if (remote) {
+				if (of_pci_supply_present(remote))
+					return true;
+			}
+		}
+	}
+
+	return false;
+}
+
 static int pci_pwrctrl_create_device(struct device_node *np,
 				     struct device *parent)
 {
@@ -287,19 +320,7 @@ static int pci_pwrctrl_create_device(struct device_node *np,
 		return 0;
 	}
 
-	/*
-	 * Sanity check to make sure that the node has the compatible property
-	 * to allow driver binding.
-	 */
-	if (!of_property_present(np, "compatible"))
-		return 0;
-
-	/*
-	 * Check whether the pwrctrl device really needs to be created or not.
-	 * This is decided based on at least one of the power supplies defined
-	 * in the devicetree node of the device or the graph property.
-	 */
-	if (!of_pci_supply_present(np) && !of_graph_is_present(np)) {
+	if (!pci_pwrctrl_is_required(np)) {
 		dev_dbg(parent, "Skipping OF node: %s\n", np->name);
 		return 0;
 	}

-- 
2.51.0



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v2 2/2] PCI/pwrctrl: Only create pwrctrl device if the device node belongs to a PCI device
  2026-02-23 14:45 [PATCH v2 0/2] PCI/pwrctrl: A couple of fixes Manivannan Sadhasivam via B4 Relay
  2026-02-23 14:45 ` [PATCH v2 1/2] PCI/pwrctrl: Ensure that the remote endpoint node parent has the supply requirement Manivannan Sadhasivam via B4 Relay
@ 2026-02-23 14:46 ` Manivannan Sadhasivam via B4 Relay
  2026-03-16 22:32 ` [PATCH v2 0/2] PCI/pwrctrl: A couple of fixes Bjorn Helgaas
  2 siblings, 0 replies; 4+ messages in thread
From: Manivannan Sadhasivam via B4 Relay @ 2026-02-23 14:46 UTC (permalink / raw)
  To: Bartosz Golaszewski, Manivannan Sadhasivam, Bjorn Helgaas,
	Krishna Chaitanya Chundru
  Cc: linux-pci, linux-kernel, Bartosz Golaszewski,
	Manivannan Sadhasivam, Bjorn Andersson

From: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>

The PCI host bridge node can have non-PCI child nodes as well, like OPP
tables, USB hub etc... So the pwrctrl core must ensure that the pwrctrl
device is only created for PCI device nodes by checking for the 'pci'
prefix in the compatible property.

Fixes: 4c4132489201 ("PCI/pwrctrl: Add APIs to create, destroy pwrctrl devices")
Reported-by: Bjorn Andersson <bjorn.andersson@oss.qualcomm.com>
Closes: https://lore.kernel.org/all/20260212-rb3gen2-upd-gl3590-v1-1-18fb04bb32b0@oss.qualcomm.com
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
---
 drivers/pci/pwrctrl/core.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/pwrctrl/core.c b/drivers/pci/pwrctrl/core.c
index 8325858cc379..7754baed67f2 100644
--- a/drivers/pci/pwrctrl/core.c
+++ b/drivers/pci/pwrctrl/core.c
@@ -272,7 +272,8 @@ EXPORT_SYMBOL_GPL(pci_pwrctrl_power_on_devices);
  * Check whether the pwrctrl device really needs to be created or not. The
  * pwrctrl device will only be created if the node satisfies below requirements:
  *
- * 1. Presence of compatible property to match against the pwrctrl driver (AND)
+ * 1. Presence of compatible property with "pci" prefix to match against the
+ *    pwrctrl driver (AND)
  * 2. At least one of the power supplies defined in the devicetree node of the
  *    device (OR) in the remote endpoint parent node to indicate pwrctrl
  *    requirement.
@@ -280,8 +281,14 @@ EXPORT_SYMBOL_GPL(pci_pwrctrl_power_on_devices);
 static bool pci_pwrctrl_is_required(struct device_node *np)
 {
 	struct device_node *endpoint;
+	const char *compat;
+	int ret;
+
+	ret = of_property_read_string(np, "compatible", &compat);
+	if (ret < 0)
+		return false;
 
-	if (!of_property_present(np, "compatible"))
+	if (!strstarts(compat, "pci"))
 		return false;
 
 	if (of_pci_supply_present(np))

-- 
2.51.0



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 0/2] PCI/pwrctrl: A couple of fixes
  2026-02-23 14:45 [PATCH v2 0/2] PCI/pwrctrl: A couple of fixes Manivannan Sadhasivam via B4 Relay
  2026-02-23 14:45 ` [PATCH v2 1/2] PCI/pwrctrl: Ensure that the remote endpoint node parent has the supply requirement Manivannan Sadhasivam via B4 Relay
  2026-02-23 14:46 ` [PATCH v2 2/2] PCI/pwrctrl: Only create pwrctrl device if the device node belongs to a PCI device Manivannan Sadhasivam via B4 Relay
@ 2026-03-16 22:32 ` Bjorn Helgaas
  2 siblings, 0 replies; 4+ messages in thread
From: Bjorn Helgaas @ 2026-03-16 22:32 UTC (permalink / raw)
  To: manivannan.sadhasivam
  Cc: Bartosz Golaszewski, Manivannan Sadhasivam, Bjorn Helgaas,
	Krishna Chaitanya Chundru, linux-pci, linux-kernel,
	Bartosz Golaszewski, Raj Kumar Bhagat, Bjorn Andersson

On Mon, Feb 23, 2026 at 08:15:58PM +0530, Manivannan Sadhasivam via B4 Relay wrote:
> Hi,
> 
> This series fixes a couple of issues introduced in the recent pwrctrl rework
> for v7.0. Both issues are due to some incorrect assumptions on deciding when to
> create pwrctrl devices. First issue is due to assuming that all OF graph nodes
> require pwrctrl and another one is due to assuming that all PCI child nodes are
> PCI devices.
> 
> Both issues are fixed by changing the pwrctrl device creation logic in
> pwrctrl/core.
> 
> Testing
> =======
> 
> This series is tested on Lenovo Thinkpad T14s.
> 
> Note for Bjorn H
> ================
> 
> Even though only patch 1 is fixing a regression on the IPQ board which was not
> part of the testbed of the pwrctrl rework went in for v7.0, patch 2 is also
> fixing an actual issue, but it is not impacting any of the current upstream
> supported platforms. But I'd like to get these two patches merged for v7.0 so
> that both the issues are fixed in the same major release where the issues
> originated.
> 
> Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
> ---
> Changes in v2:
> - Used the compatible match for detecting the PCI devices in DT
> - Link to v1: https://lore.kernel.org/r/20260217-pwrctrl-fixes-7-0-v1-0-b5671e58934f@oss.qualcomm.com
> 
> ---
> Manivannan Sadhasivam (2):
>       PCI/pwrctrl: Ensure that the remote endpoint node parent has the supply requirement
>       PCI/pwrctrl: Only create pwrctrl device if the device node belongs to a PCI device
> 
>  drivers/pci/pwrctrl/core.c | 54 +++++++++++++++++++++++++++++++++++-----------
>  1 file changed, 41 insertions(+), 13 deletions(-)

Applied to pci/for-linus for v7.0, thanks!

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-03-16 22:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-23 14:45 [PATCH v2 0/2] PCI/pwrctrl: A couple of fixes Manivannan Sadhasivam via B4 Relay
2026-02-23 14:45 ` [PATCH v2 1/2] PCI/pwrctrl: Ensure that the remote endpoint node parent has the supply requirement Manivannan Sadhasivam via B4 Relay
2026-02-23 14:46 ` [PATCH v2 2/2] PCI/pwrctrl: Only create pwrctrl device if the device node belongs to a PCI device Manivannan Sadhasivam via B4 Relay
2026-03-16 22:32 ` [PATCH v2 0/2] PCI/pwrctrl: A couple of fixes Bjorn Helgaas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox