Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2472812pxj; Mon, 10 May 2021 03:58:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzw0xu9o/oObs4Dg4ic3bHqEHbFputZQDQZN6uy4bIQl1s/LBzbr1Wmw0vkGriYQ4j3kuXV X-Received: by 2002:a17:906:74c6:: with SMTP id z6mr25439153ejl.13.1620644281074; Mon, 10 May 2021 03:58:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620644281; cv=none; d=google.com; s=arc-20160816; b=Ifzf4k0RVioUi0+Q+ntvzV8k2FBqP1J7sv8EyTBspQW41/VfnUvCs+DqQPr2tGnuzj mzpSLhtMugThsyMZICQvUZEW4mHNJAyBU8Zw+nzwm2+sk2UjNtsJCZMzr/756ZoFqnHX g0ExCUQvZFp/zBT03INhEVSvHaFJV7KbHimr6l6evN6Wz0Dn21Eug2iQb5ndHrTxfSH6 OXlLuaSTPvHEw3PPAp33PvCkpXqRCVZNBqgkTOPAHZo8RJ1M1bTbzd6oICjBg9YUb9Ij 9xJEiiJE0IB3uw2+VfxsiGCZpCPdag6oEkIdTG+l7MVi/f5osquAYXzzUTnUYQSOqN7W rmlg== 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=UsdrZefIFp6xt5g3Eqfxf4EH2BPkYb5fF/07QX3/TRM=; b=h5BAoTnzHKTXj9wiDEVsOVg+gm8DFP8jQ9oTm9n5USKIJQ7mm6eHn2MBrfPHRJN1WX 5czM5AVyRDOV3VvYlQ7+PIeSTvx5Jv7hSmj1ZoNMg4gNnLfizCyj/ot3C5XjYztPfwkc Fc8pIziMTQC3MkfcYgbfX+rUoZlhNck69qh659B+1t43fFsoRJF/4nqt2TaXi9JiX3gc JHNbI1y38kaZo8uWR9JkmQQygweuKNemCMb7NVOPQq+tXba+W69f36KXRVKmiXnffduZ zc3IZO83Bb2EGW+F64+sDmz9Yp5WvvNSh9p+Dj8UfFSMNfLE4yohJyGNKFAR+Nf7k9h5 W2ng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=kp9iPAdG; 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 m21si14369379edc.194.2021.05.10.03.57.36; Mon, 10 May 2021 03:58:01 -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=kp9iPAdG; 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 S233893AbhEJKze (ORCPT + 99 others); Mon, 10 May 2021 06:55:34 -0400 Received: from mail.kernel.org ([198.145.29.99]:57348 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232803AbhEJKoi (ORCPT ); Mon, 10 May 2021 06:44:38 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id F37D46198A; Mon, 10 May 2021 10:33:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620642824; bh=zBrj9N0+ZJrHc7wY1+NswB6PUK+mR6562Gb1iQFBVVE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kp9iPAdGKZm32i27iPJdouU2oFEMhZJaqMbhqsTqQljXjruZERZr1Nwr8GS0qOU1D IGD7kSH/mIJ5ymMCAuTz/ThqjLme/JDC4koU7GDL+ePXI7ydb7qjKmoblsAmm9sgsy I2x26QBwtYYSYoM3KoTypcpzd4sefANyMAXBVyjI= 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 5.10 066/299] usb: xhci: Fix port minor revision Date: Mon, 10 May 2021 12:17:43 +0200 Message-Id: <20210510102007.080219629@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210510102004.821838356@linuxfoundation.org> References: <20210510102004.821838356@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 138ba4528dd3..1ad0ac8c8209 100644 --- a/drivers/usb/host/xhci-mem.c +++ b/drivers/usb/host/xhci-mem.c @@ -2143,6 +2143,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