Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3558044pxb; Mon, 24 Jan 2022 12:10:52 -0800 (PST) X-Google-Smtp-Source: ABdhPJwZYNiC1SO4G1cGIOQlFZC1laTVqHMvIj+A2sXEPQZNX8n/KiNdL88FelRP381lRLLOyMja X-Received: by 2002:a17:902:db02:b0:14b:5c6d:fc11 with SMTP id m2-20020a170902db0200b0014b5c6dfc11mr4186514plx.143.1643055051834; Mon, 24 Jan 2022 12:10:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643055051; cv=none; d=google.com; s=arc-20160816; b=nR2SJ0AzWl+vdNfOz7a2aLTHEx5kEwyj+2dVxv9v0VI6nmavpZywoj5FcN7SnPmtTE 1kTq3tZ4ZsNpS2zXcV8He3u63YPGfIvFJ87lq2ahtrjo2jaIuGbw+rU+oIRtsAR9gW/m Tdy+5r+UwiUY8zGExrVQDcjfDEip82i8IkM0AKjz/sBKbmRBaOdwutdEOztCvaErz+mi pqG8HkI3uBHa/zj824R5ZuJjfwRiRwWmvXRjlKctKT98krRC+HfqIBNQfZUW3RszFu2X JdZNoyiiDZx8/Gratp3dp4LriIDnhCY8X9q3nRbXbXllW03R1Zl3Mross5gaiXWxxSZF PG+g== 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=2BXVbfF4/+r169QC8gk/IS9+vksAH0W0AGALCRjif9Y=; b=nnsk/gYTuUnr0CnjC0c1XJMllPZGNTG5W9z0srou6WaT4yK6ZSKJCiWZ80VDEErQgt IJawZGbN7kfANCTZUGjOJr8E77hzB7erDds0ibWJ6qK0W2hBH25RwtWGh3EcnCUM4ec5 qy3QZtIrFqZf7krCwvkYoKV5mFp4tpvK4Ick6tTl3DLvSJvA4H3lj5QsDKzbGE6EvH+T RZB7DduZXHmQZFUBK0J8h5cqWapxV6oGEJkGk9NfUktqLAyEUQNTuUvjWjxLgghkWKC2 au+k7onHlDs4gcSKS9Cpb0fqG5IXT1pr01Ke3E+kQvqcxGWAZQVVAW7kVjoCfmnp0jKr OX2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Akzdt3Gn; 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 f1si15494071pgh.264.2022.01.24.12.10.39; Mon, 24 Jan 2022 12:10:51 -0800 (PST) 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=Akzdt3Gn; 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 S1345997AbiAXTMW (ORCPT + 99 others); Mon, 24 Jan 2022 14:12:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46038 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345180AbiAXTDD (ORCPT ); Mon, 24 Jan 2022 14:03:03 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 26CC5C0604FB; Mon, 24 Jan 2022 10:58:40 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E333EB81227; Mon, 24 Jan 2022 18:58:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0CDE0C340E5; Mon, 24 Jan 2022 18:58:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643050717; bh=jVojy5ALgdj1kn9VcaJCjEHW1ktu1nFBMSftQYDqjRk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Akzdt3GnGY7Np3Xy4/b5Yk9EGfo2Y9Xtt70Z8+NkQSOUG72m2kERWpieo3Pty+HAL XCNQWN/nIQ6s47PQj8gDYA4EGGGLRtx0IEjqc55fMpLJmFlYm3yayHAZxSsMEUv7Rt myNkSXZgpGZ0aucis+TU2MzaHLOzIbdXV486F/bs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alan Stern , Kai-Heng Feng , Sasha Levin Subject: [PATCH 4.9 091/157] usb: hub: Add delay for SuperSpeed hub resume to let links transit to U0 Date: Mon, 24 Jan 2022 19:43:01 +0100 Message-Id: <20220124183935.672130357@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183932.787526760@linuxfoundation.org> References: <20220124183932.787526760@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: Kai-Heng Feng [ Upstream commit 00558586382891540c59c9febc671062425a6e47 ] When a new USB device gets plugged to nested hubs, the affected hub, which connects to usb 2-1.4-port2, doesn't report there's any change, hence the nested hubs go back to runtime suspend like nothing happened: [ 281.032951] usb usb2: usb wakeup-resume [ 281.032959] usb usb2: usb auto-resume [ 281.032974] hub 2-0:1.0: hub_resume [ 281.033011] usb usb2-port1: status 0263 change 0000 [ 281.033077] hub 2-0:1.0: state 7 ports 4 chg 0000 evt 0000 [ 281.049797] usb 2-1: usb wakeup-resume [ 281.069800] usb 2-1: Waited 0ms for CONNECT [ 281.069810] usb 2-1: finish resume [ 281.070026] hub 2-1:1.0: hub_resume [ 281.070250] usb 2-1-port4: status 0203 change 0000 [ 281.070272] usb usb2-port1: resume, status 0 [ 281.070282] hub 2-1:1.0: state 7 ports 4 chg 0010 evt 0000 [ 281.089813] usb 2-1.4: usb wakeup-resume [ 281.109792] usb 2-1.4: Waited 0ms for CONNECT [ 281.109801] usb 2-1.4: finish resume [ 281.109991] hub 2-1.4:1.0: hub_resume [ 281.110147] usb 2-1.4-port2: status 0263 change 0000 [ 281.110234] usb 2-1-port4: resume, status 0 [ 281.110239] usb 2-1-port4: status 0203, change 0000, 10.0 Gb/s [ 281.110266] hub 2-1.4:1.0: state 7 ports 4 chg 0000 evt 0000 [ 281.110426] hub 2-1.4:1.0: hub_suspend [ 281.110565] usb 2-1.4: usb auto-suspend, wakeup 1 [ 281.130998] hub 2-1:1.0: hub_suspend [ 281.137788] usb 2-1: usb auto-suspend, wakeup 1 [ 281.142935] hub 2-0:1.0: state 7 ports 4 chg 0000 evt 0000 [ 281.177828] usb 2-1: usb wakeup-resume [ 281.197839] usb 2-1: Waited 0ms for CONNECT [ 281.197850] usb 2-1: finish resume [ 281.197984] hub 2-1:1.0: hub_resume [ 281.198203] usb 2-1-port4: status 0203 change 0000 [ 281.198228] usb usb2-port1: resume, status 0 [ 281.198237] hub 2-1:1.0: state 7 ports 4 chg 0010 evt 0000 [ 281.217835] usb 2-1.4: usb wakeup-resume [ 281.237834] usb 2-1.4: Waited 0ms for CONNECT [ 281.237845] usb 2-1.4: finish resume [ 281.237990] hub 2-1.4:1.0: hub_resume [ 281.238067] usb 2-1.4-port2: status 0263 change 0000 [ 281.238148] usb 2-1-port4: resume, status 0 [ 281.238152] usb 2-1-port4: status 0203, change 0000, 10.0 Gb/s [ 281.238166] hub 2-1.4:1.0: state 7 ports 4 chg 0000 evt 0000 [ 281.238385] hub 2-1.4:1.0: hub_suspend [ 281.238523] usb 2-1.4: usb auto-suspend, wakeup 1 [ 281.258076] hub 2-1:1.0: hub_suspend [ 281.265744] usb 2-1: usb auto-suspend, wakeup 1 [ 281.285976] hub 2-0:1.0: hub_suspend [ 281.285988] usb usb2: bus auto-suspend, wakeup 1 USB 3.2 spec, 9.2.5.4 "Changing Function Suspend State" says that "If the link is in a non-U0 state, then the device must transition the link to U0 prior to sending the remote wake message", but the hub only transits the link to U0 after signaling remote wakeup. So be more forgiving and use a 20ms delay to let the link transit to U0 for remote wakeup. Suggested-by: Alan Stern Acked-by: Alan Stern Signed-off-by: Kai-Heng Feng Link: https://lore.kernel.org/r/20211215120108.336597-1-kai.heng.feng@canonical.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/usb/core/hub.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 1629fdba37ad3..33bf5ba438397 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c @@ -1070,7 +1070,10 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type) } else { hub_power_on(hub, true); } - } + /* Give some time on remote wakeup to let links to transit to U0 */ + } else if (hub_is_superspeed(hub->hdev)) + msleep(20); + init2: /* -- 2.34.1