Skip to contentSkip to conversation

Add a quirk in xhci-plat for parent nodes to specify no 64 bit support

PATCH RESEND In review Naveen Kumar 4 participants 6 messages Nov 1, 2023 – Nov 6, 2023

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

cover Add a quirk in xhci-plat for parent nodes to specify no 64 bit support

From: Naveen Kumar M <[email protected]>

This patch aims to expose the XHCI_NO_64BIT_SUPPORT flag to the parent nodes of xhci for clients to specify if they can not support 64 bit DMA memory pointers. This issue was observed with a Google SoC that uses a DWC3 controller where the virtual address's higher order bits are truncated.

Resending due to missing out some reviewers/maintainers in the original patch.

Naveen Kumar M (2):
usb: host: xhci-plat: Add quirk-no-64-bit-support
dt-bindings: usb: add no-64-bit-support property

 Documentation/devicetree/bindings/usb/usb-xhci.yaml | 4 ++++
 drivers/usb/host/xhci-plat.c                        | 3 +++
 2 files changed, 7 insertions(+)
Signature · 1 line
2.42.0.820.g83a721a137-goog
#1 lore raw

PATCH RESEND 1/2 usb: host: xhci-plat: Add quirk-no-64-bit-support

From: Naveen Kumar M <[email protected]>

This patch exposes the existing quirk XHCI_NO_64BIT_SUPPORT so that dwc3 clients can also use this flag. Despite HCCPARAMS1 being set to 1 some clients may not support 64 bit addressing.

---
 drivers/usb/host/xhci-plat.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/usb/host/xhci-plat.c +3 -0
index b93161374293..d5f37decb7da 100644
@@ -249,6 +249,9 @@ int xhci_plat_probe(struct platform_device *pdev, struct device *sysdev, const s
 		if (device_property_read_bool(tmpdev, "quirk-broken-port-ped"))
 			xhci->quirks |= XHCI_BROKEN_PORT_PED;
 
+		if (device_property_read_bool(tmpdev, "quirk-no-64-bit-support"))
+			xhci->quirks |= XHCI_NO_64BIT_SUPPORT;
+
 		device_property_read_u32(tmpdev, "imod-interval-ns",
 					 &xhci->imod_interval);
 	}
Signature · 1 line
2.42.0.820.g83a721a137-goog
#2 lore raw

PATCH RESEND 2/2 dt-bindings: usb: add no-64-bit-support property

In reply to Naveen Kumar

From: Naveen Kumar M <[email protected]>

Add a new DT option to specify whether a host controller is able to support 64-bit DMA memory pointers

---
 Documentation/devicetree/bindings/usb/usb-xhci.yaml | 4 ++++
 1 file changed, 4 insertions(+)
Documentation/devicetree/bindings/usb/usb-xhci.yaml +4 -0
index 180a261c3e8f..20dc134004f3 100644
@@ -25,6 +25,10 @@ properties:
     description: Set if the controller has broken port disable mechanism
     type: boolean
 
+  quirk-no-64-bit-support:
+    description: Set if the xHC doesn't support 64-bit DMA memory pointers
+    type: boolean
+
   imod-interval-ns:
     description: Interrupt moderation interval
     default: 5000
Signature · 1 line
2.42.0.820.g83a721a137-goog
#3 lore raw

Re: [PATCH RESEND 2/2] dt-bindings: usb: add no-64-bit-support property

Quoted 4 lines · Naveen Kumar

From: Naveen Kumar M <[email protected]>

Add a new DT option to specify whether a host controller is able to support 64-bit DMA memory pointers

What host controllers are broken?

Quoted 10 lines
---
 Documentation/devicetree/bindings/usb/usb-xhci.yaml | 4 ++++
 1 file changed, 4 insertions(+)
Documentation/devicetree/bindings/usb/usb-xhci.yaml +0 -0
index 180a261c3e8f..20dc134004f3 100644

Documentation/devicetree/bindings/usb/usb-xhci.yaml properties: · line 29

Quoted 5 lines
Documentation/devicetree/bindings/usb/usb-xhci.yaml +2 -0
@@ -25,6 +25,10 @@ properties:
     description: Set if the controller has broken port disable mechanism
     type: boolean
 
+  quirk-no-64-bit-support:
+    description: Set if the xHC doesn't support 64-bit DMA memory pointers

To set this property, you need to know that the host controller is broken, so why not just make the driver set the quirk once it sees that the host controller is one of the broken ones?
Unless there are "sometimes broken" host controllers, a dedicated property should not be needed, right?

Quoted 8 lines
Documentation/devicetree/bindings/usb/usb-xhci.yaml +2 -0
+    type: boolean
+
   imod-interval-ns:
     description: Interrupt moderation interval
     default: 5000
Signature · 1 line
2.42.0.820.g83a721a137-goog
#4 lore raw

Re: [PATCH RESEND 2/2] dt-bindings: usb: add no-64-bit-support property

Quoted 21 lines · Conor Dooley
Quoted 4 lines · Naveen Kumar

From: Naveen Kumar M <[email protected]>

Add a new DT option to specify whether a host controller is able to support 64-bit DMA memory pointers

What host controllers are broken?

Quoted 13 lines
---
 Documentation/devicetree/bindings/usb/usb-xhci.yaml | 4 ++++
 1 file changed, 4 insertions(+)
Documentation/devicetree/bindings/usb/usb-xhci.yaml +0 -0
index 180a261c3e8f..20dc134004f3 100644
@@ -25,6 +25,10 @@ properties:
     description: Set if the controller has broken port disable mechanism
     type: boolean
 
Quoted 8 lines

Documentation/devicetree/bindings/usb/usb-xhci.yaml properties: · line 29

Quoted 2 lines
Documentation/devicetree/bindings/usb/usb-xhci.yaml +2 -0
+  quirk-no-64-bit-support:
+    description: Set if the xHC doesn't support 64-bit DMA memory pointers

To set this property, you need to know that the host controller is broken, so why not just make the driver set the quirk once it sees that the host controller is one of the broken ones?
Unless there are "sometimes broken" host controllers, a dedicated property should not be needed, right?

Yep, this looks like property specific to given XHCI controller, thus can be implied from compatible and there is no need for new DT property at all.

Also, there is no single DTS user of this property. It looks like you add it for some out-of-tree vendor or non-upstreamable code, which personally I would not care about. Feel free to prove me wrong by adding it to respective DTS in other patchset linked here.

Best regards,
Krzysztof

maintainer
#5 lore raw

Re: [PATCH RESEND 2/2] dt-bindings: usb: add no-64-bit-support property

In reply to Naveen Kumar
Quoted 15 lines · Naveen Kumar

From: Naveen Kumar M <[email protected]>

Add a new DT option to specify whether a host controller is able to support 64-bit DMA memory pointers

---
 Documentation/devicetree/bindings/usb/usb-xhci.yaml | 4 ++++
 1 file changed, 4 insertions(+)
Documentation/devicetree/bindings/usb/usb-xhci.yaml +0 -0
index 180a261c3e8f..20dc134004f3 100644

Documentation/devicetree/bindings/usb/usb-xhci.yaml properties: · line 30

Quoted 6 lines
Documentation/devicetree/bindings/usb/usb-xhci.yaml +3 -0
@@ -25,6 +25,10 @@ properties:
     description: Set if the controller has broken port disable mechanism
     type: boolean
 
+  quirk-no-64-bit-support:
+    description: Set if the xHC doesn't support 64-bit DMA memory pointers
+    type: boolean

To add on to this, you can handle this with dma-ranges if you need to limit DMA addresses to less than 32-bits.

Rob