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 11.10.2017 07:19, Thang Q. Nguyen wrote:
Hi,

On Wed, Oct 11, 2017 at 2:50 AM, Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx <mailto:gregkh@xxxxxxxxxxxxxxxxxxx>> wrote:

    4.13-stable review patch.  If anyone has any objections, please let me know.

    ------------------

    From: Adam Wallis <awallis@xxxxxxxxxxxxxx <mailto: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 <mailto:tqnguyen@xxxxxxx>>
    Signed-off-by: Adam Wallis <awallis@xxxxxxxxxxxxxx <mailto:awallis@xxxxxxxxxxxxxx>>
    Signed-off-by: Mathias Nyman <mathias.nyman@xxxxxxxxxxxxxxx <mailto:mathias.nyman@xxxxxxxxxxxxxxx>>
    Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx <mailto: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

Regards,

Thang Q. Nguyen


All those required patches are already in 4.13 stable.
They were accepted to 4.12
Applying this one on top is fine.

The issue you are talking about is for 4.11 stable only

-Mathias



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