Re: [PATCH v4 3/7] dt-bindings: mmc: add property for partitions node in mmc-card node
From: Christian Marangi
Date: Wed Aug 21 2024 - 13:59:15 EST
On Wed, Aug 21, 2024 at 03:12:49PM +0200, Miquel Raynal wrote:
> Hi Christian,
>
> ansuelsmth@xxxxxxxxx wrote on Tue, 20 Aug 2024 22:20:59 +0200:
>
> > On Tue, Aug 13, 2024 at 02:07:34PM -0600, Rob Herring wrote:
> > > On Fri, Aug 09, 2024 at 07:21:01PM +0200, Christian Marangi wrote:
> > > > Add property for defining partitions node in mmc-card node to define
> > > > partitions in DT by the use of the block2mtd module to use block
> > > > devices as MTD.
> > >
> > > You justified patch 1 saying eMMC already supported this, but then here
> > > you add support.
> > >
> > > Both are a NAK for me as both already have a way to describe partitions
> > > with GPT.
> > >
> >
> > I think this got a bit confused and hope we can find a way to add
> > support for this.
> >
> > What is "already supported" is assigning an OF node so driver can
> > reference it. This patch was just adding the nodes in the schema to say
> > that partitions can be defined.
> >
> > I think what is not clear is that block devices might be used as raw
> > devices without a partition table defined in the device. In such case
> > it's the kernel that define a fixed partition table.
> >
> > One example is [1] where the partition table is provided by cmdline.
> > Similar to cmdlinepart MTD parser.
> >
> > The use of block2mtd is just to make use of the MTD parser system.
> >
> > Considering
> > - eMMC is soldered to the device (no dynamic scan)
> > - cmdline might be not tunable and hardcoding it might also be
> > problematic (as some cmdline needs to be used)
> > - concept of fixed partition for block device is already a thing and
> > used a lot (android AFAIK)
> >
> > I think it should be acceptable to introduce in DT support for defining
> > fixed partition for block devices and some kind of parser system similar
> > to MTD. What do you think? Would this be more acceptable? Idea is to
> > just have a DT schema that makes use of the values that can be set in
> > [1].
> >
> > Hope we can find a solution to this, I'm totally OK for dropping NVMe as
> > I understand it's PCIe stuff and very dynamic but OEM are making lots of
> > use of eMMC and are starting to use these strange way (block2mtd) as we
> > currently don't give a proper and easy solution for the task.
>
> Thanks for the summary. I believe I now have a better understanding of
> what you want to do, but I am still convinced you should not abuse the
> mtd layer for that. If blocks can be partitioned based on the cmdline
> (or from the DT) then the partitioning logic should be specific to
> the block layer. However, the parsing logic is probably very similar
> and could be extracted into a lib/, provided that the mtd bits are
> moved away cleverly. You only need the fixed parser anyway, and you
> probably don't want all the weird corner cases we keep supporting for
> backward compatibility reasons.
>
Yes I also agree abusing MTD layer for this is wrong and I also love
introducing and actually "stabilize" support for fixed-partitions for
block devices. So what it needs to be done is creating support in DT.
(interesting that cmdline is supported but nobody cared of adding
support in DT as that opens to lots of possibilities and is generally
better)
Yes I will check how the current fixed-partition parser for MTD can be
generalized and moved to MTD. In theory the DT schema should be the
same. (it's just offset, label and size after all)
> > [1] https://github.com/torvalds/linux/blob/master/Documentation/block/cmdline-partition.rst
> >
> > > >
> > > > Signed-off-by: Christian Marangi <ansuelsmth@xxxxxxxxx>
> > > > ---
> > > > .../devicetree/bindings/mmc/mmc-card.yaml | 40 +++++++++++++++++++
> > > > 1 file changed, 40 insertions(+)
> >
>
> Thanks,
> Miquèl
--
Ansuel