Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp1639376ybv; Fri, 21 Feb 2020 00:48:32 -0800 (PST) X-Google-Smtp-Source: APXvYqyuLs5mqSsj9yAMqEDS9mmu9Ld4nGme3ndzHnTviMzhc4Et/C9jZGTFyL4P/nVlLnV4qXBi X-Received: by 2002:aca:1c01:: with SMTP id c1mr1100357oic.18.1582274912675; Fri, 21 Feb 2020 00:48:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582274912; cv=none; d=google.com; s=arc-20160816; b=j8OBi0OQ4FhAEiIN3s/CvIuIls34U4dDyuJuPbA7aJH8WLe9KmEKJQF8FkUSoJ+If2 KtxHuaIn+JKUGDsI9I8B2YSco4fOcoAhcv9bYrmIXsZ3JPhT4IC4xWn6ozK2Fv4zoWV/ bvZ3GFW0bjHooRla3TZtmxIghmJQnfFyg+XpjAaRE+BpK0KcKbsfLD9d/7OG7DEbl2kj cROA5uPo7ni6yZwzDzETCUib8Vl9NMzt74apzq8A4uBO/o4Ps3EHwLTn9NbBI78kwJiD 3/C0l+03Z8bVx2MAHyuK8W8/Aqwi0KykpqiRq7DQTlm3SrXWtSepAuVtlmR51apDsTZ6 FT8Q== 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=2iijmHpabU1gw1T41ZM9bRiOB3ddt/K+EQofo5pyxbo=; b=GqtfrK35rkIg6L9iJWzF4AgPBR/LBgS+4OQbKgFuia0VuzgmXrIaQThuDTPyOVDDZu GEcyplfPx7xjodttO8PWEFuaWZ/mtHt17ahE1+dNSTBscfktN7tIp/MO8sm626HpV2F/ PYA7mRkjnwBS5ppACyWqW7b6Hs6pYHOImHe/eoIMfDVe+YEx5IqqrNazxsSjck6+LRWF TFdALeiRZT8f80xHfTkapqx0bnFDeVK6xWp5TasmyGtwvgKptFpmRMGS3GjNNxBHDqHG KvpcBDVFVGEN6MaWBkT4RetdaR6SDXzDXo2lE/MN+X/+w5tC56hv9bjW3Nkv+PajyWmy Gzzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=URqjOFw4; 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 k128si517508oih.274.2020.02.21.00.48.20; Fri, 21 Feb 2020 00:48:32 -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=URqjOFw4; 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 S1732583AbgBUIqx (ORCPT + 99 others); Fri, 21 Feb 2020 03:46:53 -0500 Received: from mail.kernel.org ([198.145.29.99]:45878 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728198AbgBUHtY (ORCPT ); Fri, 21 Feb 2020 02:49:24 -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 E952C208C4; Fri, 21 Feb 2020 07:49:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1582271363; bh=Z+YSjqjpzc7rQw4bo2wzZnOWNDIeIgJkYMzUDWpteo8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=URqjOFw4Zxweu4dBV8DSv6A+Mi4MOlfcNqNq+NA1X47OFSv+iuOOP+1GBs1HTulx2 FKihIWa/L9yp6Gn+5nh/eTWuyNT1vUlK6xyrPYzq4DlAYI5n7bBCHuxb7Bqh2SWvBM 49Cc6egFKBgXKMeW7QHMK/BFpGIJc5evX7Qp9zDM= 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 5.5 137/399] PCI: Increase D3 delay for AMD Ryzen5/7 XHCI controllers Date: Fri, 21 Feb 2020 08:37:42 +0100 Message-Id: <20200221072415.792531597@linuxfoundation.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200221072402.315346745@linuxfoundation.org> References: <20200221072402.315346745@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 27008edce1a24..c0b7aa4dc0f51 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c @@ -1889,6 +1889,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