Re: [PATCH v2] usb: xhci-pci: Limit VIA VL805 DMA addressing to 36 bits

From: Xincheng Zhang

Date: Mon Jun 29 2026 - 03:37:39 EST


Hi Michal,

On Mon, Jun 29, 2026 at 07:09:06AM +0200, Michal Pecio wrote:
> This may turn into multiple quirks differing only in the number at the
> end. For example, ASMedia chips appear to be limited to 48 bits and we
> don't even know if these two are the only bad vendors. I briefly tested
> Etron and NEC/Renesas, they seem to be OK, but there are others.
>
> The driver is getting dangerously close to filling quirks bitmap and
> needing changes to support more than 64 quirks.
>
> Alternatively, I think your 'dma_bits' variable could be allocated at
> the beginning and initialized to 64, then passed by reference to
> get_quirks() so it can tweak it, and lastly clamped to 32 if the AC64
> capability is absent or disabled by quirk.

Thanks, this makes sense.

I reworked v3 to avoid consuming a new xHCI quirk bit for each possible
DMA address width. Instead, struct xhci_hcd now has a generic
dma_mask_bits field. xhci_gen_setup() initializes it to 64 before
calling get_quirks(), and the VIA VL805/806 PCI quirk sets it to 36.

The DMA mask setup then uses DMA_BIT_MASK(xhci->dma_mask_bits), while
still preserving HCCPARAMS1.AC64 for VL805/806.

> I'm not sure if we really need this second call to dma_set_mask() below
> when the first call fails? This code was added by fda182d80a0bf and it
> really should have been an 'else' to the check for AC64 capbality, not
> to the capability *and* having successfully enabled 64 bit DMA.
>
> OTOH, one could argue against cleaning this up in a stable patch.

I left the existing 32-bit fallback behavior unchanged in v3, since this
patch is intended to stay narrowly scoped for stable.

Thanks,
Xincheng