Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3697429ybi; Fri, 5 Jul 2019 12:06:47 -0700 (PDT) X-Google-Smtp-Source: APXvYqz6t5vVP0ak1goXaGojkBNqwmkPv3NeLRtpXA6SzFZ/VyXO0RrDlVqdPzgu8C5QUIZVRCRZ X-Received: by 2002:a17:902:28:: with SMTP id 37mr6897985pla.188.1562353607556; Fri, 05 Jul 2019 12:06:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562353607; cv=none; d=google.com; s=arc-20160816; b=msD4ZOpoOlXGt/t5qivN+KXxCmSkqn5iM0sLNy//RIpHrifvkwwchTz1z1xyLfwz8Q nBAbw0kacvO+V5ezwSnT6jbhtzgc22NVoibl711GmxFPbOx5TU0Yp1e9/1nbaqQtjFZY r1H9zJpJ7onZ4wc9osq4DFSwYruBS19V5upnCab9R+6VwmP4Kb0qJgypr4wancTUtghI uRKMi41YK3KKayUMtTft8xOs54gzS9XJ3GdTpVzM/vgiLXBlSz/byzX1HtZXFSNow9dR Ek71agKAOlbKZwKQuKLqRNqdXsjBw78Z+Agn9fORAZVQtewAOPpQHcB6vtbSGFyAXEIu EbYw== 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=tAfnSRTP33wrn9orCRnVYMq6tFFykfj1MWFy307mgUY=; b=KKlzhikUg7o+QsQH3fr7LrW1HeRRU47rVTbRgbei8H8Hdp5kVsvv4A2prK2ytot9gP rvqpthNEajB+x37zLlyUUS7/xji97XmrkO+mUJImsIbE3GAdEdn+rXaAYn7noRGUcu/s 9S8VrkrRbB3P7kKlHcGGqLIQ5NlmJihCql+BqGmvjRg8G2GsP8gNiBt6cD7FUXd33tj1 /+H9wu60bb4JVWe5w5c6XK0xFe2SkCIuCbEO83e1kUm79ryRvejvs6/1aH1d8EF0zT7K N74nO9F47zK0Gd6CvmYnLZFnAc/Ri87qklHb4WKJAA9f8Ujg8RcVD+xjoSgdUmr5m9Ry my2w== ARC-Authentication-Results: i=1; mx.google.com; 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 a10si9904677pgq.194.2019.07.05.12.06.32; Fri, 05 Jul 2019 12:06:47 -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; 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 S1727487AbfGETE3 (ORCPT + 99 others); Fri, 5 Jul 2019 15:04:29 -0400 Received: from iolanthe.rowland.org ([192.131.102.54]:47662 "HELO iolanthe.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1725778AbfGETE3 (ORCPT ); Fri, 5 Jul 2019 15:04:29 -0400 Received: (qmail 5565 invoked by uid 2102); 5 Jul 2019 15:04:28 -0400 Received: from localhost (sendmail-bs@127.0.0.1) by localhost with SMTP; 5 Jul 2019 15:04:28 -0400 Date: Fri, 5 Jul 2019 15:04:28 -0400 (EDT) From: Alan Stern X-X-Sender: stern@iolanthe.rowland.org To: Ryan Kennedy cc: gregkh@linuxfoundation.org, , , Subject: Re: [PATCH 1/2] usb: pci-quirks: Correct AMD PLL quirk detection In-Reply-To: <20190704153529.9429-2-ryan5544@gmail.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 Thu, 4 Jul 2019, Ryan Kennedy wrote: > 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 > --- > drivers/usb/host/pci-quirks.c | 31 +++++++++++++++++++------------ > 1 file changed, 19 insertions(+), 12 deletions(-) > > diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c > index 3ce71cbfbb58..ad05c27b3a7b 100644 > --- a/drivers/usb/host/pci-quirks.c > +++ b/drivers/usb/host/pci-quirks.c > @@ -205,7 +205,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); > > @@ -219,21 +219,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; > } > > @@ -252,7 +259,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: > @@ -263,7 +270,7 @@ int usb_amd_find_chipset_info(void) > > /* 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); > > @@ -277,7 +284,7 @@ int usb_amd_find_chipset_info(void) > spin_unlock_irqrestore(&amd_lock, flags); > } > > - return ret; > + return need_pll_quirk; > } > EXPORT_SYMBOL_GPL(usb_amd_find_chipset_info); Acked-by: Alan Stern