From patchwork Wed Sep 11 05:17:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuangyi Chiang X-Patchwork-Id: 13799696 Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5CDCE762D0; Wed, 11 Sep 2024 05:18:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726031913; cv=none; b=TwnIHBVuKUXA+3hhFKbwBYMnrzYRh1iJr0cn6jhxnjrmmencIauIatboYSkjpBYPO4EWbUAPdgPuzBHLVmzUKVXsDKm3gl2cAMh71HWtJL4JPkn3UN2EWL4bN6/ucfrEpzcqq+ksCYPYZ/aCBsuE5wblHcjaiuoohPVwoWLvgmc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726031913; c=relaxed/simple; bh=RqBrtZ6RcId/Wwa03NFKxlcuYZrrOtLPWX9Kfq5utiw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=goUT4x6PG2FjRuvrxitH1ma/71+AkH+kUi4bR9Uz7KrVwY/dw7SMMFwI3eS0jVXoJLowUAKxSyB5Zq0fb2WcGYxGC40E2x4qWgxj4TDS+s1Gn06kWczAGoyrrB6LOTDfhg9QtG8X7aMZTczjxtshCg9Kb3QJj8uu89fHZDRpeh8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=gEWAvKkv; arc=none smtp.client-ip=209.85.214.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="gEWAvKkv" Received: by mail-pl1-f174.google.com with SMTP id d9443c01a7336-2068acc8b98so58945735ad.3; Tue, 10 Sep 2024 22:18:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1726031912; x=1726636712; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=JccXbw3hH4c/KqwFumvLxKlVMr8FDRUDpE1kHgDGAvw=; b=gEWAvKkvk7l0y3s0C3CqelD74M1Y3lPZm7pwu3J79K6cJ3+8a8mdnpPx7MCvCWDVZg HR58PlE7YadbETYkdopfyOJtB05EDKOG1vW3ZSVOWQkOj/3BiOyTIFhmvKpjUto9XAUy g0qfyfwwt6ho/oRuiHFFUgvj3VttzZkHunYOF/6lHaS9RFew0wVB9XlUY7K30ZKt3Pp8 794eVBXVR/Ys4PVv0hhkkXsWqPnwx0uWk4ubAqekswSMp4KKMDDVJivyUzFxGd/9TqbW kcInJ+caoQjVUw8bZK0bJbSSoB+ovNNOn4b/m3jV79fzExNiNNRNyHj0DxVy4NmO6XX/ p2Lg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726031912; x=1726636712; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=JccXbw3hH4c/KqwFumvLxKlVMr8FDRUDpE1kHgDGAvw=; b=OuE2ZdnEp+p4ewY21ipnt4nRUqnDix6oWcaNa3xAbp24qZADVEPjga+ZnmlmLCmgPT WUO4xV2iNegiBQ8tfGfVQoz8Gwfewt3iXjCx/vOBJEkGDiuCEaUyFxAfUou/Xk/jv3T7 HMxNqQtzgBgC2vo0Hw5UWTj55JltK5lGAac5DfsCBeqzZRAVy7bIMjPQB604x8vsKc7d +cypuQ1VxNVjxb/o9ZzOqijaOtUBCUjC/KXe7v9H4VsY3kePo6HyTNdUJY8co08u1IjR /+08IAF60ZYrvpAQRLbR06pu4qLO+0neHdBcFsZE/fhMO0CxOELLmxsXgSOTO3IXtqPT SAWA== X-Forwarded-Encrypted: i=1; AJvYcCVtPcFnulw8X9PRUPGwoCRa4fzOdt1Wwss473RmXB7tH9qKd9xx4l8HhKshCfMenazVMZ7VWwVpGai4PGA=@vger.kernel.org, AJvYcCVv03CKLkamn6P8ehI+izhfd6qa4NTXgMtD2rzKdtSdkYjWTd1YlbCqRgMagMaDUS4MBtdvwmpN@vger.kernel.org X-Gm-Message-State: AOJu0Ywbyw6oIjmyw16NTty+Qtzmla6jBBfeYYVQvM/ph6c9/jTW3B+3 2dDgvLLZF9ljPJIDoZBGpzBbMjL+KwD6cWyorfY/sAJml4QUNsHU X-Google-Smtp-Source: AGHT+IErzhhAleCqnI06WgjhDxXvL3+aItEi1FKD9pXg99eqcy1Z4myO2SKjAur1AtKIAwIVZe0RtA== X-Received: by 2002:a17:903:238e:b0:206:8acc:8871 with SMTP id d9443c01a7336-2074c60f452mr37745755ad.31.1726031911552; Tue, 10 Sep 2024 22:18:31 -0700 (PDT) Received: from kic-machine.localdomain (122-117-151-175.hinet-ip.hinet.net. [122.117.151.175]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20710e10eb4sm56252735ad.7.2024.09.10.22.18.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Sep 2024 22:18:30 -0700 (PDT) From: Kuangyi Chiang To: gregkh@linuxfoundation.org, mathias.nyman@intel.com Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, ki.chiang65@gmail.com, stable@vger.kernel.org Subject: [PATCH 1/3] xhci: Don't issue Reset Device command to Etron xHCI host Date: Wed, 11 Sep 2024 13:17:15 +0800 Message-Id: <20240911051716.6572-3-ki.chiang65@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240911051716.6572-1-ki.chiang65@gmail.com> References: <20240911051716.6572-1-ki.chiang65@gmail.com> Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Sometimes the hub driver does not recognize the USB device connected to the external USB2.0 hub when the system resumes from S4. After the SetPortFeature(PORT_RESET) request is completed, the hub driver calls the HCD reset_device callback, which will issue a Reset Device command and free all structures associated with endpoints that were disabled. This happens when the xHCI driver issue a Reset Device command to inform the Etron xHCI host that the USB device associated with a device slot has been reset. Seems that the Etron xHCI host can not perform this command correctly, affecting the USB device. To work around this, the xHCI driver should obtain a new device slot with reference to commit 651aaf36a7d7 ("usb: xhci: Handle USB transaction error on address command"), which is another way to inform the Etron xHCI host that the USB device has been reset. Add a new quirk flag XHCI_NO_RESET_DEVICE to invoke the workaround in xhci_discover_or_reset_device(). Both EJ168 and EJ188 have the same problem, applying this patch then the problem is gone. Fixes: 2a8f82c4ceaf ("USB: xhci: Notify the xHC when a device is reset.") Cc: Signed-off-by: Kuangyi Chiang --- drivers/usb/host/xhci-pci.c | 2 ++ drivers/usb/host/xhci.c | 19 +++++++++++++++++++ drivers/usb/host/xhci.h | 1 + 3 files changed, 22 insertions(+) diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c index dc1e345ab67e..2fa7f32c2bf9 100644 --- a/drivers/usb/host/xhci-pci.c +++ b/drivers/usb/host/xhci-pci.c @@ -397,11 +397,13 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) pdev->device == PCI_DEVICE_ID_EJ168) { xhci->quirks |= XHCI_RESET_ON_RESUME; xhci->quirks |= XHCI_BROKEN_STREAMS; + xhci->quirks |= XHCI_NO_RESET_DEVICE; } if (pdev->vendor == PCI_VENDOR_ID_ETRON && pdev->device == PCI_DEVICE_ID_EJ188) { xhci->quirks |= XHCI_RESET_ON_RESUME; xhci->quirks |= XHCI_BROKEN_STREAMS; + xhci->quirks |= XHCI_NO_RESET_DEVICE; } if (pdev->vendor == PCI_VENDOR_ID_RENESAS && diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index efdf4c228b8c..d890a97e0682 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c @@ -3692,6 +3692,8 @@ void xhci_free_device_endpoint_resources(struct xhci_hcd *xhci, xhci->num_active_eps); } +static void xhci_free_dev(struct usb_hcd *hcd, struct usb_device *udev); + /* * This submits a Reset Device Command, which will set the device state to 0, * set the device address to 0, and disable all the endpoints except the default @@ -3762,6 +3764,23 @@ static int xhci_discover_or_reset_device(struct usb_hcd *hcd, SLOT_STATE_DISABLED) return 0; + if (xhci->quirks & XHCI_NO_RESET_DEVICE) { + /* + * Obtaining a new device slot to inform the xHCI host that + * the USB device has been reset. + */ + ret = xhci_disable_slot(xhci, udev->slot_id); + xhci_free_virt_device(xhci, udev->slot_id); + if (!ret) { + ret = xhci_alloc_dev(hcd, udev); + if (ret == 1) + ret = 0; + else + ret = -EINVAL; + } + return ret; + } + trace_xhci_discover_or_reset_device(slot_ctx); xhci_dbg(xhci, "Resetting device with slot ID %u\n", slot_id); diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h index ebd0afd59a60..1272d725270a 100644 --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h @@ -1628,6 +1628,7 @@ struct xhci_hcd { #define XHCI_ZHAOXIN_TRB_FETCH BIT_ULL(45) #define XHCI_ZHAOXIN_HOST BIT_ULL(46) #define XHCI_WRITE_64_HI_LO BIT_ULL(47) +#define XHCI_NO_RESET_DEVICE BIT_ULL(48) unsigned int num_active_eps; unsigned int limit_active_eps; From patchwork Wed Sep 11 05:17:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuangyi Chiang X-Patchwork-Id: 13799695 Received: from mail-pl1-f182.google.com (mail-pl1-f182.google.com [209.85.214.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CD9D26A33B; Wed, 11 Sep 2024 05:18:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726031904; cv=none; b=WkeFlLkJsmeRiLzPonsndFA/uTPi0ZWAA9CUUdq/IfZobtfId8SC+kEc6Ey5UQNw7w3T9vaCmWyFSEs8j7EBrhgCMHua1b7AYVRPtjRK5cFyY0lgRhdByE7sdHXZf7X71S4M/80KjovNVHvpGl+4CeCJuzWQSsYPKT34hokK140= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726031904; c=relaxed/simple; bh=KfIlK/+l3YnhJ98a5ywAp03Aaq0K9BAiH8QDXhowRoU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=pNMVaCR9umUdisA891lnG6nJsgbttF2ETj4YyxiWU6WaTMxrZSFWGJECzmE55+pHmIMjFm5/9Exks3TsSLuvrgws5kvDNeqrXziN2ABscti16spkzYS5WnSf0W5VV6+UBcGoDghgfTl7hr/5F8NVqUFgTAFmCPKC+v1xvFPLTg0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=jF7vVryV; arc=none smtp.client-ip=209.85.214.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="jF7vVryV" Received: by mail-pl1-f182.google.com with SMTP id d9443c01a7336-2059112f0a7so58148545ad.3; Tue, 10 Sep 2024 22:18:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1726031902; x=1726636702; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=yWIDMbqJsRxxIml4+HWO93IWTZE2hwnYycJj4UDpW+E=; b=jF7vVryVWSf26ajdOPsDx74W5ji3JHpz+L+GEvDoI2GaD5GdtjiRjnw11z5/J6dk7V xMy/Pr0XhoW+sBiYnnNzpUIZcMJOuKBuRNkuKupbB5L+rLKWQ5U4xcLUo3U/mKXvCD0p 7JLTyBMXK/8FtTBsVdLCPzEVKyt8c8BdCeyAf/bSxGoAWyfrPhRsqsJ4bJ303bwHjhAc BcHm/QhnsDteNpJHeOMry4Wb8RA0diWf9ObSvzDT4o1oL4LQrNB66iS2ECPtp5UVi62l 4wsqIQnOWxIBBPVaeDrLyEniUO66d0FMjK8cmgzO3cXLWn8zdiBVGqcuwSw0Ln6KBBiE Kr9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726031902; x=1726636702; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=yWIDMbqJsRxxIml4+HWO93IWTZE2hwnYycJj4UDpW+E=; b=DOgLPIJLwa989WgJ+SURL/jV3gyL3QA4e4wdERiBM9XNB7Wg2XIMuM81xfF7MRGn/6 DDaBXMl2y/7kxT76KNCsEPflHIgnTe3Mq6DXGdevFYsA9pNndns0/BmdwnXV1Vr67LR+ 42JKGrKv2ubajtyHMl6eDdjSbx+xTXmRRcyZu4PGq9+Su8Q37IBPAi/xqSxEcycrghAw nnxxSIivbc2cyPKqCbKN8rDXGPYjFiW6ohPXJRXpkfBwWjiIvPb69MF/RET1DrGoNqu6 7v3jAPgS24KtfOnI4PkD6MdH3nD25g+cpSvD43Bp1MFdZuhgNb2mzBLZVCAeqRy7Jc2B ihZg== X-Forwarded-Encrypted: i=1; AJvYcCVcb0xXAkxcW6Fhztx5pTEm3xb7jPrx0eVyF2kT6Asqcscsn2DDsb4M0aGL5G0Q6s5dnDKke+fT@vger.kernel.org, AJvYcCXINhgXZ08D5bd7FwkMtxG0II3EJueVS0K9lzHmryCnwhljyoG3Vx5LkN7tmsC/eU+MvjzF9NEZA4BccYw=@vger.kernel.org X-Gm-Message-State: AOJu0Yyruoce+aNYCvCJkApn4OsMMeRwtwTlzpppHgdy7exur00KtXjI 3RedIHFw5XfmkLU6wQHAw0yS71nJFgXZlOCgb7kzErSnvzGEUdFS X-Google-Smtp-Source: AGHT+IGp9udTy8LVWEL7pJkY8X8ptRgiBtwX/0i2COXqT3aJcTWJZrG8LjQUUgq3e8lv7w0mBNSEjA== X-Received: by 2002:a17:903:2ca:b0:206:aa47:adc2 with SMTP id d9443c01a7336-2074c4cb9d1mr37395025ad.14.1726031901838; Tue, 10 Sep 2024 22:18:21 -0700 (PDT) Received: from kic-machine.localdomain (122-117-151-175.hinet-ip.hinet.net. [122.117.151.175]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20710e10eb4sm56252735ad.7.2024.09.10.22.18.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Sep 2024 22:18:21 -0700 (PDT) From: Kuangyi Chiang To: gregkh@linuxfoundation.org, mathias.nyman@intel.com Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, ki.chiang65@gmail.com, stable@vger.kernel.org Subject: [PATCH 2/3] xhci: Fix control transfer error on Etron xHCI host Date: Wed, 11 Sep 2024 13:17:14 +0800 Message-Id: <20240911051716.6572-2-ki.chiang65@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240911051716.6572-1-ki.chiang65@gmail.com> References: <20240911051716.6572-1-ki.chiang65@gmail.com> Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Performing a stability stress test on a USB3.0 2.5G ethernet adapter results in errors like this: [ 91.441469] r8152 2-3:1.0 eth3: get_registers -71 [ 91.458659] r8152 2-3:1.0 eth3: get_registers -71 [ 91.475911] r8152 2-3:1.0 eth3: get_registers -71 [ 91.493203] r8152 2-3:1.0 eth3: get_registers -71 [ 91.510421] r8152 2-3:1.0 eth3: get_registers -71 The r8152 driver will periodically issue lots of control-IN requests to access the status of ethernet adapter hardware registers during the test. This happens when the xHCI driver enqueue a control TD (which cross over the Link TRB between two ring segments, as shown) in the endpoint zero's transfer ring. Seems the Etron xHCI host can not perform this TD correctly, causing the USB transfer error occurred, maybe the upper driver retry that control-IN request can solve problem, but not all drivers do this. | | ------- | TRB | Setup Stage ------- | TRB | Link ------- ------- | TRB | Data Stage ------- | TRB | Status Stage ------- | | To work around this, the xHCI driver should enqueue a No Op TRB if next available TRB is the Link TRB in the ring segment, this can prevent the Setup and Data Stage TRB to be breaked by the Link TRB. Add a new quirk flag XHCI_NO_BREAK_CTRL_TD to invoke the workaround in xhci_queue_ctrl_tx(). Both EJ168 and EJ188 have the same problem, applying this patch then the problem is gone. Fixes: d0e96f5a71a0 ("USB: xhci: Control transfer support.") Cc: Signed-off-by: Kuangyi Chiang --- drivers/usb/host/xhci-pci.c | 2 ++ drivers/usb/host/xhci-ring.c | 13 +++++++++++++ drivers/usb/host/xhci.h | 1 + 3 files changed, 16 insertions(+) diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c index 2fa7f32c2bf9..dda873f3fee7 100644 --- a/drivers/usb/host/xhci-pci.c +++ b/drivers/usb/host/xhci-pci.c @@ -398,12 +398,14 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) xhci->quirks |= XHCI_RESET_ON_RESUME; xhci->quirks |= XHCI_BROKEN_STREAMS; xhci->quirks |= XHCI_NO_RESET_DEVICE; + xhci->quirks |= XHCI_NO_BREAK_CTRL_TD; } if (pdev->vendor == PCI_VENDOR_ID_ETRON && pdev->device == PCI_DEVICE_ID_EJ188) { xhci->quirks |= XHCI_RESET_ON_RESUME; xhci->quirks |= XHCI_BROKEN_STREAMS; xhci->quirks |= XHCI_NO_RESET_DEVICE; + xhci->quirks |= XHCI_NO_BREAK_CTRL_TD; } if (pdev->vendor == PCI_VENDOR_ID_RENESAS && diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index 4ea2c3e072a9..1c387d4dc152 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c @@ -3727,6 +3727,19 @@ int xhci_queue_ctrl_tx(struct xhci_hcd *xhci, gfp_t mem_flags, if (!urb->setup_packet) return -EINVAL; + if (xhci->quirks & XHCI_NO_BREAK_CTRL_TD) { + /* + * If next available TRB is the Link TRB in the ring segment then + * enqueue a No Op TRB, this can prevent the Setup and Data Stage + * TRB to be breaked by the Link TRB. + */ + if (trb_is_link(ep_ring->enqueue + 1)) { + field = TRB_TYPE(TRB_TR_NOOP) | ep_ring->cycle_state; + queue_trb(xhci, ep_ring, false, 0, 0, + TRB_INTR_TARGET(0), field); + } + } + /* 1 TRB for setup, 1 for status */ num_trbs = 2; /* diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h index 1272d725270a..aedbe8fee8be 100644 --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h @@ -1629,6 +1629,7 @@ struct xhci_hcd { #define XHCI_ZHAOXIN_HOST BIT_ULL(46) #define XHCI_WRITE_64_HI_LO BIT_ULL(47) #define XHCI_NO_RESET_DEVICE BIT_ULL(48) +#define XHCI_NO_BREAK_CTRL_TD BIT_ULL(49) unsigned int num_active_eps; unsigned int limit_active_eps; From patchwork Wed Sep 11 05:17:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuangyi Chiang X-Patchwork-Id: 13799694 Received: from mail-pl1-f172.google.com (mail-pl1-f172.google.com [209.85.214.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8B9945464B; Wed, 11 Sep 2024 05:18:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726031887; cv=none; b=PumyrNRbM2EmhWdim1O9SHFeiJNsHwnAGYEQ3f9KeYcjP8FjeD00ouYC3P11StnLXsCI0Uf3vrvCiPSOsL+gRlkQa6jkEnrGIP1wzhsl59k4alcww5MAD3iD7nITRw2SCtaQrH6AL95LDfbrVcojA1+rfGpymFjo3r6DVw5Hifg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726031887; c=relaxed/simple; bh=HIl6FUMwsId7NWuqsLQb6qLx/lhvSz/FK61If7SUvoc=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=UBsGQLEQjFTbg6+nEhsPy41Auj2kDOOaX/oOGmkWqJQCIB1wj4832TVupokrwbo9edG1pDoOljAIGYD1ORPQ6MaWz1Mmp2l1ELKv7+ory+9wvko8cjRgag2CDnlLa6IZhvq928iP5xro1O3yUU5YWinIsWJbqQP1vDwKVd9KtmU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=jYTfSlI2; arc=none smtp.client-ip=209.85.214.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="jYTfSlI2" Received: by mail-pl1-f172.google.com with SMTP id d9443c01a7336-1fc47abc040so55830875ad.0; Tue, 10 Sep 2024 22:18:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1726031886; x=1726636686; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=vPFFkBUH1KUQvGTAkddgh3AbnGWF386sDPxW9jKCyYA=; b=jYTfSlI2MpNebT2QE+MWXan2aR/VWtRcTdYgENU0JFp/jI5FokAkMjDySER5csvtPO z8139cwSSR9CF2HcqKXg0dtqKetZFTxEYvpFgVSt69/7rs32ghvhxosazCMGeFNuTAwR 6uSQjmjtvsPtDt5fHnL+ktj1udMuutuX/tQvNP1xo0JtXOFJAd4bgl6ZG+la2POpYobN +3EsJTVbZrBgEbeic0EZ0VLElDiFMVUu2v1BVG7tUlCbgyJdBBRKUSnZfz008TxT6NVc 2SBXs0pf26DEYJqNBRb6m6jSUnv/7RkTvXX5lTk9yCk0o/5Q6N8oRU3tX55GR6ZTgydp 2XGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726031886; x=1726636686; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=vPFFkBUH1KUQvGTAkddgh3AbnGWF386sDPxW9jKCyYA=; b=GuG8yjQhHejNTzLjkrigCSzBD7ZW1xJ6X7+JULZLIozZlIbbxIl2q5ghMc/122+nOO rF+xX0Ec8dZQnAo72ZO770HciYMEJKLDdB58UsVHzjCYp6zSkWxoZ7+0jwDDhtxJlIBf QnrZ+S82nD1ShFlC+LGBcAWDeaBK3BVaIzPAx31mTXixTUP5XndxR1GaYjIwvkhRmCnF Qkp4Z+sz4fBrmOJq50QPbZeqxpJgU2CQsAwrGoAcXh1rNwxdhBb6wYWwHeBN1PNt3+7t sz9NjNxJK/LmFYCQweDqQu0p93nlfWeQ6KspEzjqfZGoTrErQ+mlS1j63l23O/ZriRyQ r5Ug== X-Forwarded-Encrypted: i=1; AJvYcCVn2CogJsO7a+SkEipabkU3/tWMIR22jjsCpKRycdujodOJsUk0CHe8lLc/xrnabWXGKbNtibPe@vger.kernel.org, AJvYcCXffJwqqKVIWFyqqvQ1OZ9j+tf2Lipxcuy5IN8UtafNtw88ILohUcGXSM+xA78kfBdM3OazD2B0c/9QvJw=@vger.kernel.org X-Gm-Message-State: AOJu0Yxn6JmSNUYsp+Gwvuitju//LpaZPmlJ6CAC2CuhQCII0RWNYokv blg/WK2I3ZLLv1UQUnslLysJunEJLPxzHNeu7NmCM2tLQbpgEsOE X-Google-Smtp-Source: AGHT+IFIs42BaBHr5f6zXfAUHBDW+oglVKQHTCBImU/2pgw3MkM8yZdGXBV6oGVZLrxZQGsXtn/WcA== X-Received: by 2002:a17:903:247:b0:207:c38:9fd7 with SMTP id d9443c01a7336-2074c5f13f8mr38917615ad.22.1726031885488; Tue, 10 Sep 2024 22:18:05 -0700 (PDT) Received: from kic-machine.localdomain (122-117-151-175.hinet-ip.hinet.net. [122.117.151.175]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20710e10eb4sm56252735ad.7.2024.09.10.22.18.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Sep 2024 22:18:04 -0700 (PDT) From: Kuangyi Chiang To: gregkh@linuxfoundation.org, mathias.nyman@intel.com Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, ki.chiang65@gmail.com, stable@vger.kernel.org Subject: [PATCH 3/3] xhci: Don't perform Soft Retry for Etron xHCI host Date: Wed, 11 Sep 2024 13:17:13 +0800 Message-Id: <20240911051716.6572-1-ki.chiang65@gmail.com> X-Mailer: git-send-email 2.25.1 Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Since commit f8f80be501aa ("xhci: Use soft retry to recover faster from transaction errors"), unplugging USB device while enumeration results in errors like this: [ 364.855321] xhci_hcd 0000:0b:00.0: ERROR Transfer event for disabled endpoint slot 5 ep 2 [ 364.864622] xhci_hcd 0000:0b:00.0: @0000002167656d70 67f03000 00000021 0c000000 05038001 [ 374.934793] xhci_hcd 0000:0b:00.0: Abort failed to stop command ring: -110 [ 374.958793] xhci_hcd 0000:0b:00.0: xHCI host controller not responding, assume dead [ 374.967590] xhci_hcd 0000:0b:00.0: HC died; cleaning up [ 374.973984] xhci_hcd 0000:0b:00.0: Timeout while waiting for configure endpoint command Seems that Etorn xHCI host can not perform Soft Retry correctly, apply XHCI_NO_SOFT_RETRY quirk to disable Soft Retry and then issue is gone. This patch depends on commit a4a251f8c235 ("usb: xhci: do not perform Soft Retry for some xHCI hosts"). Fixes: f8f80be501aa ("xhci: Use soft retry to recover faster from transaction errors") Cc: Signed-off-by: Kuangyi Chiang --- drivers/usb/host/xhci-pci.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c index dda873f3fee7..19f120ed8dd3 100644 --- a/drivers/usb/host/xhci-pci.c +++ b/drivers/usb/host/xhci-pci.c @@ -399,6 +399,7 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) xhci->quirks |= XHCI_BROKEN_STREAMS; xhci->quirks |= XHCI_NO_RESET_DEVICE; xhci->quirks |= XHCI_NO_BREAK_CTRL_TD; + xhci->quirks |= XHCI_NO_SOFT_RETRY; } if (pdev->vendor == PCI_VENDOR_ID_ETRON && pdev->device == PCI_DEVICE_ID_EJ188) { @@ -406,6 +407,7 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) xhci->quirks |= XHCI_BROKEN_STREAMS; xhci->quirks |= XHCI_NO_RESET_DEVICE; xhci->quirks |= XHCI_NO_BREAK_CTRL_TD; + xhci->quirks |= XHCI_NO_SOFT_RETRY; } if (pdev->vendor == PCI_VENDOR_ID_RENESAS &&