From: Mathias Nyman <mathias.nyman@linux.intel.com>
To: Jay Chen <shawn2000100@gmail.com>,
mathias.nyman@intel.com, gregkh@linuxfoundation.org
Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
jay.chen@siemens.com
Subject: Re: [PATCH v3] usb: xhci: Set avg_trb_len = 8 for EP0 during Address Device Command
Date: Mon, 19 May 2025 16:14:33 +0300 [thread overview]
Message-ID: <e87a80d9-9603-4d27-99a7-a34eeda8c6f5@linux.intel.com> (raw)
In-Reply-To: <20250516033908.7386-1-shawn2000100@gmail.com>
On 16.5.2025 6.39, Jay Chen wrote:
> According to the xHCI 1.2 spec (Section 6.2.3, p.454), the Average
> TRB Length (avg_trb_len) for control endpoints should be set to 8.
Maybe add here "But section 4.8.2 "Endpoint Context Initialization"
states that all fields of an Input Endpoint Context data structure
(including the Reserved fields) shall be initialized to 0
> > Currently, during the Address Device Command, EP0's avg_trb_len remains 0,
> which may cause some xHCI hardware to reject the Input Context, resulting
> in device enumeration failures. In extreme cases, using a zero avg_trb_len
> in calculations may lead to division-by-zero errors and unexpected system
> crashes.
Would be good to specify here which exact hardware requires avg_trb_len to be
set before the 'Address Device Command'. This way we can later create a
quirk for it in case it turns out other existing controllers can't handle it.
So far it seems other hosts can handle it well, and quirks may not be needed
at all. Thanks to Michał for testing.
Thanks
Mathias
>
> This patch sets avg_trb_len to 8 for EP0 in
> xhci_setup_addressable_virt_dev(), ensuring compliance with the spec
> and improving compatibility across various host controller implementations.
I'd skip the 'compliance with spec..' part as spec is a bit unclear on this
issue.
Thanks
Mathias
next prev parent reply other threads:[~2025-05-19 13:14 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-16 3:39 [PATCH v3] usb: xhci: Set avg_trb_len = 8 for EP0 during Address Device Command Jay Chen
2025-05-18 22:57 ` Michał Pecio
2025-05-19 13:14 ` Mathias Nyman [this message]
2025-05-19 15:47 ` 陳子潔
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e87a80d9-9603-4d27-99a7-a34eeda8c6f5@linux.intel.com \
--to=mathias.nyman@linux.intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=jay.chen@siemens.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=mathias.nyman@intel.com \
--cc=shawn2000100@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox