lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 14 Jul 2022 21:02:03 +0200
From:   Marek Vasut <marex@...x.de>
To:     Amelie Delaunay <amelie.delaunay@...s.st.com>,
        Jonathan Corbet <corbet@....net>,
        Vinod Koul <vkoul@...nel.org>,
        Maxime Coquelin <mcoquelin.stm32@...il.com>,
        Alexandre Torgue <alexandre.torgue@...s.st.com>
Cc:     linux-doc@...r.kernel.org, dmaengine@...r.kernel.org,
        linux-stm32@...md-mailman.stormreply.com,
        linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 3/4] dmaengine: stm32-dma: add support to trigger STM32
 MDMA

On 7/13/22 16:21, Amelie Delaunay wrote:

[...]

> diff --git a/drivers/dma/stm32-dma.c b/drivers/dma/stm32-dma.c
> index adb25a11c70f..3916295fe154 100644
> --- a/drivers/dma/stm32-dma.c
> +++ b/drivers/dma/stm32-dma.c
> @@ -142,6 +142,8 @@
>   #define STM32_DMA_DIRECT_MODE_GET(n)	(((n) & STM32_DMA_DIRECT_MODE_MASK) >> 2)
>   #define STM32_DMA_ALT_ACK_MODE_MASK	BIT(4)
>   #define STM32_DMA_ALT_ACK_MODE_GET(n)	(((n) & STM32_DMA_ALT_ACK_MODE_MASK) >> 4)
> +#define STM32_DMA_MDMA_STREAM_ID_MASK	GENMASK(19, 16)
> +#define STM32_DMA_MDMA_STREAM_ID_GET(n) (((n) & STM32_DMA_MDMA_STREAM_ID_MASK) >> 16)

Try FIELD_GET() from include/linux/bitfield.h

[...]

> @@ -1630,6 +1670,20 @@ static int stm32_dma_probe(struct platform_device *pdev)
>   		chan->id = i;
>   		chan->vchan.desc_free = stm32_dma_desc_free;
>   		vchan_init(&chan->vchan, dd);
> +
> +		chan->mdma_config.ifcr = res->start;
> +		chan->mdma_config.ifcr += (chan->id & 4) ? STM32_DMA_HIFCR : STM32_DMA_LIFCR;
> +
> +		chan->mdma_config.tcf = STM32_DMA_TCI;
> +		/*
> +		 * bit0 of chan->id represents the need to left shift by 6
> +		 * bit1 of chan->id represents the need to extra left shift by 16
> +		 * TCIF0, chan->id = b0000; TCIF4, chan->id = b0100: left shift by 0*6 + 0*16
> +		 * TCIF1, chan->id = b0001; TCIF5, chan->id = b0101: left shift by 1*6 + 0*16
> +		 * TCIF2, chan->id = b0010; TCIF6, chan->id = b0110: left shift by 0*6 + 1*16
> +		 * TCIF3, chan->id = b0011; TCIF7, chan->id = b0111: left shift by 1*6 + 1*16
> +		 */
> +		chan->mdma_config.tcf <<= (6 * (chan->id & 0x1) + 16 * ((chan->id & 0x2) >> 1));

Some sort of symbolic macros instead of open-coded constants could help 
readability here.

[...]

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ