Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp1623520ybv; Fri, 21 Feb 2020 00:29:38 -0800 (PST) X-Google-Smtp-Source: APXvYqxLAXu9KAeOX/ukFjKdZX8gR4aRE2XlYm2JGjKvbo5kQoun9vYfOjYCOqjxRiS0yx/E+ZXy X-Received: by 2002:a9d:6b06:: with SMTP id g6mr27064277otp.93.1582273778135; Fri, 21 Feb 2020 00:29:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582273778; cv=none; d=google.com; s=arc-20160816; b=eqLEBmuMWidwpwZr0U+/Bw9YqloKLgtxlBqf/prCaSDiDkS/Oou4K5kfjK3rFUPHR8 GuG6+NiKyzfqAMkNYHbnxgpe+9U4bRD39mIlG3oOanN4T0ZJhHnI4+ekgU6xQYhPOq9q Jwtce7Ry4T5MHjI+L8GXHYcu+7Cxj2AI6UZDX0BIwbdAiZbGpDuj6aNEiEJZlpQQj9Al /lQ4hhuYC8nK57gpIHAb+L+wJPeVTwBIUx7TcWm8wPBfuaf56EJwpwJsb4CowMla6/QX eY+uv/TiE9snP3rJoOP2KD4NX8zZyzua1CRpJQAyEG/tMtNRVYdSDeOPoBnmPU/7FVAG 7ATw== 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:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ydJs1CxBbfpBQY+gsEdyCc4iDCmGGXJ/L9hd7iVa0Mc=; b=ugojBC0JZ+GYxeKNHfq9mOyhWNzzTMCLKmCP+VN8nU5rIlY0FHY2LzUS7PUfGkHKwJ 5z7sOOFSdceJcR/AKaDO7JRIcdKsdQOrBjrZCa/zLERsUzumbP4rWO0xeyVRkhXMvjDA mX1ZbQrUP0KvxvHZSYahqLbguBQApqrD1b/KlZ7jWaSPyiMnM2MBfZU696a3wgJJ3PHG DLNUruZ3bhRUIMIcQKYngujBClbLsReTBcC2kdXxHmKM4jYygcflCug7v9TwxkcBkSc3 XGjMSW/Tt9YVOe8wRF343IS8uvapdslMOVRQJ3aP3rsmDCm+3+zSnEiEdkszVpWIGIzi CM3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ffA4cKa2; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h14si450568oie.130.2020.02.21.00.29.25; Fri, 21 Feb 2020 00:29:38 -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=ffA4cKa2; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387900AbgBUI2v (ORCPT + 99 others); Fri, 21 Feb 2020 03:28:51 -0500 Received: from mail.kernel.org ([198.145.29.99]:57764 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730626AbgBUITT (ORCPT ); Fri, 21 Feb 2020 03:19:19 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 841EA24689; Fri, 21 Feb 2020 08:19:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1582273159; bh=Xs1RqRXIkyN0/rD5GmpQxSzni0ZbVlti+J5ScEHxGAg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ffA4cKa2BL/Tf41xqSWDE/gXcTePe8icPiNtUKqt5Ofi91LqWZYlk5mHcGsuQjnm9 1TUsS0KU78+DiPQJCTYIFpdCuZ0S632sEBoC/9vP9QopwyJbT9Cb755+pv4LPdWIvf BnnIwEj8qQF6Kwvctp+QdDSQhYdEzAn2xkWTxTg4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Drake , Bjorn Helgaas , Mika Westerberg , Sasha Levin Subject: [PATCH 4.19 067/191] PCI: Increase D3 delay for AMD Ryzen5/7 XHCI controllers Date: Fri, 21 Feb 2020 08:40:40 +0100 Message-Id: <20200221072259.414117602@linuxfoundation.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200221072250.732482588@linuxfoundation.org> References: <20200221072250.732482588@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Daniel Drake [ Upstream commit 3030df209aa8cf831b9963829bd9f94900ee8032 ] On Asus UX434DA (AMD Ryzen7 3700U) and Asus X512DK (AMD Ryzen5 3500U), the XHCI controller fails to resume from runtime suspend or s2idle, and USB becomes unusable from that point. xhci_hcd 0000:03:00.4: Refused to change power state, currently in D3 xhci_hcd 0000:03:00.4: enabling device (0000 -> 0002) xhci_hcd 0000:03:00.4: WARN: xHC restore state timeout xhci_hcd 0000:03:00.4: PCI post-resume error -110! xhci_hcd 0000:03:00.4: HC died; cleaning up During suspend, a transition to D3cold is attempted, however the affected platforms do not seem to cut the power to the PCI device when in this state, so the device stays in D3hot. Upon resume, the D3hot-to-D0 transition is successful only if the D3 delay is increased to 20ms. The transition failure does not appear to be detectable as a CRS condition. Add a PCI quirk to increase the delay on the affected hardware. Link: https://bugzilla.kernel.org/show_bug.cgi?id=205587 Link: http://lkml.kernel.org/r/CAD8Lp47Vh69gQjROYG69=waJgL7hs1PwnLonL9+27S_TcRhixA@mail.gmail.com Link: https://lore.kernel.org/r/20191127053836.31624-2-drake@endlessm.com Signed-off-by: Daniel Drake Signed-off-by: Bjorn Helgaas Reviewed-by: Mika Westerberg Signed-off-by: Sasha Levin --- drivers/pci/quirks.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index 798d46a266037..419dda6dbd166 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c @@ -1866,6 +1866,22 @@ static void quirk_radeon_pm(struct pci_dev *dev) } DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x6741, quirk_radeon_pm); +/* + * Ryzen5/7 XHCI controllers fail upon resume from runtime suspend or s2idle. + * https://bugzilla.kernel.org/show_bug.cgi?id=205587 + * + * The kernel attempts to transition these devices to D3cold, but that seems + * to be ineffective on the platforms in question; the PCI device appears to + * remain on in D3hot state. The D3hot-to-D0 transition then requires an + * extended delay in order to succeed. + */ +static void quirk_ryzen_xhci_d3hot(struct pci_dev *dev) +{ + quirk_d3hot_delay(dev, 20); +} +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, 0x15e0, quirk_ryzen_xhci_d3hot); +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, 0x15e1, quirk_ryzen_xhci_d3hot); + #ifdef CONFIG_X86_IO_APIC static int dmi_disable_ioapicreroute(const struct dmi_system_id *d) { -- 2.20.1