FROMGIT: usb: host: xhci-mem: Allow for interrupter clients to choose specific index
Some clients may operate only on a specific XHCI interrupter instance. Allow for the associated class driver to request for the interrupter that it requires. Tested-by: Puma Hsu <pumahsu@google.com> Tested-by: Daehwan Jung <dh10.jung@samsung.com> Signed-off-by: Wesley Cheng <quic_wcheng@quicinc.com> Acked-by: Mark Brown <broonie@kernel.org> Link: https://lore.kernel.org/r/20250409194804.3773260-4-quic_wcheng@quicinc.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Bug: 392112015 (cherry picked from commit fce57295497df70711d50ed01bf6d914de0ca647 https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-next) Change-Id: Ie7d74da3cdcc3afddd1b65332d89dae12fb7fb5e Signed-off-by: Wesley Cheng <quic_wcheng@quicinc.com>
This commit is contained in:
committed by
Carlos Llamas
parent
bd97464e74
commit
c354230ab9
+14
-10
@@ -2324,14 +2324,15 @@ xhci_add_interrupter(struct xhci_hcd *xhci, struct xhci_interrupter *ir,
|
||||
|
||||
struct xhci_interrupter *
|
||||
xhci_create_secondary_interrupter(struct usb_hcd *hcd, unsigned int segs,
|
||||
u32 imod_interval)
|
||||
u32 imod_interval, unsigned int intr_num)
|
||||
{
|
||||
struct xhci_hcd *xhci = hcd_to_xhci(hcd);
|
||||
struct xhci_interrupter *ir;
|
||||
unsigned int i;
|
||||
int err = -ENOSPC;
|
||||
|
||||
if (!xhci->interrupters || xhci->max_interrupters <= 1)
|
||||
if (!xhci->interrupters || xhci->max_interrupters <= 1 ||
|
||||
intr_num >= xhci->max_interrupters)
|
||||
return NULL;
|
||||
|
||||
ir = xhci_alloc_interrupter(xhci, segs, GFP_KERNEL);
|
||||
@@ -2339,15 +2340,18 @@ xhci_create_secondary_interrupter(struct usb_hcd *hcd, unsigned int segs,
|
||||
return NULL;
|
||||
|
||||
spin_lock_irq(&xhci->lock);
|
||||
|
||||
/* Find available secondary interrupter, interrupter 0 is reserved for primary */
|
||||
for (i = 1; i < xhci->max_interrupters; i++) {
|
||||
if (xhci->interrupters[i] == NULL) {
|
||||
err = xhci_add_interrupter(xhci, ir, i);
|
||||
break;
|
||||
if (!intr_num) {
|
||||
/* Find available secondary interrupter, interrupter 0 is reserved for primary */
|
||||
for (i = 1; i < xhci->max_interrupters; i++) {
|
||||
if (!xhci->interrupters[i]) {
|
||||
err = xhci_add_interrupter(xhci, ir, i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (!xhci->interrupters[intr_num])
|
||||
err = xhci_add_interrupter(xhci, ir, intr_num);
|
||||
}
|
||||
|
||||
spin_unlock_irq(&xhci->lock);
|
||||
|
||||
if (err) {
|
||||
@@ -2363,7 +2367,7 @@ xhci_create_secondary_interrupter(struct usb_hcd *hcd, unsigned int segs,
|
||||
i, imod_interval);
|
||||
|
||||
xhci_dbg(xhci, "Add secondary interrupter %d, max interrupters %d\n",
|
||||
i, xhci->max_interrupters);
|
||||
ir->intr_num, xhci->max_interrupters);
|
||||
|
||||
return ir;
|
||||
}
|
||||
|
||||
@@ -259,7 +259,7 @@ EXPORT_SYMBOL_GPL(xhci_sideband_get_event_buffer);
|
||||
*/
|
||||
int
|
||||
xhci_sideband_create_interrupter(struct xhci_sideband *sb, int num_seg,
|
||||
bool ip_autoclear, u32 imod_interval)
|
||||
bool ip_autoclear, u32 imod_interval, int intr_num)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
@@ -273,7 +273,8 @@ xhci_sideband_create_interrupter(struct xhci_sideband *sb, int num_seg,
|
||||
}
|
||||
|
||||
sb->ir = xhci_create_secondary_interrupter(xhci_to_hcd(sb->xhci),
|
||||
num_seg, imod_interval);
|
||||
num_seg, imod_interval,
|
||||
intr_num);
|
||||
if (!sb->ir) {
|
||||
ret = -ENOMEM;
|
||||
goto out;
|
||||
|
||||
@@ -1835,7 +1835,7 @@ void xhci_free_container_ctx(struct xhci_hcd *xhci,
|
||||
struct xhci_container_ctx *ctx);
|
||||
struct xhci_interrupter *
|
||||
xhci_create_secondary_interrupter(struct usb_hcd *hcd, unsigned int segs,
|
||||
u32 imod_interval);
|
||||
u32 imod_interval, unsigned int intr_num);
|
||||
void xhci_remove_secondary_interrupter(struct usb_hcd
|
||||
*hcd, struct xhci_interrupter *ir);
|
||||
void xhci_skip_sec_intr_events(struct xhci_hcd *xhci,
|
||||
|
||||
@@ -66,7 +66,7 @@ struct sg_table *
|
||||
xhci_sideband_get_event_buffer(struct xhci_sideband *sb);
|
||||
int
|
||||
xhci_sideband_create_interrupter(struct xhci_sideband *sb, int num_seg,
|
||||
bool ip_autoclear, u32 imod_interval);
|
||||
bool ip_autoclear, u32 imod_interval, int intr_num);
|
||||
void
|
||||
xhci_sideband_remove_interrupter(struct xhci_sideband *sb);
|
||||
int
|
||||
|
||||
Reference in New Issue
Block a user