Hi Claudiu,
-----Original Message----- From: Claudiu claudiu.beznea@tuxon.dev Sent: 17 December 2025 13:52 To: vkoul@kernel.org; Fabrizio Castro fabrizio.castro.jz@renesas.com; Biju Das biju.das.jz@bp.renesas.com; geert+renesas@glider.be; Prabhakar Mahadev Lad <prabhakar.mahadev- lad.rj@bp.renesas.com> Cc: Claudiu.Beznea claudiu.beznea@tuxon.dev; dmaengine@vger.kernel.org; linux- kernel@vger.kernel.org; Claudiu Beznea claudiu.beznea.uj@bp.renesas.com; stable@vger.kernel.org Subject: [PATCH v5 2/6] dmaengine: sh: rz-dmac: Move all CHCTRL updates under spinlock
From: Claudiu Beznea claudiu.beznea.uj@bp.renesas.com
Both rz_dmac_disable_hw() and rz_dmac_irq_handle_channel() update the CHCTRL registers. To avoid concurrency issues when updating these 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.
Maybe I am missing some thing here about race-access:
local_irq_save(flags); rz_dmac_ch_writel(channel, CHCTRL_DEFAULT, CHCTRL, 1);
After local_irq_save there won't be any IRQ. So how there can be a race in IRQ handler.
rz_dmac_irq_handle_channel(){
rz_dmac_ch_writel(channel, chctrl | CHCTRL_CLREND, CHCTRL, 1); }
Now adding a vc lock inside interrupt handler the IRQ routine is serialized
Cheers, Biju