ALSA: hda: Clear RIRB status before reading WP
PATCH 1/1 ALSA: hda: Clear RIRB status before reading WP
From: Mohan Kumar <[email protected]>
RIRB interrupt status getting cleared after the write pointer is read causes a race condition, where last response(s) into RIRB may remain unserviced by IRQ, eventually causing azx_rirb_get_response to fall back to polling mode. Clearing the RIRB interrupt status ahead of write pointer access ensures that this condition is avoided.
--- sound/pci/hda/hda_controller.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
sound/pci/hda/hda_controller.c +9 -2
@@ -1110,16 +1110,23 @@ irqreturn_t azx_interrupt(int irq, void *dev_id)if (snd_hdac_bus_handle_stream_irq (bus, status, stream_update)) active = true; -/* clear rirb int */ status =azx_readb (chip,RIRBSTS );if (status &RIRB_INT_MASK ) { +/* +* Clearing the interrupt status here ensures that no +* interrupt gets masked after the RIRB wp is read in +* snd_hdac_bus_update_rirb. This avoids a possible +* race condition where codec response in RIRB may +* remain unserviced by IRQ, eventually falling back +* to polling mode in azx_rirb_get_response. +*/ +azx_writeb (chip,RIRBSTS ,RIRB_INT_MASK ); active = true;if (status &RIRB_INT_RESPONSE ) {if (chip->driver_caps &AZX_DCAPS_CTX_WORKAROUND )udelay (80 );snd_hdac_bus_update_rirb (bus); } -azx_writeb (chip,RIRBSTS ,RIRB_INT_MASK ); } }while (active && ++repeat <10 );
Signature · 1 line
2.7.4
Takashi Iwai
AppliedQuoted 11 lines · Viswanath L
From: Mohan Kumar <[email protected]>
RIRB interrupt status getting cleared after the write pointer is read causes a race condition, where last response(s) into RIRB may remain unserviced by IRQ, eventually causing
azx_rirb_get_responseto fall back to polling mode. Clearing the RIRB interrupt status ahead of write pointer access ensures that this condition is avoided.Signed-off-by Mohan Kumar <[email protected]>Signed-off-by Viswanath L <[email protected]>
Applied, thanks.
Takashi