Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp703077ybk; Wed, 13 May 2020 10:49:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzys5VI8w4CPPOrm1Q2MOSmekUigr5vAYJC5+oxzu9+o+LVXtzFsR2/C8iKDD40wvVbnhil X-Received: by 2002:a50:ccc5:: with SMTP id b5mr731254edj.340.1589392144898; Wed, 13 May 2020 10:49:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589392144; cv=none; d=google.com; s=arc-20160816; b=mG8BrBxznot8G8eptwPfMkRP1fPzeRkx5MUlZwxrcPYMeXbVlHTZDUKvq2qWaWcfbF jkPbQeZoTE/ARRcg3W5qmmT76MVEdtwmgg1FQAtQym1LUoHvmoFnNPlW5K8kjl9wACE/ KN1eJDohDMciaD8NWCGktxfNWW1/xAsF6VBMmaSru1VLxEXPRaliVrjHBQGRlsapk/gf 8QIGYittVhF+ffBn77P+3GbqkRFSB6MjKINEwsJIKO+D6hc46TVQJQ7s4DilBRqodfoq n++yBo7PdL7Dx1f11cHdv3pBxQrsSl4pkEqKGEB0qMjD9z85VuM9a6Yf4gfT6AtlBIyq S0dA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=3AyO9Ui8zFCawW0Lwfl84VvMEinAsSXxuQe8ws/cLpY=; b=XsL3HH/cHFsW9tWj3pH73KIO35cNrHz1xlNWqEDtL/+UqDb2I/9RZxancciqFiIgHj KNPujgKLalV5RuU2ZX9I4FIe84dw9Ljk2aGwBbP9ALqBTvEwvSw2wvWt4s8+QcGKlVSP BxWBdMWNSs7QAnN5qNLuOZlPIFJGLq8kuKUpWByO+krIGJrL68IJjSzww3MqYpCIFF2V GAn2d8nhl/q2aT7LTDoI5JaqAAV47IBP9lpDCAe3NKprgKLKCWEANqrN8mWgslP+vvWj chYuVXhIhsZ1sF8me2KR7zerXBgkrXEs5Xuon/IWvf33AwBoGb2YAjHj+y1OKJa1LX/p LO5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=kivnDObF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l6si179143edr.243.2020.05.13.10.48.39; Wed, 13 May 2020 10:49:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=kivnDObF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389941AbgEMRqZ (ORCPT + 99 others); Wed, 13 May 2020 13:46:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38930 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1732670AbgEMRqZ (ORCPT ); Wed, 13 May 2020 13:46:25 -0400 Received: from mail-pg1-x541.google.com (mail-pg1-x541.google.com [IPv6:2607:f8b0:4864:20::541]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 24C1BC061A0C; Wed, 13 May 2020 10:46:25 -0700 (PDT) Received: by mail-pg1-x541.google.com with SMTP id u35so70805pgk.6; Wed, 13 May 2020 10:46:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=3AyO9Ui8zFCawW0Lwfl84VvMEinAsSXxuQe8ws/cLpY=; b=kivnDObFzJc7ctBIJXaOiWWZXUlFXAUOrjfO9Z1UWpkr6wFzle7r+TadzK6PwrdZCE 2dR9zZ6LUZlFeJfp+mFw66lM4bwWxM4IkZCvri+Tw595lnwdZeMxoL6gO+x0OCZtYNZS uGOY/rO4y6C7QSwq/KBHQE1coNFtesZE2SguL9VDMlXNECk3oiRpQKz0Q1nMuGh0qkRF 10O60lgkp2ubtj/IZstkN6qlrmKweIwuIjiP3ofXwg/mvxdkxjzl04Zu043fFphUWwwI 4G4XqjA6Lws1jiKE49zdTFS0MK1NYySJ+Yrh8xTNluXFd6RuogzHnCWrqHtJIj14xsjT kTiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=3AyO9Ui8zFCawW0Lwfl84VvMEinAsSXxuQe8ws/cLpY=; b=cdNlS369h2F3MjuQshJ7ohzQWiwCnjx3nWG+NmfvbbSZO5BzVF9H9AoCBgYvaOQ5qJ NStu8prXZV78vxeNaKOqiPHLFNluaf51D0TTHSTxWkFj9R+xt7Et8W/SIIvb4mDZNd4K /H5+GthDkNjiaBsBXJFiNE6ebS2N5bETqgxs96czgyh0BeHPotFc4RW+yvWOErUN/zHo FUV2l4wE2cbVsOebjKI9djrV2zBHjW3fzUAZlT+36a3qrvUDj47926lnoA7YVPtPo5Ds /Zg0YgFTc2OfEy68CwumOy1Nqb9OOfnhg28oCAw9VttekC7U128w0ohHkQFz89pN4T3G Z1KA== X-Gm-Message-State: AOAM532Wm2PwmIwS7eGtRSo9T+AW/ERhDuR2gtmeVpixaHfHrmDFv7Hz frexM5VtgMlBR2fCIFC52Es= X-Received: by 2002:a63:e148:: with SMTP id h8mr405667pgk.313.1589391984595; Wed, 13 May 2020 10:46:24 -0700 (PDT) Received: from [10.230.188.43] ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id d12sm172454pfq.36.2020.05.13.10.46.22 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 13 May 2020 10:46:23 -0700 (PDT) Subject: Re: [PATCH v10 1/5] usb: xhci: Change the XHCI link order in the Makefile To: Alan Stern , Greg Kroah-Hartman Cc: Al Cooper , linux-kernel@vger.kernel.org, Andy Shevchenko , bcm-kernel-feedback-list@broadcom.com, devicetree@vger.kernel.org, Krzysztof Kozlowski , linux-usb@vger.kernel.org, Mathias Nyman , Rob Herring , Yoshihiro Shimoda , Andy Shevchenko References: <20200512150019.25903-1-alcooperx@gmail.com> <20200512150019.25903-2-alcooperx@gmail.com> <20200513122613.GA1023594@kroah.com> <7acc2a4c-caab-11e7-7b3f-4176f19c58cf@gmail.com> <20200513162723.GF1362525@kroah.com> <38ff034d-a84c-2309-a8d5-f344930d9a31@gmail.com> <20200513170505.GB1369204@kroah.com> <20200513173920.GA2862@rowland.harvard.edu> From: Florian Fainelli Message-ID: Date: Wed, 13 May 2020 10:46:22 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Firefox/68.0 Thunderbird/68.8.0 MIME-Version: 1.0 In-Reply-To: <20200513173920.GA2862@rowland.harvard.edu> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 5/13/2020 10:39 AM, Alan Stern wrote: > On Wed, May 13, 2020 at 07:05:05PM +0200, Greg Kroah-Hartman wrote: >> On Wed, May 13, 2020 at 09:31:11AM -0700, Florian Fainelli wrote: >>> >>> >>> On 5/13/2020 9:27 AM, Greg Kroah-Hartman wrote: >>>> On Wed, May 13, 2020 at 08:08:07AM -0700, Florian Fainelli wrote: >>>>> >>>>> >>>>> On 5/13/2020 5:26 AM, Greg Kroah-Hartman wrote: >>>>>> On Tue, May 12, 2020 at 11:00:15AM -0400, Al Cooper wrote: >>>>>>> Some BRCMSTB USB chips have an XHCI, EHCI and OHCI controller >>>>>>> on the same port where XHCI handles 3.0 devices, EHCI handles 2.0 >>>>>>> devices and OHCI handles <2.0 devices. Currently the Makefile >>>>>>> has XHCI linking at the bottom which will result in the XHIC driver >>>>>>> initalizing after the EHCI and OHCI drivers and any installed 3.0 >>>>>>> device will be seen as a 2.0 device. Moving the XHCI linking >>>>>>> above the EHCI and OHCI linking fixes the issue. >>>>>> >>>>>> What happens if all of these are modules and they are loaded in a >>>>>> different order? This makefile change will not help with that, you need >>>>>> to have logic in the code in order to properly coordinate this type of >>>>>> mess, sorry. >>>>> >>>>> I believe we should be using module soft dependencies to instruct the >>>>> module loaders to load the modules in the correct order, so something >>>>> like this would do (not tested) for xhci-plat-hcd.c: >>>>> >>>>> MODULE_SOFTDEP("post: ehci-hcd ohci-hcd"); >>>>> >>>>> and I am not sure whether we need to add the opposite for ehci-hcd and >>>>> ohci-hcd: >>>>> >>>>> MODULE_SOFTDEP("pre: xhci-plat-hcd"); >>>> >>>> That's a nice start, but what happens if that isn't honored? This >>>> really needs to work properly for any order as you never can guarantee >>>> module/driver loading order in a system of modules. >>> >>> I also suggested that device links may help, though I am not sure. What >>> do you suggest to be done? >> >> No idea. device links will help if you defer the probe properly until >> you see the proper drivers binding correctly. > > I suspect that in general there is no way to do this properly. > > We can't modify ehci-hcd and ohci-hcd to make them wait. In fact, for > all they know, xhci-hcd will _never_ be loaded. > > One thing that might be possible (although not all platforms may support > it) is if xhci-hcd could somehow disconnect all devices attached to a > peer port when it starts up. But that would be disruptive to any > devices that aren't USB-3. > > We faced a very similar ordering problem between ehci-hcd and > [ou]hci-hcd many years ago, and we never found a good solution. > We did arrange the link order so that ehci-hcd precedes the others, and > we added a warning message to ehci-hcd which gets printed if the module > initialization routine runs after [ou]hci-hcd is loaded. Also, there > are MODULE_SOFTDEP lines in ohci-pci.c and uhci-pci.c. Given that these modules are used on specific SoC platforms, where we usually provide a reference implementation of user space and kernel space and documentation, it seems to me that the MODULE_SOFTDEP(), despite being a hint and best effort from user space module loaders is probably acceptable. -- Florian