Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp2319412pxb; Mon, 20 Sep 2021 18:42:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyCYiFmWTzkhvIbOD/egHjA4RRPZJCAkhu6HDIH/ONEjYBbNFylT5tJC2swl8khzZR+oDO6 X-Received: by 2002:a05:6638:1909:: with SMTP id p9mr22105164jal.108.1632188549858; Mon, 20 Sep 2021 18:42:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632188549; cv=none; d=google.com; s=arc-20160816; b=jeypKZLpULzMFyKQ1ueZRrDCWaqVrwLJvQ/ZzBcbkimY4l2W8nMt164D62d9vi3u7c EvFEsxKxNb4N7vEaA3d3HdKJhxUXiVMVm/raKlps06QAhJ4KPIM3bgHRSH+T+HD7zkD1 e2DxsCEtYZMN/C7vBC/0dk6Y6ly9CbKocRW4V0lLuk/UHQh6uHfZUchvlWb25Qm+JHWT UPrlxwCKANGaCanPR1KmuXh7Tz7BTJL4KsS7f+QKA6zvjGjpPecJ3aAmOgOSu0kc7Jmy 3tTFKlFvapEzBzlH4CTJopRg7maAb6TLzGFI/osUHah+RzEyg19aYZcR3As6uKKOjQXu +z0Q== 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=caTQQjMEhZUJjBJ+d8+56AzHc435Wq1N4tLjGmJ//aA=; b=J2Ps4qMsrsc/lYR7DZJxchsm7rIi0bn4osEpUC3AeuBiA2BnmRoyi18yRerHNR+48A TFzliEOeMFrgF17fEIJhufyDpXK+tEHOLptEQl5bFmcZfnkNHu/XmFyVms1ZT7vrkP2i RRoo5vuO+mhpGfXA8bFnVSn/bRmbwk5aa5UsTpVxp9sG0bkMEJ2jbsMzRXMW1QbNm7+/ D+2l5lFavj+6WqI47uoXC2afZZD5lUxO7L6JWxuRuuv6pQK2dSTwgJQh2sMWdP8t7cLu spb+I/DkhvK/3JHdc0y+7OHGudLdSltaJvskYWnSUQ7XO94MSN38jkHZsJ22XeH5TRBV o1DQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=MbPqIxPr; 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 j19si1775922jat.117.2021.09.20.18.42.19; Mon, 20 Sep 2021 18:42:29 -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=MbPqIxPr; 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 S1343491AbhITQyn (ORCPT + 99 others); Mon, 20 Sep 2021 12:54:43 -0400 Received: from mail.kernel.org ([198.145.29.99]:38968 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243344AbhITQus (ORCPT ); Mon, 20 Sep 2021 12:50:48 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id EFEE461359; Mon, 20 Sep 2021 16:49:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1632156554; bh=NkrhRnAGso2BthwGEsErc4p9dPma96S6+l5Hj0YIvMs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MbPqIxPrlDk6Y8euI72S9D3YvnSq8vpqgAlLM96x6b+j4/yZTpQre7BJwgnokTJ4f 3QNno0xPsvebdl++H1hiuKEa5SyMQM9QN+/vYclJOTy/blNWfJAeowDIqGXIs9jCS5 7eOFZX4EPSH0nYXggc6EMgNLLHnucWiJ7v93B+Fc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mathias Nyman , Sasha Levin Subject: [PATCH 4.4 112/133] Revert "USB: xhci: fix U1/U2 handling for hardware with XHCI_INTEL_HOST quirk set" Date: Mon, 20 Sep 2021 18:43:10 +0200 Message-Id: <20210920163916.284398874@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210920163912.603434365@linuxfoundation.org> References: <20210920163912.603434365@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: Mathias Nyman [ Upstream commit 2847c46c61486fd8bca9136a6e27177212e78c69 ] This reverts commit 5d5323a6f3625f101dbfa94ba3ef7706cce38760. That commit effectively disabled Intel host initiated U1/U2 lpm for devices with periodic endpoints. Before that commit we disabled host initiated U1/U2 lpm if the exit latency was larger than any periodic endpoint service interval, this is according to xhci spec xhci 1.1 specification section 4.23.5.2 After that commit we incorrectly checked that service interval was smaller than U1/U2 inactivity timeout. This is not relevant, and can't happen for Intel hosts as previously set U1/U2 timeout = 105% * service interval. Patch claimed it solved cases where devices can't be enumerated because of bandwidth issues. This might be true but it's a side effect of accidentally turning off lpm. exit latency calculations have been revised since then Signed-off-by: Mathias Nyman Link: https://lore.kernel.org/r/20210820123503.2605901-5-mathias.nyman@linux.intel.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/usb/host/xhci.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index b1994b03341f..bd010f8caf87 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c @@ -4438,19 +4438,19 @@ static u16 xhci_calculate_u1_timeout(struct xhci_hcd *xhci, { unsigned long long timeout_ns; - if (xhci->quirks & XHCI_INTEL_HOST) - timeout_ns = xhci_calculate_intel_u1_timeout(udev, desc); - else - timeout_ns = udev->u1_params.sel; - /* Prevent U1 if service interval is shorter than U1 exit latency */ if (usb_endpoint_xfer_int(desc) || usb_endpoint_xfer_isoc(desc)) { - if (xhci_service_interval_to_ns(desc) <= timeout_ns) { + if (xhci_service_interval_to_ns(desc) <= udev->u1_params.mel) { dev_dbg(&udev->dev, "Disable U1, ESIT shorter than exit latency\n"); return USB3_LPM_DISABLED; } } + if (xhci->quirks & XHCI_INTEL_HOST) + timeout_ns = xhci_calculate_intel_u1_timeout(udev, desc); + else + timeout_ns = udev->u1_params.sel; + /* The U1 timeout is encoded in 1us intervals. * Don't return a timeout of zero, because that's USB3_LPM_DISABLED. */ @@ -4502,19 +4502,19 @@ static u16 xhci_calculate_u2_timeout(struct xhci_hcd *xhci, { unsigned long long timeout_ns; - if (xhci->quirks & XHCI_INTEL_HOST) - timeout_ns = xhci_calculate_intel_u2_timeout(udev, desc); - else - timeout_ns = udev->u2_params.sel; - /* Prevent U2 if service interval is shorter than U2 exit latency */ if (usb_endpoint_xfer_int(desc) || usb_endpoint_xfer_isoc(desc)) { - if (xhci_service_interval_to_ns(desc) <= timeout_ns) { + if (xhci_service_interval_to_ns(desc) <= udev->u2_params.mel) { dev_dbg(&udev->dev, "Disable U2, ESIT shorter than exit latency\n"); return USB3_LPM_DISABLED; } } + if (xhci->quirks & XHCI_INTEL_HOST) + timeout_ns = xhci_calculate_intel_u2_timeout(udev, desc); + else + timeout_ns = udev->u2_params.sel; + /* The U2 timeout is encoded in 256us intervals */ timeout_ns = DIV_ROUND_UP_ULL(timeout_ns, 256 * 1000); /* If the necessary timeout value is bigger than what we can set in the -- 2.30.2