Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp397359ybl; Fri, 31 Jan 2020 00:44:31 -0800 (PST) X-Google-Smtp-Source: APXvYqzvWw60vl3MFkfLhCKJXs1BnrovSphNCT95OjrwXLWgOb7RfH71j+2B9A+ZaDMwaeojoh1p X-Received: by 2002:a9d:6e02:: with SMTP id e2mr6897081otr.194.1580460271253; Fri, 31 Jan 2020 00:44:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580460271; cv=none; d=google.com; s=arc-20160816; b=uq8VDyqOkwKAOcTA7uRk99RFKX++uB8tuhft9cMa8Yb1fxc2kkfXhmmVGw/bgbzcoS RWswB31dqXPNVz7UIO7hPcNujFAXl0YlnBgmYrLd24BPO8ksBmdfNyebbOw1CUwOCVO+ rMsP661CmSq5Wi100B+nGl6/sE5q8LyjNPeq5vAC39IjK+xVKbjDdeVqRz+x8oNIfJPj ATplxeEjtytioeZLYSZFXuc9mcPqOepzuP3rl9Pd0qNaHlJnHGFg89X759ZXoBhvqr0Y +sRTOhoKgpVngsuqJqVkKvJq6HXOYo2cY1qOqOmBY+h8wX8d/yZgf0uv1niEW8I1WA63 cSTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=yy4JT2ZYNFOY8zqSRDX4gzT3928AE8fwWbBYqRnycc0=; b=BQHZwb36iASFy4OaJTWeh/IzxA73WmpaPqIMh9XP/l2ZFheZJ9eNeDm+yp5iDqyvxj LD3CHFs9WLR1vhDWoaroG8t79MDJRBQlqq0Jj1xRDoOTatEacpeRxetR6NuxaYLIhSt7 gX9te5xVIKkX1IU6EqS1/vz3XJnJ5kfbJvBO2iwectKrRmM0Uc/a0jVxKuQpfpmIT1wV zpMAweh1RuToPNmBNrHVHSeJkykDsnPntQbLWVICiyye68dfb92Rwdj5/hModlX9mVAW 4l7/Fb33hVL0PGOZtIAmafGF66veqYcnaS65hZ7k2NRJM363LdzqQRLwomZbSUCX0fmx fV5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=IzmjjCc3; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z14si3985274oih.89.2020.01.31.00.44.19; Fri, 31 Jan 2020 00:44:31 -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; dkim=pass header.i=@kernel.org header.s=default header.b=IzmjjCc3; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728183AbgAaIm4 (ORCPT + 99 others); Fri, 31 Jan 2020 03:42:56 -0500 Received: from mail.kernel.org ([198.145.29.99]:36074 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728099AbgAaIkr (ORCPT ); Fri, 31 Jan 2020 03:40:47 -0500 Received: from localhost (unknown [223.226.100.111]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 961D320705; Fri, 31 Jan 2020 08:40:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1580460046; bh=119KLhF3P03xMSeOpDVQsbZVVDzEf0xaJjHj3Tue+eo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=IzmjjCc3DOBerXMB9+bKejVuCOMgbEpqINlqBDAlsyrMwqisPuc8t8xiz0oSRWRlQ pQAIlOtA1jQNHo74kPQCY3WTok+mgbFQh6ALkslHsUT0Qud+g1fMap3SvjFsG3+VbO MwZx661+bP73+af1A4Zex/9rY+cPF9QPMfqJKjNQ= Date: Fri, 31 Jan 2020 14:10:41 +0530 From: Vinod Koul To: Mathias Nyman 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 Subject: Re: [PATCH v6 0/5] usb: xhci: Add support for Renesas USB controllers Message-ID: <20200131084041.GI2841@vkoul-mobl> 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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <64340358-6682-4ae0-9c06-d72d5a4ff259@linux.intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. > > > > > > > > > ... > > > > Mathias, any comments on this series..? > > > > Hi Vinod > > Sorry about the delay. > > Maybe a firmware loading driver like this that wraps the xhci pci driver could > work. > > One benefit is that we could skip searching for the right firmware name based > on PCI ID. Each of these Renesas controllers now have their own pci_device_id > entry in the pci_ids[] table, and could have the supported firmware name(s) > in .driver_data. This way we wouldn't need to add the renesas_fw_table[] or > maybe even the renesas_needs_fw_dl() function in this series. > > I realize this can't be easily changed because usb_hcd_pci_probe() takes the > pci_device_id pointer as an argument, and expects id.driver_data to be a > HC driver pointer. > > So this turns out to be a question for Greg and Alan: > > Would it make sense to change usb_hcd_pci_probe() to take a HC driver pointer > as an argument instead of a pointer to pci_device_id? > pci_device_id pointer is only used to extract the HC driver handle. > This way the driver_data could be used for, well, driver data. > > Heikki actually suggested this some time ago to me, back then the idea was to > improve xhci quirks code by using driver_data for quirk flags instead of > finding and setting them later. > > 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. > I understood that a synchronous request_firmware() in probe has its own > issues, not sure if there is a good solution for this. Yeah with userspace not available, that can be tricky! > - Before the firmware is written to the controller the firmware version is > compared against a hardcoded number in the drivers renesas_fw_table[]. > This means new firmware versions can't be supported without patching the driver. > Is this intentional? Yes, we have only bunch of validated versions. There maybe more in the wild but we dont know. The vendor is not very helpful here :( Across all folks using this, there seems to be only few versions and vendor is not supporting it anymore, so chances of new versions seems remote Thanks -- ~Vinod