Skip to content

usb: xhci: allocate arrays based on supported slot amount

Niklas Neronin linux-usb 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 2 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3usb: xhci: refactor DCBAA structdrivers/usb/host/xhci-mem.c drivers/usb/host/xhci-ring.c drivers/usb/host/xhci.c +1 more+32 -290 replies
2/3usb: xhci: allocate DCBAA based on host controller max slotsdrivers/usb/host/xhci-mem.c drivers/usb/host/xhci-ring.c drivers/usb/host/xhci.h+7 -100 replies
3/3usb: xhci: allocate internal DCBAA mirror dynamicallydrivers/usb/host/xhci-mem.c drivers/usb/host/xhci.c drivers/usb/host/xhci.h+19 -82 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/3] usb: xhci: allocate arrays based on supported slot amount

The xHCI specification allows for up to 255 device slots, but the actual number of slots supported by the controller may be lower.

Prior to this patch, the xhci driver allocated the devices and device context pointer arrays to 255 slots, regardless of the supported amount. Each entry is 8 bytes, which results in 4080 bytes being allocated even on systems that support far fewer slots.

Address this by allocating these arrays based on the number of slots supported by the controller. This approach is consistent with how the driver already handles allocation for ports and interrupters.

Niklas Neronin (3):
usb: xhci: refactor DCBAA struct
usb: xhci: allocate DCBAA based on host controller max slots
usb: xhci: allocate internal DCBAA mirror dynamically

 drivers/usb/host/xhci-mem.c  | 54 +++++++++++++++++++++---------------
 drivers/usb/host/xhci-ring.c |  6 ++--
 drivers/usb/host/xhci.c      | 10 +++----
 drivers/usb/host/xhci.h      | 27 ++++++++++--------
 4 files changed, 54 insertions(+), 43 deletions(-)
Signature · 1 line
2.50.1