Re: [RFC PATCH 07/14] usb: host: xhci: Add XHCI secondary interrupter support
From: Greg KH
Date: Sat Dec 24 2022 - 03:55:51 EST
On Fri, Dec 23, 2022 at 03:31:53PM -0800, Wesley Cheng wrote:
> Implement the XHCI operations for allocating and requesting for a secondary
> interrupter. The secondary interrupter can allow for events for a
> particular endpoint to be routed to a separate event ring. The event
> routing is defined when submitting a transfer descriptor to the USB HW.
> There is a specific field which denotes which interrupter ring to route the
> event to when the transfer is completed.
>
> An example use case, such as audio packet offloading can utilize a separate
> event ring, so that these events can be routed to a different processor
> within the system. The processor would be able to independently submit
> transfers and handle its completions without intervention from the main
> processor.
>
> Signed-off-by: Wesley Cheng <quic_wcheng@xxxxxxxxxxx>
> ---
> drivers/usb/host/xhci-mem.c | 219 ++++++++++++++++++++++++++++-------
> drivers/usb/host/xhci-plat.c | 2 +
> drivers/usb/host/xhci.c | 169 ++++++++++++++++++++++++++-
> drivers/usb/host/xhci.h | 15 +++
> 4 files changed, 363 insertions(+), 42 deletions(-)
>
> diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c
> index 81ca2bc1f0be..d5cb4b82ad3d 100644
> --- a/drivers/usb/host/xhci-mem.c
> +++ b/drivers/usb/host/xhci-mem.c
> @@ -1835,6 +1835,7 @@ void xhci_free_erst(struct xhci_hcd *xhci, struct xhci_erst *erst)
> void xhci_mem_cleanup(struct xhci_hcd *xhci)
> {
> struct device *dev = xhci_to_hcd(xhci)->self.sysdev;
> + struct xhci_sec *sec, *tmp;
> int i, j, num_ports;
>
> cancel_delayed_work_sync(&xhci->cmd_timer);
> @@ -1846,6 +1847,16 @@ void xhci_mem_cleanup(struct xhci_hcd *xhci)
> xhci->event_ring = NULL;
> xhci_dbg_trace(xhci, trace_xhci_dbg_init, "Freed event ring");
>
> + list_for_each_entry_safe(sec, tmp, &xhci->xhci_sec_list, list) {
> + list_del(&sec->list);
> + if (sec->event_ring) {
> + xhci_ring_free(xhci, sec->event_ring);
> + xhci_dbg_trace(xhci, trace_xhci_dbg_init,
> + "Freed secondary ring %d", sec->intr_num);
Odd indentation :(