mbox series

[v2,00/11] usb: xhci: decouple allocation and initialization

Message ID 20250416134510.2406543-1-niklas.neronin@linux.intel.com
Headers show
Series usb: xhci: decouple allocation and initialization | expand

Message

Niklas Neronin April 16, 2025, 1:44 p.m. UTC
Currently, after hibernation (S4 state), the xhci driver frees all its
memory and reallocates it from scratch, which is inefficient. Instead, much
of the memory can be simply re-initialized.

The proposed changes begin the process by decoupling initialization code
from memory allocation code. Specifically, the initialization code is moved
from xhci_mem_init() into separate functions, which are then called from
xhci_init().

By implementing these changes, future patches will be able to call the
initialization functions directly after hibernation, thereby improving
efficiency and enhancing code structure.

v2:
 * Add "Array" to "Set Device Context Base Address pointer" comment.
 * Rebase on top of the recently accepted sideband series to resolve some
   conflicts. The rebase impacts commits 8 and 9.
   There will be duplicate code in xhci_create_secondary_interrupter().
   Since I have another patch set pending that slightly impacts this
   function, I have decided to hold off on reworking or cleaning up the
   function.

Niklas Neronin (11):
  usb: xhci: relocate pre-allocation initialization
  usb: xhci: move device slot enabling register write
  usb: xhci: move command ring pointer write
  usb: xhci: refactor xhci_set_cmd_ring_deq()
  usb: xhci: move DCBAA pointer write
  usb: xhci: move doorbell array pointer assignment
  usb: xhci: move enabling of USB 3 device notifications
  usb: xhci: remove error handling from xhci_add_interrupter()
  usb: xhci: move initialization of the primary interrupter
  usb: xhci: add individual allocation checks in xhci_mem_init()
  usb: xhci: cleanup xhci_mem_init()

 drivers/usb/host/xhci-caps.h |   4 +-
 drivers/usb/host/xhci-mem.c  | 168 ++++++++++-------------------------
 drivers/usb/host/xhci.c      | 126 +++++++++++++++++++++-----
 drivers/usb/host/xhci.h      |  12 +--
 4 files changed, 159 insertions(+), 151 deletions(-)