Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp412720pxj; Thu, 20 May 2021 12:13:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx9yh9vhI8g6+BO6n9ggUOQg5BvmKAxVKMnBDnOgj+CX+JGx+CFQ9FD0B4wL42s6HWR8cXR X-Received: by 2002:a17:906:1e49:: with SMTP id i9mr6080089ejj.536.1621538011591; Thu, 20 May 2021 12:13:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621538011; cv=none; d=google.com; s=arc-20160816; b=G4hDt46Y6u5VqxyJSUgPN09vTyWYANSJr2kRQM9SC9cY95QfOp4tWByOdTOAi/xNkQ 9Jy3GE4QEcRQ5d7JtsW5u58tQlbbrM6wvcYM0F1if4O1thc8KS2LO14BquObJFg8l4iz T3OrZZw4+rC8xVj3iVmgl5S0zlAv5ZcBaimwa/VAKEOA0py253h224evgx0rBytcs8lS zTwNj0it0anNpjuKMcBhab//5Nr7S1utk6h6gec56u6sTmS7csGg6Z5dRFBPX4fCoOEt 6oBODWYHVJH8lSkL+9zdYbxQpV+gjEnwqf4NzyX+Phxg+8d5qPUdZBibERM3ms7g6ASK mzog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=AuCSfoSXQsnKY3AHJdyrTVA3L8Ff+2TxBupBtUb4J3I=; b=ElCdmIx5a+eKsE5eke4UlKMr5eB5ooqp4gofxEd0+FDjPMIMrvPF0d0zg4UoRLHq2E bi1UYiUDJLydSSMWGjNNVpqpcnwQdyJ+krkl2mRP3u+SIF2ncpzpE53rqns+XrjMX6WC oWPul43JMQkjdm+iviSe4BJgas2YRBzrwla9me3rNXEqqKh6DdiA0WwOpl/COxIAM3dU v99+gqhd3ShilA7fY34Jsscs65Nhr4NoXLbaWMf1WhoSNUVceHPpFgncv4vLenPAhNH2 WQas6NBV/g+J+ij/92brk5dxmhoRbWJGdoZCf45vejzwhRQLOxtphQZzJCsJJp8QjDKo ejcg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=gF+mSSJP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e16si3204343ejj.154.2021.05.20.12.13.07; Thu, 20 May 2021 12:13:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=gF+mSSJP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237154AbhETK3k (ORCPT + 99 others); Thu, 20 May 2021 06:29:40 -0400 Received: from mail.kernel.org ([198.145.29.99]:47686 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235815AbhETKRR (ORCPT ); Thu, 20 May 2021 06:17:17 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6E2ED61455; Thu, 20 May 2021 09:46:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621503967; bh=YBlSG0CxKZJRXO2zFQtplCOnG9ojUjbFXr2qEAn/B6g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gF+mSSJPS+sdh/d01Wyc5Eho4zabvQpgpIrMN78R3t5tHjpIOF6d/A3OkwF5FKV9X OHDj1KLsgqDyJ/JlMLTdZK0AT3+gTDz+0rSvLfzzZyWcWjy16OSoERrmboy02DXPPA sk6/VmuSbquVNaqdfVvJTQ3wGtWrpanpLHLETjCw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mathias Nyman , Thinh Nguyen , Sasha Levin Subject: [PATCH 4.14 035/323] usb: xhci: Fix port minor revision Date: Thu, 20 May 2021 11:18:47 +0200 Message-Id: <20210520092121.317183536@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520092120.115153432@linuxfoundation.org> References: <20210520092120.115153432@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Thinh Nguyen [ Upstream commit 64364bc912c01b33bba6c22e3ccb849bfca96398 ] Some hosts incorrectly use sub-minor version for minor version (i.e. 0x02 instead of 0x20 for bcdUSB 0x320 and 0x01 for bcdUSB 0x310). Currently the xHCI driver works around this by just checking for minor revision > 0x01 for USB 3.1 everywhere. With the addition of USB 3.2, checking this gets a bit cumbersome. Since there is no USB release with bcdUSB 0x301 to 0x309, we can assume that sub-minor version 01 to 09 is incorrect. Let's try to fix this and use the minor revision that matches with the USB/xHCI spec to help with the version checking within the driver. Acked-by: Mathias Nyman Signed-off-by: Thinh Nguyen Link: https://lore.kernel.org/r/ed330e95a19dc367819c5b4d78bf7a541c35aa0a.1615432770.git.Thinh.Nguyen@synopsys.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/usb/host/xhci-mem.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c index 70452c881e56..5fd1e95f5400 100644 --- a/drivers/usb/host/xhci-mem.c +++ b/drivers/usb/host/xhci-mem.c @@ -2085,6 +2085,15 @@ static void xhci_add_in_port(struct xhci_hcd *xhci, unsigned int num_ports, if (major_revision == 0x03) { rhub = &xhci->usb3_rhub; + /* + * Some hosts incorrectly use sub-minor version for minor + * version (i.e. 0x02 instead of 0x20 for bcdUSB 0x320 and 0x01 + * for bcdUSB 0x310). Since there is no USB release with sub + * minor version 0x301 to 0x309, we can assume that they are + * incorrect and fix it here. + */ + if (minor_revision > 0x00 && minor_revision < 0x10) + minor_revision <<= 4; } else if (major_revision <= 0x02) { rhub = &xhci->usb2_rhub; } else { -- 2.30.2