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: <87sei5hjul.fsf@bootlin.com>
Date: Tue, 05 Aug 2025 17:24:50 +0200
From: Miquel Raynal <miquel.raynal@...tlin.com>
To: Mikhail Kshevetskiy <mikhail.kshevetskiy@...sys.eu>
Cc: Richard Weinberger <richard@....at>,  Vignesh Raghavendra
 <vigneshr@...com>,  Lorenzo Bianconi <lorenzo@...nel.org>,  Ray Liu
 <ray.liu@...oha.com>,  Mark Brown <broonie@...nel.org>,  Tudor Ambarus
 <tudor.ambarus@...aro.org>,  Martin Kurbanov
 <mmkurbanov@...utedevices.com>,  Takahiro Kuwano
 <Takahiro.Kuwano@...ineon.com>,  Cheng Ming Lin
 <chengminglin@...c.com.tw>,  linux-mtd@...ts.infradead.org,
  linux-kernel@...r.kernel.org,  linux-arm-kernel@...ts.infradead.org,
  linux-spi@...r.kernel.org
Subject: Re: [PATCH 1/4] drivers: mtd: spi-nand: fix direct mapping creation
 sizes.

Hello Mikhail,

Thanks a lot for this series!

On 04/08/2025 at 22:21:29 +03, Mikhail Kshevetskiy <mikhail.kshevetskiy@...sys.eu> wrote:

> Continuous mode is only supported for non-raw data reads, thus raw I/O
> or non-raw writing requires only single flash page mapping.
>
> Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@...sys.eu>
> ---
>  drivers/mtd/nand/spi/core.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/mtd/nand/spi/core.c b/drivers/mtd/nand/spi/core.c
> index b0898990b2a5..b42c42ec58a4 100644
> --- a/drivers/mtd/nand/spi/core.c
> +++ b/drivers/mtd/nand/spi/core.c
> @@ -1103,9 +1103,6 @@ static int spinand_create_dirmap(struct spinand_device *spinand,
>  	};
>  	struct spi_mem_dirmap_desc *desc;
>  
> -	if (spinand->cont_read_possible)
> -		info.length = nanddev_eraseblock_size(nand);
> -
>  	/* The plane number is passed in MSB just above the column address */
>  	info.offset = plane << fls(nand->memorg.pagesize);
>  
> @@ -1117,6 +1114,8 @@ static int spinand_create_dirmap(struct spinand_device *spinand,
>  
>  	spinand->dirmaps[plane].wdesc = desc;
>  
> +	if (spinand->cont_read_possible)
> +		info.length = nanddev_eraseblock_size(nand);
>  	info.op_tmpl = *spinand->op_templates.read_cache;
>  	desc = devm_spi_mem_dirmap_create(&spinand->spimem->spi->dev,
>  					  spinand->spimem, &info);
> @@ -1132,6 +1131,9 @@ static int spinand_create_dirmap(struct spinand_device *spinand,
>  		return 0;
>  	}
>  
> +	// ECC reading/writing always happen in non-continuous mode

This comment does not sound helpful, at least I do not understand it?
(and the comment style should be /* */)

> +	info.length = nanddev_page_size(nand) + nanddev_per_page_oobsize(nand);
> +
>  	info.op_tmpl = *spinand->op_templates.update_cache;
>  	info.op_tmpl.data.ecc = true;
>  	desc = devm_spi_mem_dirmap_create(&spinand->spimem->spi->dev,

May I suggest to use two different dirmap infos? One with a large size
(for reads) and a page-sized one for other cases (including the fallback
you're introducing in PATCH 2).

Thanks,
Miquèl

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ