Skip to contentSkip to conversation

Skip waiting for link up during probe

PATCH In review Sajid Dalvi 2 participants 8 messages Feb 24, 2023 – Feb 27, 2023 2 messages not in the archive

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover Skip waiting for link up during probe

When the Root Complex is probed, the default behavior is to spin in a loop waiting for the link to come up. In some systems the link is not brought up during probe, but later in the context of an end-point turning on. This patch adds a device tree property to the Synopsis designware root controller to skip this loop.

Sajid Dalvi (2):
dt-bindings: PCI: dwc: Add snps,skip-wait-link-up
PCI: dwc: Skip waiting for link up on probe

 Documentation/devicetree/bindings/pci/snps,dw-pcie.yaml | 8 ++++++++
 drivers/pci/controller/dwc/pcie-designware-host.c       | 5 +++--
 2 files changed, 11 insertions(+), 2 deletions(-)
Signature · 1 line
2.39.2.637.g21b0678d19-goog
#1 lore raw

PATCH 1/2 dt-bindings: PCI: dwc: Add snps,skip-wait-link-up

When the Root Complex is probed, the default behavior is to spin in a loop waiting for the link to come up. In some systems the link is not brought up during probe, but later in the context of an end-point turning on. This property will allow the loop to be skipped.

---
 Documentation/devicetree/bindings/pci/snps,dw-pcie.yaml | 8 ++++++++
 1 file changed, 8 insertions(+)
Documentation/devicetree/bindings/pci/snps,dw-pcie.yaml +8 -0
index 1a83f0f65f19..0b8950a73b7e 100644
@@ -197,6 +197,14 @@ properties:
       - contains:
           const: msi
 
+  snps,skip-wait-link-up:
+    $ref: /schemas/types.yaml#/definitions/flag
+    description:
+      When the Root Complex is probed, the default behavior is to spin in a
+      loop waiting for the link to come up. In some systems the link is not
+      brought up during probe, but later in the context of an end-point turning
+      on. This property will allow the loop to be skipped.
+
 additionalProperties: true
 
 required:
Signature · 1 line
2.39.2.637.g21b0678d19-goog
#2 lore raw

Re: [PATCH v1 1/2] dt-bindings: PCI: dwc: Add snps,skip-wait-link-up

Quoted 7 lines · Sajid Dalvi

When the Root Complex is probed, the default behavior is to spin in a loop waiting for the link to come up. In some systems the link is not brought up during probe, but later in the context of an end-point turning on. This property will allow the loop to be skipped.

---

Thank you for your patch. There is something to discuss/improve.

Quoted 8 lines
 Documentation/devicetree/bindings/pci/snps,dw-pcie.yaml | 8 ++++++++
 1 file changed, 8 insertions(+)
Documentation/devicetree/bindings/pci/snps,dw-pcie.yaml +0 -0
index 1a83f0f65f19..0b8950a73b7e 100644

Documentation/devicetree/bindings/pci/snps,dw-pcie.yaml properties: · line 206

Quoted 10 lines
Documentation/devicetree/bindings/pci/snps,dw-pcie.yaml +7 -0
@@ -197,6 +197,14 @@ properties:
       - contains:
           const: msi
 
+  snps,skip-wait-link-up:
+    $ref: /schemas/types.yaml#/definitions/flag
+    description:
+      When the Root Complex is probed, the default behavior is to spin in a
+      loop waiting for the link to come up. In some systems the link is not
+      brought up during probe, but later in the context of an end-point turning
+      on. This property will allow the loop to be skipped.

I fail to see how probe behavior is related to properties of hardware. You describe OS behavior, not hardware. This does not look like belonging to DT.

Best regards,
Krzysztof

A message that is not in the archive (sent off-list or not yet received): CAEbtx1k-7TJPcd3+cueRoKLJcoUQLfF6nfOQFVfzB0YCUrbtqg@mail.gmail.com

A message that is not in the archive (sent off-list or not yet received): [email protected]

#5 lore raw

Re: [PATCH v1 1/2] dt-bindings: PCI: dwc: Add snps,skip-wait-link-up

Quoted 53 lines · Krzysztof Kozlowski
Quoted 41 lines · Sajid Dalvi
Quoted 36 lines · Krzysztof Kozlowski
Quoted 7 lines · Sajid Dalvi

When the Root Complex is probed, the default behavior is to spin in a loop waiting for the link to come up. In some systems the link is not brought up during probe, but later in the context of an end-point turning on. This property will allow the loop to be skipped.

---

Thank you for your patch. There is something to discuss/improve.

Quoted 8 lines
 Documentation/devicetree/bindings/pci/snps,dw-pcie.yaml | 8 ++++++++
 1 file changed, 8 insertions(+)
Documentation/devicetree/bindings/pci/snps,dw-pcie.yaml +0 -0
index 1a83f0f65f19..0b8950a73b7e 100644

Documentation/devicetree/bindings/pci/snps,dw-pcie.yaml properties: · line 206

Quoted 10 lines
Documentation/devicetree/bindings/pci/snps,dw-pcie.yaml +7 -0
@@ -197,6 +197,14 @@ properties:
       - contains:
           const: msi
 
+  snps,skip-wait-link-up:
+    $ref: /schemas/types.yaml#/definitions/flag
+    description:
+      When the Root Complex is probed, the default behavior is to spin in a
+      loop waiting for the link to come up. In some systems the link is not
+      brought up during probe, but later in the context of an end-point turning
+      on. This property will allow the loop to be skipped.

I fail to see how probe behavior is related to properties of hardware. You describe OS behavior, not hardware. This does not look like belonging to DT.

Quoted 2 lines

Best regards,
Krzysztof

Quoted 7 lines

Thanks for your response Krzysztof.
The hardware configuration of the system determines whether an endpoint device is available during host init. If it isn't available on a particular and dedicated pcie interface, we should skip waiting for the link to be up. For other interfaces, possibly even on the same system, where a device is present or maybe present we should wait for the link to come up.

Keep discussions public.

Quoted 8 lines

Your commit and property description mentions probe, which is nothing related to hardware. Why the device would not be available during host init (I understand we do not talk about hotplug as it is already supported by Linux) in a way it is hardware property, not OS?

Best regards,
Krzysztof

+ everyone else I mistakenly didn't reply to earlier

If I understand you correctly, the usage of probe is misleading because it doesn't have anything to do with the hardware. So your recommendation is to replace probe with device init, in the description of the property and the commit message?

Sajid

#6 lore raw

Re: [PATCH v1 1/2] dt-bindings: PCI: dwc: Add snps,skip-wait-link-up

Quoted 64 lines · Sajid Dalvi
Quoted 53 lines · Krzysztof Kozlowski
Quoted 41 lines · Sajid Dalvi
Quoted 36 lines · Krzysztof Kozlowski
Quoted 7 lines · Sajid Dalvi

When the Root Complex is probed, the default behavior is to spin in a loop waiting for the link to come up. In some systems the link is not brought up during probe, but later in the context of an end-point turning on. This property will allow the loop to be skipped.

---

Thank you for your patch. There is something to discuss/improve.

Quoted 8 lines
 Documentation/devicetree/bindings/pci/snps,dw-pcie.yaml | 8 ++++++++
 1 file changed, 8 insertions(+)
Documentation/devicetree/bindings/pci/snps,dw-pcie.yaml +0 -0
index 1a83f0f65f19..0b8950a73b7e 100644

Documentation/devicetree/bindings/pci/snps,dw-pcie.yaml properties: · line 206

Quoted 10 lines
Documentation/devicetree/bindings/pci/snps,dw-pcie.yaml +7 -0
@@ -197,6 +197,14 @@ properties:
       - contains:
           const: msi
 
+  snps,skip-wait-link-up:
+    $ref: /schemas/types.yaml#/definitions/flag
+    description:
+      When the Root Complex is probed, the default behavior is to spin in a
+      loop waiting for the link to come up. In some systems the link is not
+      brought up during probe, but later in the context of an end-point turning
+      on. This property will allow the loop to be skipped.

I fail to see how probe behavior is related to properties of hardware. You describe OS behavior, not hardware. This does not look like belonging to DT.

Quoted 2 lines

Best regards,
Krzysztof

Quoted 7 lines

Thanks for your response Krzysztof.
The hardware configuration of the system determines whether an endpoint device is available during host init. If it isn't available on a particular and dedicated pcie interface, we should skip waiting for the link to be up. For other interfaces, possibly even on the same system, where a device is present or maybe present we should wait for the link to come up.

Keep discussions public.

Quoted 8 lines

Your commit and property description mentions probe, which is nothing related to hardware. Why the device would not be available during host init (I understand we do not talk about hotplug as it is already supported by Linux) in a way it is hardware property, not OS?

Best regards,
Krzysztof

Quoted 6 lines

+ everyone else I mistakenly didn't reply to earlier

If I understand you correctly, the usage of probe is misleading because it doesn't have anything to do with the hardware. So your recommendation is to replace probe with device init, in the description of the property and the commit message?

No, I asked there a question for which we need answer.

device init is also OS task... You need to explain why this is a property of hardware, not OS behavior.

Best regards,
Krzysztof

#7 lore raw

Re: [PATCH v1 1/2] dt-bindings: PCI: dwc: Add snps,skip-wait-link-up

Quoted 72 lines · Krzysztof Kozlowski
Quoted 64 lines · Sajid Dalvi
Quoted 53 lines · Krzysztof Kozlowski
Quoted 41 lines · Sajid Dalvi
Quoted 36 lines · Krzysztof Kozlowski
Quoted 7 lines · Sajid Dalvi

When the Root Complex is probed, the default behavior is to spin in a loop waiting for the link to come up. In some systems the link is not brought up during probe, but later in the context of an end-point turning on. This property will allow the loop to be skipped.

---

Thank you for your patch. There is something to discuss/improve.

Quoted 8 lines
 Documentation/devicetree/bindings/pci/snps,dw-pcie.yaml | 8 ++++++++
 1 file changed, 8 insertions(+)
Documentation/devicetree/bindings/pci/snps,dw-pcie.yaml +0 -0
index 1a83f0f65f19..0b8950a73b7e 100644

Documentation/devicetree/bindings/pci/snps,dw-pcie.yaml properties: · line 206

Quoted 10 lines
Documentation/devicetree/bindings/pci/snps,dw-pcie.yaml +7 -0
@@ -197,6 +197,14 @@ properties:
       - contains:
           const: msi
 
+  snps,skip-wait-link-up:
+    $ref: /schemas/types.yaml#/definitions/flag
+    description:
+      When the Root Complex is probed, the default behavior is to spin in a
+      loop waiting for the link to come up. In some systems the link is not
+      brought up during probe, but later in the context of an end-point turning
+      on. This property will allow the loop to be skipped.

I fail to see how probe behavior is related to properties of hardware. You describe OS behavior, not hardware. This does not look like belonging to DT.

Quoted 2 lines

Best regards,
Krzysztof

Quoted 7 lines

Thanks for your response Krzysztof.
The hardware configuration of the system determines whether an endpoint device is available during host init. If it isn't available on a particular and dedicated pcie interface, we should skip waiting for the link to be up. For other interfaces, possibly even on the same system, where a device is present or maybe present we should wait for the link to come up.

Keep discussions public.

Quoted 8 lines

Your commit and property description mentions probe, which is nothing related to hardware. Why the device would not be available during host init (I understand we do not talk about hotplug as it is already supported by Linux) in a way it is hardware property, not OS?

Best regards,
Krzysztof

Quoted 6 lines

+ everyone else I mistakenly didn't reply to earlier

If I understand you correctly, the usage of probe is misleading because it doesn't have anything to do with the hardware. So your recommendation is to replace probe with device init, in the description of the property and the commit message?

Quoted 4 lines

No, I asked there a question for which we need answer.

device init is also OS task... You need to explain why this is a property of hardware, not OS behavior.

Actually let's be clearer - your cover letter says:
"In some systems the link is not brought up
during probe, but later in the context of an end-point turning on. (...) to skip this loop."

so this is pure Linux OS stuff. You just want to control driver behavior from DT. Not at all DT property.

Best regards,
Krzysztof

#8 lore raw

Re: [PATCH v1 1/2] dt-bindings: PCI: dwc: Add snps,skip-wait-link-up

Thanks Krzysztof.
I will attempt to send a new patch to address the delay solely in the driver.

Sajid

Quoted 90 lines · Krzysztof Kozlowski
Quoted 72 lines · Krzysztof Kozlowski
Quoted 64 lines · Sajid Dalvi
Quoted 53 lines · Krzysztof Kozlowski
Quoted 41 lines · Sajid Dalvi
Quoted 36 lines · Krzysztof Kozlowski
Quoted 7 lines · Sajid Dalvi

When the Root Complex is probed, the default behavior is to spin in a loop waiting for the link to come up. In some systems the link is not brought up during probe, but later in the context of an end-point turning on. This property will allow the loop to be skipped.

---

Thank you for your patch. There is something to discuss/improve.

Quoted 8 lines
 Documentation/devicetree/bindings/pci/snps,dw-pcie.yaml | 8 ++++++++
 1 file changed, 8 insertions(+)
Documentation/devicetree/bindings/pci/snps,dw-pcie.yaml +0 -0
index 1a83f0f65f19..0b8950a73b7e 100644

Documentation/devicetree/bindings/pci/snps,dw-pcie.yaml properties: · line 206

Quoted 10 lines
Documentation/devicetree/bindings/pci/snps,dw-pcie.yaml +7 -0
@@ -197,6 +197,14 @@ properties:
       - contains:
           const: msi
 
+  snps,skip-wait-link-up:
+    $ref: /schemas/types.yaml#/definitions/flag
+    description:
+      When the Root Complex is probed, the default behavior is to spin in a
+      loop waiting for the link to come up. In some systems the link is not
+      brought up during probe, but later in the context of an end-point turning
+      on. This property will allow the loop to be skipped.

I fail to see how probe behavior is related to properties of hardware. You describe OS behavior, not hardware. This does not look like belonging to DT.

Quoted 2 lines

Best regards,
Krzysztof

Quoted 7 lines

Thanks for your response Krzysztof.
The hardware configuration of the system determines whether an endpoint device is available during host init. If it isn't available on a particular and dedicated pcie interface, we should skip waiting for the link to be up. For other interfaces, possibly even on the same system, where a device is present or maybe present we should wait for the link to come up.

Keep discussions public.

Quoted 8 lines

Your commit and property description mentions probe, which is nothing related to hardware. Why the device would not be available during host init (I understand we do not talk about hotplug as it is already supported by Linux) in a way it is hardware property, not OS?

Best regards,
Krzysztof

Quoted 6 lines

+ everyone else I mistakenly didn't reply to earlier

If I understand you correctly, the usage of probe is misleading because it doesn't have anything to do with the hardware. So your recommendation is to replace probe with device init, in the description of the property and the commit message?

Quoted 4 lines

No, I asked there a question for which we need answer.

device init is also OS task... You need to explain why this is a property of hardware, not OS behavior.

Actually let's be clearer - your cover letter says:
"In some systems the link is not brought up
during probe, but later in the context of an end-point turning on. (...) to skip this loop."

so this is pure Linux OS stuff. You just want to control driver behavior from DT. Not at all DT property.

Best regards,
Krzysztof

#9 lore raw

PATCH 2/2 PCI: dwc: Skip waiting for link up on probe

In reply to Sajid Dalvi

When the Root Complex is probed, the default behavior is to spin in a loop waiting for the link to come up. In some systems the link is not brought up during probe, but later in the context of an end-point turning on.

Call trace:

dw_pcie_wait_for_link << spins in a loop for 1 second dw_pcie_host_init

Adding the snps,skip-wait-link-up property in the pcie device tree node will skip this loop and save 1 second per interface on pcie probe for systems that do not need to bring up the link this early in the boot sequence.

---
 drivers/pci/controller/dwc/pcie-designware-host.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/pci/controller/dwc/pcie-designware-host.c +3 -2
index 3ab6ae3712c4..f5cba44ebf39 100644
@@ -477,8 +477,9 @@ int dw_pcie_host_init(struct dw_pcie_rp *pp)
 			goto err_free_msi;
 	}
 
-	/* Ignore errors, the link may come up later */
-	dw_pcie_wait_for_link(pci);
+	if (!of_property_read_bool(np, "snps,skip-wait-link-up"))
+		/* Ignore errors, the link may come up later */
+		dw_pcie_wait_for_link(pci);
 
 	bridge->sysdata = pp;
 
Signature · 1 line
2.39.2.637.g21b0678d19-goog