Re: [PATCH 4.13 077/160] usb: host: xhci-plat: allow sysdev to inherit from ACPI

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 10/11/2017 7:53 AM, Greg Kroah-Hartman wrote:
> On Wed, Oct 11, 2017 at 11:19:41AM +0700, Thang Q. Nguyen wrote:
>> Hi,
>>
>> On Wed, Oct 11, 2017 at 2:50 AM, Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx
>>> wrote:
>>
>>     4.13-stable review patch.  If anyone has any objections, please let me
>>     know.
>>
>>     ------------------
>>
>>     From: Adam Wallis <awallis@xxxxxxxxxxxxxx>
>>
>>     commit c6b8e79306f515b5483eb11076e0fbfc140434a8 upstream.
>>
>>     Commit 4c39d4b949d3 ("usb: xhci: use bus->sysdev for DMA configuration")
>>     updated the method determining DMA for XHCI from sysdev. However, this
>>     patch broke the ability to enumerate the FWNODE from parent ACPI devices
>>     from the child plat XHCI device.
>>
>>     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)
>>
>>     Fixes: 4c39d4b949d3 ("usb: xhci: use bus->sysdev for DMA configuration")
>>     Tested-by: Thang Q. Nguyen <tqnguyen@xxxxxxx>
>>     Signed-off-by: Adam Wallis <awallis@xxxxxxxxxxxxxx>
>>     Signed-off-by: Mathias Nyman <mathias.nyman@xxxxxxxxxxxxxxx>
>>     Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
>>
>>     ---
>>      drivers/usb/host/xhci-plat.c |   16 ++++++++++------
>>      1 file changed, 10 insertions(+), 6 deletions(-)
>>
>>     --- a/drivers/usb/host/xhci-plat.c
>>     +++ b/drivers/usb/host/xhci-plat.c
>>     @@ -186,14 +186,18 @@ static int xhci_plat_probe(struct platfo
>>              * 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))
>>
>>
>>
>> This patch and Sriram's patches below should come together:
>>
>> d64ff406e5("usb: dwc3: use bus->sysdev for DMA configuration")
>>
>> 8c9f2de459("usb: dwc3: Do not set dma coherent mask")
>>
>> a8c06e407e("usb: separate out sysdev pointer from usb_bus")
>>
>> aeb78cda51("usb: chipidea: use bus->sysdev for DMA configuration")
>>
>> 8123e4953f("usb: ehci: fsl: use bus->sysdev for DMA configuration")
>>
>> 4c39d4b949("usb: xhci: use bus->sysdev for DMA configuration")
>>
>> Otherwise, the below issue still happen:
>>
>> [   17.591549] xhci-hcd: probe of xhci-hcd.6.auto failed with error -5
>>
>>  
>>
>> The first 2 above patches are in linux-stable.git/linux-4.11.y. And all above
>> Sriram's patches are in linux-stable.git/linux-4.12.y. This means we need the
>> followings:
>>
>> - Apply this patch and 4 missing Sriram's patches into linux-4.11.y.
>>
>> - Apply this patch into linux-4.12.y
> 
> Huh?  As Mathias said, all of the 4.11 and 4.12 patches are in 4.13,
> right?  We better not have missed them, as that is _not_ how we do
> kernel development and version branching.
> 
> Can you please verify this?
This patch applies directly on 4.13. All required patches are already in 4.13 as
Mathias mentioned
> 
> Also note that 4.11.y and 4.12.y are end-of-life, and we in the
> community are not adding any new patches to it.  If you have a crazy
> vendor that feels they want to maintain one of these kernel versions on
> their own, then please go talk to them about it :)
> 
> thanks,
> 
> greg k-h
> 


-- 
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.



[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]