Skip to contentSkip to conversation

usb: host: xhci-plat: allow sysdev to inherit from ACPI

PATCH Superseded Adam Wallis 2 participants 6 messages Sep 5, 2017

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 usb: host: xhci-plat: allow sysdev to inherit from ACPI

Currently, xhci_plat is not set up properly when the parent device is an ACPI node. The conditions that xhci_plat_probe should satisfy are

1. xhci_plat comes from firmware
2. xhci_plat is child of a device from firmware (dwc3-plat)
3. xhci_plat is grandchild of a pci device (dwc3-pci)

Case 2 is covered when the child is an OF node (by checking sysdev->parent->of_node), however, an ACPI parent will return NULL in the of_node check and will thus not result in sysdev being set to sysdev->parent

[   17.591549] xhci-hcd: probe of xhci-hcd.6.auto failed with error -5

This change adds a check for ACPI to completely allow for condition 2. This is done by first checking if the parent node is of type ACPI (e.g., dwc3-plat) and set sysdev to sysdev->parent if either of the two following conditions are met:

1: If fwnode is empty (in the case that platform_device_add_properties was not called on the allocated platform device)
2: fwnode exists but is not of type ACPI (this would happen if platform_device_add_properties was called on the allocated device. Instead of type FWNODE_ACPI, you would end up with FWNODE_PDATA)

Cc stable at vger.kernel.org #4.12.x
Cc stable at vger.kernel.org #4.13.x

---
Changes in v2: Incorporate the simplified fwnode check as suggested by Mathias

 drivers/usb/host/xhci-plat.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)
drivers/usb/host/xhci-plat.c +10 -6
index c04144b..2087407 100644
@@ -186,14 +186,18 @@ static int xhci_plat_probe(struct platform_device *pdev)
 	 * 2. xhci_plat is child of a device from firmware (dwc3-plat)
 	 * 3. xhci_plat is grandchild of a pci device (dwc3-pci)
 	 */
-	sysdev = &pdev->dev;
-	if (sysdev->parent && !sysdev->of_node && sysdev->parent->of_node)
-		sysdev = sysdev->parent;
+	for (sysdev = &pdev->dev; sysdev; sysdev = sysdev->parent) {
+		if (is_of_node(sysdev->fwnode) ||
+			is_acpi_device_node(sysdev->fwnode))
+			break;
 #ifdef CONFIG_PCI
-	else if (sysdev->parent && sysdev->parent->parent &&
-		 sysdev->parent->parent->bus == &pci_bus_type)
-		sysdev = sysdev->parent->parent;
+		else if (sysdev->bus == &pci_bus_type)
+			break;
 #endif
+	}
+
+	if (!sysdev)
+		sysdev = &pdev->dev;
 
 	/* Try to set 64-bit DMA first */
 	if (WARN_ON(!sysdev->dma_mask))
Signature · 3 lines
Qualcomm Datacenter Technologies as an affiliate of Qualcomm Technologies, Inc.
Qualcomm Technologies, Inc. is a member of the
Code Aurora Forum, a Linux Foundation Collaborative Project.
#1 lore raw

PATCH v2 1/1 usb: host: xhci-plat: allow sysdev to inherit from ACPI

Quoted 19 lines · Adam Wallis

Currently, xhci_plat is not set up properly when the parent device is an ACPI node. The conditions that xhci_plat_probe should satisfy are

1. xhci_plat comes from firmware
2. xhci_plat is child of a device from firmware (dwc3-plat)
3. xhci_plat is grandchild of a pci device (dwc3-pci)

Case 2 is covered when the child is an OF node (by checking sysdev->parent->of_node), however, an ACPI parent will return NULL in the of_node check and will thus not result in sysdev being set to sysdev->parent

[   17.591549] xhci-hcd: probe of xhci-hcd.6.auto failed with error -5

This change adds a check for ACPI to completely allow for condition 2. This is done by first checking if the parent node is of type ACPI (e.g., dwc3-plat) and set sysdev to sysdev->parent if either of the two following conditions are met:

Quoted 8 lines

1: If fwnode is empty (in the case that platform_device_add_properties was not called on the allocated platform device)
2: fwnode exists but is not of type ACPI (this would happen if platform_device_add_properties was called on the allocated device. Instead of type FWNODE_ACPI, you would end up with FWNODE_PDATA)

Cc stable at vger.kernel.org #4.12.x
Cc stable at vger.kernel.org #4.13.x

What bug is this fixing that needs to go into the stable kernel trees? Is this a regression, or a new feature for those versions?

thanks,

greg k-h

#2 lore raw

PATCH v2 1/1 usb: host: xhci-plat: allow sysdev to inherit from ACPI

Quoted 26 lines · Greg Kroah-Hartman
Quoted 25 lines · Adam Wallis

Currently, xhci_plat is not set up properly when the parent device is an ACPI node. The conditions that xhci_plat_probe should satisfy are

1. xhci_plat comes from firmware
2. xhci_plat is child of a device from firmware (dwc3-plat)
3. xhci_plat is grandchild of a pci device (dwc3-pci)

Case 2 is covered when the child is an OF node (by checking sysdev->parent->of_node), however, an ACPI parent will return NULL in the of_node check and will thus not result in sysdev being set to sysdev->parent

[   17.591549] xhci-hcd: probe of xhci-hcd.6.auto failed with error -5

This change adds a check for ACPI to completely allow for condition 2. This is done by first checking if the parent node is of type ACPI (e.g., dwc3-plat) and set sysdev to sysdev->parent if either of the two following conditions are met:

1: If fwnode is empty (in the case that platform_device_add_properties was not called on the allocated platform device)
2: fwnode exists but is not of type ACPI (this would happen if platform_device_add_properties was called on the allocated device. Instead of type FWNODE_ACPI, you would end up with FWNODE_PDATA)

Quoted 6 lines
Quoted 2 lines
Cc stable at vger.kernel.org #4.12.x
Cc stable at vger.kernel.org #4.13.x

What bug is this fixing that needs to go into the stable kernel trees? Is this a regression, or a new feature for those versions?

Greg

The following patch

4c39d4b949d36f usb: xhci: use bus->sysdev for DMA configuration

provided an incomplete check for all firmware nodes (only checked for PCI and OF case, but not the ACPI case). This bug affects the 4.12 and 4.13 kernels.

Adam

Quoted 9 lines

thanks,

greg k-h

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

Signature · 4 lines
Adam Wallis
Qualcomm Datacenter Technologies as an affiliate of Qualcomm Technologies, Inc.
Qualcomm Technologies, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project.
#3 lore raw

PATCH v2 1/1 usb: host: xhci-plat: allow sysdev to inherit from ACPI

Quoted 33 lines · Adam Wallis
Quoted 26 lines · Greg Kroah-Hartman
Quoted 25 lines · Adam Wallis

Currently, xhci_plat is not set up properly when the parent device is an ACPI node. The conditions that xhci_plat_probe should satisfy are

1. xhci_plat comes from firmware
2. xhci_plat is child of a device from firmware (dwc3-plat)
3. xhci_plat is grandchild of a pci device (dwc3-pci)

Case 2 is covered when the child is an OF node (by checking sysdev->parent->of_node), however, an ACPI parent will return NULL in the of_node check and will thus not result in sysdev being set to sysdev->parent

[   17.591549] xhci-hcd: probe of xhci-hcd.6.auto failed with error -5

This change adds a check for ACPI to completely allow for condition 2. This is done by first checking if the parent node is of type ACPI (e.g., dwc3-plat) and set sysdev to sysdev->parent if either of the two following conditions are met:

1: If fwnode is empty (in the case that platform_device_add_properties was not called on the allocated platform device)
2: fwnode exists but is not of type ACPI (this would happen if platform_device_add_properties was called on the allocated device. Instead of type FWNODE_ACPI, you would end up with FWNODE_PDATA)

Quoted 6 lines
Quoted 2 lines
Cc stable at vger.kernel.org #4.12.x
Cc stable at vger.kernel.org #4.13.x

What bug is this fixing that needs to go into the stable kernel trees? Is this a regression, or a new feature for those versions?

Quoted 8 lines

Greg

The following patch

4c39d4b949d36f usb: xhci: use bus->sysdev for DMA configuration

provided an incomplete check for all firmware nodes (only checked for PCI and OF case, but not the ACPI case). This bug affects the 4.12 and 4.13 kernels.

What is the symptom of "incomplete check"? Something that used to work now does not? Or just that it doesn't work "correctly" and this patch resolves that issue so that new hardware can now work properly? I ask as you have read the stable kernel rules, right?

thanks,

greg k-h

#4 lore raw

PATCH v2 1/1 usb: host: xhci-plat: allow sysdev to inherit from ACPI

Quoted 38 lines · Greg Kroah-Hartman
Quoted 37 lines · Adam Wallis
Quoted 26 lines · Greg Kroah-Hartman
Quoted 25 lines · Adam Wallis

Currently, xhci_plat is not set up properly when the parent device is an ACPI node. The conditions that xhci_plat_probe should satisfy are

1. xhci_plat comes from firmware
2. xhci_plat is child of a device from firmware (dwc3-plat)
3. xhci_plat is grandchild of a pci device (dwc3-pci)

Case 2 is covered when the child is an OF node (by checking sysdev->parent->of_node), however, an ACPI parent will return NULL in the of_node check and will thus not result in sysdev being set to sysdev->parent

[   17.591549] xhci-hcd: probe of xhci-hcd.6.auto failed with error -5

This change adds a check for ACPI to completely allow for condition 2. This is done by first checking if the parent node is of type ACPI (e.g., dwc3-plat) and set sysdev to sysdev->parent if either of the two following conditions are met:

1: If fwnode is empty (in the case that platform_device_add_properties was not called on the allocated platform device)
2: fwnode exists but is not of type ACPI (this would happen if platform_device_add_properties was called on the allocated device. Instead of type FWNODE_ACPI, you would end up with FWNODE_PDATA)

Quoted 6 lines
Quoted 2 lines
Cc stable at vger.kernel.org #4.12.x
Cc stable at vger.kernel.org #4.13.x

What bug is this fixing that needs to go into the stable kernel trees? Is this a regression, or a new feature for those versions?

Greg

The following patch

Quoted 8 lines
Quoted 4 lines

4c39d4b949d36f usb: xhci: use bus->sysdev for DMA configuration

provided an incomplete check for all firmware nodes (only checked for PCI and OF case, but not the ACPI case). This bug affects the 4.12 and 4.13 kernels.

What is the symptom of "incomplete check"? Something that used to work now does not? Or just that it doesn't work "correctly" and this patch resolves that issue so that new hardware can now work properly?

Greg, the change I reference above broke behavior that previously worked. Previously, it was possible to have a an ACPI host driver (e.g., dwc3) that created a platform xhci device as a child. The above change removed the ability to have a parent ACPI device to the platform xhci platform device (so drivers like dwc3 host do not work with ACPI now in 4.12/4.13)

I ask

Quoted 1 line

as you have read the stable kernel rules, right?

I have read the rules. Are you asking for me to update my sign-off area with the fix commit information?

Quoted 5 lines

thanks,

greg k-h

Thank you for your help

Adam

Signature · 4 lines
Adam Wallis
Qualcomm Datacenter Technologies as an affiliate of Qualcomm Technologies, Inc.
Qualcomm Technologies, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project.
#5 lore raw

PATCH v2 1/1 usb: host: xhci-plat: allow sysdev to inherit from ACPI

Quoted 44 lines · Adam Wallis
Quoted 43 lines · Greg Kroah-Hartman
Quoted 41 lines · Adam Wallis
Quoted 26 lines · Greg Kroah-Hartman
Quoted 25 lines · Adam Wallis

Currently, xhci_plat is not set up properly when the parent device is an ACPI node. The conditions that xhci_plat_probe should satisfy are

1. xhci_plat comes from firmware
2. xhci_plat is child of a device from firmware (dwc3-plat)
3. xhci_plat is grandchild of a pci device (dwc3-pci)

Case 2 is covered when the child is an OF node (by checking sysdev->parent->of_node), however, an ACPI parent will return NULL in the of_node check and will thus not result in sysdev being set to sysdev->parent

[   17.591549] xhci-hcd: probe of xhci-hcd.6.auto failed with error -5

This change adds a check for ACPI to completely allow for condition 2. This is done by first checking if the parent node is of type ACPI (e.g., dwc3-plat) and set sysdev to sysdev->parent if either of the two following conditions are met:

1: If fwnode is empty (in the case that platform_device_add_properties was not called on the allocated platform device)
2: fwnode exists but is not of type ACPI (this would happen if platform_device_add_properties was called on the allocated device. Instead of type FWNODE_ACPI, you would end up with FWNODE_PDATA)

Quoted 6 lines
Quoted 2 lines
Cc stable at vger.kernel.org #4.12.x
Cc stable at vger.kernel.org #4.13.x

What bug is this fixing that needs to go into the stable kernel trees? Is this a regression, or a new feature for those versions?

Greg

The following patch

4c39d4b949d36f usb: xhci: use bus->sysdev for DMA configuration

provided an incomplete check for all firmware nodes (only checked for PCI and OF case, but not the ACPI case). This bug affects the 4.12 and 4.13 kernels.

Quoted 8 lines
Quoted 3 lines

What is the symptom of "incomplete check"? Something that used to work now does not? Or just that it doesn't work "correctly" and this patch resolves that issue so that new hardware can now work properly?

Greg, the change I reference above broke behavior that previously worked. Previously, it was possible to have a an ACPI host driver (e.g., dwc3) that created a platform xhci device as a child. The above change removed the ability to have a parent ACPI device to the platform xhci platform device (so drivers like dwc3 host do not work with ACPI now in 4.12/4.13)

Ok, then provide this information with a "Fixes:" tag please.

thanks,

greg k-h