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.

dmaengine: sh: rz-dmac: Move CHCTRL updates under spinlock

Both rz_dmac_disable_hw() and rz_dmac_irq_handle_channel() update the
CHCTRL register. To avoid concurrency issues when configuring
functionalities exposed by this registers, take the virtual channel lock.
All other CHCTRL updates were already protected by the same lock.

Previously, rz_dmac_disable_hw() disabled and re-enabled local IRQs, before
accessing CHCTRL registers but this does not ensure race-free access.
Remove the local IRQ disable/enable code as well.

Fixes: 5000d37042a6 ("dmaengine: sh: Add DMAC driver for RZ/G2L SoC")
Cc: stable@vger.kernel.org
Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Link: https://patch.msgid.link/20260316133252.240348-3-claudiu.beznea.uj@bp.renesas.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>

authored by

Claudiu Beznea and committed by
Vinod Koul
89a8567d abb863e6

+4 -5
+4 -5
drivers/dma/sh/rz-dmac.c
··· 297 297 { 298 298 struct dma_chan *chan = &channel->vc.chan; 299 299 struct rz_dmac *dmac = to_rz_dmac(chan->device); 300 - unsigned long flags; 301 300 302 301 dev_dbg(dmac->dev, "%s channel %d\n", __func__, channel->index); 303 302 304 - local_irq_save(flags); 305 303 rz_dmac_ch_writel(channel, CHCTRL_DEFAULT, CHCTRL, 1); 306 - local_irq_restore(flags); 307 304 } 308 305 309 306 static void rz_dmac_set_dmars_register(struct rz_dmac *dmac, int nr, u32 dmars) ··· 565 568 unsigned int i; 566 569 LIST_HEAD(head); 567 570 568 - rz_dmac_disable_hw(channel); 569 571 spin_lock_irqsave(&channel->vc.lock, flags); 572 + rz_dmac_disable_hw(channel); 570 573 for (i = 0; i < DMAC_NR_LMDESC; i++) 571 574 lmdesc[i].header = 0; 572 575 ··· 703 706 if (chstat & CHSTAT_ER) { 704 707 dev_err(dmac->dev, "DMAC err CHSTAT_%d = %08X\n", 705 708 channel->index, chstat); 706 - rz_dmac_ch_writel(channel, CHCTRL_DEFAULT, CHCTRL, 1); 709 + 710 + scoped_guard(spinlock_irqsave, &channel->vc.lock) 711 + rz_dmac_ch_writel(channel, CHCTRL_DEFAULT, CHCTRL, 1); 707 712 goto done; 708 713 } 709 714