devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH 0/6] Add GPT parser to MTD layer
@ 2023-12-11 15:12 Romain Gantois
  2023-12-11 15:12 ` [RFC PATCH 1/6] block: partitions: efi: Move efi.h header to include/linux/gpt.h Romain Gantois
                   ` (6 more replies)
  0 siblings, 7 replies; 11+ messages in thread
From: Romain Gantois @ 2023-12-11 15:12 UTC (permalink / raw)
  To: Miquel Raynal, Richard Weinberger, Vignesh Raghavendra,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, Jens Axboe,
	Davidlohr Bueso, Ard Biesheuvel
  Cc: Romain Gantois, Thomas Petazzoni, Herve Codina, linux-mtd,
	devicetree, linux-kernel, linux-block, linux-efi

Hello everyone,

MTD devices were historically partitioned using fixed partitions schemes
defined in the kernel device tree or on the cmdline. More recently, a bunch
of dynamic parsers have been introduced, allowing partitioning information
to be stored in-band. However, unlike disks, parsers for MTD devices do not
support runtime discovery of the partition format. This format is instead
named in the device-tree using a compatible string.

The GUID Partition Table is one of the most common ways of partitioning a
block device. As of now, there is no support in the MTD layer for parsing
GPT tables. Indeed, use cases for layouts like GPT on raw Flash devices are
rare, and for good reason since these partitioning schemes are sensitive to
bad blocks in strategic locations such as LBA 2.  Moreover, they do not
allow proper wear-leveling to be performed on the full span of the device.

However, allowing GPT to be used on MTD devices can be practical in some
cases. In the context of an A/B OTA upgrade that can act on either NOR of
eMMC devices, having the same partition table format for both kinds of
devices can simplify the task of the update software.

This series adds a fully working MTD GPT parser to the kernel. Use of the
parser is restricted to NOR flash devices, since NAND flashes are too
susceptible to bad blocks. To ensure coherence and code-reuse between
subsystems, I've factored device-agnostic code from the block layer GPT
parser and moved it to a new generic library in lib/gpt.c. No functional
change is intended in the block layer parser.

I understand that this can seem like a strange feature for MTD devices, but
with the restriction to NOR devices, the partition table can be fairly
reliable. Moreover, this addition fits nicely into the MTD parser model.
Please tell me what you think.

Best Regards,

Romain

Romain Gantois (6):
  block: partitions: efi: Move efi.h header to include/linux/gpt.h
  block: partitions: efi: Fix some style issues
  block: partitions: efi: Separate out GPT-specific code
  block: partitions: efi: Move GPT-specific code to a new library
  drivers: mtd: introduce GPT parser for NOR flash devices
  dt-bindings: mtd: add GPT partition bindings

 .../bindings/mtd/partitions/gpt.yaml          |  41 ++
 .../bindings/mtd/partitions/partitions.yaml   |   1 +
 MAINTAINERS                                   |   4 +-
 block/partitions/Kconfig                      |   2 +-
 block/partitions/efi.c                        | 478 +++---------------
 block/partitions/msdos.c                      |   2 +-
 drivers/mtd/parsers/Kconfig                   |  10 +
 drivers/mtd/parsers/Makefile                  |   1 +
 drivers/mtd/parsers/gpt.c                     | 222 ++++++++
 include/linux/efi.h                           |  18 +
 block/partitions/efi.h => include/linux/gpt.h |  72 ++-
 lib/Kconfig                                   |   3 +
 lib/Makefile                                  |   3 +
 lib/gpt.c                                     | 342 +++++++++++++
 14 files changed, 777 insertions(+), 422 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/mtd/partitions/gpt.yaml
 create mode 100644 drivers/mtd/parsers/gpt.c
 rename block/partitions/efi.h => include/linux/gpt.h (61%)
 create mode 100644 lib/gpt.c

-- 
2.43.0


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2023-12-14 10:34 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-11 15:12 [RFC PATCH 0/6] Add GPT parser to MTD layer Romain Gantois
2023-12-11 15:12 ` [RFC PATCH 1/6] block: partitions: efi: Move efi.h header to include/linux/gpt.h Romain Gantois
2023-12-11 15:12 ` [RFC PATCH 2/6] block: partitions: efi: Fix some style issues Romain Gantois
2023-12-12  0:57   ` Davidlohr Bueso
2023-12-11 15:12 ` [RFC PATCH 3/6] block: partitions: efi: Separate out GPT-specific code Romain Gantois
2023-12-11 15:12 ` [RFC PATCH 4/6] block: partitions: efi: Move GPT-specific code to a new library Romain Gantois
2023-12-11 15:12 ` [RFC PATCH 5/6] drivers: mtd: introduce GPT parser for NOR flash devices Romain Gantois
2023-12-11 15:12 ` [RFC PATCH 6/6] dt-bindings: mtd: add GPT partition bindings Romain Gantois
2023-12-11 16:21   ` Rob Herring
2023-12-12  0:43 ` [RFC PATCH 0/6] Add GPT parser to MTD layer Davidlohr Bueso
2023-12-14 10:34   ` Miquel Raynal

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).