Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3794254ybi; Mon, 29 Jul 2019 12:45:31 -0700 (PDT) X-Google-Smtp-Source: APXvYqwuXvVxN6sElix527BqK7o/Djjp+s2A61RDlwkECwQmARgHFvRS/tj1x0sOtQyFwlTfcncp X-Received: by 2002:a62:3103:: with SMTP id x3mr37472017pfx.107.1564429531437; Mon, 29 Jul 2019 12:45:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564429531; cv=none; d=google.com; s=arc-20160816; b=eF/glKHLdOc188gJXmozX5ynAvxbqwj0IygfmipgfjPxdzSOn6KzwKpjgoZcIwtXVD 5uTv3IlXKNMoVrp2QboQaE9w3MKh9C5LcmddmRz7kYjFFWt7qCjhy6uFzsGuR3ILwNWe jr/vTAJVRD/4orv68yEPR+AwToFCYRR+hoGIVQhhLQ/ixVgBT4R7mk8ig1cULMBD1v04 7ORiWfOuMu6o1P//3Z3pPkSlqVd08XjFOP+e+vCM1Ajxaj2nG/2MfRj+02sORDjcV8KA T1qn0q0CdX6QDhBQINDsvgIWhAVIe2dhzlDQUUYRiEY/ea4PkwBm/nC/HMjBPir3c81J 8yMg== 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=KsN/9llmpYNvTZUPBAQYQLG/W7ksWBLQpWcViU9St4tJXLrpyxM1Muz+gCIy3jPepn O8nYlahf2fsNcS1z/d+wlRNPEmoEZPT4usmnd5T4XOTSoEqXnrCxcskOnIPM7BL0TqGX UL6KVT8QN1KzK1mhN0jGH2U7Vt3IpYb3xvf+5ogWS5GfTpJoB+eWT+GUb6vDXT4v2hIf Y+ZDVaHSJUlkUrifzJpbuJWAmCWTm0QYL9XN+sLKs4bXVC6pZq7ST73SLEkpIH6mcgrf wuiz24wwpR9Byvb8D4K6IoVzt1bJQoDU8mt4nXxIee/QYZ2NX6yIokqID/seq3WfeeAw X8fw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=mMWMvYil; 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 n6si30754504pgl.419.2019.07.29.12.45.16; Mon, 29 Jul 2019 12:45:31 -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=mMWMvYil; 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 S2389740AbfG2ToG (ORCPT + 99 others); Mon, 29 Jul 2019 15:44:06 -0400 Received: from mail.kernel.org ([198.145.29.99]:60776 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389739AbfG2ToE (ORCPT ); Mon, 29 Jul 2019 15:44:04 -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 2C413217D4; Mon, 29 Jul 2019 19:44:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564429443; bh=YwuccWPC67nky6oHRiVyPdUqhiollFHNBC3F7IK5tXM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mMWMvYilQdh/9EdLQ+ZQGrxNtxcYApRkHsuhmkxpzdR70slJEGQVxbtTv+hVii1Ky wS1gSCXBgFz1hBuNtlJRVuK7p5FioyfrZAqq5HpziwjQ5zdHmqH9VBBYSWewWTiU3A P7SMA5iSWo5xvG026ZD9gXXOEEShgpIxGuA2yjLw= 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.19 099/113] usb: pci-quirks: Correct AMD PLL quirk detection Date: Mon, 29 Jul 2019 21:23:06 +0200 Message-Id: <20190729190719.218930773@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190729190655.455345569@linuxfoundation.org> References: <20190729190655.455345569@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);