Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp504692yba; Mon, 1 Apr 2019 10:37:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqxR+UpIeF4rF/3ZwTfe9pYYCOCgXqglW+e7fZXJieo8cE1t109cYZ5kmregX/Mr/2AX3fou X-Received: by 2002:a17:902:b10c:: with SMTP id q12mr48626013plr.254.1554140261228; Mon, 01 Apr 2019 10:37:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554140261; cv=none; d=google.com; s=arc-20160816; b=qT5cGfyMNw6MsRvbgM33QR7XxfXkVPSGYEXJoevHQeAO5i3NDHnLY/Nj8ZkCcleDWy aWMWF/fTKQJQz+D9PrxL6eOZsUnfjRy9eBY1Ysd95irBvTo3VewNSYypPBwpFDEhssOT Keg3JsW7bsjoFTbCVs5SWa5rOvoCQ/Chd8GBpccXXjJh2zqSJvi5fXQJ6mBDzzqxgNtU AbZ9dz8O3cxscOCnSLcS+w6XaeBfDYVZo0VlbaoaZlSsNDpAQl4PV8eBhPkJEC0yLLDY u/Ojns218J3ELs9LrQQDslwdMF6GU+JkMrdpUkhqNRmP20sI61nIkOiqVQRQFEMqscwv xUow== 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=WT0qcU5/wO0oTkURGz+53EltJxfHmxJV6wr88shH494=; b=gDR3ISRoxyZ2z25aOVFrB76ZQiIiEPdSVSSyT75f7fv5YzIAA2u0ipuoBIqEORhZvh JBYxQzTQug0PNRxK4uiBifmmfiAUvhsWFNA1o1cKgBlGFESHMMjyHoswan2QYTbqOuFv tk3Xr+K2Wpn4LSnhFKcqR/dynEksXkeppAgxU4uU92xFzGZTZw6KY8I7+0ZNliFTtxNG cihXOJNT5kb2R2VLUA74h9JMM31IO1LDtqPG7FbEyVjLQNlN4N+6IgQwuaXnsiWE4NyK dN6iGi3KKdS3GndyvhPI941wIANULdrihhkB9+qLVxG44bDGpc1OpqGH02M1OUllJva/ +PzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=WLhTHfjd; 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 b8si9690345pla.290.2019.04.01.10.37.26; Mon, 01 Apr 2019 10:37:41 -0700 (PDT) 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=WLhTHfjd; 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 S2387718AbfDARgp (ORCPT + 99 others); Mon, 1 Apr 2019 13:36:45 -0400 Received: from mail.kernel.org ([198.145.29.99]:48682 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387697AbfDARgn (ORCPT ); Mon, 1 Apr 2019 13:36:43 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 D77B42070B; Mon, 1 Apr 2019 17:36:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1554140202; bh=4cyIdJzIZXfZReDJURK5ZvHW0rm/IgINnJJ9PELLecY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WLhTHfjdJfb/XzZl7Bgr+xM55wWrjVfRRvnpBImw/npU2axBLFzikQGmW+fB2ASnB VrMbJ4VIGx7d9t4mxkcsXNNxrIhNeHBuU7+yo9HKM+g1REvur0GiotKUvXhDw4NGtr rD2SvS5M9j1l68DE6HQizE5i01hzea6CF5HE+6rc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mathias Nyman Subject: [PATCH 4.4 127/131] xhci: Fix port resume done detection for SS ports with LPM enabled Date: Mon, 1 Apr 2019 19:03:17 +0200 Message-Id: <20190401170102.030989363@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190401170051.645954551@linuxfoundation.org> References: <20190401170051.645954551@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore 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 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Mathias Nyman commit 6cbcf596934c8e16d6288c7cc62dfb7ad8eadf15 upstream. A suspended SS port in U3 link state will go to U0 when resumed, but can almost immediately after that enter U1 or U2 link power save states before host controller driver reads the port status. Host controller driver only checks for U0 state, and might miss the finished resume, leaving flags unclear and skip notifying usb code of the wake. Add U1 and U2 to the possible link states when checking for finished port resume. Cc: stable Signed-off-by: Mathias Nyman Signed-off-by: Greg Kroah-Hartman --- drivers/usb/host/xhci-ring.c | 9 ++++++--- drivers/usb/host/xhci.h | 1 + 2 files changed, 7 insertions(+), 3 deletions(-) --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c @@ -1642,10 +1642,13 @@ static void handle_port_status(struct xh } } - if ((temp & PORT_PLC) && (temp & PORT_PLS_MASK) == XDEV_U0 && - DEV_SUPERSPEED_ANY(temp)) { + if ((temp & PORT_PLC) && + DEV_SUPERSPEED_ANY(temp) && + ((temp & PORT_PLS_MASK) == XDEV_U0 || + (temp & PORT_PLS_MASK) == XDEV_U1 || + (temp & PORT_PLS_MASK) == XDEV_U2)) { xhci_dbg(xhci, "resume SS port %d finished\n", port_id); - /* We've just brought the device into U0 through either the + /* We've just brought the device into U0/1/2 through either the * Resume state after a device remote wakeup, or through the * U3Exit state after a host-initiated resume. If it's a device * initiated remote wake, don't pass up the link state change, --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h @@ -309,6 +309,7 @@ struct xhci_op_regs { */ #define PORT_PLS_MASK (0xf << 5) #define XDEV_U0 (0x0 << 5) +#define XDEV_U1 (0x1 << 5) #define XDEV_U2 (0x2 << 5) #define XDEV_U3 (0x3 << 5) #define XDEV_INACTIVE (0x6 << 5)