Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp1277368pxb; Thu, 15 Apr 2021 19:53:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw2KlX2Pm4943yAmEGV7wQqexVb/K0Q+fKtoP/OAb6Xn/P1fUlXY2C3SqAlZ/l38yNIpTyQ X-Received: by 2002:a17:90a:5217:: with SMTP id v23mr3278941pjh.95.1618541632701; Thu, 15 Apr 2021 19:53:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618541632; cv=none; d=google.com; s=arc-20160816; b=bG8/u5wOHx4tAsKcl+Af3K7pO1BRWjL058JuIjylpaxRnIe9vMeZ7JhUNvbdwwSull JX/ryEIOA70K5YfDxVc7VqP4F7Evf3E0kE+MoqEPKfcHhf6LidrSILzB0TtDDkstmraS xSYxzpXvDb4XrEZP9ngQO9DHxesJXQGfhM9eDr30/3YXjvw9jE47sfvpiF4KUmLt7ydL Cd7Lp4vRcexbXBqFfprwO3puAR0Ye0Yf7GxQ7L7iLqoIHmAZAoUYIXc0ENEE4XfSMm1J zZTNesh9bUoPzTcj0oh2Tbvit51s3M6OHjbzx9PD6pfdsLbW0tBsX52cj9UR2FAP49S3 m0Ww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:references:cc:to :subject; bh=k812bL1Q6O4ni4gd2zsV7WpNfHWR++HbArUEce3+du8=; b=hvN2tr6rmgU7utv7HKFSxsNBdLNp+C60AwvjhcPzZCk/0PpebxvMgrWLassapegkBN X9CoVcKv3k/gBPSFl2tGsLCv/b6977cJU03Fy86fkVudXgp5dASSi7f0z40apJd9HZ0v 133Ntyf+kjS1+ZrT6I8f8nk06U8tELnVomEALZEO5O//OD5XAAx1r9SArKd8WY+agAke 2HMOMN26PlAhgaDk28A3PnLhcXgqVecpA2+wLPp3nehRVDM/TfclsaUygKL+aiwv2/en y6O1rvkfIpOWM+3adIo8W83RONx+JAatTCYaRraBtoWcCAkNQ7q5TskbyAu7rdXzBgOB LHFw== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o7si5346935pgb.89.2021.04.15.19.53.33; Thu, 15 Apr 2021 19:53:52 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237623AbhDPCoL (ORCPT + 99 others); Thu, 15 Apr 2021 22:44:11 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:17363 "EHLO szxga06-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236366AbhDPCoH (ORCPT ); Thu, 15 Apr 2021 22:44:07 -0400 Received: from DGGEMS408-HUB.china.huawei.com (unknown [172.30.72.60]) by szxga06-in.huawei.com (SkyGuard) with ESMTP id 4FM0ph74jJzlWp0; Fri, 16 Apr 2021 10:41:48 +0800 (CST) Received: from [10.67.102.118] (10.67.102.118) by DGGEMS408-HUB.china.huawei.com (10.3.19.208) with Microsoft SMTP Server id 14.3.498.0; Fri, 16 Apr 2021 10:43:34 +0800 Subject: Re: [RFC PATCH] USB:XHCI:skip hub registration To: Greg KH CC: , , , , , , References: <1618489358-42283-1-git-send-email-liulongfang@huawei.com> From: liulongfang Message-ID: <973a4759-4464-e59e-f84b-15672503e290@huawei.com> Date: Fri, 16 Apr 2021 10:43:34 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="gbk" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.67.102.118] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2021/4/15 20:34, Greg KH wrote: > On Thu, Apr 15, 2021 at 08:22:38PM +0800, Longfang Liu wrote: >> When the number of ports on the USB hub is 0, skip the registration >> operation of the USB hub. > > That's crazy. Why not fix the hardware? How has this hub passed the > USB certification process? > >> The current Kunpeng930's XHCI hardware controller is defective. The number >> of ports on its USB3.0 bus controller is 0, and the number of ports on >> the USB2.0 bus controller is 1. >> >> In order to solve this problem that the USB3.0 controller does not have >> a port which causes the registration of the hub to fail, this patch passes >> the defect information by adding flags in the quirks of xhci and usb_hcd, >> and finally skips the registration process of the hub directly according >> to the results of these flags when the hub is initialized. >> >> Signed-off-by: Longfang Liu >> --- >> drivers/usb/core/hub.c | 6 ++++++ >> drivers/usb/host/xhci-pci.c | 4 ++++ >> drivers/usb/host/xhci.c | 5 +++++ >> drivers/usb/host/xhci.h | 1 + >> include/linux/usb/hcd.h | 1 + >> 5 files changed, 17 insertions(+) >> >> diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c >> index b1e14be..2d6869d 100644 >> --- a/drivers/usb/core/hub.c >> +++ b/drivers/usb/core/hub.c >> @@ -1769,9 +1769,15 @@ static int hub_probe(struct usb_interface *intf, const struct usb_device_id *id) >> struct usb_host_interface *desc; >> struct usb_device *hdev; >> struct usb_hub *hub; >> + struct usb_hcd *hcd; >> >> desc = intf->cur_altsetting; >> hdev = interface_to_usbdev(intf); >> + hcd = bus_to_hcd(hdev->bus); >> + if (hcd->usb3_no_port) { >> + dev_warn(&intf->dev, "USB hub has no port\n"); >> + return -ENODEV; >> + } >> >> /* >> * Set default autosuspend delay as 0 to speedup bus suspend, >> diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c >> index ef513c2..63b89a4 100644 >> --- a/drivers/usb/host/xhci-pci.c >> +++ b/drivers/usb/host/xhci-pci.c >> @@ -281,6 +281,10 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) >> if (xhci->quirks & XHCI_RESET_ON_RESUME) >> xhci_dbg_trace(xhci, trace_xhci_dbg_quirks, >> "QUIRK: Resetting on resume"); >> + >> + if (pdev->vendor == PCI_VENDOR_ID_HUAWEI && >> + pdev->device == 0xa23c) >> + xhci->quirks |= XHCI_USB3_NOPORT; > > Can't we just detect this normally that there are no ports for this > device? Why is the device lying about how many ports it has such that > we have to "override" this? > The hub driver will check the port number in prob(). If there is no port, the driver will report an error log. But we hope this defective device does not print error log. > And again, why not fix this broken hardware? > > thanks, > > greg k-h > . > The current generation of hardware can no longer be modified, this problem will be solved in the next generation of hardware. Thanks, Longfang.