Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp4502340ybx; Mon, 4 Nov 2019 14:27:57 -0800 (PST) X-Google-Smtp-Source: APXvYqzDXuwDB1mxlIQjg1KkuO1dkNcQ3TAQn3Ii9B99JAeB0znBOJZFEDYlEutW8e31Q7RokzfF X-Received: by 2002:a50:984b:: with SMTP id h11mr32553507edb.248.1572906476985; Mon, 04 Nov 2019 14:27:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1572906476; cv=none; d=google.com; s=arc-20160816; b=Ymqy97CBGQdY0vcMENWlMJWKBpDiRDJHOeaOqN8kfrab2BnCdNWMikagIK0ISZ1YNs +8e0UIwWr+GmQUODOru3TOq7XepsFqyM1TPzcjQJsYBMQQH61DIrqDpafqstnpo894ch 4MsH9wwXjAzTn7jtdSLldgdh6gYeIywSmxj0pS8NEdHPW2wYXh4fZtzOPwlJ3O2tEb1Z cSwpDy3GSB1JhffBEG/y9fPhWkWXvzTB7+uiI5NDUFTO+KdPcXCfzvzOHUFMDbREt/MY T7V3fbm9VAOXgtfbxeZwtXaMExjQICevb0Kl9P1v9Pof0E0gtG/cHzTqz3BN56X2ypX5 Xh9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=f+nE45Wb91jF+SQQuj4DcgnuSIJW8mnplo4xwDQgSiA=; b=qKqKMIPffCtlUH1ZairjFJ1Om7yCYHWVPJ6xjCCTvp+Fw0BJ2BPQSNO8GUDPKQkqX1 k1TiU3tqNN0ngltIBZGohnjNZ1OTQDFBh3FjzxPAWkvzmNr+ruFVKr1zo6aO82hH1xPg kZVwihQBisquMlueTAD//wxdC4ZsUjteuFuM5BhylgcbtADmcTZsBL6/vq4xw9P/E3jf O4hWL2Mn699WqZXkd0D2hsdKi0gRZjzuEwj8mfsIl3VuPL/ZJf56hOCnfUvnHycBHC+D 3eq9gLWgEEql5JPKcGpbwc4d5+oP1LEb6brJqTG4owmWOTgEvfHWcEYz+efFdu6cg4kM Xvtg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=jPB9znlv; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 63si9262446edp.302.2019.11.04.14.27.34; Mon, 04 Nov 2019 14:27:56 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=jPB9znlv; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387801AbfKDWYh (ORCPT + 99 others); Mon, 4 Nov 2019 17:24:37 -0500 Received: from mail.kernel.org ([198.145.29.99]:45974 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730762AbfKDVw3 (ORCPT ); Mon, 4 Nov 2019 16:52:29 -0500 Received: from localhost (6.204-14-84.ripe.coltfrance.com [84.14.204.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 06839217F4; Mon, 4 Nov 2019 21:52:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1572904348; bh=H12XsaAVdOeeHzLMIlQdJrBU963KqbPjLFf+EN77ZTo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jPB9znlvRjIa7+UoDVOqYJVXzzzKEExF6jVloXglgecnZ2dsPxCQ5XEioB59XxRx3 +Rnw62E780PdkpEzKkdErvgUgJc2PA8EG4IuUuVCMrvg+M1sJUuGisdVhv1pVk3R+o iM8hSa/ZUptQBdWNmZm9pLu3r4S9cQky7R+d+tpo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jan-Marek Glogowski , Alan Stern , Sasha Levin Subject: [PATCH 4.14 16/95] usb: handle warm-reset port requests on hub resume Date: Mon, 4 Nov 2019 22:44:14 +0100 Message-Id: <20191104212045.768461327@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191104212038.056365853@linuxfoundation.org> References: <20191104212038.056365853@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jan-Marek Glogowski [ Upstream commit 4fdc1790e6a9ef22399c6bc6e63b80f4609f3b7e ] On plug-in of my USB-C device, its USB_SS_PORT_LS_SS_INACTIVE link state bit is set. Greping all the kernel for this bit shows that the port status requests a warm-reset this way. This just happens, if its the only device on the root hub, the hub therefore resumes and the HCDs status_urb isn't yet available. If a warm-reset request is detected, this sets the hubs event_bits, which will prevent any auto-suspend and allows the hubs workqueue to warm-reset the port later in port_event. Signed-off-by: Jan-Marek Glogowski Acked-by: Alan Stern Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/usb/core/hub.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index b543a4730ef24..bb20aa433e984 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c @@ -104,6 +104,8 @@ EXPORT_SYMBOL_GPL(ehci_cf_port_reset_rwsem); static void hub_release(struct kref *kref); static int usb_reset_and_verify_device(struct usb_device *udev); static int hub_port_disable(struct usb_hub *hub, int port1, int set_state); +static bool hub_port_warm_reset_required(struct usb_hub *hub, int port1, + u16 portstatus); static inline char *portspeed(struct usb_hub *hub, int portstatus) { @@ -1110,6 +1112,11 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type) USB_PORT_FEAT_ENABLE); } + /* Make sure a warm-reset request is handled by port_event */ + if (type == HUB_RESUME && + hub_port_warm_reset_required(hub, port1, portstatus)) + set_bit(port1, hub->event_bits); + /* * Add debounce if USB3 link is in polling/link training state. * Link will automatically transition to Enabled state after -- 2.20.1