From patchwork Tue Nov 13 06:48:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Henry Lin X-Patchwork-Id: 10679809 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id ED00F1709 for ; Tue, 13 Nov 2018 06:49:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D318B29C47 for ; Tue, 13 Nov 2018 06:49:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C637C29C45; Tue, 13 Nov 2018 06:49:48 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B9DC629C45 for ; Tue, 13 Nov 2018 06:49:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730674AbeKMQq1 (ORCPT ); Tue, 13 Nov 2018 11:46:27 -0500 Received: from hqemgate16.nvidia.com ([216.228.121.65]:5157 "EHLO hqemgate16.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726173AbeKMQq1 (ORCPT ); Tue, 13 Nov 2018 11:46:27 -0500 Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqemgate16.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Mon, 12 Nov 2018 22:49:54 -0800 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Mon, 12 Nov 2018 22:49:45 -0800 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Mon, 12 Nov 2018 22:49:45 -0800 Received: from HQMAIL109.nvidia.com (172.20.187.15) by HQMAIL104.nvidia.com (172.18.146.11) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Tue, 13 Nov 2018 06:49:42 +0000 Received: from HQMAIL104.nvidia.com (172.18.146.11) by HQMAIL109.nvidia.com (172.20.187.15) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Tue, 13 Nov 2018 06:49:41 +0000 Received: from hqnvemgw01.nvidia.com (172.20.150.20) by HQMAIL104.nvidia.com (172.18.146.11) with Microsoft SMTP Server (TLS) id 15.0.1395.4 via Frontend Transport; Tue, 13 Nov 2018 06:49:41 +0000 Received: from henryl-nb2.nvidia.com (Not Verified[10.19.108.180]) by hqnvemgw01.nvidia.com with Trustwave SEG (v7,5,8,10121) id ; Mon, 12 Nov 2018 22:49:41 -0800 From: Henry Lin To: CC: , Henry Lin Subject: [PATCH] xhci: handle stop ep on invalid CStream Date: Tue, 13 Nov 2018 14:48:52 +0800 Message-ID: <1542091732-23951-1-git-send-email-henryl@nvidia.com> X-Mailer: git-send-email 2.7.4 X-NVConfidentiality: public MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1542091794; bh=rECdPxiAP2Ihk8YiVknzjqGtejEjuMYg78DeojxICbg=; h=X-PGP-Universal:From:To:CC:Subject:Date:Message-ID:X-Mailer: X-NVConfidentiality:MIME-Version:Content-Type; b=DdC8GXn/6sGzW1BD0aHP8TUCtVH4ZurMqv/yTppmrmVKvNINt7Qw1qSxqelTA5xUd na3INMCRXAikk/lJeejR7MFehVHyAsQOIfM79uV2lnBlsBLNoLwJ2AyawJUI+3KbLW i2Jm7DVDGVQncOoO7gaAKOkhFTf0Kd/2eW+a949QuuIyYXTxYV+VDCmsSFBKY9hWpF WwB/PA4EU+/4yh+UkUNEsTqiecJhVTIKXSo+Q+oU+7jp6CWsQMJEjanOK8JyqPHSwp 2/ZGl2SoM76ZvzFrtXJsFXIan36rCmDobwDOpuxCaY4ji0PGUU6jYkULR2urzLLh7z HahCUDAQx+2bg== Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Below Note in xHCI spec 6.4.2.1 describes a Transfer Event is generated for Stop Endpoint Command on invalid CStream: CStream is not valid until a Streams endpoint transitions to the Start Stream state for the first time. A Transfer Event generated by a Stop Endpoint Command shall report '0' in the TRB Pointer and TRB Length fields if the command is executed and CStream is invalid. Refer to section 4.12.1. But, current implementation will output below error messages once driver receives the Transfer Event for invalid CStream: [ 133.184633] xhci_hcd 0000:01:00.2: ERROR Transfer event for unknown stream ring slot 1 ep 2 [ 133.184635] xhci_hcd 0000:01:00.2: @000000046044a420 00000000 00000000 1b000000 01038001 This issue can be observed while uas driver is handling SCSI command that connected UAS device doesn't support. UAS device rejects the unsupported command and causes Data-In stream for SCSI command data stopped when CStream is invalid. This patch handles the transfer event to remove false error messages. Signed-off-by: Henry Lin --- drivers/usb/host/xhci-ring.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index a8d92c9..8ae658e 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c @@ -2267,6 +2267,11 @@ static int handle_tx_event(struct xhci_hcd *xhci, case COMP_RING_UNDERRUN: case COMP_RING_OVERRUN: goto cleanup; + case COMP_STOPPED_LENGTH_INVALID: + if ((ep->ep_state & EP_HAS_STREAMS) && + (event->buffer == 0)) + goto cleanup; + /* else fall through */ default: xhci_err(xhci, "ERROR Transfer event for unknown stream ring slot %u ep %u\n", slot_id, ep_index);