Skip to contentSkip to conversation

drivers/usb/dwc3: fix PCI parent check

PATCH Superseded Punit Agrawal 2 participants 4 messages Nov 5, 2025 – Nov 6, 2025

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drivers/usb/dwc3: fix PCI parent check

From: Jamie Iles <[email protected]>

The sysdev_is_parent check was being used to infer PCI devices that have the DMA mask set from the PCI capabilities, but sysdev_is_parent is also used for non-PCI ACPI devices in which case the DMA mask would be the bus default or as set by the _DMA method.

Without this fix the DMA mask would default to 32-bits and so allocation would fail if there was no DRAM below 4GB.

Fixes 47ce45906ca9 ("usb: dwc3: leave default DMA for PCI devices")
---
 drivers/usb/dwc3/core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/usb/dwc3/core.c +2 -1
index ae140c356295..c2ce2f5e60a1 100644
@@ -25,6 +25,7 @@
 #include <linux/of.h>
 #include <linux/of_graph.h>
 #include <linux/acpi.h>
+#include <linux/pci.h>
 #include <linux/pinctrl/consumer.h>
 #include <linux/pinctrl/devinfo.h>
 #include <linux/reset.h>
@@ -2241,7 +2242,7 @@ int dwc3_core_probe(const struct dwc3_probe_data *data)
 	dev_set_drvdata(dev, dwc);
 	dwc3_cache_hwparams(dwc);
 
-	if (!dwc->sysdev_is_parent &&
+	if (!dev_is_pci(dwc->sysdev) &&
 	    DWC3_GHWPARAMS0_AWIDTH(dwc->hwparams.hwparams0) == 64) {
 		ret = dma_set_mask_and_coherent(dwc->sysdev, DMA_BIT_MASK(64));
 		if (ret)
Signature · 1 line
2.34.1
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 7 lines · Punit Agrawal

From: Jamie Iles <[email protected]>

The sysdev_is_parent check was being used to infer PCI devices that have the DMA mask set from the PCI capabilities, but sysdev_is_parent is also used for non-PCI ACPI devices in which case the DMA mask would be the bus default or as set by the _DMA method.

Quoted 6 lines

Without this fix the DMA mask would default to 32-bits and so allocation would fail if there was no DRAM below 4GB.

Fixes 47ce45906ca9 ("usb: dwc3: leave default DMA for PCI devices")

We should Cc stable also.

Quoted 28 lines
---
 drivers/usb/dwc3/core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/usb/dwc3/core.c +2 -1
index ae140c356295..c2ce2f5e60a1 100644
@@ -25,6 +25,7 @@
 #include <linux/of.h>
 #include <linux/of_graph.h>
 #include <linux/acpi.h>
+#include <linux/pci.h>
 #include <linux/pinctrl/consumer.h>
 #include <linux/pinctrl/devinfo.h>
 #include <linux/reset.h>
@@ -2241,7 +2242,7 @@ int dwc3_core_probe(const struct dwc3_probe_data *data)
 	dev_set_drvdata(dev, dwc);
 	dwc3_cache_hwparams(dwc);
 
-	if (!dwc->sysdev_is_parent &&
+	if (!dev_is_pci(dwc->sysdev) &&
 	    DWC3_GHWPARAMS0_AWIDTH(dwc->hwparams.hwparams0) == 64) {
 		ret = dma_set_mask_and_coherent(dwc->sysdev, DMA_BIT_MASK(64));
 		if (ret)
Signature · 1 line
2.34.1

BR,
Thinh

#2 lore raw
Quoted 37 lines · Thinh Nguyen
Quoted 7 lines · Punit Agrawal

From: Jamie Iles <[email protected]>

The sysdev_is_parent check was being used to infer PCI devices that have the DMA mask set from the PCI capabilities, but sysdev_is_parent is also used for non-PCI ACPI devices in which case the DMA mask would be the bus default or as set by the _DMA method.

Quoted 6 lines

Without this fix the DMA mask would default to 32-bits and so allocation would fail if there was no DRAM below 4GB.

Fixes 47ce45906ca9 ("usb: dwc3: leave default DMA for PCI devices")

We should Cc stable also.

Quoted 20 lines
---
 drivers/usb/dwc3/core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/usb/dwc3/core.c +1 -0
index ae140c356295..c2ce2f5e60a1 100644
@@ -25,6 +25,7 @@
 #include <linux/of.h>
 #include <linux/of_graph.h>
 #include <linux/acpi.h>
+#include <linux/pci.h>
 #include <linux/pinctrl/consumer.h>
 #include <linux/pinctrl/devinfo.h>
 #include <linux/reset.h>
@@ -2241,7 +2242,7 @@ int dwc3_core_probe(const struct dwc3_probe_data *data)
 	dev_set_drvdata(dev, dwc);
 	dwc3_cache_hwparams(dwc);
 
Quoted 10 lines
Quoted 8 lines
drivers/usb/dwc3/core.c +1 -1
-	if (!dwc->sysdev_is_parent &&
+	if (!dev_is_pci(dwc->sysdev) &&
 	    DWC3_GHWPARAMS0_AWIDTH(dwc->hwparams.hwparams0) == 64) {
 		ret = dma_set_mask_and_coherent(dwc->sysdev, DMA_BIT_MASK(64));
 		if (ret)
Signature · 1 line
2.34.1

Thank you for taking a look.

Not sure if Greg prefers a repost or he can add the tag and Cc: stable while applying. I'll resend next week with updates if there's no response.

[...]

maintainer
#3 lore raw
Quoted 50 lines · Punit Agrawal
Quoted 37 lines · Thinh Nguyen
Quoted 7 lines · Punit Agrawal

From: Jamie Iles <[email protected]>

The sysdev_is_parent check was being used to infer PCI devices that have the DMA mask set from the PCI capabilities, but sysdev_is_parent is also used for non-PCI ACPI devices in which case the DMA mask would be the bus default or as set by the _DMA method.

Quoted 6 lines

Without this fix the DMA mask would default to 32-bits and so allocation would fail if there was no DRAM below 4GB.

Fixes 47ce45906ca9 ("usb: dwc3: leave default DMA for PCI devices")

We should Cc stable also.

Quoted 20 lines
---
 drivers/usb/dwc3/core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/usb/dwc3/core.c +1 -0
index ae140c356295..c2ce2f5e60a1 100644
@@ -25,6 +25,7 @@
 #include <linux/of.h>
 #include <linux/of_graph.h>
 #include <linux/acpi.h>
+#include <linux/pci.h>
 #include <linux/pinctrl/consumer.h>
 #include <linux/pinctrl/devinfo.h>
 #include <linux/reset.h>
@@ -2241,7 +2242,7 @@ int dwc3_core_probe(const struct dwc3_probe_data *data)
 	dev_set_drvdata(dev, dwc);
 	dwc3_cache_hwparams(dwc);
 
Quoted 10 lines
Quoted 8 lines
drivers/usb/dwc3/core.c +1 -1
-	if (!dwc->sysdev_is_parent &&
+	if (!dev_is_pci(dwc->sysdev) &&
 	    DWC3_GHWPARAMS0_AWIDTH(dwc->hwparams.hwparams0) == 64) {
 		ret = dma_set_mask_and_coherent(dwc->sysdev, DMA_BIT_MASK(64));
 		if (ret)
Signature · 1 line
2.34.1
Quoted 8 lines

Thank you for taking a look.

Not sure if Greg prefers a repost or he can add the tag and Cc: stable while applying. I'll resend next week with updates if there's no response.

[...]

Unless Greg specifically indicated that he'd update himself, please submit a new version with the change.

Thanks,
Thinh