Hi Mathias,
On 9/28/2023 3:31 AM, Mathias Nyman wrote:
On 22.9.2023 0.48, Wesley Cheng wrote:
From: Mathias Nyman <mathias.nyman@xxxxxxxxxxxxxxx>
Modify the XHCI drivers to accommodate for handling multiple event rings in
case there are multiple interrupters. Add the required APIs so clients are
able to allocate/request for an interrupter ring, and pass this information
back to the client driver. This allows for users to handle the resource
accordingly, such as passing the event ring base address to an audio DSP.
There is no actual support for multiple MSI/MSI-X vectors.
Factoring out XHCI interrupter APIs and structures done by Wesley Cheng, in
order to allow for USB class drivers to utilze them.
}
+void xhci_remove_secondary_interrupter(struct usb_hcd *hcd, struct xhci_interrupter *ir)
+{
+ struct xhci_hcd *xhci = hcd_to_xhci(hcd);
+ unsigned int intr_num;
+
+ /* interrupter 0 is primary interrupter, don't touchit */
+ if (!ir || !ir->intr_num || ir->intr_num >= xhci->max_interrupters) {
+ xhci_dbg(xhci, "Invalid secondary interrupter, can't remove\n");
+ return;
+ }
+
+ /* fixme, should we check xhci->interrupter[intr_num] == ir */
+ spin_lock(&xhci->lock);
Needs to be spin_lock_irq() ir spin_lock_irqsave() as xhci->lock is used in interrupt handler.
+ intr_num = ir->intr_num;
+ xhci_free_interrupter(xhci, ir);
+ xhci->interrupters[intr_num] = NULL;
+ spin_unlock(&xhci->lock);
likewise
Let me check these again. In general, I think I will use both the xhci->mutex and xhci->lock where needed, because I believe we'd run into sleep while atomic issues
while freeing the DMA memory. Will rework this and submit in the next rev.