Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp3660688ybz; Mon, 4 May 2020 07:21:58 -0700 (PDT) X-Google-Smtp-Source: APiQypLpgNnRVK4fC4/3sV/Cx1mol6p80klc7Avxp2vW4+qdsDl8riQzqla8Ar8B72g2hoq9HZpL X-Received: by 2002:aa7:cdce:: with SMTP id h14mr14676857edw.51.1588602118069; Mon, 04 May 2020 07:21:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588602118; cv=none; d=google.com; s=arc-20160816; b=mJk9/3rnNjyg6yWX4jIMlKZVUAZV7WFFLjO/17soO79WdSG10Z78sPP7fvvClQkX44 sxb4ieGmnlpkM2uzxIXAkxbzZZaYHWRDo6CDraRtDDPkSoJvhx6e+BGkUxOM9qdVNjNP U2n5SpfQLSnPEkJFY1TLwTDCfOQrG2cd6LhsJcK6hX9YDLSnLgyVsS9X8t2TnibrujiF kst12SPfdTIwp3WEerg59z27bo7yvnIsTVc24L6aoUelseqzuN+p+gkeIIygJEFTwR6s h4np7ahsAtLDHktJoeQFFbOajsVWLZe8KjuwHGmJecU18v2nawVZQUwCEnSGRVZvhyGV oCJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:in-reply-to :subject:cc:to:from:date; bh=qMzoY0ueEMHQOSr/Ks23je0pSeG8zdYf6kYtlpbr04M=; b=vkn57qNgWVJJf7xQJxJxWlBmMlrKDoHF7mq7X5fCYGXK58wcx25UYSFcW2lsmXvc6M z2ZQPStUDyIDZamdfcgoMFM3KY0zPl6Ws0EBUBF+iVbDDn3Zjts6O1KmGCGhntxQp97u PmgCIWPAIGEzqg4NHiCYv9CLJoXIiqmJY2baH19du/2FXGB6UNVAcHKsMAe1Zhukc6ax vczejHJH26sUAT4WJNg/FnVpiq/Nfta0OfDf38iBKbkT2NgmYuKXXDfKSO4PyTmBDhMI YhrafX9VgdZqaKHD0o9D9voHu3cvcCPAVGoiTz4CUf81KEwfaTx7Py4thb8/GdnD5epk uYQQ== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g15si6928559edr.14.2020.05.04.07.21.34; Mon, 04 May 2020 07:21:58 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728486AbgEDOR6 (ORCPT + 99 others); Mon, 4 May 2020 10:17:58 -0400 Received: from netrider.rowland.org ([192.131.102.5]:44283 "HELO netrider.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1728075AbgEDOR5 (ORCPT ); Mon, 4 May 2020 10:17:57 -0400 Received: (qmail 13977 invoked by uid 500); 4 May 2020 10:17:56 -0400 Received: from localhost (sendmail-bs@127.0.0.1) by localhost with SMTP; 4 May 2020 10:17:56 -0400 Date: Mon, 4 May 2020 10:17:56 -0400 (EDT) From: Alan Stern X-X-Sender: stern@netrider.rowland.org To: Kai-Heng Feng cc: mathias.nyman@intel.com, Greg Kroah-Hartman , "open list:USB XHCI DRIVER" , open list Subject: Re: [PATCH v2] xhci: Prevent runtime suspend on Etron EJ168 In-Reply-To: <20200504113622.20361-1-kai.heng.feng@canonical.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 4 May 2020, Kai-Heng Feng wrote: > Etron EJ168 USB 3.0 Host Controller stops working after S3, if it was > runtime suspended previously: > [ 370.080359] pci 0000:02:00.0: can't change power state from D3cold to D0 (config space inaccessible) > [ 370.080477] xhci_hcd 0000:04:00.0: can't change power state from D3cold to D0 (config space inaccessible) > [ 370.080532] pcieport 0000:00:1c.0: DPC: containment event, status:0x1f05 source:0x0200 > [ 370.080533] pcieport 0000:00:1c.0: DPC: ERR_FATAL detected > [ 370.080536] xhci_hcd 0000:04:00.0: can't change power state from D3hot to D0 (config space inaccessible) > [ 370.080552] xhci_hcd 0000:04:00.0: AER: can't recover (no error_detected callback) > [ 370.080566] usb usb3: root hub lost power or was reset > [ 370.080566] usb usb4: root hub lost power or was reset > [ 370.080572] xhci_hcd 0000:04:00.0: Host halt failed, -19 > [ 370.080574] xhci_hcd 0000:04:00.0: Host not accessible, reset failed. > [ 370.080575] xhci_hcd 0000:04:00.0: PCI post-resume error -19! > [ 370.080586] xhci_hcd 0000:04:00.0: HC died; cleaning up > > This can be fixed by not runtime suspend the controller at all. > > So disable runtime suspend for EJ168 xHCI device. > > Signed-off-by: Kai-Heng Feng > --- > v2: > - Use a new quirk to avoid changing existing behavior. > > drivers/usb/host/xhci-pci.c | 4 +++- > drivers/usb/host/xhci.h | 1 + > 2 files changed, 4 insertions(+), 1 deletion(-) > > diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c > index 766b74723e64..1658fa4c3e4e 100644 > --- a/drivers/usb/host/xhci-pci.c > +++ b/drivers/usb/host/xhci-pci.c > @@ -227,6 +227,7 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) > xhci->quirks |= XHCI_RESET_ON_RESUME; > xhci->quirks |= XHCI_TRUST_TX_LENGTH; > xhci->quirks |= XHCI_BROKEN_STREAMS; > + xhci->quirks |= XHCI_DISABLE_RUNTIME_SUSPEND; > } > if (pdev->vendor == PCI_VENDOR_ID_RENESAS && > pdev->device == 0x0014) { > @@ -371,7 +372,8 @@ static int xhci_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) > xhci->shared_hcd->can_do_streams = 1; > > /* USB-2 and USB-3 roothubs initialized, allow runtime pm suspend */ > - pm_runtime_put_noidle(&dev->dev); > + if (!(xhci->quirks & XHCI_DISABLE_RUNTIME_SUSPEND)) > + pm_runtime_put_noidle(&dev->dev); This cannot possibly be correct. You have changed an unconditional runtime-put to a conditional one, but you have not made the corresponding change to the matching runtime-get. Every runtime-PM put must be balanced by a get, and vice versa. Alan Stern