Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp5148139ybl; Tue, 4 Feb 2020 08:32:58 -0800 (PST) X-Google-Smtp-Source: APXvYqx+5kyWvfExc6moAZ+/xV+tuHePQX12JFldLVBQueWPjVehiyZ24tkXD1IiwvNh1eHWgGHy X-Received: by 2002:aca:5083:: with SMTP id e125mr4071147oib.96.1580833978159; Tue, 04 Feb 2020 08:32:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580833978; cv=none; d=google.com; s=arc-20160816; b=DED5QMYaottSkrLZ2ndR6QcjE9X+F5xqdPRbWeuD2S4blxJlaAVWbcegNwn6EfKR4A luOCzKUzEMTHiv/91cTyUaFMJdlI1BotiJUFTWmbJFhBlBQ4kzAlyiYY1oXgmejpmaFY 8w1m48dAh0b2cL4xP74yPBs7MtOY94y8y7lHfh7D3wvPeJkAI8GiOmAvCWUg50qC2Bbf Rlv5WPIsIZEjC79Yb2u2pVkEOL5i18Vgh9BLR+ZF1NakED5O8730IdVJzzG5pfKF3jut DVM/GNfz/JfQBlvMs47fRMFSKvZkmg4fUmIOabznvDntQrAG1yMPS6vaLzYQle/V3gYq zGeg== 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; bh=Or6esc6RKqddKWMQ8FjvjgYRWLpZVBPU6t9+t0nMiAI=; b=BgI4pCeaMi0dpHE0AHIG1NXQkZHbH7u5PKyj4O4beWHaLnPSFrGRN90pYt8XrzNqmG DJf/T/l9645FTLsmS7GTr4X2e8CikYejSueWGay2kMexVQGexhNdl4SXUtXFjyhivW57 HSIymplBYSRr6gX8iGO3TlA9Sh/1zlmycB3ZOuykLmDxdQlW/vrLt+W8fM2yo/0MIWjR BDiEkowNEdd2vNPePdN/41T16snMwF4pDlhUmhyJbBWWv8lfg8z+0P+rUNIrze2hd0CJ vCuJjkRBfMODSKDQ+dPnz4rSthmHS13joVVxk1gLzP6XfSNQ0slIThSViHSgQuQAH/02 0EFQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r6si11641459otn.216.2020.02.04.08.32.44; Tue, 04 Feb 2020 08:32:58 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727339AbgBDQbt (ORCPT + 99 others); Tue, 4 Feb 2020 11:31:49 -0500 Received: from mga07.intel.com ([134.134.136.100]:17209 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727307AbgBDQbt (ORCPT ); Tue, 4 Feb 2020 11:31:49 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Feb 2020 08:31:48 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,402,1574150400"; d="scan'208";a="311093473" Received: from mattu-haswell.fi.intel.com (HELO [10.237.72.170]) ([10.237.72.170]) by orsmga001.jf.intel.com with ESMTP; 04 Feb 2020 08:31:45 -0800 Subject: Re: [PATCH v6 0/5] usb: xhci: Add support for Renesas USB controllers To: Vinod Koul Cc: Christian Lamparter , Greg Kroah-Hartman , John Stultz , Mathias Nyman , linux-arm-msm@vger.kernel.org, Bjorn Andersson , Yoshihiro Shimoda , USB list , Linux Kernel Mailing List , Alan Stern , Heikki Krogerus References: <20200113084005.849071-1-vkoul@kernel.org> <20200121064608.GA2841@vkoul-mobl> <5878067.luYmtVZgP3@debian64> <20200125053237.GG2841@vkoul-mobl> <64340358-6682-4ae0-9c06-d72d5a4ff259@linux.intel.com> <20200131084041.GI2841@vkoul-mobl> From: Mathias Nyman Message-ID: <1ce257f5-df10-73ac-53ea-1c771abe70f2@linux.intel.com> Date: Tue, 4 Feb 2020 18:33:58 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <20200131084041.GI2841@vkoul-mobl> Content-Type: text/plain; charset=utf-8; format=flowed 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 31.1.2020 10.40, Vinod Koul wrote: > Hi Mathias, > > On 30-01-20, 19:07, Mathias Nyman wrote: >> On 25.1.2020 7.32, Vinod Koul wrote: >>>>>>>> >>>>>>>> On Mon, Jan 13, 2020 at 12:42 AM Vinod Koul wrote: >>>>>>>>> >>>>>>>>> This series add support for Renesas USB controllers uPD720201 and uPD720202. >>>>>>>>> These require firmware to be loaded and in case devices have ROM those can >>>>>>>>> also be programmed if empty. If ROM is programmed, it runs from ROM as well. >>>>>>>>> >>>>>>>>> This includes two patches from Christian which supported these controllers >>>>>>>>> w/o ROM and later my patches for ROM support and multiple firmware versions, >>>>>>>>> debugfs hook for rom erase and export of xhci-pci functions. >>>>>>>>> ... >> >> There are a few other opens regarding this series. Mostly because I'm not (yet) >> familiar with all the details, so I'll just just list them here. >> >> - Is it really enough to add the Renesas driver to Makefile before xhci-pci >> driver to make sure it gets matched and probed based on vendor/device id >> before xhci-pci driver is matched and probed based on pci class? >> What if the Renesas driver is a module and xhci-pci compiled in? > > The driver loading rules are based on level and makefile order. So > renesas will always be loaded before xhci driver. This is required since > xhci claims all devices, so we need to make sure it loads before. > > I think we should make it inbuilt driver rather than a module. xhci > driver is only inbuilt. > > If there is a better way to handle this, am all for it. > >> - Previously probe didn't return before hcd's were added and everything set up. >> Now with request_firmware_nowait() probe returns early successfully, and the >> old xhci_pci_probe() which sets up everything is called later by the request >> firmware callback. So there could be whole new set of races possible. >> For example pci remove can be called mid firmware loading, or when the old >> xhci_pci_probe is still setting up things. > > I think this is a valid concern. Let me think about how to solve this.. > maybe add a flag in remove which ensure remove doesnt run untill the > probe/firmware callback is completed. How about initiating async firmware loading before probe is called by using DECLARE_PCI_FIXUP_*() hooks? Probe would then just check if there is a valid running firmware, if not just defer probe until later (return -EPROBE_DEFER). No need for a separate Renesas xhci driver, no worries about which driver claims the device first, no races because of probe returning successfully too early. Can we check the device for a valid running firmware without disrupting a ongoing firmware write? -Mathias