All of lore.kernel.org
 help / color / mirror / Atom feed
From: Miquel Raynal <miquel.raynal@bootlin.com>
To: <Takahiro.Kuwano@infineon.com>
Cc: <pratyush@kernel.org>,  <mwalle@kernel.org>,  <richard@nod.at>,
	<vigneshr@ti.com>,  <corbet@lwn.net>,  <sean.anderson@linux.dev>,
	<thomas.petazzoni@bootlin.com>,  <STLin2@winbond.com>,
	<linux-mtd@lists.infradead.org>,  <linux-kernel@vger.kernel.org>,
	<linux-doc@vger.kernel.org>
Subject: Re: [PATCH v4 17/27] mtd: spi-nor: debugfs: Add locking support
Date: Mon, 27 Apr 2026 15:39:27 +0200	[thread overview]
Message-ID: <87h5owh69c.fsf@bootlin.com> (raw)
In-Reply-To: <c8521e12e49040ce8683f81692644574@infineon.com> (Takahiro Kuwano's message of "Fri, 10 Apr 2026 04:39:22 +0000")

Hello SPI NOR foks,

On 10/04/2026 at 04:39:22 GMT, <Takahiro.Kuwano@infineon.com> wrote:

>> The ioctl output may be counter intuitive in some cases. Asking for a
>> "locked status" over a region that is only partially locked will return
>> "unlocked" whereas in practice maybe the biggest part is actually
>> locked.
>> 
>> Knowing what is the real software locking state through debugfs would be
>> very convenient for development/debugging purposes, hence this proposal
>> for adding an extra block at the end of the file: a "locked sectors"
>> array which lists every section, if it is locked or not, showing both
>> the address ranges and the sizes in numbers of blocks.
>> 
>> Here is an example of output, what is after the "sector map" is new.
>> 
>> $ cat /sys/kernel/debug/spi-nor/spi0.0/params
>> name            (null)
>> id              ef a0 20 00 00 00
>> size            64.0 MiB
>> write size      1
>> page size       256
>> address nbytes  4
>> flags           HAS_SR_TB | 4B_OPCODES | HAS_4BAIT | HAS_LOCK | HAS_16BIT_SR | HAS_SR_TB_BIT6 | HAS_4BIT_BP |
>> SOFT_RESET | NO_WP
>> 
>> opcodes
>>  read           0xec
>>   dummy cycles  6
>>  erase          0xdc
>>  program        0x34
>>  8D extension   none
>> 
>> protocols
>>  read           1S-4S-4S
>>  write          1S-1S-4S
>>  register       1S-1S-1S
>> 
>> erase commands
>>  21 (4.00 KiB) [1]
>>  dc (64.0 KiB) [3]
>>  c7 (64.0 MiB)
>> 
>> sector map
>>  region (in hex)   | erase mask | overlaid
>>  ------------------+------------+---------
>>  00000000-03ffffff |     [   3] | no
>> 
>> locked sectors
>>  region (in hex)   | status   | #blocks
>>  ------------------+----------+--------
>>  00000000-03ffffff | unlocked | 1024
>> 
>> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>

I don't want to be too pushy but this series has been pending for a
while, there are real fixes inside, it (IMO) greatly improve the
documentation, adds a testing procedure, gives a friendly interface to
understand what is locked, etc. I am working on clarifying and improving
the Winbond vendor driver even more now and I need these changes to get
in for the cleanup to continue. Can someone bump spi-nor/next on top of
v7.1-rc1 and apply this? Unless there are more changes, of course.

Thanks a lot!
Miquèl

WARNING: multiple messages have this Message-ID (diff)
From: Miquel Raynal <miquel.raynal@bootlin.com>
To: <Takahiro.Kuwano@infineon.com>
Cc: <pratyush@kernel.org>,  <mwalle@kernel.org>,  <richard@nod.at>,
	<vigneshr@ti.com>,  <corbet@lwn.net>,  <sean.anderson@linux.dev>,
	<thomas.petazzoni@bootlin.com>,  <STLin2@winbond.com>,
	<linux-mtd@lists.infradead.org>,  <linux-kernel@vger.kernel.org>,
	<linux-doc@vger.kernel.org>
Subject: Re: [PATCH v4 17/27] mtd: spi-nor: debugfs: Add locking support
Date: Mon, 27 Apr 2026 15:39:27 +0200	[thread overview]
Message-ID: <87h5owh69c.fsf@bootlin.com> (raw)
In-Reply-To: <c8521e12e49040ce8683f81692644574@infineon.com> (Takahiro Kuwano's message of "Fri, 10 Apr 2026 04:39:22 +0000")

Hello SPI NOR foks,

On 10/04/2026 at 04:39:22 GMT, <Takahiro.Kuwano@infineon.com> wrote:

>> The ioctl output may be counter intuitive in some cases. Asking for a
>> "locked status" over a region that is only partially locked will return
>> "unlocked" whereas in practice maybe the biggest part is actually
>> locked.
>> 
>> Knowing what is the real software locking state through debugfs would be
>> very convenient for development/debugging purposes, hence this proposal
>> for adding an extra block at the end of the file: a "locked sectors"
>> array which lists every section, if it is locked or not, showing both
>> the address ranges and the sizes in numbers of blocks.
>> 
>> Here is an example of output, what is after the "sector map" is new.
>> 
>> $ cat /sys/kernel/debug/spi-nor/spi0.0/params
>> name            (null)
>> id              ef a0 20 00 00 00
>> size            64.0 MiB
>> write size      1
>> page size       256
>> address nbytes  4
>> flags           HAS_SR_TB | 4B_OPCODES | HAS_4BAIT | HAS_LOCK | HAS_16BIT_SR | HAS_SR_TB_BIT6 | HAS_4BIT_BP |
>> SOFT_RESET | NO_WP
>> 
>> opcodes
>>  read           0xec
>>   dummy cycles  6
>>  erase          0xdc
>>  program        0x34
>>  8D extension   none
>> 
>> protocols
>>  read           1S-4S-4S
>>  write          1S-1S-4S
>>  register       1S-1S-1S
>> 
>> erase commands
>>  21 (4.00 KiB) [1]
>>  dc (64.0 KiB) [3]
>>  c7 (64.0 MiB)
>> 
>> sector map
>>  region (in hex)   | erase mask | overlaid
>>  ------------------+------------+---------
>>  00000000-03ffffff |     [   3] | no
>> 
>> locked sectors
>>  region (in hex)   | status   | #blocks
>>  ------------------+----------+--------
>>  00000000-03ffffff | unlocked | 1024
>> 
>> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>

I don't want to be too pushy but this series has been pending for a
while, there are real fixes inside, it (IMO) greatly improve the
documentation, adds a testing procedure, gives a friendly interface to
understand what is locked, etc. I am working on clarifying and improving
the Winbond vendor driver even more now and I need these changes to get
in for the cleanup to continue. Can someone bump spi-nor/next on top of
v7.1-rc1 and apply this? Unless there are more changes, of course.

Thanks a lot!
Miquèl

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

  reply	other threads:[~2026-04-27 13:39 UTC|newest]

Thread overview: 82+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-03 16:09 [PATCH v4 00/27] mtd: spi-nor: Enhance software protection Miquel Raynal
2026-04-03 16:09 ` Miquel Raynal
2026-04-03 16:09 ` [PATCH v4 01/27] mtd: spi-nor: Drop duplicate Kconfig dependency Miquel Raynal
2026-04-03 16:09   ` Miquel Raynal
2026-04-03 16:09 ` [PATCH v4 02/27] mtd: spi-nor: debugfs: Fix the flags list Miquel Raynal
2026-04-03 16:09   ` Miquel Raynal
2026-04-03 16:09 ` [PATCH v4 03/27] mtd: spi-nor: swp: Improve locking user experience Miquel Raynal
2026-04-03 16:09   ` Miquel Raynal
2026-04-03 16:09 ` [PATCH v4 04/27] mtd: spi-nor: Improve opcodes documentation Miquel Raynal
2026-04-03 16:09   ` Miquel Raynal
2026-04-03 16:09 ` [PATCH v4 05/27] mtd: spi-nor: debugfs: Align variable access with the rest of the file Miquel Raynal
2026-04-03 16:09   ` Miquel Raynal
2026-04-03 16:09 ` [PATCH v4 06/27] mtd: spi-nor: debugfs: Enhance output Miquel Raynal
2026-04-03 16:09   ` Miquel Raynal
2026-04-03 16:09 ` [PATCH v4 07/27] mtd: spi-nor: swp: Explain the MEMLOCK ioctl implementation behaviour Miquel Raynal
2026-04-03 16:09   ` Miquel Raynal
2026-05-05 15:40   ` Pratyush Yadav
2026-05-05 15:40     ` Pratyush Yadav
2026-05-06  8:42     ` Miquel Raynal
2026-05-06  8:42       ` Miquel Raynal
2026-04-03 16:09 ` [PATCH v4 08/27] mtd: spi-nor: swp: Clarify a comment Miquel Raynal
2026-04-03 16:09   ` Miquel Raynal
2026-04-03 16:09 ` [PATCH v4 09/27] mtd: spi-nor: swp: Use a pointer for SR instead of a single byte Miquel Raynal
2026-04-03 16:09   ` Miquel Raynal
2026-04-03 16:09 ` [PATCH v4 10/27] mtd: spi-nor: swp: Create a helper that writes SR, CR and checks Miquel Raynal
2026-04-03 16:09   ` Miquel Raynal
2026-05-05 16:05   ` Pratyush Yadav
2026-05-05 16:05     ` Pratyush Yadav
2026-05-06  8:57     ` Miquel Raynal
2026-05-06  8:57       ` Miquel Raynal
2026-05-06  9:06     ` Michael Walle
2026-05-06  9:06       ` Michael Walle
2026-05-06  9:54       ` Miquel Raynal
2026-05-06  9:54         ` Miquel Raynal
2026-04-03 16:09 ` [PATCH v4 11/27] mtd: spi-nor: swp: Rename a mask Miquel Raynal
2026-04-03 16:09   ` Miquel Raynal
2026-04-03 16:09 ` [PATCH v4 12/27] mtd: spi-nor: swp: Create a TB intermediate variable Miquel Raynal
2026-04-03 16:09   ` Miquel Raynal
2026-04-03 16:09 ` [PATCH v4 13/27] mtd: spi-nor: swp: Create helpers for building the SR register Miquel Raynal
2026-04-03 16:09   ` Miquel Raynal
2026-04-03 16:09 ` [PATCH v4 14/27] mtd: spi-nor: swp: Simplify checking the locked/unlocked range Miquel Raynal
2026-04-03 16:09   ` Miquel Raynal
2026-04-03 16:09 ` [PATCH v4 15/27] mtd: spi-nor: swp: Cosmetic changes Miquel Raynal
2026-04-03 16:09   ` Miquel Raynal
2026-04-03 16:09 ` [PATCH v4 16/27] mtd: spi-nor: Create a local SR cache Miquel Raynal
2026-04-03 16:09   ` Miquel Raynal
2026-05-05 16:14   ` Pratyush Yadav
2026-05-05 16:14     ` Pratyush Yadav
2026-05-06  8:51     ` Michael Walle
2026-05-06  8:51       ` Michael Walle
2026-05-06  8:59       ` Miquel Raynal
2026-05-06  8:59         ` Miquel Raynal
2026-04-03 16:09 ` [PATCH v4 17/27] mtd: spi-nor: debugfs: Add locking support Miquel Raynal
2026-04-03 16:09   ` Miquel Raynal
2026-04-10  4:39   ` Takahiro.Kuwano
2026-04-10  4:39     ` Takahiro.Kuwano
2026-04-27 13:39     ` Miquel Raynal [this message]
2026-04-27 13:39       ` Miquel Raynal
2026-04-27 16:11       ` Pratyush Yadav
2026-04-27 16:11         ` Pratyush Yadav
2026-04-28  7:56         ` Miquel Raynal
2026-04-28  7:56           ` Miquel Raynal
2026-04-03 16:09 ` [PATCH v4 18/27] mtd: spi-nor: debugfs: Add a locked sectors map Miquel Raynal
2026-04-03 16:09   ` Miquel Raynal
2026-04-03 16:09 ` [PATCH v4 19/27] mtd: spi-nor: Add steps for testing locking support Miquel Raynal
2026-04-03 16:09   ` Miquel Raynal
2026-04-03 16:09 ` [PATCH v4 20/27] mtd: spi-nor: swp: Add support for the complement feature Miquel Raynal
2026-04-03 16:09   ` Miquel Raynal
2026-04-03 16:09 ` [PATCH v4 21/27] mtd: spi-nor: Add steps for testing locking with CMP Miquel Raynal
2026-04-03 16:09   ` Miquel Raynal
2026-04-03 16:09 ` [PATCH v4 22/27] mtd: spi-nor: winbond: Add W25H512NWxxAM CMP locking support Miquel Raynal
2026-04-03 16:09   ` Miquel Raynal
2026-04-03 16:09 ` [PATCH v4 23/27] mtd: spi-nor: winbond: Add W25H01NWxxAM " Miquel Raynal
2026-04-03 16:09   ` Miquel Raynal
2026-04-03 16:09 ` [PATCH v4 24/27] mtd: spi-nor: winbond: Add W25H02NWxxAM " Miquel Raynal
2026-04-03 16:09   ` Miquel Raynal
2026-04-03 16:09 ` [PATCH v4 25/27] mtd: spi-nor: winbond: Add W25H01NWxxIQ " Miquel Raynal
2026-04-03 16:09   ` Miquel Raynal
2026-04-03 16:09 ` [PATCH v4 26/27] mtd: spi-nor: winbond: Add W25Q01NWxxIM " Miquel Raynal
2026-04-03 16:09   ` Miquel Raynal
2026-04-03 16:09 ` [PATCH v4 27/27] mtd: spi-nor: winbond: Add W25Q02NWxxIM " Miquel Raynal
2026-04-03 16:09   ` Miquel Raynal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87h5owh69c.fsf@bootlin.com \
    --to=miquel.raynal@bootlin.com \
    --cc=STLin2@winbond.com \
    --cc=Takahiro.Kuwano@infineon.com \
    --cc=corbet@lwn.net \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=mwalle@kernel.org \
    --cc=pratyush@kernel.org \
    --cc=richard@nod.at \
    --cc=sean.anderson@linux.dev \
    --cc=thomas.petazzoni@bootlin.com \
    --cc=vigneshr@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.