Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

xhci: Add interrupt pending autoclear flag to each interrupter

Each interrupter has an interrupt pending (IP) bit that should be cleared
in the interrupt handler. This is done automatically for systems using
MSI/MSI-X interrupts.

Secondary interrupters used by audio offload may not actually trigger
MSI/MSI-X messages, so driver may need to clear the IP bit manually for
these, even if the primary interrupter IP is cleared automatically.

Add an ip_autoclear flag to each interrupter that driver can configure
when requesting an interrupt for that xHC interrupter, and move
the interrupt pending clearing code to its own helper function.
Use this ip_autoclear flag instead of the current hcd->msi_enabled
to check if IP flag is cleared by software.

[Moved ip_autoclear into xhci and set based on msi_enabled -wcheng]

Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Wesley Cheng <quic_wcheng@quicinc.com>
Link: https://lore.kernel.org/r/20240217001017.29969-2-quic_wcheng@quicinc.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Mathias Nyman and committed by
Greg Kroah-Hartman
4f022aad 88bae831

+19 -6
+15 -6
drivers/usb/host/xhci-ring.c
··· 3063 3063 xhci_write_64(xhci, temp_64, &ir->ir_set->erst_dequeue); 3064 3064 } 3065 3065 3066 + /* Clear the interrupt pending bit for a specific interrupter. */ 3067 + static void xhci_clear_interrupt_pending(struct xhci_hcd *xhci, 3068 + struct xhci_interrupter *ir) 3069 + { 3070 + if (!ir->ip_autoclear) { 3071 + u32 irq_pending; 3072 + 3073 + irq_pending = readl(&ir->ir_set->irq_pending); 3074 + irq_pending |= IMAN_IP; 3075 + writel(irq_pending, &ir->ir_set->irq_pending); 3076 + } 3077 + } 3078 + 3066 3079 /* 3067 3080 * xHCI spec says we can get an interrupt, and if the HC has an error condition, 3068 3081 * we might get bad data out of the event ring. Section 4.10.2.7 has a list of ··· 3125 3112 3126 3113 /* This is the handler of the primary interrupter */ 3127 3114 ir = xhci->interrupters[0]; 3128 - if (!hcd->msi_enabled) { 3129 - u32 irq_pending; 3130 - irq_pending = readl(&ir->ir_set->irq_pending); 3131 - irq_pending |= IMAN_IP; 3132 - writel(irq_pending, &ir->ir_set->irq_pending); 3133 - } 3115 + 3116 + xhci_clear_interrupt_pending(xhci, ir); 3134 3117 3135 3118 if (xhci->xhc_state & XHCI_STATE_DYING || 3136 3119 xhci->xhc_state & XHCI_STATE_HALTED) {
+3
drivers/usb/host/xhci.c
··· 538 538 */ 539 539 540 540 hcd->uses_new_polling = 1; 541 + if (hcd->msi_enabled) 542 + ir->ip_autoclear = true; 543 + 541 544 if (!usb_hcd_is_primary_hcd(hcd)) 542 545 return xhci_run_finished(xhci); 543 546
+1
drivers/usb/host/xhci.h
··· 1432 1432 struct xhci_erst erst; 1433 1433 struct xhci_intr_reg __iomem *ir_set; 1434 1434 unsigned int intr_num; 1435 + bool ip_autoclear; 1435 1436 /* For interrupter registers save and restore over suspend/resume */ 1436 1437 u32 s3_irq_pending; 1437 1438 u32 s3_irq_control;