Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp4469601ybz; Tue, 28 Apr 2020 11:49:58 -0700 (PDT) X-Google-Smtp-Source: APiQypJT/9xwtusDmlZ0LawmqcsJzwrga22e44P7VGTR4nAkilL07L3F0BiNtJ8GRjwQud0Zqbn2 X-Received: by 2002:a17:907:4033:: with SMTP id nk3mr8640396ejb.273.1588099798049; Tue, 28 Apr 2020 11:49:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588099798; cv=none; d=google.com; s=arc-20160816; b=gnCB/737Tbh34uvtAOqQCYXH02I44AQ6jegu+CttkxMgWeocvhSzwEaJb1tF2bNFNj 9scPqjj/OpKTbzzeIm6iPK7bpdpfAgDBB4V6emGTSalS+V4mKtxO8fBU8uNDSqHlwbU8 fojRI06BpteuOUU+B2t5B10tDpRTIkwt/cRpCYLN6a7LSNrCj8XsaR306S1BLx77NxTy LVoura1FIv+B08Hk1EATPheDwkr/4td8yD/x6u8iXb9+oWzjtzWNwdCL8fuyXiYYrqA5 s3V0lrjiw2Nz+RAJUrCSA3SFilThRhIUPeO1GPFBgDd0asr6m76kFHK7S3oeOTz4gtkX uQ1g== 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=r8UKRPZJiDtkWoFCi+DYWog6iGwLisDwbjy2pQWrKOg=; b=l2ALYrH0ZR1dT7RR4GonHKHkB+PY/30W/lowKHh2YcW1k/1ZcUUkeYZ2qgpkGiWTyA pQbVkXQp2YjTzwVNFgxwhzHB8pwsHBDgVqVjtuiuQDwo67Cw7dQ3boRDv5FtIphjkZmT oHtEGrrmYL24UGMl0m4mlo66D2TvNEPtKKve8SjLxD+gERIXv9jBrg/KopIRGfNXhn2k scrd2NyfDA5HiQ9P4DR4A/33cMoKYgKOKhvXTQiuHyiHgUmm1f6dGZvEjZlsxKTlRdTG nNM33yZEjzXJyGSSS+nkMmjcLRcPmcvBMw/3aGLnJs8XQeFlsVYBK+417gtZOphyuaSE Ee6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="OD/v0S0c"; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m24si2282082edr.227.2020.04.28.11.49.34; Tue, 28 Apr 2020 11:49:58 -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=default header.b="OD/v0S0c"; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730048AbgD1SoR (ORCPT + 99 others); Tue, 28 Apr 2020 14:44:17 -0400 Received: from mail.kernel.org ([198.145.29.99]:37078 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731347AbgD1SoK (ORCPT ); Tue, 28 Apr 2020 14:44:10 -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 3B9A6206D6; Tue, 28 Apr 2020 18:44:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1588099449; bh=PvhzddcV4LfMVCiDpVZEFtGJ0jU8K4eM4uyLQeZ+RjQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OD/v0S0cc1nf82iA/MCR3zpy4D+uqQUmI7n5HN7WVjHxuFBYFgo4o+3B1787zipe0 j9zni1y0bx0REpX/eVOddzsHh1aZY0nRG+Z9wjLYgUNeji0fOFhlMU1s4JDUmpya6W kjLsgUoqC9nYBtMzZXrzEVEGD21izKCUS15l15Yo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mathias Nyman Subject: [PATCH 5.4 156/168] xhci: Dont clear hub TT buffer on ep0 protocol stall Date: Tue, 28 Apr 2020 20:25:30 +0200 Message-Id: <20200428182250.939365900@linuxfoundation.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200428182231.704304409@linuxfoundation.org> References: <20200428182231.704304409@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: Mathias Nyman commit 8f97250c21f0cf36434bf5b7ddf4377406534cd1 upstream. The default control endpoint ep0 can return a STALL indicating the device does not support the control transfer requests. This is called a protocol stall and does not halt the endpoint. xHC behaves a bit different. Its internal endpoint state will always be halted on any stall, even if the device side of the endpiont is not halted. So we do need to issue the reset endpoint command to clear the xHC host intenal endpoint halt state, but should not request the HS hub to clear the TT buffer unless device side of endpoint is halted. Clearing the hub TT buffer at protocol stall caused ep0 to become unresponsive for some FS/LS devices behind HS hubs, and class drivers failed to set the interface due to timeout: usb 1-2.1: 1:1: usb_set_interface failed (-110) Fixes: ef513be0a905 ("usb: xhci: Add Clear_TT_Buffer") Cc: # v5.3 Signed-off-by: Mathias Nyman Link: https://lore.kernel.org/r/20200421140822.28233-4-mathias.nyman@linux.intel.com Signed-off-by: Greg Kroah-Hartman --- drivers/usb/host/xhci-ring.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c @@ -1868,7 +1868,6 @@ static void xhci_cleanup_halted_endpoint ep->ep_state |= EP_HARD_CLEAR_TOGGLE; xhci_cleanup_stalled_ring(xhci, slot_id, ep_index, stream_id, td); - xhci_clear_hub_tt_buffer(xhci, td, ep); } xhci_ring_cmd_db(xhci); } @@ -1989,11 +1988,18 @@ static int finish_td(struct xhci_hcd *xh if (trb_comp_code == COMP_STALL_ERROR || xhci_requires_manual_halt_cleanup(xhci, ep_ctx, trb_comp_code)) { - /* Issue a reset endpoint command to clear the host side - * halt, followed by a set dequeue command to move the - * dequeue pointer past the TD. - * The class driver clears the device side halt later. + /* + * xhci internal endpoint state will go to a "halt" state for + * any stall, including default control pipe protocol stall. + * To clear the host side halt we need to issue a reset endpoint + * command, followed by a set dequeue command to move past the + * TD. + * Class drivers clear the device side halt from a functional + * stall later. Hub TT buffer should only be cleared for FS/LS + * devices behind HS hubs for functional stalls. */ + if ((ep_index != 0) || (trb_comp_code != COMP_STALL_ERROR)) + xhci_clear_hub_tt_buffer(xhci, td, ep); xhci_cleanup_halted_endpoint(xhci, slot_id, ep_index, ep_ring->stream_id, td, EP_HARD_RESET); } else {