All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Mathias Nyman <mathias.nyman@linux.intel.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Sasha Levin <sashal@kernel.org>,
	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	[thread overview]
Message-ID: <20210909115900.149795-49-sashal@kernel.org> (raw)
In-Reply-To: <20210909115900.149795-1-sashal@kernel.org>

From: Mathias Nyman <mathias.nyman@linux.intel.com>

[ 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 <mathias.nyman@linux.intel.com>
Link: https://lore.kernel.org/r/20210820123503.2605901-5-mathias.nyman@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 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


  parent reply	other threads:[~2021-09-09 13:17 UTC|newest]

Thread overview: 75+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-09 11:58 [PATCH AUTOSEL 4.14 01/59] media: dib8000: rewrite the init prbs logic Sasha Levin
2021-09-09 11:58 ` [PATCH AUTOSEL 4.14 02/59] crypto: mxs-dcp - Use sg_mapping_iter to copy data Sasha Levin
2021-09-09 11:58   ` Sasha Levin
2021-09-09 11:58 ` [PATCH AUTOSEL 4.14 03/59] PCI: Use pci_update_current_state() in pci_enable_device_flags() Sasha Levin
2021-09-09 11:58 ` [PATCH AUTOSEL 4.14 04/59] iio: dac: ad5624r: Fix incorrect handling of an optional regulator Sasha Levin
2021-09-09 11:58 ` [PATCH AUTOSEL 4.14 05/59] ARM: dts: qcom: apq8064: correct clock names Sasha Levin
2021-09-09 11:58 ` [PATCH AUTOSEL 4.14 06/59] video: fbdev: kyro: fix a DoS bug by restricting user input Sasha Levin
2021-09-09 11:58 ` [PATCH AUTOSEL 4.14 07/59] netlink: Deal with ESRCH error in nlmsg_notify() Sasha Levin
2021-09-09 11:58 ` [PATCH AUTOSEL 4.14 08/59] Smack: Fix wrong semantics in smk_access_entry() Sasha Levin
2021-09-09 11:58 ` [PATCH AUTOSEL 4.14 09/59] usb: host: fotg210: fix the endpoint's transactional opportunities calculation Sasha Levin
2021-09-09 11:58 ` [PATCH AUTOSEL 4.14 10/59] usb: host: fotg210: fix the actual_length of an iso packet Sasha Levin
2021-09-09 11:58 ` [PATCH AUTOSEL 4.14 11/59] usb: gadget: u_ether: fix a potential null pointer dereference Sasha Levin
2021-09-09 11:58 ` [PATCH AUTOSEL 4.14 12/59] usb: gadget: composite: Allow bMaxPower=0 if self-powered Sasha Levin
2021-09-09 11:58 ` [PATCH AUTOSEL 4.14 13/59] staging: board: Fix uninitialized spinlock when attaching genpd Sasha Levin
2021-09-09 11:58 ` [PATCH AUTOSEL 4.14 14/59] tty: serial: jsm: hold port lock when reporting modem line changes Sasha Levin
2021-09-09 11:58 ` [PATCH AUTOSEL 4.14 15/59] bpf/tests: Fix copy-and-paste error in double word test Sasha Levin
2021-09-09 11:58 ` [PATCH AUTOSEL 4.14 16/59] bpf/tests: Do not PASS tests without actually testing the result Sasha Levin
2021-09-09 11:58 ` [PATCH AUTOSEL 4.14 17/59] video: fbdev: asiliantfb: Error out if 'pixclock' equals zero Sasha Levin
2021-09-09 11:58 ` [PATCH AUTOSEL 4.14 18/59] video: fbdev: kyro: " Sasha Levin
2021-09-09 11:58 ` [PATCH AUTOSEL 4.14 19/59] video: fbdev: riva: " Sasha Levin
2021-09-09 11:58 ` [PATCH AUTOSEL 4.14 20/59] ipv4: ip_output.c: Fix out-of-bounds warning in ip_copy_addrs() Sasha Levin
2021-09-09 11:58 ` [PATCH AUTOSEL 4.14 21/59] flow_dissector: Fix out-of-bounds warnings Sasha Levin
2021-09-09 11:58 ` [PATCH AUTOSEL 4.14 22/59] s390/jump_label: print real address in a case of a jump label bug Sasha Levin
2021-09-09 11:58 ` [PATCH AUTOSEL 4.14 23/59] serial: 8250: Define RX trigger levels for OxSemi 950 devices Sasha Levin
2021-09-09 11:58 ` [PATCH AUTOSEL 4.14 24/59] xtensa: ISS: don't panic in rs_init Sasha Levin
2021-09-09 11:58 ` [PATCH AUTOSEL 4.14 25/59] hvsi: don't panic on tty_register_driver failure Sasha Levin
2021-09-09 11:58   ` Sasha Levin
2021-09-09 11:58 ` [PATCH AUTOSEL 4.14 26/59] serial: 8250_pci: make setup_port() parameters explicitly unsigned Sasha Levin
2021-09-09 11:58 ` [PATCH AUTOSEL 4.14 27/59] staging: ks7010: Fix the initialization of the 'sleep_status' structure Sasha Levin
2021-09-09 11:58 ` [PATCH AUTOSEL 4.14 28/59] ata: sata_dwc_460ex: No need to call phy_exit() befre phy_init() Sasha Levin
2021-09-09 11:58 ` [PATCH AUTOSEL 4.14 29/59] Bluetooth: skip invalid hci_sync_conn_complete_evt Sasha Levin
2021-09-09 11:58 ` [PATCH AUTOSEL 4.14 30/59] ASoC: Intel: bytcr_rt5640: Move "Platform Clock" routes to the maps for the matching in-/output Sasha Levin
2021-09-09 11:58   ` Sasha Levin
2021-09-09 11:58 ` [PATCH AUTOSEL 4.14 31/59] bpf: Fix off-by-one in tail call count limiting Sasha Levin
2021-09-09 11:58 ` [PATCH AUTOSEL 4.14 32/59] media: v4l2-dv-timings.c: fix wrong condition in two for-loops Sasha Levin
2021-09-09 11:58 ` [PATCH AUTOSEL 4.14 33/59] arm64: dts: qcom: sdm660: use reg value for memory node Sasha Levin
2021-09-09 11:58 ` [PATCH AUTOSEL 4.14 34/59] net: ethernet: stmmac: Do not use unreachable() in ipq806x_gmac_probe() Sasha Levin
2021-09-09 11:58   ` Sasha Levin
2021-09-09 11:58 ` [PATCH AUTOSEL 4.14 35/59] Bluetooth: avoid circular locks in sco_sock_connect Sasha Levin
2021-09-09 11:58 ` [PATCH AUTOSEL 4.14 36/59] gpu: drm: amd: amdgpu: amdgpu_i2c: fix possible uninitialized-variable access in amdgpu_i2c_router_select_ddc_port() Sasha Levin
2021-09-09 11:58 ` [PATCH AUTOSEL 4.14 37/59] ARM: tegra: tamonten: Fix UART pad setting Sasha Levin
2021-09-09 11:58 ` [PATCH AUTOSEL 4.14 38/59] ACPICA: iASL: Fix for WPBT table with no command-line arguments Sasha Levin
2021-09-09 11:58 ` [PATCH AUTOSEL 4.14 39/59] rpc: fix gss_svc_init cleanup on failure Sasha Levin
2021-09-09 11:58 ` [PATCH AUTOSEL 4.14 40/59] staging: rts5208: Fix get_ms_information() heap buffer size Sasha Levin
2021-09-09 11:58 ` [PATCH AUTOSEL 4.14 41/59] gfs2: Don't call dlm after protocol is unmounted Sasha Levin
2021-09-09 11:58   ` [Cluster-devel] " Sasha Levin
2021-09-09 11:58 ` [PATCH AUTOSEL 4.14 42/59] btrfs: subpage: check if there are compressed extents inside one page Sasha Levin
2021-09-09 13:01   ` David Sterba
2021-09-09 11:58 ` [PATCH AUTOSEL 4.14 43/59] btrfs: subpage: fix race between prepare_pages() and btrfs_releasepage() Sasha Levin
2021-09-09 13:01   ` David Sterba
2021-09-09 11:58 ` [PATCH AUTOSEL 4.14 44/59] ASoC: intel: atom: Revert PCM buffer address setup workaround again Sasha Levin
2021-09-09 12:06   ` Takashi Iwai
2021-09-09 12:06     ` Takashi Iwai
2021-09-09 11:58 ` [PATCH AUTOSEL 4.14 45/59] mmc: sdhci-of-arasan: Check return value of non-void funtions Sasha Levin
2021-09-09 11:58   ` Sasha Levin
2021-09-09 11:58 ` [PATCH AUTOSEL 4.14 46/59] mmc: rtsx_pci: Fix long reads when clock is prescaled Sasha Levin
2021-09-09 11:58 ` [PATCH AUTOSEL 4.14 47/59] selftests/bpf: Enlarge select() timeout for test_maps Sasha Levin
2021-09-09 11:58 ` [PATCH AUTOSEL 4.14 48/59] cifs: fix wrong release in sess_alloc_buffer() failed path Sasha Levin
2021-09-09 11:58 ` Sasha Levin [this message]
2021-09-09 11:58 ` [PATCH AUTOSEL 4.14 50/59] usb: musb: musb_dsps: request_irq() after initializing musb Sasha Levin
2021-09-09 11:58 ` [PATCH AUTOSEL 4.14 51/59] usbip: give back URBs for unsent unlink requests during cleanup Sasha Levin
2021-09-09 11:58 ` [PATCH AUTOSEL 4.14 52/59] usbip:vhci_hcd USB port can get stuck in the disabled state Sasha Levin
2021-09-09 11:58 ` [PATCH AUTOSEL 4.14 53/59] ASoC: rockchip: i2s: Fix regmap_ops hang Sasha Levin
2021-09-09 11:58   ` Sasha Levin
2021-09-09 11:58   ` Sasha Levin
2021-09-09 11:58   ` Sasha Levin
2021-09-09 11:58 ` [PATCH AUTOSEL 4.14 54/59] ASoC: rockchip: i2s: Fixup config for DAIFMT_DSP_A/B Sasha Levin
2021-09-09 11:58   ` Sasha Levin
2021-09-09 11:58   ` Sasha Levin
2021-09-09 11:58   ` Sasha Levin
2021-09-09 11:58 ` [PATCH AUTOSEL 4.14 55/59] parport: remove non-zero check on count Sasha Levin
2021-09-09 11:58 ` [PATCH AUTOSEL 4.14 56/59] ath9k: fix OOB read ar9300_eeprom_restore_internal Sasha Levin
2021-09-09 11:58 ` [PATCH AUTOSEL 4.14 57/59] ath9k: fix sleeping in atomic context Sasha Levin
2021-09-09 11:58 ` [PATCH AUTOSEL 4.14 58/59] net: fix NULL pointer reference in cipso_v4_doi_free Sasha Levin
2021-09-09 11:59 ` [PATCH AUTOSEL 4.14 59/59] net: w5100: check return value after calling platform_get_resource() Sasha Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210909115900.149795-49-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mathias.nyman@linux.intel.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.