From: Miquel Raynal <miquel.raynal@bootlin.com>
To: "Roland Kovács" <roland.kovacs@est.tech>
Cc: "linux-mtd@lists.infradead.org" <linux-mtd@lists.infradead.org>,
Malin Jonsson <malin.jonsson@est.tech>
Subject: Re: Questions about MTD subpartitioning
Date: Tue, 29 Apr 2025 10:51:25 +0200 [thread overview]
Message-ID: <87tt67tkoi.fsf@bootlin.com> (raw)
In-Reply-To: <DB8P189MB073217A985B7E4D574C972829B852@DB8P189MB0732.EURP189.PROD.OUTLOOK.COM> ("Roland Kovács"'s message of "Thu, 24 Apr 2025 14:21:49 +0000")
Hi Roland,
On 24/04/2025 at 14:21:49 GMT, Roland Kovács <roland.kovacs@est.tech> wrote:
> Many thanks for your response Miquel,
>
>> But if you have partitions in you DT, the
>> master device is not kept (for historical reasons).
>
> In our case, we don't have DT as the platform is x86.
To be very transparent, I am not familiar enough with x86 to be helpful
here.
> We are using the bog-standard spi-nor flash driver, the only extra we have is
> an additional driver that reads the predefined regions from the SPI controller,
> and registers them under the MTD master as partitions, some of them with write
> protection.
>
>> But if you need it you may select CONFIG_MTD_PARTITIONED_MASTER.
>
> Enabling the above *does* allow adding more partitions, however one issue I
> see with that is any new partition created will take its flags (including
> MTD_WRITEABLE) from the master device. So if we were to create partitions that
> overlap a predefined partition to emulate subpartitions that way we will have
> writable access over an otherwise read-only marked area.
AFAIU MTD_WRITEABLE is not a protection mechanism. It just tells
userspace if the type of underlying device is writeable, it does not
indicate anything about any type of write protection on top.
> Some partitions do have hardware write protection, but on some we enforce it
> in software, but I can't seem to find a way to do this in userspace.
>
> Is there a way to change write protection that I perhaps missed?
There is a MEMLOCK ioctl, but only a single spi nor manufacturer driver
implements it.
> Unless there's already an option for it would adding support for BLKROSET and
> BLKROGET make sense?
This would be at the block level, I have no objection myself but my
opinion would not be super relevant there, as you would have to involve
block folks in the discussion :)
Cheers,
Miquèl
> Regards,
> Roland
> -------------------------------------------------------------------------------------------------------------------------
> From: Miquel Raynal <miquel.raynal@bootlin.com>
> Sent: 18 April 2025 09:16
> To: Roland Kovács <roland.kovacs@est.tech>
> Cc: linux-mtd@lists.infradead.org <linux-mtd@lists.infradead.org>; Malin Jonsson <malin.jonsson@est.tech>
> Subject: Re: Questions about MTD subpartitioning
>
> Hi Roland,
>
> On 17/04/2025 at 12:08:42 GMT, Roland Kovács <roland.kovacs@est.tech> wrote:
>
>> Hi,
>>
>> I'd like to ask some questions regarding mtdchar device driver.
>> We'd like to add subpartitions to the PDR region of a NOR-flash device from userspace, but we hit a check in the BLKPG
>> ioctl call which prevents subpartitioning.
>> As far as I can tell, this check predates the support for subpartitions in mtdpart.c and I couldn't find information on
>> why this is the case.
>>
>> Is there a particular reason why subpartitions through BLKPG is not allowed?
>> Or do you have any other recommended way of doing subpartitions from
>> userspace?
>
> In general I do not use subpartitioning from userspace, so I must admit
> this is going to be a blind advise.
>
> Looking at the code I see that partitioning is only allowed on master
> devices, not partitions. But if you have partitions in you DT, the
> master device is not kept (for historical reasons). But if you need it
> you may select CONFIG_MTD_PARTITIONED_MASTER.
>
> If that does not help, please give more details about the command
> attempted, the device identification and geometry as well as the errors
> you get.
>
> Thanks,
> Miquèl
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
prev parent reply other threads:[~2025-04-29 8:57 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <AM7P189MB07258ABAA4DA1823DDDE78579BBC2@AM7P189MB0725.EURP189.PROD.OUTLOOK.COM>
2025-04-18 7:16 ` Questions about MTD subpartitioning Miquel Raynal
[not found] ` <DB8P189MB073217A985B7E4D574C972829B852@DB8P189MB0732.EURP189.PROD.OUTLOOK.COM>
2025-04-29 8:51 ` Miquel Raynal [this message]
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=87tt67tkoi.fsf@bootlin.com \
--to=miquel.raynal@bootlin.com \
--cc=linux-mtd@lists.infradead.org \
--cc=malin.jonsson@est.tech \
--cc=roland.kovacs@est.tech \
/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.