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]
Message-ID: <22d69113-fec0-4405-872d-af76bd038c09@sirena.org.uk>
Date: Fri, 27 Jun 2025 22:41:30 +0100
From: Mark Brown <broonie@...nel.org>
To: Frank Li <Frank.li@....com>
Cc: James Clark <james.clark@...aro.org>,
	Vladimir Oltean <olteanv@...il.com>,
	Vladimir Oltean <vladimir.oltean@....com>,
	Arnd Bergmann <arnd@...db.de>,
	Larisa Grigore <larisa.grigore@....com>,
	Christoph Hellwig <hch@....de>, linux-spi@...r.kernel.org,
	imx@...ts.linux.dev, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v4 6/6] spi: spi-fsl-dspi: Report FIFO overflows as errors

On Fri, Jun 27, 2025 at 03:56:43PM -0400, Frank Li wrote:
> On Fri, Jun 27, 2025 at 11:21:42AM +0100, James Clark wrote:

> > In target mode, the host sending more data than can be consumed would be
> > a common problem for any message exceeding the FIFO or DMA buffer size.
> > Cancel the whole message as soon as this condition is hit as the message
> > will be corrupted.

> > Only do this for target mode in a DMA transfer, it's not likely these
> > flags will be set in host mode

> "not likely", I think SPI controller should stop CLK if FIFO empty and full.
> It should be "never" happen.

> Only check FIFO error flags at target mode because it never happen at host mode.

> You can remove below whole paragram.

I agree it *should* never happen in host mode but it can be good
practice to look in case something gets messed up.  That said extra
device accesses in the hot path are probably going to be noticable so
likely not worth it, but in the dspi_poll() case:

> @@ -1067,6 +1080,9 @@ static void dspi_poll(struct fsl_dspi *dspi)
>                         regmap_read(dspi->regmap, SPI_SR, &spi_sr);
>                         regmap_write(dspi->regmap, SPI_SR, spi_sr);
> 
> +                       dspi->cur_msg->status = dspi_fifo_error(dspi, spi_sr);
> +                       if (dspi->cur_msg->status)
> +                               return;

we're reading the register anyway so the overhead is much lower.

Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ