Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp4132234ybi; Mon, 29 Jul 2019 19:58:40 -0700 (PDT) X-Google-Smtp-Source: APXvYqx39LFQ18YvecefB4nSrDPEkU4BfveyTcv/LoC+iPnfY7fpTf2MsHIBTzJ/zziF9/1XKD9v X-Received: by 2002:a17:90a:bc0c:: with SMTP id w12mr81510687pjr.111.1564455520626; Mon, 29 Jul 2019 19:58:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564455520; cv=none; d=google.com; s=arc-20160816; b=fAVKA0AoAA0t0KdmUG0xIBpcFCEtKwlDm2VU5kWtXm+CYx1EF3GBKz/XAdBTqSg9DT xxvYlosDXzTmJcdJQQBmAxUA0RFYx4DEVFnPp/xg7wwF17slhOa55SLy9BVBQZYHpjWo gPUCHLr1lRmM2hIqqtj4Et4Xbn73GiCPuM2U9SOdXNXb3yLnzCVfGr7Jddusfga4O8j8 vuR9QRe83FYmj8gMKyV1WXqlBZ4JssQ6gCNwCJRpRzxoSTDIZOWgB4N4oXhBYc5+aQyx DCSJbNQORoeFNmQwN3vJLV8LttUtvBt0UTqKX0LG0leUx02BS9IbaCADBYjrX9uf4cUl LgpQ== 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=4ykHbzDgSwQs8d+bzcoT3iy/E3sZwGW3KwtXCevHUOs=; b=OUYmwPaDe9uoabwFoiulTzhlj3OJIzaoYQmcR2C8yfX1HWfbXrumtMpZyPAy1OnJIB bdt6FFk9pZqbcpmKz35ZxzxfNaay0Er0ycdnjQDoUkK6Z3uyGu0873NSWXkJSix1V8Fx BVJhTU3sOOR9xHAlQKPFEWHy78IxcxXojUHEv96WIr/hbTNLqYZ6kscCO4rsTvOhMK47 EUbKHuOKqNvwTQlrFDwR3Rfjiz99uehbhNf6bdb8HD62+mL9qzseBHPTZ73VclOEfiaN KfcuSICoccmsFH2VdbB8FrjJWNaeKPV+Hjwyga7NYZa7J8/XiexFJsbo66T3lQBlHa8B CAGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=CWdMGecQ; 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 h38si29594107plb.149.2019.07.29.19.58.25; Mon, 29 Jul 2019 19:58:40 -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=CWdMGecQ; 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 S1729729AbfG2TyB (ORCPT + 99 others); Mon, 29 Jul 2019 15:54:01 -0400 Received: from mail.kernel.org ([198.145.29.99]:46030 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404009AbfG2Txh (ORCPT ); Mon, 29 Jul 2019 15:53:37 -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 7462D2171F; Mon, 29 Jul 2019 19:53:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564430015; bh=YwuccWPC67nky6oHRiVyPdUqhiollFHNBC3F7IK5tXM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CWdMGecQmLOJx+QkqlqBxxuuFrh+qg90q9s05YqEWlixIt8Fkjh/SSR3sB3W4/yqq WACCuN/rTVwS+9zv0qguOmFeDZv9+ZAiJMKipFYaRZRPZPoXPuYbbx6li4O0lGPDwD zHVBDR8jOKdfB7xP9/6xo6iKPUe7nOEvH75Nsbe0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ryan Kennedy , Alan Stern Subject: [PATCH 5.2 170/215] usb: pci-quirks: Correct AMD PLL quirk detection Date: Mon, 29 Jul 2019 21:22:46 +0200 Message-Id: <20190729190809.372922819@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190729190739.971253303@linuxfoundation.org> References: <20190729190739.971253303@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 @@ -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 @@ 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); @@ -277,7 +284,7 @@ commit: spin_unlock_irqrestore(&amd_lock, flags); } - return ret; + return need_pll_quirk; } EXPORT_SYMBOL_GPL(usb_amd_find_chipset_info);