Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp459927pxb; Thu, 9 Sep 2021 05:05:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx+76IrUFcA/hbcb5GW72a1xB6SD4t7fjTimUDTrhem3wztH3ugZ7vfliWNaZ6T54Zjn7sF X-Received: by 2002:a5d:4ec5:: with SMTP id s5mr3209648wrv.267.1631189154928; Thu, 09 Sep 2021 05:05:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631189154; cv=none; d=google.com; s=arc-20160816; b=dcX8260I9UfJKsFB4W0as/Xh7rn47nmVURACTJLoADoK2Rd7s6Jsz7GdcVzqoDOhpK cdDo53E1LlpULFWhgdEoAlUB4Yr/PojvaNkAq8nn8OdBJltxAQxJex5qrC/kXP6Hc2J4 MqXJmYIA0hreBVt9oxBsOFpPVHS/pBPtjQ6EgIQZpL+6wXlaBzN6QxELn/S8Eb0hUu9w I0J7Ftl2eN5KEEU7DuHeDoo18IqFMM5RaCGEoe+r9ognUPLK6EOBj6Nv8YBJV0d+5B3q vUY1k4PQv93vheC/CEFhISE9iwZaeQBY6FaUBKml54mHS7Po6mR3EKtG/jnI90EjeyPi LWoA== 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=U9Vl5aliRG4HNcTIv08d9T6wNR65bT+pmd38F1lsGFk=; b=QV+QcavqDio3jjfO2/Wnf5uyQap7ilCh5kHdL8KNGZwsYm6BKP8yJzDmi9ZOqpzUDL iVed9+Ox5MtuCbrsNTIaI0cI8/Aqe3hijrGbTXCF18iCh+FkDK1ngRUR8HgMOrggGsf4 PGyCML7qeBBmr4k2R3uPRzS0vVWGfTvBecd5O5ozMknafJ+PpJxOe9UXnXs63O92TBVB L6M21jN0fIyiuHOFOPi1TBp+Wq6LqQMOV9a45RfgGq5WDrqdrcUDYOxpvCmjb1pZgauu 16aD7CsZujd4Pz4V/OtPDu/W2qI5Mq5HoVjtJg092FpHvxgiX3e8h9lRvNm6mpQRJuKJ ucgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=AYJxDLW8; 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 f21si1604028edt.530.2021.09.09.05.05.13; Thu, 09 Sep 2021 05:05:54 -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=AYJxDLW8; 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 S243875AbhIIMDD (ORCPT + 99 others); Thu, 9 Sep 2021 08:03:03 -0400 Received: from mail.kernel.org ([198.145.29.99]:34482 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242607AbhIIL6n (ORCPT ); Thu, 9 Sep 2021 07:58:43 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 7E3BE61409; Thu, 9 Sep 2021 11:45:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1631187946; bh=U7nfynJ0s4aemPNqIE8YG6GThwovfwBxwov3Lc9Llms=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AYJxDLW8hfkXV3n0zTc4CVic0oT7ogRIEQ42YLV4pLUaX69h7IulZGnQiBUZYehZf yhiMMNOvOBmJShQUTp3P6c+3ELYkxXnpO8wnUYfRLFdfWJUK+P2kPfgrISD+GX+voL I1QTQkcOAeK826Yg/wF2R8ZYoHB0JB2nJEESuxGPY3ShOHcEYrfVyvI1UfCi+SKVVM ESu7+jZrH5hSa9IGE/NeRQ2YbX3wP2XHdNpD0VOch6OUJkMv01uCvuA157WsEYfc05 qaLhMm8jXjs3titXs+D9/dBr+rYHLPmsk3G95HvHm5qRTgiJZFnFf1wSoNE3wx6Hiu X2294wvv5XCmw== 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 5.14 215/252] Revert "USB: xhci: fix U1/U2 handling for hardware with XHCI_INTEL_HOST quirk set" Date: Thu, 9 Sep 2021 07:40:29 -0400 Message-Id: <20210909114106.141462-215-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210909114106.141462-1-sashal@kernel.org> References: <20210909114106.141462-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 3618070eba78..18a203c9011e 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c @@ -4705,19 +4705,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. */ @@ -4769,19 +4769,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