Re: [PATCH] usb: xhci: fix ERST max field conversion

From: Neronin, Niklas

Date: Thu Aug 27 2026 - 02:35:18 EST




On 27/08/2026 8.37, Youngjoon Lee wrote:
> Commit 6d45e9556d4a ("usb: xhci: standardize multi bit-field
> macros") converted the ERST maximum calculation from BIT() to a
> left shift. These operations are not equivalent because the
> HCS_ERST_MAX field contains an exponent.
>
> On an MT8173 xHCI controller where HCS_ERST_MAX is zero, the new
> calculation produces zero event ring segments. This reaches
> dma_alloc_coherent() with a zero size, triggers a page allocator
> warning, and prevents xHCI from probing with -ENOMEM.
>
> Preserve the original calculation by applying BIT() to the value
> extracted with FIELD_GET().
>
> This restores the USB 2.0 and USB 3.0 root hubs on MT8173. A USB
> webcam and both USB 2.0 and USB 3.0 hubs enumerate successfully,
> and the previous ERST allocation failure is no longer present.
>
> Fixes: 6d45e9556d4a ("usb: xhci: standardize multi bit-field macros")
> Signed-off-by: Youngjoon Lee <getfeus@xxxxxxxxx>

Thanks for the report and patch.

This issue has already been addressed in:

https://lore.kernel.org/linux-usb/7e6648ad-7459-4248-8c6c-227cfc2586d8@xxxxxxxxxxxxxxx/

-Niklas