Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3815982ybi; Mon, 29 Jul 2019 13:10:45 -0700 (PDT) X-Google-Smtp-Source: APXvYqy/07exZumE0YJb2Ff6/hG/SFMC2+wna9MdOAhv8Vr17hWufkqadrtS4nZvZnHcpzVQTQD7 X-Received: by 2002:a63:dd4e:: with SMTP id g14mr33974313pgj.227.1564431045300; Mon, 29 Jul 2019 13:10:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564431045; cv=none; d=google.com; s=arc-20160816; b=WImRpBYFgtmGLcefCLZk5v4ZEJ1cMR9XT3KEzH/an8Kk2OBWuAu5RxiQXhD5LMB3vv 3Jo8pKFwcfx8DT8VAviqlzUEwLf9oUwBHstTN/Q1X8c7fbpZuXBekVNcnmJCUbzdq1U+ Yg4PJn0ob/IdSLCsxaNtb37Fw6yUY/x7kABxeEFIHYzdmi54qVII+3srtPIIkWfcsLaU k5ZDV2oTQoIK5ux4exu/LtS6Ky0Kayg8poXBM3KtkEJCv0auiPAQh00pQGVB0skCz6ZQ ee/rr/JRQUIUTjhT+A4UiVqenyaYFYbtozA0QDqCSYCOFl7ecfnePwwfFqJ5ZOd5NVyt jxYw== 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=CXzvYvsWZDOGUPdQkn4A9HyvMv2ULAv6965yFcnVCyc=; b=UuWE7gClQSr6o6h+WFhAQgWCRl/n9zBuvNlGrNRUAGqV9+qgeKDVvnORQkjBQMXWe6 /zdIoCKyPCAbLR760NvAojwhOS30AGJun3HIdX3/ma0E2zl0hy2O/02Rxnp3w2dbbVmx C2IF4DcRmBr9xoaXE4EvgvsXQHyBB0QE5VzWQQR5Vj0FW92Rneuxnxw3U8rd/fwm/sfw AozCyjq56m+SOAp3bOyUcwhBbZbzne5DyvlTMkiFAHvEOzUaXPrzDe17an33zkk0CoD9 iKz4oTEMTOB9Qoo9CWVnOexTiZ91rNZElo6tuZz7s56K+u1d1eYICNQuE7VLN8nCnvBo JLaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ZoZ8qmXN; 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 k16si26269366pfi.174.2019.07.29.13.10.30; Mon, 29 Jul 2019 13:10:45 -0700 (PDT) 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=ZoZ8qmXN; 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 S2388835AbfG2TiM (ORCPT + 99 others); Mon, 29 Jul 2019 15:38:12 -0400 Received: from mail.kernel.org ([198.145.29.99]:53108 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388469AbfG2TiI (ORCPT ); Mon, 29 Jul 2019 15:38:08 -0400 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 47A44206DD; Mon, 29 Jul 2019 19:38:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564429086; bh=g5PHaDvBug9tJQg8/3/c0mZKrSSFk6rM4H1mNFs9ZZw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZoZ8qmXNsATLclUISs9AYQ6uLQK+akTdAsKPwU7qsnOk7ysaTPtg4JXZQPD/zbRit q8J8gmgfpTfJ6/jLopQb1VPgVjcXLr/vz0tXkM69ce2WmSSmDFRMSEnEJWOwW0Mqd2 TH2g+o0GWwtQ5BsKnRXCnSwElYPGTjsTNZiVy7jU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ryan Kennedy , Alan Stern Subject: [PATCH 4.14 281/293] usb: pci-quirks: Correct AMD PLL quirk detection Date: Mon, 29 Jul 2019 21:22:52 +0200 Message-Id: <20190729190845.788318316@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190729190820.321094988@linuxfoundation.org> References: <20190729190820.321094988@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: Ryan Kennedy commit f3dccdaade4118070a3a47bef6b18321431f9ac6 upstream. The AMD PLL USB quirk is incorrectly enabled on newer Ryzen chipsets. The logic in usb_amd_find_chipset_info currently checks for unaffected chipsets rather than affected ones. This broke once a new chipset was added in e788787ef. It makes more sense to reverse the logic so it won't need to be updated as new chipsets are added. Note that the core of the workaround in usb_amd_quirk_pll does correctly check the chipset. Signed-off-by: Ryan Kennedy Fixes: e788787ef4f9 ("usb:xhci:Add quirk for Certain failing HP keyboard on reset after resume") Cc: stable Acked-by: Alan Stern Link: https://lore.kernel.org/r/20190704153529.9429-2-ryan5544@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/usb/host/pci-quirks.c | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) --- a/drivers/usb/host/pci-quirks.c +++ b/drivers/usb/host/pci-quirks.c @@ -204,7 +204,7 @@ int usb_amd_find_chipset_info(void) { unsigned long flags; struct amd_chipset_info info; - int ret; + int need_pll_quirk = 0; spin_lock_irqsave(&amd_lock, flags); @@ -218,21 +218,28 @@ int usb_amd_find_chipset_info(void) spin_unlock_irqrestore(&amd_lock, flags); if (!amd_chipset_sb_type_init(&info)) { - ret = 0; goto commit; } - /* Below chipset generations needn't enable AMD PLL quirk */ - if (info.sb_type.gen == AMD_CHIPSET_UNKNOWN || - info.sb_type.gen == AMD_CHIPSET_SB600 || - info.sb_type.gen == AMD_CHIPSET_YANGTZE || - (info.sb_type.gen == AMD_CHIPSET_SB700 && - info.sb_type.rev > 0x3b)) { + switch (info.sb_type.gen) { + case AMD_CHIPSET_SB700: + need_pll_quirk = info.sb_type.rev <= 0x3B; + break; + case AMD_CHIPSET_SB800: + case AMD_CHIPSET_HUDSON2: + case AMD_CHIPSET_BOLTON: + need_pll_quirk = 1; + break; + default: + need_pll_quirk = 0; + break; + } + + if (!need_pll_quirk) { if (info.smbus_dev) { pci_dev_put(info.smbus_dev); info.smbus_dev = NULL; } - ret = 0; goto commit; } @@ -251,7 +258,7 @@ int usb_amd_find_chipset_info(void) } } - ret = info.probe_result = 1; + need_pll_quirk = info.probe_result = 1; printk(KERN_DEBUG "QUIRK: Enable AMD PLL fix\n"); commit: @@ -262,7 +269,7 @@ commit: /* Mark that we where here */ amd_chipset.probe_count++; - ret = amd_chipset.probe_result; + need_pll_quirk = amd_chipset.probe_result; spin_unlock_irqrestore(&amd_lock, flags); @@ -276,7 +283,7 @@ commit: spin_unlock_irqrestore(&amd_lock, flags); } - return ret; + return need_pll_quirk; } EXPORT_SYMBOL_GPL(usb_amd_find_chipset_info);