Skip to content

usb: xhci: decouple allocation and initialization

Niklas Neronin linux-usb 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest11 patches 2 repliesIn review
  2. v111 patches 1 replySuperseded

Changes in v2 from the cover letter

* 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.

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/11usb: xhci: relocate pre-allocation initializationdrivers/usb/host/xhci-mem.c drivers/usb/host/xhci.c+26 -310 replies
2/11usb: xhci: move device slot enabling register writedrivers/usb/host/xhci-mem.c drivers/usb/host/xhci.c+22 -140 replies
3/11usb: xhci: move command ring pointer writedrivers/usb/host/xhci-mem.c drivers/usb/host/xhci.c+20 -271 reply
4/11usb: xhci: refactor xhci_set_cmd_ring_deq()drivers/usb/host/xhci.c drivers/usb/host/xhci.h+18 -160 replies
5/11usb: xhci: move DCBAA pointer writedrivers/usb/host/xhci-mem.c drivers/usb/host/xhci.c+3 -10 replies
6/11usb: xhci: move doorbell array pointer assignmentdrivers/usb/host/xhci-caps.h drivers/usb/host/xhci-mem.c drivers/usb/host/xhci.c+15 -101 reply
7/11usb: xhci: move enabling of USB 3 device notificationsdrivers/usb/host/xhci-mem.c drivers/usb/host/xhci.c drivers/usb/host/xhci.h+18 -120 replies
8/11usb: xhci: remove error handling from xhci_add_interrupter()drivers/usb/host/xhci-mem.c+8 -190 replies
9/11usb: xhci: move initialization of the primary interrupterdrivers/usb/host/xhci-mem.c drivers/usb/host/xhci.c drivers/usb/host/xhci.h+14 -130 replies
10/11usb: xhci: add individual allocation checks in xhci_mem_init()drivers/usb/host/xhci-mem.c+9 -20 replies
11/11usb: xhci: cleanup xhci_mem_init()drivers/usb/host/xhci-mem.c+23 -230 replies

Reviews trailers per patch

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

Read the v2 thread

Cover letter [PATCH v2 00/11] usb: xhci: decouple allocation and initialization

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(-)
Signature · 1 line
2.47.2