From nobody Mon Feb 9 09:54:24 2026 Received: from mail-wm1-f42.google.com (mail-wm1-f42.google.com [209.85.128.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D74FD4B9E54 for ; Thu, 8 Jan 2026 10:36:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767868589; cv=none; b=sXT9esoZZTi3Z/PiXPHAqiT4mEiEcyMJNNd2PkwE9madJRIQl/a9d9LxINuSNoHrDms5vDWxbyUZ9k+q0wM0ptQXOCg/+6pq4omO4DE2O/F5O1gb20x2MEFq4QorrwuWILnXss9v4o9d/BZtMdQGnt3n34PzweVX2G/KzTRR3AA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767868589; c=relaxed/simple; bh=JyEbq8Tn/Uo5/rzkdivZJn8DiJudAQoXSYyRKYcviZg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=DlLAImLBFYteEQiHS1rU9JyXA49aPQJ10zGA7nDGj6doSxojftbBnIFHiWVzodCZcw6kWHTTMMy+qRIbrc51iqvAY8zk2O5/n7wF386fMIkgBTf4pZQsoMMEAs6DRRq5fySTlMPbZeWyhoe/aH8OUPd907zSSsL6MSKlfH+rSqo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tuxon.dev; spf=pass smtp.mailfrom=tuxon.dev; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b=DR9o07p6; arc=none smtp.client-ip=209.85.128.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tuxon.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=tuxon.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b="DR9o07p6" Received: by mail-wm1-f42.google.com with SMTP id 5b1f17b1804b1-4779adb38d3so21047525e9.2 for ; Thu, 08 Jan 2026 02:36:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxon.dev; s=google; t=1767868584; x=1768473384; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=tJKnYHH5iFZVhNa979c5sT22P1hY4dxyKYzImPI2Bi0=; b=DR9o07p64tbezMxLYgt9ijnbUpSDNT+02CyrkEiBtu9P3BLXV06RGmViY/nijp1YDY dZX4o8uOEBHtpv9zbHVR4Askt9wWTGMA+gte06xxBvmN7hAlU1DkjRgq/qxcNXLP21Sn ypuKN2vtQMgDxssyyUGc9yNAEnvlmHesiOk8Io6EzmkrmFUIkSeIfyvu0WKelQK2mjLG 49lxo2nEoabXROTamyscDWxCMcixIDA8nFzYtDhINBPyw4ZVhM5frKevD0tC+JXU12Fs +nyg/P4zP38jvs17m7UPBRSQwJTkp0BEn77Hp2ZgQabPMEYCpNvHJeGBfYIZAEUVgRDO 9j3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767868584; x=1768473384; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=tJKnYHH5iFZVhNa979c5sT22P1hY4dxyKYzImPI2Bi0=; b=UxHUg6mEnr8IibgV+d3vD7CWzBquYlY0QOmBUY0jTeDGLOZ1i3ILJz/ZFZVueA+4/9 9ZbZaviWU7c8+EHSXMcMaqQyygdfFFbO2sYo+hVOdnsotz66hL8HvB1/oXaa47aWNIOd Bk61AsAEJsUa3RiAyPEUiMgLIhJa/1TEjJgveEczSGgVNwW1GI+lJx79Nd10n2hyvjJV jkNMAlqEJLz+XC6ocfqp38LFKyGABcMI7GUcoXalpKZCel8WsT6G4wU8FeDA8TaFaaZ5 Zp7gFhWvSk5FG5BRfu9dacg799R9bvIjPXOalYybT8Rw7m5s98SKYkoVw8wjKg+GH+Zr XNGQ== X-Forwarded-Encrypted: i=1; AJvYcCWMnmlk4rPTrq5cN7KDcaxGuc5hotM1gmVj3K+sXbinKEoCJIaPpIVomA3w+SdrrZZealeJgXTZWDlyPQA=@vger.kernel.org X-Gm-Message-State: AOJu0YzhhOXOQpUGzc+WxTc2lGp5jT9UqgtfEr8Yx/iP21BmcIFZD1Gd MkD15c1ldJv/6e8GJGw+A/m8kOgTnb8fyKBw0MTQ2tJm0rNBQ6dc0vOa0B/4gNhL5eY= X-Gm-Gg: AY/fxX7ZilNf44oQ/4GH39gk/t+4asrUHPj3e+4B0DPWGKKPZmOzzjp8jas58EfdnQk K5PEyJR/Z8lm54Dk9GxEksHFdSmt/r4PRGjxR5oA/lGWxNR9IybVJxOLDGqe/E4AGIK1PAX9I7g xugFtI61eZd0PGT7/mK8t4w12SN2p6PtVIx+ol68fD/H+ErdHysB8tc48mp0aPswzZ/G9E8iaOj 6SiVRv67YqwYBURnIZr4u5g88DbCu6De7LA8UhJAwNT0QEjCUs0TpiCLue34dfr+ASsMMVYgFBh Vbxc3O36Rm0e9ShzpsDagPYVXfCupikDn3z46obPaA8QAiiKDgzTp8ZgO4UlEB7HtMX56dnvPdO NwVLVyYv0mxJRDBOt9lRKS6q9aI6tdXgIbU89moSFhn6YpVZ+/WozscFAnYfQKaGSX73rKfFXqh Nfo/nhjfoRomB1e7vhrTvvs8UfCH2zdrWusnwcyO4= X-Google-Smtp-Source: AGHT+IHIn4DooV1mtjazn7yQKWIVyIXO9iOYz2GWsNA8OQ/d9RWgsYlYP49zJM9rtUcU0rRpnde25A== X-Received: by 2002:a05:600c:4f0e:b0:470:fe3c:a3b7 with SMTP id 5b1f17b1804b1-47d84b1a3dfmr68260285e9.5.1767868583679; Thu, 08 Jan 2026 02:36:23 -0800 (PST) Received: from claudiu-X670E-Pro-RS.. ([82.78.167.17]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-432bd5ee243sm15399033f8f.31.2026.01.08.02.36.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Jan 2026 02:36:23 -0800 (PST) From: Claudiu X-Google-Original-From: Claudiu To: vkoul@kernel.org, fabrizio.castro.jz@renesas.com, geert+renesas@glider.be, prabhakar.mahadev-lad.rj@bp.renesas.com, biju.das.jz@bp.renesas.com Cc: claudiu.beznea@tuxon.dev, dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v7 1/8] dmaengine: sh: rz-dmac: Protect the driver specific lists Date: Thu, 8 Jan 2026 12:36:13 +0200 Message-ID: <20260108103620.3482147-2-claudiu.beznea.uj@bp.renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260108103620.3482147-1-claudiu.beznea.uj@bp.renesas.com> References: <20260108103620.3482147-1-claudiu.beznea.uj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Claudiu Beznea The driver lists (ld_free, ld_queue) are used in rz_dmac_free_chan_resources(), rz_dmac_terminate_all(), rz_dmac_issue_pending(), and rz_dmac_irq_handler_thread(), all under the virtual channel lock. Take the same lock in rz_dmac_prep_slave_sg() and rz_dmac_prep_dma_memcpy() as well to avoid concurrency issues, since these functions also check whether the lists are empty and update or remove list entries. Fixes: 5000d37042a6 ("dmaengine: sh: Add DMAC driver for RZ/G2L SoC") Cc: stable@vger.kernel.org Signed-off-by: Claudiu Beznea --- Changes in v7: - none Changes in v6: - none Changes in v5: - none, this patch is new drivers/dma/sh/rz-dmac.c | 57 ++++++++++++++++++++++------------------ 1 file changed, 32 insertions(+), 25 deletions(-) diff --git a/drivers/dma/sh/rz-dmac.c b/drivers/dma/sh/rz-dmac.c index 9e5f088355e2..c8e3d9f77b8a 100644 --- a/drivers/dma/sh/rz-dmac.c +++ b/drivers/dma/sh/rz-dmac.c @@ -10,6 +10,7 @@ */ =20 #include +#include #include #include #include @@ -448,6 +449,7 @@ static int rz_dmac_alloc_chan_resources(struct dma_chan= *chan) if (!desc) break; =20 + /* No need to lock. This is called only for the 1st client. */ list_add_tail(&desc->node, &channel->ld_free); channel->descs_allocated++; } @@ -503,18 +505,21 @@ rz_dmac_prep_dma_memcpy(struct dma_chan *chan, dma_ad= dr_t dest, dma_addr_t src, dev_dbg(dmac->dev, "%s channel: %d src=3D0x%pad dst=3D0x%pad len=3D%zu\n", __func__, channel->index, &src, &dest, len); =20 - if (list_empty(&channel->ld_free)) - return NULL; + scoped_guard(spinlock_irqsave, &channel->vc.lock) { + if (list_empty(&channel->ld_free)) + return NULL; + + desc =3D list_first_entry(&channel->ld_free, struct rz_dmac_desc, node); =20 - desc =3D list_first_entry(&channel->ld_free, struct rz_dmac_desc, node); + desc->type =3D RZ_DMAC_DESC_MEMCPY; + desc->src =3D src; + desc->dest =3D dest; + desc->len =3D len; + desc->direction =3D DMA_MEM_TO_MEM; =20 - desc->type =3D RZ_DMAC_DESC_MEMCPY; - desc->src =3D src; - desc->dest =3D dest; - desc->len =3D len; - desc->direction =3D DMA_MEM_TO_MEM; + list_move_tail(channel->ld_free.next, &channel->ld_queue); + } =20 - list_move_tail(channel->ld_free.next, &channel->ld_queue); return vchan_tx_prep(&channel->vc, &desc->vd, flags); } =20 @@ -530,27 +535,29 @@ rz_dmac_prep_slave_sg(struct dma_chan *chan, struct s= catterlist *sgl, int dma_length =3D 0; int i =3D 0; =20 - if (list_empty(&channel->ld_free)) - return NULL; + scoped_guard(spinlock_irqsave, &channel->vc.lock) { + if (list_empty(&channel->ld_free)) + return NULL; =20 - desc =3D list_first_entry(&channel->ld_free, struct rz_dmac_desc, node); + desc =3D list_first_entry(&channel->ld_free, struct rz_dmac_desc, node); =20 - for_each_sg(sgl, sg, sg_len, i) { - dma_length +=3D sg_dma_len(sg); - } + for_each_sg(sgl, sg, sg_len, i) + dma_length +=3D sg_dma_len(sg); =20 - desc->type =3D RZ_DMAC_DESC_SLAVE_SG; - desc->sg =3D sgl; - desc->sgcount =3D sg_len; - desc->len =3D dma_length; - desc->direction =3D direction; + desc->type =3D RZ_DMAC_DESC_SLAVE_SG; + desc->sg =3D sgl; + desc->sgcount =3D sg_len; + desc->len =3D dma_length; + desc->direction =3D direction; =20 - if (direction =3D=3D DMA_DEV_TO_MEM) - desc->src =3D channel->src_per_address; - else - desc->dest =3D channel->dst_per_address; + if (direction =3D=3D DMA_DEV_TO_MEM) + desc->src =3D channel->src_per_address; + else + desc->dest =3D channel->dst_per_address; + + list_move_tail(channel->ld_free.next, &channel->ld_queue); + } =20 - list_move_tail(channel->ld_free.next, &channel->ld_queue); return vchan_tx_prep(&channel->vc, &desc->vd, flags); } =20 --=20 2.43.0 From nobody Mon Feb 9 09:54:24 2026 Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4B3884B9E6D for ; Thu, 8 Jan 2026 10:36:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767868592; cv=none; b=s6tPQYNCJUI3+iE1LAFi/dIov4rx5mGteeF6n4ogcOUz1vDo6ABQA+OnrvULvArEjDPTe226nCfrrQc58nQ+iP37qdPGO1EEwZ4nK428IiLDV/lC+zxp6oV8f+CTIUFj3qk7Lzi/GsDZ7gA1BxT2hnHxj5HgkqWUir2pNjZVqdQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767868592; c=relaxed/simple; bh=fyzinmoZgqFGQzgRbE/I7nHy5ErOVP8KVl3+X5XcpuE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=LHVDxlQYWfi/XXe8yPG50cGkQMstBWtx+2mtBIfdg8AYVJR8Zt59Z9wdZ1uQPYX12hdElG0WmftdOu6GE3M0+jNnhmqokavxNoEgdu46pIa/zqiD9Oa1qIOY+9PKeKao+DcQMmaEaELVLZtcpZrU5E1VbvvNPRV3/+Yt/OPxJZc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tuxon.dev; spf=pass smtp.mailfrom=tuxon.dev; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b=iUXeLhAG; arc=none smtp.client-ip=209.85.128.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tuxon.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=tuxon.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b="iUXeLhAG" Received: by mail-wm1-f44.google.com with SMTP id 5b1f17b1804b1-4779a4fc95aso8836305e9.1 for ; Thu, 08 Jan 2026 02:36:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxon.dev; s=google; t=1767868585; x=1768473385; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=MlWiT31f3SgtmE+UZqtSfS3Vhw2y+XyQEAsJHfCJGJM=; b=iUXeLhAGI09KUOPeDeh8Zl1t3KTkrzO/7Zo6eptFVMVvnKbjOdutNUKNqbJWY70fq7 CtEFLjlC+RurTj9Spe/BZuwt8u63uKKMPbiPOFximl4d6n1XDDxBScnfIlXyfepWEncH 7lKVnZ6yR2hHNbkF7qw5fwVjG5FdLWvVfqeynvHXHB5gnFhbNPOj+2WCiC5dhdC/IbAJ nGUbpMUQILA0GFQDhBw9lPHuYH8HHdhI+iDdnVgEV0jJlPSmEc9H0YnE/GbooAHtovso bKhHXMt67GzrX1zfR0Hf0MFZ6phJh/JbDPPpgaUkoWp/q3fm12pMRzOvrH2SPeebTrEg bxhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767868585; x=1768473385; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=MlWiT31f3SgtmE+UZqtSfS3Vhw2y+XyQEAsJHfCJGJM=; b=gYAHV/NdEFSwQxR5NXF04rIKCYo4elQ+ze5j3tPkWUjmSwiGR/Sg5Dtv3d9Q+hdXTA HBGlMEIe7MAqK/trYvHjoRG9N0wqfN4NPqGlYgziySrncc2b4JkL6V/oMbD65SPTzpUK mV0lrTEV7ayy2LjYMkKIa/lF42WeQppvT4zHYEBI75aYimYO3SDkLmb7gsuEnk/fm85W M3wpNDvfc1yBD+VNr2PQdOheDn0/6EpHk5LfI1AfUkfGefajNm5reV9YfN4FGhYodAzu VBC+rlA5m+kpMKiU5CL9qYBGUg6rBxdiBN5GFxvrkWuJRn72BgSWHu0a5F9xaUj/In3V WgQQ== X-Forwarded-Encrypted: i=1; AJvYcCWUSrunMEXz9RhL590ju4vm05X9JWO3wdo1mIura+cFzpJBipBaxYG98THNUf8nNi0hetDKavAJCTMlQSk=@vger.kernel.org X-Gm-Message-State: AOJu0Yy5idJ0gCvn/0Bo2/jdCbSif7JURH7kV+4cjFp2KPtd+u/l72wL Jn+o6VZbebAHLyaonytJ1w8qaDejrhlTfd+jnfnGJRAw6fw1DzlRcW3oB0P4Td6rOO0= X-Gm-Gg: AY/fxX6V+1WD7YFgDrYE636czYzVpQHUyIoLYXBfBhLEVmyjjhVhny/FvhGKDSVbZLM N56vRsTghrbY7RFeNCne0HQAVWDo7B8N4UGon5xEiga8Ju1qzok9pwvQESEBi/XfzY8cJ/6VwWA 73bmVcOZPeS3KgXnsFbj3yQScKnSmLZUghxqmeFGNSNFFFkXX2phRMu4fRtXR+7431o9AWPHjPc 9fejB1GW0B/ECt45ECzww8t330BzDROliOfVbArSDpaa1M+yZMcOVyeJk7KMV4NtTgG7poeFNMJ cBXk988ar7B7gO7riDclYrDhL1Mc5VFOFtPCoK0m1njPKs4InbTp0aKQ49aclsZnkMYQwRxOWml zG5a2LEoQsPw+mqHnSOksiuXvPsSjwjqxNz8xaeDPux8nXDp7kPRsvFR53oEPSgDfGP6cDb6BvF AFUQRxFAiMHp9VVPX4A9CeVOFBeiGemwTgNjkG0c4= X-Google-Smtp-Source: AGHT+IF+EBHPhz3JKj5aczdkdvcVVpNzewaaim609iBvVtqQDrzRGqQxcaDVKwG6DKoC5k9Zk7ZRjA== X-Received: by 2002:a05:600c:8b44:b0:477:7588:c8cc with SMTP id 5b1f17b1804b1-47d7f410cc8mr113421185e9.7.1767868584926; Thu, 08 Jan 2026 02:36:24 -0800 (PST) Received: from claudiu-X670E-Pro-RS.. ([82.78.167.17]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-432bd5ee243sm15399033f8f.31.2026.01.08.02.36.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Jan 2026 02:36:24 -0800 (PST) From: Claudiu X-Google-Original-From: Claudiu To: vkoul@kernel.org, fabrizio.castro.jz@renesas.com, geert+renesas@glider.be, prabhakar.mahadev-lad.rj@bp.renesas.com, biju.das.jz@bp.renesas.com Cc: claudiu.beznea@tuxon.dev, dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v7 2/8] dmaengine: sh: rz-dmac: Move CHCTRL updates under spinlock Date: Thu, 8 Jan 2026 12:36:14 +0200 Message-ID: <20260108103620.3482147-3-claudiu.beznea.uj@bp.renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260108103620.3482147-1-claudiu.beznea.uj@bp.renesas.com> References: <20260108103620.3482147-1-claudiu.beznea.uj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Claudiu Beznea 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 Signed-off-by: Claudiu Beznea --- Changes in v7: - collected tags Changes in v6: - update patch title and description - in rz_dmac_irq_handle_channel() lock only around the updates for the error path and continued using the vc lock as this is the error path and the channel will anyway be stopped; this avoids updating the code with another lock as it was suggested in the review process of v5 and the code remain simpler for a fix, w/o any impact on performance Changes in v5: - none, this patch is new drivers/dma/sh/rz-dmac.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/dma/sh/rz-dmac.c b/drivers/dma/sh/rz-dmac.c index c8e3d9f77b8a..818d1ef6f0bf 100644 --- a/drivers/dma/sh/rz-dmac.c +++ b/drivers/dma/sh/rz-dmac.c @@ -298,13 +298,10 @@ static void rz_dmac_disable_hw(struct rz_dmac_chan *c= hannel) { struct dma_chan *chan =3D &channel->vc.chan; struct rz_dmac *dmac =3D to_rz_dmac(chan->device); - unsigned long flags; =20 dev_dbg(dmac->dev, "%s channel %d\n", __func__, channel->index); =20 - local_irq_save(flags); rz_dmac_ch_writel(channel, CHCTRL_DEFAULT, CHCTRL, 1); - local_irq_restore(flags); } =20 static void rz_dmac_set_dmars_register(struct rz_dmac *dmac, int nr, u32 d= mars) @@ -569,8 +566,8 @@ static int rz_dmac_terminate_all(struct dma_chan *chan) unsigned int i; LIST_HEAD(head); =20 - rz_dmac_disable_hw(channel); spin_lock_irqsave(&channel->vc.lock, flags); + rz_dmac_disable_hw(channel); for (i =3D 0; i < DMAC_NR_LMDESC; i++) lmdesc[i].header =3D 0; =20 @@ -707,7 +704,9 @@ static void rz_dmac_irq_handle_channel(struct rz_dmac_c= han *channel) if (chstat & CHSTAT_ER) { dev_err(dmac->dev, "DMAC err CHSTAT_%d =3D %08X\n", channel->index, chstat); - rz_dmac_ch_writel(channel, CHCTRL_DEFAULT, CHCTRL, 1); + + scoped_guard(spinlock_irqsave, &channel->vc.lock) + rz_dmac_ch_writel(channel, CHCTRL_DEFAULT, CHCTRL, 1); goto done; } =20 --=20 2.43.0 From nobody Mon Feb 9 09:54:24 2026 Received: from mail-wr1-f45.google.com (mail-wr1-f45.google.com [209.85.221.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 597EF4BB0A6 for ; Thu, 8 Jan 2026 10:36:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767868600; cv=none; b=MLQwHdGZSSfq1rB45UgpZkx5fD8rziVpQ1xmZRoc77pLab2L1/oWKPhHxX2EbTsx7KXHHiuEC4xVmfsgYZjHTxftNDuZ9AXk2w8IiEcr9DaXQyCGoykfHLwGSLADXU0xc2yRbY6GaarrmNuVSdTGe28w6Mhhs6fTf6ME1HBgVDg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767868600; c=relaxed/simple; bh=HETVrG2xXKuP/JPJ6ag7HnrtvAYHmwaCMinWzd9CPyw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=naPXmhy9DVvshPIBftc6eUm/EuXPmBC3XQ//F52uXOTLBWwV4fzZN6zskli5D0ZZkDDKtq4vQn3uC+fomMRmFjAQIld0DSsh6Q6lcbPj/A0vDjpTq+/tnGqGzvBinpgknqSlXxv+jLheI2ICNFwbnehSOy5WaS0vQZOxP08ls6I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tuxon.dev; spf=pass smtp.mailfrom=tuxon.dev; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b=rSz7bJTD; arc=none smtp.client-ip=209.85.221.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tuxon.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=tuxon.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b="rSz7bJTD" Received: by mail-wr1-f45.google.com with SMTP id ffacd0b85a97d-4327778df7fso1795860f8f.3 for ; Thu, 08 Jan 2026 02:36:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxon.dev; s=google; t=1767868586; x=1768473386; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ZBsL+5U9mBQbUpXgenVPfjce381EbAdS3YvmQ5cZZAE=; b=rSz7bJTDHxYiHge7Dky7s3miRn37Re71RiDqQLpmOA9l5498YzGQSenEgwqYzhMTkh St0CDCuE7cllfVYGsathm6hD05jto9xKTgRqR/MfqZ+0D9K/Q6Achl5N5323w6o11uaI rU2M8PZdM6eB2T/0Arm62wy93a72hwuvkIGEV4oN6aea5wFY6NIP5RRqdUj8RJ1b/014 UlT9nHQtHVguUTUsKzDTxHPI1abwmgmnIAlu5KUHv6AiACLSYgrESXymQoceJKlIhJC2 G6rjWJ0V0G8cOiQOzY4qhGytmGigvP3PR5x+8lMny3VBGJ74UyZlE5Gp9dw3yjWmMuiJ iunA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767868586; x=1768473386; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=ZBsL+5U9mBQbUpXgenVPfjce381EbAdS3YvmQ5cZZAE=; b=qCt1+daEzn2jrWJ6cNVbcC5EbF7g2mTlG4PKKEH/IzJrpf7V//6cAwgQtVhK1hQqp3 JNQaiPwGRWJdWxFvAk/fij++mzSgyQwl2hqBTn5UmtJJDL5X1PY6Zu7cd5Fmw4sTn8m5 6e1CYG0CsVKm0H/wa42qjvUU848bLPiYPh8Yo0t8uVpxfaQf58KRNnJTICCutXaYaw8x fOjH3bSulgb+mescdUxlJG4dWkEh7BD0SwYd1/wRhWqyQn6DcKKPvxvjmKYd92le9yB9 MQuxYM6hLQoWNmH4/iGaI14p/av3d1T5aRwgLfiwXPRKdh4g7Wkr9G/+5kMya+Kig2zB JaGw== X-Forwarded-Encrypted: i=1; AJvYcCWN8Tg9lwP9IHzOWu7rRk3fLWXD/C4DVhmjpzXTb+en046e52bmx8hsAgptnvrunWgGY+m8ivqYJcHFuug=@vger.kernel.org X-Gm-Message-State: AOJu0Yzq3TFBHfV6HpmZ2Xg58J7uIeG8+wX87+A7w5LNAymmh8fOop6L x7ThyOT6n0Be4Sxcn0oNCajL72asPNVkGHZPFCOF6UOATS7ETue9wCuTi8w4vx3AcGs= X-Gm-Gg: AY/fxX5fyYqFN2bs9KIksztiq38zSu2Vf+98ws0bcqb9wY+vi3hkCRnKaKhlht0P85O WxYNXHjEu1y7klZqad0r6PJzlasfvILkokfKnWypwqU45Zmp6LU2fCVptIyRwNTmjWwTIRkFLqT X2dlrP1K8kfh8ZrOQzWkwwAE/ghfgmVKSzQmrt0Tt8A36JQSRuIoeEHUDNg6Bfo0qjizKyGUdpw R+bu8IkeRbzN4IUoE6WV88/OH/DlfymBdfOoRofyfDoCSoAP+9x09whoU83AiYGIGtIp1+5TDFu 6swsmu9KIUGs+9Z5RjQYraaTlEV9/RIwVYm6IH382qj+2lM65R0aZVHoPQPLk01v28LtXcOuPsQ KvEhZ1J2PDemloBw4QxyXYzlTnN/JXE6rChQYbDuet/i6AqF9Eq+yPAcrLELmN2WUcUIltQFhcy ugbvMSUMJf4wV5UgtCBrTFpI3Q6AR84XZ8ieE1THE= X-Google-Smtp-Source: AGHT+IFN6hOBhvkM+I+ctFJfN3aGqoA1MUMOHG5e0LucOvl5KGhtkxH/erS6N+bFoWDZhu8EOHkqFA== X-Received: by 2002:a05:6000:2913:b0:42f:b871:66b9 with SMTP id ffacd0b85a97d-432c3778dc8mr7189927f8f.56.1767868586329; Thu, 08 Jan 2026 02:36:26 -0800 (PST) Received: from claudiu-X670E-Pro-RS.. ([82.78.167.17]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-432bd5ee243sm15399033f8f.31.2026.01.08.02.36.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Jan 2026 02:36:25 -0800 (PST) From: Claudiu X-Google-Original-From: Claudiu To: vkoul@kernel.org, fabrizio.castro.jz@renesas.com, geert+renesas@glider.be, prabhakar.mahadev-lad.rj@bp.renesas.com, biju.das.jz@bp.renesas.com Cc: claudiu.beznea@tuxon.dev, dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v7 3/8] dmaengine: sh: rz-dmac: Drop read of CHCTRL register Date: Thu, 8 Jan 2026 12:36:15 +0200 Message-ID: <20260108103620.3482147-4-claudiu.beznea.uj@bp.renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260108103620.3482147-1-claudiu.beznea.uj@bp.renesas.com> References: <20260108103620.3482147-1-claudiu.beznea.uj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Claudiu Beznea The CHCTRL register has 11 bits that can be updated by software. The documentation for all these bits states the following: - A read operation results in 0 being read - Writing zero does not affect the operation All bits in the CHCTRL register accessible by software are set and clear bits. The documentation for the CLREND bit of CHCTRL states: Setting this bit to 1 can clear the END bit of the CHSTAT_n/nS register. Also, the DMA transfer end interrupt is cleared. An attempt to read this bit results in 0 being read. 1: Clears the END bit. 0: Does not affect the operation. Since writing zero to any bit in this register does not affect controller operation and reads always return zero, there is no need to perform read-modify-write accesses to set the CLREND bit. Drop the read of the CHCTRL register. Also, since setting the CLREND bit does not interact with other functionalities exposed through this register and only clears the END interrupt, there is no need to lock around this operation. Add a comment to document this. Reviewed-by: Biju Das Signed-off-by: Claudiu Beznea --- Changes in v7: - collected tags Changes in v6: - none, this patch is new drivers/dma/sh/rz-dmac.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/dma/sh/rz-dmac.c b/drivers/dma/sh/rz-dmac.c index 818d1ef6f0bf..43a772e4478c 100644 --- a/drivers/dma/sh/rz-dmac.c +++ b/drivers/dma/sh/rz-dmac.c @@ -698,7 +698,7 @@ static void rz_dmac_irq_handle_channel(struct rz_dmac_c= han *channel) { struct dma_chan *chan =3D &channel->vc.chan; struct rz_dmac *dmac =3D to_rz_dmac(chan->device); - u32 chstat, chctrl; + u32 chstat; =20 chstat =3D rz_dmac_ch_readl(channel, CHSTAT, 1); if (chstat & CHSTAT_ER) { @@ -710,8 +710,11 @@ static void rz_dmac_irq_handle_channel(struct rz_dmac_= chan *channel) goto done; } =20 - chctrl =3D rz_dmac_ch_readl(channel, CHCTRL, 1); - rz_dmac_ch_writel(channel, chctrl | CHCTRL_CLREND, CHCTRL, 1); + /* + * No need to lock. This just clears the END interrupt. Writing + * zeros to CHCTRL is just ignored by HW. + */ + rz_dmac_ch_writel(channel, CHCTRL_CLREND, CHCTRL, 1); done: return; } --=20 2.43.0 From nobody Mon Feb 9 09:54:24 2026 Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3BBE44B8DF0 for ; Thu, 8 Jan 2026 10:36:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767868596; cv=none; b=CFqCiCwvZDqypCKrLVkBPdsQTUfP5mYlOreu2pF7jRdjk57dpVK2FgCYcrK9CT6UvFm/cUv+0NtAz2ubGPMKA5aL8GsEDC/vMd5qHGjD5otM9U5k0o7vV/4rKthC+PQy9JwuaJlxq7ixTrdKOEah2tNksPo7qXAMN8Qml7FDgAQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767868596; c=relaxed/simple; bh=cKZhuVFO1q2xfKQugBDH5m/0EIcp/48jwQv4HFV08PA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=JjUtUedk0H92XPCZ3c3G10Q8cEp9aHTa/gqTY3SHd8Hl5zsYODIOTqCo2ziXRFVN/DM896/giZtrH9Nt7Rde5cJArRw8Lg4OQ2ZyP/MiLRJ7iT6cXwgp//bTTrjQ5EunLpn+/mvJ3MybIKI7a2puOcFXtt05F7NupyABjIWHd60= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tuxon.dev; spf=pass smtp.mailfrom=tuxon.dev; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b=gdjyhQKW; arc=none smtp.client-ip=209.85.128.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tuxon.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=tuxon.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b="gdjyhQKW" Received: by mail-wm1-f54.google.com with SMTP id 5b1f17b1804b1-477a2ab455fso28430435e9.3 for ; Thu, 08 Jan 2026 02:36:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxon.dev; s=google; t=1767868587; x=1768473387; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=YLrl6GiIePCtteP1jR08IO97Jd422famCxZr1GzvOdM=; b=gdjyhQKWBvGcyhYJr5XKaFkbYr7XCHoS10ATr4Us6K9RX0igBlf7PTRJ3M4VaiYS4w c+sV4PoAmdR5cqCoC04U+zZpCtU+gedapZKLN0mVeKSDZguK+UWiC5pqpz1sByPqTysD YOMfAgmFCh9uSCXpCnWOy8RpAUf/BOM3PzhoP5LwY/9WvmX4FdWbFnUZUlaSSNvwfAzk LY99KpKjFgNXCd1Nzp3k0a/7LtnqLZ+4DNykiajhb+o3rWHMZuZdiRY0LjphDqzGCsIs byOeM8pKlNZkznHGxw+fSpkMuTFQe1LakHlCUnaxvWnUkb7rQP2YNv3v+p0SFX9qD0cb qflg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767868587; x=1768473387; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=YLrl6GiIePCtteP1jR08IO97Jd422famCxZr1GzvOdM=; b=ZnjzqiXfnW0GZKs9ZtEQ0GE2cb6gmGdp8aXJIriEg/Pgr820K+Of8WR0QB5cymjl5/ JZDuAJUq7vyn2sZqCp2+8I03GANZuUBAOTb/E+TbMOQmg8PXRJRHWvfhXMqjyUZdgZDe JNznPAxCCklzW906UNqn1syf/JXOSXtAzqTzHOQt9wvdftUsBG+CsxcPR9mZ71J2Gkk0 /cMHe/i6zsHUKT/VVmIoNpVorE7/Reoxo7UqlQW2vh2oLqtNCjykssnnCGoPo66vyGBY UpLrVfJRyiOh4VhObr8LFMipGrxT6f5NB4AqtdXx2ODhCxha7FdjqXLpFX0xNo483Mt3 e1zQ== X-Forwarded-Encrypted: i=1; AJvYcCW5OL8kxjvP1EmJyLqSNQK4gAw7Yx2iF9y3iu5DwABomIK4eYdT7TrC1LLmEztgb8LIfMXVAVcsjp+PwJs=@vger.kernel.org X-Gm-Message-State: AOJu0Yxba1S3ORB4NbD9sulGTvJAQl4O5j0AUxXHNcuGFgOuvA9Nvq0R pvEfJM92tbA1R3L/HQEb+cLbSbTFOAUuWQIObbrQyk0/eSotJ1J1A1ArV//y2jE9H0U= X-Gm-Gg: AY/fxX4SK1UJCM5sP7Pnjhc5ee3iCf+46LF0qUQiaT+LeG/8jORQj+9bP95mv2c/8vu L1JfsCRHrgfN2z1bWdjGRQpLSf4FRChl7lLAcwV2jAoBrqIKAn4AV0Vwu1eEtx/7rzpfkwl/NBt u+GYU0poNEYTGnmLiPy8McegxngKQC1j1qv+TIqIwUFAPu9QVRawZZSfo+z0PdUVnfhbIiiofDx qhhqwXSGwgd4JJXCp1BPAP+6Iy6/s9+62ALOxhYnPO9XUNI7Ctl9ISgJEpMqus2CdqCoJAyrx66 2uC5AXjRe+DPfcbhRdm5KtOWkX/gKrU3MaOVyqXda6WjQgfGBKuI73GSoPGtaHarJby0ghIzDvH J7sAEpHdlJP7nFFatTR2CVzKzMGtEF0PUbLFNf4tFYW4hHVBBkt3bujdnbg2oKw6xEPdHfbwnXA AgQDbkox1YH2l7LgML3FU/pIGhjGVO7+RRKkuh6v8= X-Google-Smtp-Source: AGHT+IEeoFFEPeqUu/5dUdvSI7Ttbgabj544hEOiXsYJUJMKsoX04E+p6Y5ieTX7aNcxvUT+g71maQ== X-Received: by 2002:a5d:64e3:0:b0:430:f68f:ee7d with SMTP id ffacd0b85a97d-432c379b79cmr7333948f8f.47.1767868587539; Thu, 08 Jan 2026 02:36:27 -0800 (PST) Received: from claudiu-X670E-Pro-RS.. ([82.78.167.17]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-432bd5ee243sm15399033f8f.31.2026.01.08.02.36.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Jan 2026 02:36:27 -0800 (PST) From: Claudiu X-Google-Original-From: Claudiu To: vkoul@kernel.org, fabrizio.castro.jz@renesas.com, geert+renesas@glider.be, prabhakar.mahadev-lad.rj@bp.renesas.com, biju.das.jz@bp.renesas.com Cc: claudiu.beznea@tuxon.dev, dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v7 4/8] dmaengine: sh: rz-dmac: Drop goto instruction and label Date: Thu, 8 Jan 2026 12:36:16 +0200 Message-ID: <20260108103620.3482147-5-claudiu.beznea.uj@bp.renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260108103620.3482147-1-claudiu.beznea.uj@bp.renesas.com> References: <20260108103620.3482147-1-claudiu.beznea.uj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Claudiu Beznea There is no need to jump to the done label just to return. Return immediately. Signed-off-by: Claudiu Beznea --- Changes in v7: - none Changes in v6: - none, this patch is new drivers/dma/sh/rz-dmac.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/dma/sh/rz-dmac.c b/drivers/dma/sh/rz-dmac.c index 43a772e4478c..a2e16b52efe8 100644 --- a/drivers/dma/sh/rz-dmac.c +++ b/drivers/dma/sh/rz-dmac.c @@ -707,7 +707,7 @@ static void rz_dmac_irq_handle_channel(struct rz_dmac_c= han *channel) =20 scoped_guard(spinlock_irqsave, &channel->vc.lock) rz_dmac_ch_writel(channel, CHCTRL_DEFAULT, CHCTRL, 1); - goto done; + return; } =20 /* @@ -715,8 +715,6 @@ static void rz_dmac_irq_handle_channel(struct rz_dmac_c= han *channel) * zeros to CHCTRL is just ignored by HW. */ rz_dmac_ch_writel(channel, CHCTRL_CLREND, CHCTRL, 1); -done: - return; } =20 static irqreturn_t rz_dmac_irq_handler(int irq, void *dev_id) --=20 2.43.0 From nobody Mon Feb 9 09:54:24 2026 Received: from mail-wr1-f49.google.com (mail-wr1-f49.google.com [209.85.221.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6DD144BB0AB for ; Thu, 8 Jan 2026 10:36:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767868600; cv=none; b=NvsZhukJ2XdD4nB06On6uj7q/hlQSVKEj4EI+LNYUgpdpWq0E69xmQgGEcQWkVVi6+quRIL1ZZxtJyNgBZ80yNAavIdIlDltGhcEj/7gf+yk+ux0AX6+/Mb49Hw3w0G8y4nMhRET/94T1dEzA2tp4HkwVkbDpY+MBTA//OLZAtE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767868600; c=relaxed/simple; bh=6WsUDBB7QB7beHKPFRpBEY1bDN8cUp493GVUrOWSTok=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=aCEHEoWf54D6SAjBkGNxoawh0NopBdKQ2HIiKx/2H/cU18CSCCFyyr3FDp+toDjwdjNIYWDk1Z2pfwnudTOFvN5QZCItpB4IER/dWYJiXakB5+Mi6D/FG7+QR0wkldZ8ZHR3CFXCNGu+2Ap8uAahyTJgogdLYMzxF0ZM7djzrM8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tuxon.dev; spf=pass smtp.mailfrom=tuxon.dev; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b=F4WK8N55; arc=none smtp.client-ip=209.85.221.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tuxon.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=tuxon.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b="F4WK8N55" Received: by mail-wr1-f49.google.com with SMTP id ffacd0b85a97d-42fb6ce71c7so2312285f8f.1 for ; Thu, 08 Jan 2026 02:36:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxon.dev; s=google; t=1767868589; x=1768473389; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=e1SXKH3uUM3QnZfl6aZyV1ZJSZCTqIp00wyVEztqcnA=; b=F4WK8N55OHopne6Nm39snqKl9wIVf98Zy23Kptoef6q5194Pyvnyd5YiOy1E1Bwl3u 9trMbOvQ3+fAlEH5gZxpi9Yp1IsMGKh6dM6+xyWge8yqtxqrC7iqeToJtrpt9FwfZJ0f lus8D+JpTeitHjrjZrdnXsMJ/gEqTg6Xljsk8TaC0MMsExcLjSM8LmJXj92ITgqrQ57w 3Vqj2lV+w/krWrIcShj/O2AnftXBT9doPBDQ+d/leWhypNlp2gSw4cA0dNHrOlC5znb6 cmR24xMCKe8ikD1+u/WEOLyltDs8RTnvoXWMFvVbbhawlDybf0KWER40ZEvLwQMP1gaK o4Zg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767868589; x=1768473389; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=e1SXKH3uUM3QnZfl6aZyV1ZJSZCTqIp00wyVEztqcnA=; b=SbRYhy70MlZJd7UfnBx1dwi3jOJQEQMNHHmmg+gLi8I0oc1QbGOxH6JgArEhAFSXgN 1eaKYHdWZePypMPJ866jd9FptWydXrSoPIW1yl1LJ3e6ewW2YbCACxcZRW17HT97yS18 9yuvM0CrXAYxBfhZeSh5QLrDjtWsinOoKOaS6V1mI8UjoXgBBhKUzVmO9RSW9rrZOjFc bKOZASZ6Ti7LRoYTJIkpZXXQ7UP9cqouYnVKR9lUmlt3IIGVRVilHb6O9j1/8azjWFw7 ttym786TywQv7+Kl9D0jALBs3gCakdp1kCHxO+HHOpxDAKBIeP01K4655Y6iFT5XBYuX azTQ== X-Forwarded-Encrypted: i=1; AJvYcCWFApqlPW6LXaFZGmPt/Tq0hFkL7SWsLhA9vRvJEQ4/Ch1l5a+YKEAS7rFgRFbTYjsMNRIH3Gsv4tSZv1M=@vger.kernel.org X-Gm-Message-State: AOJu0YxeHwTnN/7scSL6UFvRQbHDh3t9UXBPX5Efgrf1a/V7uo6Y3wmo POVU0JmuKqIkDdyiLrTB8kFFNVR7yUx3YFU1JFf+mzhPex/8X7krqnnzp+PWeriFMjw= X-Gm-Gg: AY/fxX7pe5i4jj+xl9kzJDDqGUR4dHu2J/Rop9vsf8e0BF8mNOGcV3pi/xS73PbFncB ghi1imch1FHQnv+urcJgCRG1McI9eR384GcGnJHCdCF9NRH+eJVS/54GKypNwOjKKexbqZr4CZR K/FF4+C1iJ5XbqM/45nPAKUXMPonU41uTJbd67NMmDlcwBhgQbYGhVyO1ZOSbqMsHnBN6TPULnL h9HZC/8yX4wZb2UlmH7jJMjAY/Y3YUZeaWQQk8RHpi6T9M1QmJt3YZIUzl61CiS1flKYNRXLpih 8uCM0l1VVZm2ndiYZimr2Z45FAKFShQkpDUgZaihVf+ePYpwnF3DiPeI3Tfrc5td0LOLckqGhe5 +4Ga44GTr2YIg0GCEAALVCI4aF+7968tYl4UaRZ3FH8XKEiyZW6F4Zle65YB7WlRau6vQtklK4y +LbkGgEr2H6KXyHFpOhM0uMEhBYSOyZKTSqD3oxQU= X-Google-Smtp-Source: AGHT+IHsxCiYx8rmqp77oAdTH6pZgI1q5pv2nheYrLqEiaVk/RQ4pqEz3b62xkFaX7spNJWohof1hQ== X-Received: by 2002:a05:6000:2909:b0:431:84:33e with SMTP id ffacd0b85a97d-432c37d3641mr7597423f8f.50.1767868588683; Thu, 08 Jan 2026 02:36:28 -0800 (PST) Received: from claudiu-X670E-Pro-RS.. ([82.78.167.17]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-432bd5ee243sm15399033f8f.31.2026.01.08.02.36.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Jan 2026 02:36:28 -0800 (PST) From: Claudiu X-Google-Original-From: Claudiu To: vkoul@kernel.org, fabrizio.castro.jz@renesas.com, geert+renesas@glider.be, prabhakar.mahadev-lad.rj@bp.renesas.com, biju.das.jz@bp.renesas.com Cc: claudiu.beznea@tuxon.dev, dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v7 5/8] dmaengine: sh: rz-dmac: Drop unnecessary local_irq_save() call Date: Thu, 8 Jan 2026 12:36:17 +0200 Message-ID: <20260108103620.3482147-6-claudiu.beznea.uj@bp.renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260108103620.3482147-1-claudiu.beznea.uj@bp.renesas.com> References: <20260108103620.3482147-1-claudiu.beznea.uj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Claudiu Beznea rz_dmac_enable_hw() calls local_irq_save()/local_irq_restore(), but this is not needed because the callers of rz_dmac_enable_hw() already protect the critical section using spin_lock_irqsave()/spin_lock_irqrestore(). Remove the local_irq_save()/local_irq_restore() calls. Signed-off-by: Claudiu Beznea --- Changes in v7: - none Changes in v6: - none Changes in v5: - none, this patch is new drivers/dma/sh/rz-dmac.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/drivers/dma/sh/rz-dmac.c b/drivers/dma/sh/rz-dmac.c index a2e16b52efe8..72ec42fedac6 100644 --- a/drivers/dma/sh/rz-dmac.c +++ b/drivers/dma/sh/rz-dmac.c @@ -267,15 +267,12 @@ static void rz_dmac_enable_hw(struct rz_dmac_chan *ch= annel) { struct dma_chan *chan =3D &channel->vc.chan; struct rz_dmac *dmac =3D to_rz_dmac(chan->device); - unsigned long flags; u32 nxla; u32 chctrl; u32 chstat; =20 dev_dbg(dmac->dev, "%s channel %d\n", __func__, channel->index); =20 - local_irq_save(flags); - rz_dmac_lmdesc_recycle(channel); =20 nxla =3D channel->lmdesc.base_dma + @@ -290,8 +287,6 @@ static void rz_dmac_enable_hw(struct rz_dmac_chan *chan= nel) rz_dmac_ch_writel(channel, CHCTRL_SWRST, CHCTRL, 1); rz_dmac_ch_writel(channel, chctrl, CHCTRL, 1); } - - local_irq_restore(flags); } =20 static void rz_dmac_disable_hw(struct rz_dmac_chan *channel) --=20 2.43.0 From nobody Mon Feb 9 09:54:24 2026 Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B6A5E4BB0C1 for ; Thu, 8 Jan 2026 10:36:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767868597; cv=none; b=gDWAAnTeA4Nj/3L/G+vXlUrekoR2Lf9nJoYllE/cwBkaGGTbxzEOsTJydTxwjeJahiNha5CgqCUP55TbKMlSgLNRfoytdTex6eJgJc4F1PLfe0TvTCGVqvXrLgc7/GbT2ligndxaf29K3qAB7ZyPS8VRxwXbCm46Ii0wsYBjMPY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767868597; c=relaxed/simple; bh=QS+utOwh+0j3irGBIh+JGLsDHpGY3hY1exq7PJszteM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=hr4/nYbWAB531obeiLFgm38w6oMHAW78g06MbPqe5DnR5LBqtbFa3x8jMFkh9ZYQZM8GwbzaOjA4R2UOhHGbc8MIRjKU8PDCEFgxjki8+v8VsLKP4+cbjgVULkm9PFW0BbIiJXmpftmtN/dIvrtckqdweleI93Wn9nf5aBjlWiU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tuxon.dev; spf=pass smtp.mailfrom=tuxon.dev; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b=i/YXFDgK; arc=none smtp.client-ip=209.85.128.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tuxon.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=tuxon.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b="i/YXFDgK" Received: by mail-wm1-f44.google.com with SMTP id 5b1f17b1804b1-47d182a8c6cso19326565e9.1 for ; Thu, 08 Jan 2026 02:36:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxon.dev; s=google; t=1767868590; x=1768473390; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ofcyHkZ1yfZGW50Mzzzs74lToTM5Llj7vVSz2eItujY=; b=i/YXFDgKj+6yIi4KwtQa/ShZFxLqRgg6CSJKAFSqYxG+GrdcopAuLsPY3aoXnFSt98 HL86bo1RS7wZ3HQnwOzTpEKrHO59WoJsYc5RiTKS33d8gricDC2uLLY2qvY9VHzIuDx+ 3SRXVq5kU2WoV4HlKwyqvLOpNwTDOY+nAUkZ/b5baof2amgX7qqGxeDQGYPzK34H+hHt Pixm0IABlddDMiDtZjB+kPhJvrsivE2osprDdYLVukigxRt7DP+yASd3qGEkg0OCV+G+ NnKk6V+uCv3T54DLLxSIv87wWWvSGwqvaxig4XHIhYjnn87y0V5mpGon7NkTEjOzQW9x DRhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767868590; x=1768473390; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=ofcyHkZ1yfZGW50Mzzzs74lToTM5Llj7vVSz2eItujY=; b=b/tbwYGgaYL/Foy364GHp00DEx8aKfnp7U/ohIqq6k3kohdvpCxYg7QJrY3XWEryGz hTtJAQxAnvtcpuEb+2XYzb/OXr0WL9FobdrlNGc0pr3XS0qv168X7Hpa+wQF3QxMi9G6 p0lQ0LvRgMj+xS7ztlDCueNH3xp0YH50CMmPVRZdku0CbJ48cRvvd2CGjLs4Hh3dObP7 fMRONPrqA/QGTGcgMF4m5sr+yKN6EBBLEAlLSmj2Ka1OQJ9Yz+6BdqAVdrJ/YQJ1ggNi /OkfyrdtUIad8UlBfRcNU80s22hN0lo+bUwDikJ+h8dBsdbFFTn1pxBilAo6toO4ZWgP ZcFA== X-Forwarded-Encrypted: i=1; AJvYcCVhr68XCtBz/0VicsRov3x9IXd0QT/dE+6u9sCO5sOisQH8oIdF81vHA4UmCwzZpfAHnYV7qBgn9UsAer8=@vger.kernel.org X-Gm-Message-State: AOJu0Ywndj3D/vIeKzRZcYg+24hMU9bQWb6L17ohm7kp5BaXer4a62Zq mms2Kw+DZ5Jdu4+XqciH2XYaIb1rK7JsqBOINxBtyggMRDm6DFZFqE8QqRYd7gOc2/Q= X-Gm-Gg: AY/fxX7OzFIcdZ5GRimkHQU+xcawMRubhliUtrH/adMvKZV7+6MN2mEED42oMEFHjGO OLgzlafM4zn6vfieA7XhlpVCVGGPyMUBxPxz/5fzYTiq4QYGd/C5+WCGLjl3uLBIs71duM5ZYJN 6sHmqowUvwmkSuuLYZwQNI1GCiSLlKW4ru1nXnGdPASd6gQxJD21KYa2M3RaNhBiMMRA7ZD77nm dv0t2ZFKEtzmyO8KMfTOFDwqYey7FqnzYF+4YbUCFuuIKlbQFJ5AL4tk3WcRa4XB8nsBrbpJ8g0 ozGaOByJgoy4VVmlKs9gUz4NeNodT7gXa0HFxjz3Q/y+PlXeMs9LkUiKFzd+BQpy0W/eG63Gtyz ZSaSE6hiswCbAw9cTLA8nmrsIiOs324BL3xcMbnxngGQK40LQlzXGvhWmpUoZVaIlRq/6lYNgKl 1RXo2LDnrUqGEug3a4UBr8ecR6cz4dFi0hwZt4gtQ= X-Google-Smtp-Source: AGHT+IG2SJAd0v0AcYc9v7TjJkOxRE15Dp8J8Nuxbu/xPEYPE9IbPkifz+mDxd43qWjdlTLmBxDKDw== X-Received: by 2002:a05:600c:1f8c:b0:477:7d94:5d0e with SMTP id 5b1f17b1804b1-47d84b40955mr66133135e9.27.1767868590027; Thu, 08 Jan 2026 02:36:30 -0800 (PST) Received: from claudiu-X670E-Pro-RS.. ([82.78.167.17]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-432bd5ee243sm15399033f8f.31.2026.01.08.02.36.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Jan 2026 02:36:29 -0800 (PST) From: Claudiu X-Google-Original-From: Claudiu To: vkoul@kernel.org, fabrizio.castro.jz@renesas.com, geert+renesas@glider.be, prabhakar.mahadev-lad.rj@bp.renesas.com, biju.das.jz@bp.renesas.com Cc: claudiu.beznea@tuxon.dev, dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v7 6/8] dmaengine: sh: rz-dmac: Add rz_dmac_invalidate_lmdesc() Date: Thu, 8 Jan 2026 12:36:18 +0200 Message-ID: <20260108103620.3482147-7-claudiu.beznea.uj@bp.renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260108103620.3482147-1-claudiu.beznea.uj@bp.renesas.com> References: <20260108103620.3482147-1-claudiu.beznea.uj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Biju Das Add rz_dmac_invalidate_lmdesc() so that the same code can be shared between rz_dmac_terminate_all() and rz_dmac_free_chan_resources(). Based on a patch in the BSP by Long Luu . Signed-off-by: Biju Das [claudiu.beznea: adjusted the commit description; defined the lmdesc inside the for block to have more compact code] Signed-off-by: Claudiu Beznea --- Changes in v7: - none Changes in v6: - none Changes in v5: - adjusted the commit description - defined the lmdesc inside the for block drivers/dma/sh/rz-dmac.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/drivers/dma/sh/rz-dmac.c b/drivers/dma/sh/rz-dmac.c index 72ec42fedac6..45c45053e9df 100644 --- a/drivers/dma/sh/rz-dmac.c +++ b/drivers/dma/sh/rz-dmac.c @@ -250,6 +250,13 @@ static void rz_lmdesc_setup(struct rz_dmac_chan *chann= el, * Descriptors preparation */ =20 +static void rz_dmac_invalidate_lmdesc(struct rz_dmac_chan *channel) +{ + for (struct rz_lmdesc *lmdesc =3D channel->lmdesc.base; + lmdesc < channel->lmdesc.base + DMAC_NR_LMDESC; lmdesc++) + lmdesc->header =3D 0; +} + static void rz_dmac_lmdesc_recycle(struct rz_dmac_chan *channel) { struct rz_lmdesc *lmdesc =3D channel->lmdesc.head; @@ -456,15 +463,12 @@ static void rz_dmac_free_chan_resources(struct dma_ch= an *chan) { struct rz_dmac_chan *channel =3D to_rz_dmac_chan(chan); struct rz_dmac *dmac =3D to_rz_dmac(chan->device); - struct rz_lmdesc *lmdesc =3D channel->lmdesc.base; struct rz_dmac_desc *desc, *_desc; unsigned long flags; - unsigned int i; =20 spin_lock_irqsave(&channel->vc.lock, flags); =20 - for (i =3D 0; i < DMAC_NR_LMDESC; i++) - lmdesc[i].header =3D 0; + rz_dmac_invalidate_lmdesc(channel); =20 rz_dmac_disable_hw(channel); list_splice_tail_init(&channel->ld_active, &channel->ld_free); @@ -556,15 +560,12 @@ rz_dmac_prep_slave_sg(struct dma_chan *chan, struct s= catterlist *sgl, static int rz_dmac_terminate_all(struct dma_chan *chan) { struct rz_dmac_chan *channel =3D to_rz_dmac_chan(chan); - struct rz_lmdesc *lmdesc =3D channel->lmdesc.base; unsigned long flags; - unsigned int i; LIST_HEAD(head); =20 spin_lock_irqsave(&channel->vc.lock, flags); rz_dmac_disable_hw(channel); - for (i =3D 0; i < DMAC_NR_LMDESC; i++) - lmdesc[i].header =3D 0; + rz_dmac_invalidate_lmdesc(channel); =20 list_splice_tail_init(&channel->ld_active, &channel->ld_free); list_splice_tail_init(&channel->ld_queue, &channel->ld_free); --=20 2.43.0 From nobody Mon Feb 9 09:54:24 2026 Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C92F838B9A0 for ; Thu, 8 Jan 2026 10:36:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767868609; cv=none; b=APtufobGFyboHzql4MxeyuuL3gf3hJ4BDrymjCsWqTsaitWySY3ogIZoppVylC42YkRLE49wzpJLYA2843cm+rumDyU7IpOj2VrSTUi5oQ3OAsMwX70Hg74ixVqyflQuP8grkx1NndpctZhKNeudkJ7IJnc89uXVc3zv6F6+qzc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767868609; c=relaxed/simple; bh=2TdQW69drVLrL0CqMqSFeSzO65TAAV4hLZB/cfhdy3E=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ssWaVR0GI56g9tvJxAyoozobd6hWbnslpjwPANYSfr7+uLCiRySMocnefSFNdsaxOKQ6+MJJ16Pr32RvdiWooNjaz4Wo2rIw1NpvKd3/jmEMlJHVKGNLw6TkihXCuHMX+pQGakWOgCLiR3PzIm3YHkbo+VI7IJMGn/cDhSEDUXo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tuxon.dev; spf=pass smtp.mailfrom=tuxon.dev; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b=SWci4cOi; arc=none smtp.client-ip=209.85.128.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tuxon.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=tuxon.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b="SWci4cOi" Received: by mail-wm1-f54.google.com with SMTP id 5b1f17b1804b1-4779cb0a33fso32592875e9.0 for ; Thu, 08 Jan 2026 02:36:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxon.dev; s=google; t=1767868591; x=1768473391; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=x+7+V1b0T7BwengozlA1kapkoKFaMZj4KFqvQVGlzjg=; b=SWci4cOiYHoJO2jO5q6QuX6PIjgVg//G4yFigOnsVJT/gGEnYjUFYvG97bwPo+ityH JHrR048bYcfq4KBFpDMsQQjkYBougSIdVlt+MQWmzWyKNhwxkiM2ktBKEMjJrghLEQtA R6fE1cx+mQjCuyA6pPSyFhMvRqAEWccJbTVKEkBSNdfQf4otGcpWhl22WRu0yz7McIRy Bw31Rh6tfb1Zy1YPjrjnO9THd/Ut9U3dED+SrXOInCwlfAneDvwWUaUn+M7cPAhNE8gm nQ3cfvV0mT+cmhESxcj0rnuteXBsEVN0B5RdHaHzksob6EvFg9M4RSDlJ2qWBlydtmCJ 7+oQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767868591; x=1768473391; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=x+7+V1b0T7BwengozlA1kapkoKFaMZj4KFqvQVGlzjg=; b=WbKvHyjRk1epVBitXq+LyhpRTlpqdYNbwf6VXglb+slZxyLyvsczHxcP7cJKJQeeJL eY19yMGjhtZ2COBewDCqT1Z3zPwJ0ORGYxRD9vCVS1umenvaWa1FQnqnFoX83ZacpZ2H DRvlcvFAgWSKoGW+LCezEuTBp/4iSLP0vmiIVLcL4DBoiy+lJjJ9XpbU9PBUrIj2hG89 4ihKUAFuNlJpYSQHl/5TSoBfSAaAoL4wWtkNWK7AeqsQ6TypklUZYIOi3whOp7SrsoJY VNtRDalZIRMbl8mdLoIIu5S8szDvD+vOmHOuQnfkb/X/dwuwyGWg4qyOFbTvv9HAXP+L kF4A== X-Forwarded-Encrypted: i=1; AJvYcCV9sJYc81EvZscScDKpxxAFzUHX3L68ES9/+uCCJMwzHkBinwA9YmrR59nbzVkWI0Gtckj0rCoG6BfRn4Y=@vger.kernel.org X-Gm-Message-State: AOJu0YwAu0OCRE5rXoyfDnRBY4L/Ry3i+5bf43nLfV2aclMSjmmvGzqw zNuy+QqBjXUcB9OY2ZI8BE+ReBIlKd0r0aA5TqHvEoDhOGk/HB+SH8NmXKibzmbwuaE= X-Gm-Gg: AY/fxX6pgJEbZxXZy7M9o76Nh1rUKijQLkF4bcGwLsVXDLsNKawE5z+TpsUMFNxnJgG Ryq2eyF4cfEeEp/z+FKwBNwV4lRiiQy/Gmu87slc1ZkELHE/e1AlEzGEf+0kCVSmyFApX7iMWsJ Mdr8Iae6NY+9fP8K1DrUU6cRe9DJlnwSyLJbOP7tTkat6uT9agjDQXgT4IZh29USlVxX9Em/pG8 mGBXAqj0dOWfK11hUmYKLM7E/9/8BSlLOOYzZEXP6GLL5swFTAJFuUt8xXKXx4IOuyrKqpPmedd pFPL8/s5aMbMcGQUVw1OM1xt2qgmpd7EaI03FmlKsAtNFPpeQ2ZmyQqz1RUV0ke5yh/k/kAhRTm yDJzcoz6FFvtBejHzezZRMlOe+3gOAsRZ0nZlnmoqt7KO7ooN1CX+jVu17m5L0Qy2z/47GGKiaK Slhr23zK4nnUpk1Ahoov8R7JjJIx4uo7nCLaMJLTo= X-Google-Smtp-Source: AGHT+IHUxrKyZpvD7fy2nd1gEgyZ6D9esMG93wZrRE99dQhqCp+RdJFq45V1O1M4oDg6d3sN+VDJyg== X-Received: by 2002:a05:600c:5490:b0:471:1717:411 with SMTP id 5b1f17b1804b1-47d84b33bc0mr77838785e9.24.1767868591419; Thu, 08 Jan 2026 02:36:31 -0800 (PST) Received: from claudiu-X670E-Pro-RS.. ([82.78.167.17]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-432bd5ee243sm15399033f8f.31.2026.01.08.02.36.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Jan 2026 02:36:30 -0800 (PST) From: Claudiu X-Google-Original-From: Claudiu To: vkoul@kernel.org, fabrizio.castro.jz@renesas.com, geert+renesas@glider.be, prabhakar.mahadev-lad.rj@bp.renesas.com, biju.das.jz@bp.renesas.com Cc: claudiu.beznea@tuxon.dev, dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v7 7/8] dmaengine: sh: rz-dmac: Add device_tx_status() callback Date: Thu, 8 Jan 2026 12:36:19 +0200 Message-ID: <20260108103620.3482147-8-claudiu.beznea.uj@bp.renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260108103620.3482147-1-claudiu.beznea.uj@bp.renesas.com> References: <20260108103620.3482147-1-claudiu.beznea.uj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Biju Das Add support for device_tx_status() callback as it is needed for RZ/G2L SCIFA driver. Based on a patch in the BSP similar to rcar-dmac by Long Luu . Signed-off-by: Biju Das [claudiu.beznea: - post-increment lmdesc in rz_dmac_get_next_lmdesc() to allow the next pointer to advance - use 'lmdesc->nxla !=3D crla' comparison instead of '!(lmdesc->nxla =3D=3D crla)' in rz_dmac_calculate_residue_bytes_in_vd() - in rz_dmac_calculate_residue_bytes_in_vd() use '++i >=3D DMAC_NR_LMDESC' to verify if the full lmdesc list was checked - drop rz_dmac_calculate_total_bytes_in_vd() and use desc->len instead - re-arranged comments so they span fewer lines and are wrapped to ~80 characters - use u32 for the residue value and the functions returning it - use u32 for the variables storing register values - fixed typos] Signed-off-by: Claudiu Beznea --- Changes in v7: - none Changes in v6: - s/byte/bytes in comment from rz_dmac_chan_get_residue() Changes in v5: - post-increment lmdesc in rz_dmac_get_next_lmdesc() to allow the next pointer to advance - use 'lmdesc->nxla !=3D crla' comparison instead of '!(lmdesc->nxla =3D=3D crla)' in rz_dmac_calculate_residue_bytes_in_vd() - in rz_dmac_calculate_residue_bytes_in_vd() use '++i >=3D DMAC_NR_LMDESC' to verify if the full lmdesc list was checked - drop rz_dmac_calculate_total_bytes_in_vd() and use desc->len instead - re-arranged comments so they span fewer lines and are wrapped to ~80 characters - use u32 for the residue value and the functions returning it - use u32 for the variables storing register values - fixed typos drivers/dma/sh/rz-dmac.c | 144 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 143 insertions(+), 1 deletion(-) diff --git a/drivers/dma/sh/rz-dmac.c b/drivers/dma/sh/rz-dmac.c index 45c45053e9df..44f0f72cbcf1 100644 --- a/drivers/dma/sh/rz-dmac.c +++ b/drivers/dma/sh/rz-dmac.c @@ -119,10 +119,12 @@ struct rz_dmac { * Registers */ =20 +#define CRTB 0x0020 #define CHSTAT 0x0024 #define CHCTRL 0x0028 #define CHCFG 0x002c #define NXLA 0x0038 +#define CRLA 0x003c =20 #define DCTRL 0x0000 =20 @@ -685,6 +687,146 @@ static void rz_dmac_device_synchronize(struct dma_cha= n *chan) } } =20 +static struct rz_lmdesc * +rz_dmac_get_next_lmdesc(struct rz_lmdesc *base, struct rz_lmdesc *lmdesc) +{ + struct rz_lmdesc *next =3D ++lmdesc; + + if (next >=3D base + DMAC_NR_LMDESC) + next =3D base; + + return next; +} + +static u32 rz_dmac_calculate_residue_bytes_in_vd(struct rz_dmac_chan *chan= nel) +{ + struct rz_lmdesc *lmdesc =3D channel->lmdesc.head; + struct dma_chan *chan =3D &channel->vc.chan; + struct rz_dmac *dmac =3D to_rz_dmac(chan->device); + u32 residue =3D 0, crla, i =3D 0; + + crla =3D rz_dmac_ch_readl(channel, CRLA, 1); + while (lmdesc->nxla !=3D crla) { + lmdesc =3D rz_dmac_get_next_lmdesc(channel->lmdesc.base, lmdesc); + if (++i >=3D DMAC_NR_LMDESC) + return 0; + } + + /* Calculate residue from next lmdesc to end of virtual desc */ + while (lmdesc->chcfg & CHCFG_DEM) { + residue +=3D lmdesc->tb; + lmdesc =3D rz_dmac_get_next_lmdesc(channel->lmdesc.base, lmdesc); + } + + dev_dbg(dmac->dev, "%s: VD residue is %u\n", __func__, residue); + + return residue; +} + +static u32 rz_dmac_chan_get_residue(struct rz_dmac_chan *channel, + dma_cookie_t cookie) +{ + struct rz_dmac_desc *current_desc, *desc; + enum dma_status status; + u32 crla, crtb, i; + + /* Get current processing virtual descriptor */ + current_desc =3D list_first_entry(&channel->ld_active, + struct rz_dmac_desc, node); + if (!current_desc) + return 0; + + /* + * If the cookie corresponds to a descriptor that has been completed + * there is no residue. The same check has already been performed by the + * caller but without holding the channel lock, so the descriptor could + * now be complete. + */ + status =3D dma_cookie_status(&channel->vc.chan, cookie, NULL); + if (status =3D=3D DMA_COMPLETE) + return 0; + + /* + * If the cookie doesn't correspond to the currently processing virtual + * descriptor then the descriptor hasn't been processed yet, and the + * residue is equal to the full descriptor size. Also, a client driver + * is possible to call this function before rz_dmac_irq_handler_thread() + * runs. In this case, the running descriptor will be the next + * descriptor, and will appear in the done list. So, if the argument + * cookie matches the done list's cookie, we can assume the residue is + * zero. + */ + if (cookie !=3D current_desc->vd.tx.cookie) { + list_for_each_entry(desc, &channel->ld_free, node) { + if (cookie =3D=3D desc->vd.tx.cookie) + return 0; + } + + list_for_each_entry(desc, &channel->ld_queue, node) { + if (cookie =3D=3D desc->vd.tx.cookie) + return desc->len; + } + + list_for_each_entry(desc, &channel->ld_active, node) { + if (cookie =3D=3D desc->vd.tx.cookie) + return desc->len; + } + + /* + * No descriptor found for the cookie, there's thus no residue. + * This shouldn't happen if the calling driver passes a correct + * cookie value. + */ + WARN(1, "No descriptor for cookie!"); + return 0; + } + + /* + * We need to read two registers. Make sure the hardware does not move + * to next lmdesc while reading the current lmdesc. Trying it 3 times + * should be enough: initial read, retry, retry for the paranoid. + */ + for (i =3D 0; i < 3; i++) { + crla =3D rz_dmac_ch_readl(channel, CRLA, 1); + crtb =3D rz_dmac_ch_readl(channel, CRTB, 1); + /* Still the same? */ + if (crla =3D=3D rz_dmac_ch_readl(channel, CRLA, 1)) + break; + } + + WARN_ONCE(i >=3D 3, "residue might not be continuous!"); + + /* + * Calculate number of bytes transferred in processing virtual descriptor. + * One virtual descriptor can have many lmdesc. + */ + return crtb + rz_dmac_calculate_residue_bytes_in_vd(channel); +} + +static enum dma_status rz_dmac_tx_status(struct dma_chan *chan, + dma_cookie_t cookie, + struct dma_tx_state *txstate) +{ + struct rz_dmac_chan *channel =3D to_rz_dmac_chan(chan); + enum dma_status status; + u32 residue; + + status =3D dma_cookie_status(chan, cookie, txstate); + if (status =3D=3D DMA_COMPLETE || !txstate) + return status; + + scoped_guard(spinlock_irqsave, &channel->vc.lock) + residue =3D rz_dmac_chan_get_residue(channel, cookie); + + /* if there's no residue, the cookie is complete */ + if (!residue) + return DMA_COMPLETE; + + dma_set_residue(txstate, residue); + + return status; +} + /* * -----------------------------------------------------------------------= ------ * IRQ handling @@ -1016,7 +1158,7 @@ static int rz_dmac_probe(struct platform_device *pdev) =20 engine->device_alloc_chan_resources =3D rz_dmac_alloc_chan_resources; engine->device_free_chan_resources =3D rz_dmac_free_chan_resources; - engine->device_tx_status =3D dma_cookie_status; + engine->device_tx_status =3D rz_dmac_tx_status; engine->device_prep_slave_sg =3D rz_dmac_prep_slave_sg; engine->device_prep_dma_memcpy =3D rz_dmac_prep_dma_memcpy; engine->device_config =3D rz_dmac_config; --=20 2.43.0 From nobody Mon Feb 9 09:54:24 2026 Received: from mail-wr1-f52.google.com (mail-wr1-f52.google.com [209.85.221.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C9C4338737E for ; Thu, 8 Jan 2026 10:36:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767868603; cv=none; b=R81bMLhIqjAZpy7pIwAm3r+M/83DBCKAqIAuzZe8Ly4mseB02QkZbsxA8Gj/HXq2l1DrC80PYgwz0QNPbjI0lnCacNAygE0feqKmvEG5YhD+gsAJH+ZO1yhUbwFsxea36hFKhjaDf1sqnGOoqaPqpX6+/9oGh86+VM4c57C1oRo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767868603; c=relaxed/simple; bh=spUFrQpAHUSihVIbrTd6aDb/HQEXMQYbUxekF5wDPZI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=bAhicfoT8CAoSf2C7xG//K0P3VKwWWWhmYfqOVHBW5nUT1xpONfTTdOVGIGSfOpD2QXnIUKZAydyvpw0cAkZPiJ/DBuJirjLQIAaxUbw8pMwXJa+wl+uGUHLzJXRAw5Cqm4VV8STaForLLaayyx+12qKxI1Fl1LUcuQHpHhMtl8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tuxon.dev; spf=pass smtp.mailfrom=tuxon.dev; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b=YuFPcOpN; arc=none smtp.client-ip=209.85.221.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tuxon.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=tuxon.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b="YuFPcOpN" Received: by mail-wr1-f52.google.com with SMTP id ffacd0b85a97d-42fb0fc5aa4so2222054f8f.1 for ; Thu, 08 Jan 2026 02:36:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxon.dev; s=google; t=1767868593; x=1768473393; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=o7PLTkw/HbTkvBtEU+lXi+/ObfFOUjX/JmNK1olicNI=; b=YuFPcOpNeyae46NGGeFsfiFNhZrPb5qRP9WlE/O4oGxcGR8aR7ERqVxRLjt6lzVa9r +E//QSn4VStD4CCJ1CzvPoDDIM8623B27W1pGRcRM4rjVSsR2H6BrGKTXZoGHml/vlXB 5+dezXY8ifJe/UBXFwhR2htCu913IGqhxGrtlVvcahBjQXH6aPOYpiE8hIT9Rcf8gkYq CXLi9CxDntOaa+m8IDVsf0Zoj8/XvhXk2PirJRdO2kWJs8Z76BJ39Ypz5uWureCXn7Ba f5OaqLKa9ZPOu9Jink9fCjv4uK8eKzcQ8VhuJ10esIuSelm/Lu2hm8tCwhSQASTAmLkq dM/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767868593; x=1768473393; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=o7PLTkw/HbTkvBtEU+lXi+/ObfFOUjX/JmNK1olicNI=; b=dyCqzh1RKm0eb6cgZcsUQ/ux/W1n8h+Cg3CzPYyH2MpyrIHjCY6EbWv4hstqe4Fq84 pcFQB7TEek+ixVhfPYirhwifyUlrc3WpvXDV5UKhV0avvNuS4Kc5JD1B9KPzmbhPlxqX wOKh3dwlDwgtt2xUgyxLMYyv2Nz7NyJaf7clz7PhYsU/vGSkp45UHc4CaGnXOmZppf+z CdEYTroZ5n3HGWGwSFm9QpqjSEIPwjHAc+2zKfsXOqTJrI94eheNaivSgHuFgGgNmPnF 5ARbuFXwycXIzR9nKNRogKpHRtWIuj1IJkywP/9WTVMCw+CLVA7jRgFxgPh8CnTDDenM BFXg== X-Forwarded-Encrypted: i=1; AJvYcCVkQDVcVkxluDZQ/YLajYgntqGJXF9V2AGdLAiUhSgXPayGz6voU3PNl3gRikLEt0xk4T0ugxWQgfkzi7A=@vger.kernel.org X-Gm-Message-State: AOJu0YxOBxwKo8Voq2+joocC5BTjbc8JkzjfL/QPS7DAzNJtZ3GstVUd 2xFiF6JqkQYonAPYiErwRqfNFYDawmBSZH7+R+YQOtO19Nq3htQOOkax2PVrHwoLZ8k= X-Gm-Gg: AY/fxX6JlPAh2tAYfvwrL2a9gPp9njx0yMBu2s0NKojHhpyXZDN/s42fkWBTStxpwY8 NcVcTSRZo7AhvJU2yuH8C19ShVzrS+0mTgS23ctDlAXBzzl/8h5Mx485QOi/B0BEDATMxnF+WxE Ct7TKlRCBh7F8wFwh5Q441CcqbBUaLbHO9k+w744CbR2cKUTkO5Iqj5OIgTtG7w9pWpm0dugxNe NEl6d/aMR6npkAGem3qA6jcIGfBpXBUsuGOQ3W24ugMM6ffF2S2h23M4Fbxb6bE2mH8R4SJC54d WR92o9tm4f1Q7gBdvhakW8iLz8Ct4PjYxnLDgGx+oORratnogRioED4qWQ3Zpknqv3ClB7JqHC3 DIsRZGBuuUWC59qNn4hr+6PybgVdehzDQpSFDAQeS7l+MkCJgxVWh94zKPOmJfGMZ6mFixsT+FW q/liYxDWWvSk3PQHq1LRAyfnDsdQsrDMw4JTTpa0k= X-Google-Smtp-Source: AGHT+IF0e1OZBhaJwQ+s5DlVX+WY1KnxeqJ91c95V464aKTYpKJlrDgGrA3vXH3o0akj7eFchMyu+A== X-Received: by 2002:a05:6000:25c6:b0:42b:4267:83e3 with SMTP id ffacd0b85a97d-432c374f5femr7993687f8f.5.1767868592727; Thu, 08 Jan 2026 02:36:32 -0800 (PST) Received: from claudiu-X670E-Pro-RS.. ([82.78.167.17]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-432bd5ee243sm15399033f8f.31.2026.01.08.02.36.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Jan 2026 02:36:32 -0800 (PST) From: Claudiu X-Google-Original-From: Claudiu To: vkoul@kernel.org, fabrizio.castro.jz@renesas.com, geert+renesas@glider.be, prabhakar.mahadev-lad.rj@bp.renesas.com, biju.das.jz@bp.renesas.com Cc: claudiu.beznea@tuxon.dev, dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v7 8/8] dmaengine: sh: rz-dmac: Add device_{pause,resume}() callbacks Date: Thu, 8 Jan 2026 12:36:20 +0200 Message-ID: <20260108103620.3482147-9-claudiu.beznea.uj@bp.renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260108103620.3482147-1-claudiu.beznea.uj@bp.renesas.com> References: <20260108103620.3482147-1-claudiu.beznea.uj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Claudiu Beznea Add support for device_{pause, resume}() callbacks. These are required by the RZ/G2L SCIFA driver. Signed-off-by: Claudiu Beznea --- Changes in v7: - use guard() instead of scoped_guard() - in rz_dmac_device_pause() checked the channel is enabled before suspending it to avoid read poll timeouts - added a comment in rz_dmac_device_resume() Changes in v6: - set CHCTRL_SETSUS for pause and CHCTRL_CLRSUS for resume - dropped read-modify-update approach for CHCTRL updates as the HW returns zero when reading CHCTRL - moved the read_poll_timeout_atomic() under spin lock to ensure avoid any races b/w pause and resume functionalities Changes in v5: - used suspend capability of the controller to pause/resume the transfers drivers/dma/sh/rz-dmac.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/drivers/dma/sh/rz-dmac.c b/drivers/dma/sh/rz-dmac.c index 44f0f72cbcf1..de95139c18a0 100644 --- a/drivers/dma/sh/rz-dmac.c +++ b/drivers/dma/sh/rz-dmac.c @@ -135,10 +135,12 @@ struct rz_dmac { #define CHANNEL_8_15_COMMON_BASE 0x0700 =20 #define CHSTAT_ER BIT(4) +#define CHSTAT_SUS BIT(3) #define CHSTAT_EN BIT(0) =20 #define CHCTRL_CLRINTMSK BIT(17) #define CHCTRL_CLRSUS BIT(9) +#define CHCTRL_SETSUS BIT(8) #define CHCTRL_CLRTC BIT(6) #define CHCTRL_CLREND BIT(5) #define CHCTRL_CLRRQ BIT(4) @@ -827,6 +829,38 @@ static enum dma_status rz_dmac_tx_status(struct dma_ch= an *chan, return status; } =20 +static int rz_dmac_device_pause(struct dma_chan *chan) +{ + struct rz_dmac_chan *channel =3D to_rz_dmac_chan(chan); + u32 val; + + guard(spinlock_irqsave)(&channel->vc.lock); + + val =3D rz_dmac_ch_readl(channel, CHSTAT, 1); + if (!(val & CHSTAT_EN)) + return 0; + + rz_dmac_ch_writel(channel, CHCTRL_SETSUS, CHCTRL, 1); + return read_poll_timeout_atomic(rz_dmac_ch_readl, val, + (val & CHSTAT_SUS), 1, 1024, + false, channel, CHSTAT, 1); +} + +static int rz_dmac_device_resume(struct dma_chan *chan) +{ + struct rz_dmac_chan *channel =3D to_rz_dmac_chan(chan); + u32 val; + + guard(spinlock_irqsave)(&channel->vc.lock); + + /* Do not check CHSTAT_SUS but rely on HW capabilities. */ + + rz_dmac_ch_writel(channel, CHCTRL_CLRSUS, CHCTRL, 1); + return read_poll_timeout_atomic(rz_dmac_ch_readl, val, + !(val & CHSTAT_SUS), 1, 1024, + false, channel, CHSTAT, 1); +} + /* * -----------------------------------------------------------------------= ------ * IRQ handling @@ -1165,6 +1199,8 @@ static int rz_dmac_probe(struct platform_device *pdev) engine->device_terminate_all =3D rz_dmac_terminate_all; engine->device_issue_pending =3D rz_dmac_issue_pending; engine->device_synchronize =3D rz_dmac_device_synchronize; + engine->device_pause =3D rz_dmac_device_pause; + engine->device_resume =3D rz_dmac_device_resume; =20 engine->copy_align =3D DMAENGINE_ALIGN_1_BYTE; dma_set_max_seg_size(engine->dev, U32_MAX); --=20 2.43.0