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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250701144711.hfcgk7hhk5w4jmvf@skbuf>
Date: Tue, 1 Jul 2025 17:47:11 +0300
From: Vladimir Oltean <vladimir.oltean@....com>
To: James Clark <james.clark@...aro.org>
Cc: Vladimir Oltean <olteanv@...il.com>, Mark Brown <broonie@...nel.org>,
	Arnd Bergmann <arnd@...db.de>,
	Larisa Grigore <larisa.grigore@....com>,
	Frank Li <Frank.li@....com>, Christoph Hellwig <hch@....de>,
	linux-spi@...r.kernel.org, imx@...ts.linux.dev,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH v4 5/6] spi: spi-fsl-dspi: Increase DMA buffer size

On Fri, Jun 27, 2025 at 11:21:41AM +0100, James Clark wrote:
> diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c
> index e7856f9c9440..46d3cae9efed 100644
> --- a/drivers/spi/spi-fsl-dspi.c
> +++ b/drivers/spi/spi-fsl-dspi.c
> @@ -493,6 +493,39 @@ static u32 dspi_pop_tx_pushr(struct fsl_dspi *dspi)
>  	return cmd << 16 | data;
>  }
>  
> +static int dspi_dma_bufsize(struct fsl_dspi *dspi)
> +{
> +	if (spi_controller_is_target(dspi->ctlr)) {
> +		/*
> +		 * In target mode we have to be ready to receive the maximum
> +		 * that can possibly be transferred at once by EDMA without any
> +		 * FIFO underflows. This is CITER * SSIZE, where SSIZE is a max
> +		 * of 4 when transferring to a peripheral.
> +		 */
> +		return GENMASK(14, 0) * DMA_SLAVE_BUSWIDTH_4_BYTES;

Is this really a constant that can be hardcoded? Should this be queried
from the EDMA driver somehow?

I'm not well versed in the dmaengine/dma-mapping API at all, but I see
fsl_edma_probe() makes a call to dma_set_max_seg_size(), which consumer
drivers such as DSPI can query using dma_get_max_seg_size(). To the
untrained eye, and from a great distance, it looks like the value you're
interested in. Apologies if that isn't the case.

> +	}
> +
> +	return PAGE_SIZE;
> +}

The other question is: what's fundamentally different between the host
and target operating modes, such that we return different values? Why
not the same?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ