From nobody Mon Feb 9 09:09:38 2026 Received: from mail-vk1-f228.google.com (mail-vk1-f228.google.com [209.85.221.228]) (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 DADE940756D for ; Thu, 8 Jan 2026 09:10:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.228 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767863444; cv=none; b=jPXsIOMveI6UpvPAn1e+KWAmW+yLNyJFETxRlgF/ro2SlxeuIq86/8j1LauJsVeqBaYQItYtRy2gu+0vp6cQjRFPQadGScFQ0CUIjGZIQR713zq/hr7dY5M5FZuACthcaLK7EFJuOVQDVEHMih0If5nHJqi9MU7dkVNNn/76NxI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767863444; c=relaxed/simple; bh=oMOgFSwY0RAP2ZDnrjutIY7BiKOu+6XtN7G/uaCAPag=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ZrSJzM09wj0No92vNZwkjoqqF4hCJgpfTyd9NsmxY/9eXDHYcjwfcUk/6wiDsgU5TSrdSOWAniAdwZQsRI8TrwoStnEW+MzJpfDI4HfjAwZEGOMv1YAN7h5mtejGyV8CxB7URsQ9qs4qMEu49cqOA48Pl/hb+vYUl8KnC4396mY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=broadcom.com; spf=fail smtp.mailfrom=broadcom.com; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b=LTc4sRBn; arc=none smtp.client-ip=209.85.221.228 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=broadcom.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=broadcom.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="LTc4sRBn" Received: by mail-vk1-f228.google.com with SMTP id 71dfb90a1353d-55b302b8369so1978955e0c.0 for ; Thu, 08 Jan 2026 01:10:36 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767863433; x=1768468233; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=c9fHKbor+4yAlWDOSfn8eCqOO4MCtVL+l7N/J/f2X+c=; b=jBi/JlSDRfpRvnp50k0sd7nntXw2KuYESepsMP2sGe9ipOhgG3HrioyWy2gt8l+pGE UovFIiScq+ebg8a6xCYAymnjtG5uk49x6ugjmSnv7HIzGWbjZx2V0vz4HOG4hCcWaN2j 4Y6MY4I+DG+qNVqmdw2F9L6i8rL0udtojN4hm/3vXzRimYChLJLJqDTTOMcG6yyus1UT wsCgYxryPL9QfQzUhQCfVx0hj0X5bx/uZeNhwwllBuslyps/KiHuwdQcX+EbUUHQBD0j H18/49ahXybSNCZZ6DYszD/Z4veYKKySx9/JnGgSUw8Flj7fP1G/4HRd7SfNRh1ohfYk bK+Q== X-Forwarded-Encrypted: i=1; AJvYcCWzV7jY5NqEXht8HePc21A+vANorNpvY0ETjVvS7gSOT+XC2FR7vsYwgAY6zJtWNKS8y7d6yfQy4Ucyev4=@vger.kernel.org X-Gm-Message-State: AOJu0Yw1X69lNkKhZZY3gKZTJqdbpWIMh+AIGgPzmuJdaw7cNsR1vsEE RNpNaIfv7Bt4ZZOg6wNkqXkPnM0qUG3z0BxswDC5iUJvDw427+C7EP6hYCYKedoproQ/4nABTS0 iIkZChp5oSgBviHHrBMq+X99jHxhVxYM6XPoUb0KKi8MMXDi5Erbto1LiisaX+3INrqPx3b0qzZ QrRITPoUPjNxnf9zHTIoYpFbrnY81r/lBHAMIArJjyn+m1EiU1b3xkiaCjF33VYdwp4JBpuak8p 0l3Srlj11wm3OeqiICWKik6Mg== X-Gm-Gg: AY/fxX4ty7ES4h55yjo/AJWrFIuUbZJQxgo0WWAzvVERuBDfQlaOWsfTEC0DJVwFBgL V0gXz5/n4trk/qKo6FM6UCVo1rT5D89PmOgggyHUC8DWVIYQduNCjlHEBXfCnrwINhj/pewUvQI +tUCZCB+mXlNcQI1nmNc3cpE2+aFROhbNCMJFnTRHcIPrYnyXOWqIIxEwDYPMEm0bdAfWi9uopm qoWQ29sTrGIEhzv4q8vMYoKZvKt9pFDWV4SkEKvVUwDQNGYT843mjHXz85vqM9PmFOYOuUOL6+o PAE0zG+81+gRQEKQ3vIrWr7uBNk5FEe/2dqqAPUp64641N3de0tPrqUZGU8wMSwc8a3T9G++gUH GigChI4sZZhtiF9bVsN1LPfzWEyXEfe1ogMFej+BHlTrLp1QB8wd87PThxLmdRYaL5YfKEtNN13 iGGcc48QnsphketFoyGNJ6ps7ds4EXGzv3Wbvhz9AYgM3Pmg== X-Google-Smtp-Source: AGHT+IG99rAM/9ULOC3zSGTXtiIuDpvOlWOWxZsX2Dl4V1Bl8pDV7ydHIyefw5aT8hwSkXRH8NavSuucJQO0 X-Received: by 2002:a05:6122:4593:b0:54a:9fe8:171e with SMTP id 71dfb90a1353d-56347d8330amr2034787e0c.7.1767863433253; Thu, 08 Jan 2026 01:10:33 -0800 (PST) Received: from smtp-us-east1-p01-i01-si01.dlp.protect.broadcom.com (address-144-49-247-1.dlp.protect.broadcom.com. [144.49.247.1]) by smtp-relay.gmail.com with ESMTPS id 71dfb90a1353d-5633a3d7c91sm799801e0c.5.2026.01.08.01.10.33 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 08 Jan 2026 01:10:33 -0800 (PST) X-Relaying-Domain: broadcom.com X-CFilter-Loop: Reflected Received: by mail-dl1-f69.google.com with SMTP id a92af1059eb24-11dd10b03d9so3077627c88.0 for ; Thu, 08 Jan 2026 01:10:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1767863432; x=1768468232; 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=c9fHKbor+4yAlWDOSfn8eCqOO4MCtVL+l7N/J/f2X+c=; b=LTc4sRBnTtZ9yqk7JM0Y7eRYHYfbFDOglaOv9zKuY+khG7l+8dG0skbYkvqOaYKs9e Xp42MEH0vOWnuKZnOWNl+yIhNTify25qqOu1REg+7GpCe0nkKJA/gKWXyyLbL1ShVnfp Nbi6KS4Y2vy9Dsk52Sop/4E4gl0i4LyWg1eLk= X-Forwarded-Encrypted: i=1; AJvYcCWE12/79/2Y3iKIIVQVsCMZEHy1uba1xs28UU4QYualKF3jIv2P3KqGAIBb/wVychCd36F4+B+cs8wHZNQ=@vger.kernel.org X-Received: by 2002:a05:7022:6187:b0:122:1e3:535d with SMTP id a92af1059eb24-12201e3552dmr268018c88.26.1767863432114; Thu, 08 Jan 2026 01:10:32 -0800 (PST) X-Received: by 2002:a05:7022:6187:b0:122:1e3:535d with SMTP id a92af1059eb24-12201e3552dmr267999c88.26.1767863431466; Thu, 08 Jan 2026 01:10:31 -0800 (PST) Received: from shivania.lvn.broadcom.net ([192.19.161.250]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-121f24985d1sm13267619c88.16.2026.01.08.01.10.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Jan 2026 01:10:30 -0800 (PST) From: Shivani Agarwal To: stable@vger.kernel.org, gregkh@linuxfoundation.org Cc: mathias.nyman@intel.com, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, ajay.kaher@broadcom.com, alexey.makhalov@broadcom.com, vamsi-krishna.brahmajosyula@broadcom.com, yin.ding@broadcom.com, tapas.kundu@broadcom.com, Michal Pecio , Mathias Nyman , Shivani Agarwal Subject: [PATCH 2/2 v5.10-v6.1] usb: xhci: Apply the link chain quirk on NEC isoc endpoints Date: Thu, 8 Jan 2026 00:49:27 -0800 Message-Id: <20260108084927.671785-3-shivani.agarwal@broadcom.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20260108084927.671785-1-shivani.agarwal@broadcom.com> References: <20260108084927.671785-1-shivani.agarwal@broadcom.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-DetectorID-Processed: b00c1d49-9d2e-4205-b15f-d015386d3d5e Content-Type: text/plain; charset="utf-8" From: Michal Pecio commit bb0ba4cb1065e87f9cc75db1fa454e56d0894d01 upstream. Two clearly different specimens of NEC uPD720200 (one with start/stop bug, one without) were seen to cause IOMMU faults after some Missed Service Errors. Faulting address is immediately after a transfer ring segment and patched dynamic debug messages revealed that the MSE was received when waiting for a TD near the end of that segment: [ 1.041954] xhci_hcd: Miss service interval error for slot 1 ep 2 expected = TD DMA ffa08fe0 [ 1.042120] xhci_hcd: AMD-Vi: Event logged [IO_PAGE_FAULT domain=3D0x0005 a= ddress=3D0xffa09000 flags=3D0x0000] [ 1.042146] xhci_hcd: AMD-Vi: Event logged [IO_PAGE_FAULT domain=3D0x0005 a= ddress=3D0xffa09040 flags=3D0x0000] It gets even funnier if the next page is a ring segment accessible to the HC. Below, it reports MSE in segment at ff1e8000, plows through a zero-filled page at ff1e9000 and starts reporting events for TRBs in page at ff1ea000 every microframe, instead of jumping to seg ff1e6000. [ 7.041671] xhci_hcd: Miss service interval error for slot 1 ep 2 expected = TD DMA ff1e8fe0 [ 7.041999] xhci_hcd: Miss service interval error for slot 1 ep 2 expected = TD DMA ff1e8fe0 [ 7.042011] xhci_hcd: WARN: buffer overrun event for slot 1 ep 2 on endpoint [ 7.042028] xhci_hcd: All TDs skipped for slot 1 ep 2. Clear skip flag. [ 7.042134] xhci_hcd: WARN: buffer overrun event for slot 1 ep 2 on endpoint [ 7.042138] xhci_hcd: ERROR Transfer event TRB DMA ptr not part of current = TD ep_index 2 comp_code 31 [ 7.042144] xhci_hcd: Looking for event-dma 00000000ff1ea040 trb-start 0000= 0000ff1e6820 trb-end 00000000ff1e6820 [ 7.042259] xhci_hcd: WARN: buffer overrun event for slot 1 ep 2 on endpoint [ 7.042262] xhci_hcd: ERROR Transfer event TRB DMA ptr not part of current = TD ep_index 2 comp_code 31 [ 7.042266] xhci_hcd: Looking for event-dma 00000000ff1ea050 trb-start 0000= 0000ff1e6820 trb-end 00000000ff1e6820 At some point completion events change from Isoch Buffer Overrun to Short Packet and the HC finally finds cycle bit mismatch in ff1ec000. [ 7.098130] xhci_hcd: ERROR Transfer event TRB DMA ptr not part of current = TD ep_index 2 comp_code 13 [ 7.098132] xhci_hcd: Looking for event-dma 00000000ff1ecc50 trb-start 0000= 0000ff1e6820 trb-end 00000000ff1e6820 [ 7.098254] xhci_hcd: ERROR Transfer event TRB DMA ptr not part of current = TD ep_index 2 comp_code 13 [ 7.098256] xhci_hcd: Looking for event-dma 00000000ff1ecc60 trb-start 0000= 0000ff1e6820 trb-end 00000000ff1e6820 [ 7.098379] xhci_hcd: Overrun event on slot 1 ep 2 It's possible that data from the isochronous device were written to random buffers of pending TDs on other endpoints (either IN or OUT), other devices or even other HCs in the same IOMMU domain. Lastly, an error from a different USB device on another HC. Was it caused by the above? I don't know, but it may have been. The disk was working without any other issues and generated PCIe traffic to starve the NEC of upstream BW and trigger those MSEs. The two HCs shared one x1 slot by means of a commercial "PCIe splitter" board. [ 7.162604] usb 10-2: reset SuperSpeed USB device number 3 using xhci_hcd [ 7.178990] sd 9:0:0:0: [sdb] tag#0 UNKNOWN(0x2003) Result: hostbyte=3D0x07= driverbyte=3DDRIVER_OK cmd_age=3D0s [ 7.179001] sd 9:0:0:0: [sdb] tag#0 CDB: opcode=3D0x28 28 00 04 02 ae 00 00= 02 00 00 [ 7.179004] I/O error, dev sdb, sector 67284480 op 0x0:(READ) flags 0x80700= phys_seg 5 prio class 0 Fortunately, it appears that this ridiculous bug is avoided by setting the chain bit of Link TRBs on isochronous rings. Other ancient HCs are known which also expect the bit to be set and they ignore Link TRBs if it's not. Reportedly, 0.95 spec guaranteed that the bit is set. The bandwidth-starved NEC HC running a 32KB/uframe UVC endpoint reports tens of MSEs per second and runs into the bug within seconds. Chaining Link TRBs allows the same workload to run for many minutes, many times. No negative side effects seen in UVC recording and UAC playback with a few devices at full speed, high speed and SuperSpeed. The problem doesn't reproduce on the newer Renesas uPD720201/uPD720202 and on old Etron EJ168 and VIA VL805 (but the VL805 has other bug). [shorten line length of log snippets in commit messge -Mathias] Signed-off-by: Michal Pecio Cc: stable@vger.kernel.org Signed-off-by: Mathias Nyman Link: https://lore.kernel.org/r/20250306144954.3507700-14-mathias.nyman@lin= ux.intel.com Signed-off-by: Greg Kroah-Hartman [Shivani: Modified to apply on v5.10.y-v6.1.y] Signed-off-by: Shivani Agarwal --- drivers/usb/host/xhci.h | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h index 07591a498b5e..b43e88102200 100644 --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h @@ -1789,11 +1789,20 @@ static inline void xhci_write_64(struct xhci_hcd *x= hci, } =20 =20 -/* Link TRB chain should always be set on 0.95 hosts, and AMD 0.96 ISOC ri= ngs */ +/* + * Reportedly, some chapters of v0.95 spec said that Link TRB always has i= ts chain bit set. + * Other chapters and later specs say that it should only be set if the li= nk is inside a TD + * which continues from the end of one segment to the next segment. + * + * Some 0.95 hardware was found to misbehave if any link TRB doesn't have = the chain bit set. + * + * 0.96 hardware from AMD and NEC was found to ignore unchained isochronou= s link TRBs when + * "resynchronizing the pipe" after a Missed Service Error. + */ static inline bool xhci_link_chain_quirk(struct xhci_hcd *xhci, enum xhci_= ring_type type) { return (xhci->quirks & XHCI_LINK_TRB_QUIRK) || - (type =3D=3D TYPE_ISOC && (xhci->quirks & XHCI_AMD_0x96_HOST)); + (type =3D=3D TYPE_ISOC && (xhci->quirks & (XHCI_AMD_0x96_HOST | XH= CI_NEC_HOST))); } =20 /* xHCI debugging */ --=20 2.43.7