Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp520346pxb; Thu, 9 Sep 2021 06:20:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJznPdgQNjN5P3x7WHAy8KOJo9+GuBhk69kLPDgLLjy7v/dTaJWtkfbod0De7OFCnKhcp7W6 X-Received: by 2002:a05:6638:d94:: with SMTP id l20mr2765531jaj.134.1631193610413; Thu, 09 Sep 2021 06:20:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631193610; cv=none; d=google.com; s=arc-20160816; b=Ow06Je/3JG8KROg8xRkSIp8XUpWF5I/eGe/nSSsgRlDETzBWobnfbxC5D/sQ7/FL3e 3MFWWB/H7ZyL58gsMbI3U0wwWOu/iemRRrBlF7wAtT9gZQ2tMM3H2pkZ9EXBV3Tbjtwy hkpvsWrIYIKXrCxF0evV2UUeG9rwOL4FegkevfADKj2eWbVPgcSAo+xGjbg8mrn39DZL tj3c2f8T+/7ww32SLleHupxoF1J23/+C9OxmDyxpgbo3st7SPrOATCCvymHmflNLWZ9G yXJsM/6r+M7l7kkngjxTTsFq7wy+o7YF2yDA4JzITv3UbLBg3ESa1PDcj9IzRbsv+onD BDnA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=nrOLOiV5vbFL1x6yl8egYX+FpwL8V8+CXvF1S9FQsqg=; b=JAQknY4P7rgr+N2cFKizX6WzQ8Lcvto+G4SoHz5cC99j/ZbZPYTbBXPQM9f/zit/VP +hTxjd6/eUoCOLauiW+w5n09x68N+vy9XCHf/NAdgCCqlfCK9r1wxbfB+iJXxyGRKVO4 z0zS/ROUYVXkgXZAwhcn6JYCEGpnujWZ4o7ZToZYl0lB//xa4RIwpio2g2I83ZqB/hZx GVTmseb+tCh1ALVNcgrbjF3J8EZye3d5iBGj5Jf4Z4zPFhP5qvP1SKKgw/YzgkIpnGK0 eJKw5A91KoAekH1THIP/HCb3oIZO/QEBW260KvpmXwAO6XUpDwnnc+YcRQbRFznZgll/ BcVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="sy6SZdI/"; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u15si1962976iot.89.2021.09.09.06.19.58; Thu, 09 Sep 2021 06:20:10 -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=@kernel.org header.s=k20201202 header.b="sy6SZdI/"; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1356959AbhIINS5 (ORCPT + 99 others); Thu, 9 Sep 2021 09:18:57 -0400 Received: from mail.kernel.org ([198.145.29.99]:46258 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1357886AbhIINFS (ORCPT ); Thu, 9 Sep 2021 09:05:18 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 70991613DB; Thu, 9 Sep 2021 12:00:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1631188802; bh=EjHkeJTNhc7GXrcFNyIGNtoE1UPt9Su+BC0wgx7onp8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sy6SZdI/HDYVYZ+8SE5GqRSAa3npebNoxn3zWKwXW0+yNDiqoOM41DDu3EAqK2Cou nmIYcXCZghTHb7tcU4mnGrQp1PWc2vPVYi+Fzh0vv7ekzsW2IjA/lXWy8luiYR5gni wtGZ/0SgQF3y9Vh90Sgcy409mwmBuXM1OsffQQYGlVYEL9Q9NHsITJTf6U2/RPs3af gorVnM4f7CnYEnJYjn7NxZPo6c102cKZUPnS+F8irNNwsIhADXR6ASxPK5tPe9zd+4 Jk51sqOf+fFNZZoFmXCHl11lDBlO6J3rbck/rGdrC6v6VcwGIGvmRfY/PnosryHEA9 obSq05izOBRxw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Mathias Nyman , Greg Kroah-Hartman , Sasha Levin , linux-usb@vger.kernel.org Subject: [PATCH AUTOSEL 4.14 49/59] Revert "USB: xhci: fix U1/U2 handling for hardware with XHCI_INTEL_HOST quirk set" Date: Thu, 9 Sep 2021 07:58:50 -0400 Message-Id: <20210909115900.149795-49-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210909115900.149795-1-sashal@kernel.org> References: <20210909115900.149795-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore 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 3cab64f2e861..e4a82da434c2 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c @@ -4400,19 +4400,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. */ @@ -4464,19 +4464,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