Skip to contentSkip to conversation

nvmem: add block device NVMEM provider

RFC PATCH In review Daniel Golle 7 participants 21 messages Mar 5, 2024 – Mar 13, 2024

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v2 cover nvmem: add block device NVMEM provider

On embedded devices using an eMMC it is common that one or more (hw/sw) partitions on the eMMC are used to store MAC addresses and Wi-Fi calibration EEPROM data.

Implement an NVMEM provider backed by block devices as typically the NVMEM framework is used to have kernel drivers read and use binary data from EEPROMs, efuses, flash memory (MTD), ...

In order to be able to reference hardware partitions on an eMMC, add code to bind each hardware partition to a specific firmware subnode.

This series is meant to open the discussion on how exactly the device tree schema for block devices and partitions may look like, and even if using the block layer to back the NVMEM device is at all the way to go -- to me it seemed to be a good solution because it will be reuable e.g. for (normal, software GPT or MBR) partitions of an NVMe SSD.

This series has previously been submitted on July 19th 2023[1] and most of the basic idea did not change since.

However, the recent introduction of bdev_file_open_by_dev() allow to get rid of most use of block layer internals which supposedly was the main objection raised by Christoph Hellwig back then.

Most of the other comments received for in the first RFC have also been addressed, however, what remains is the use of class_interface (lacking an alternative way to get notifications about addition or removal of block devices from the system). As this has been criticized in the past I'm specifically interested in suggestions on how to solve this in another way -- ideally without having to implement a whole new way for in-kernel notifications of appearing or disappearing block devices...

And, in a way just like in case of MTD and UBI, I believe acting as an NVMEM provider *is* a functionality which belongs to the block layer itself and, other than e.g. filesystems, is inconvenient to implement elsewhere.

[1]: https://patchwork.kernel.org/project/linux-block/list/?series=767565

Daniel Golle (8):
dt-bindings: block: add basic bindings for block devices
block: partitions: populate fwnode
block: add new genhd flag GENHD_FL_NVMEM
block: implement NVMEM provider
dt-bindings: mmc: mmc-card: add block device nodes
mmc: core: set card fwnode_handle
mmc: block: set fwnode of disk devices
mmc: block: set GENHD_FL_NVMEM

 .../bindings/block/block-device.yaml          |  22 +++
 .../devicetree/bindings/block/partition.yaml  |  51 +++++
 .../devicetree/bindings/block/partitions.yaml |  20 ++
 .../devicetree/bindings/mmc/mmc-card.yaml     |  45 +++++
 block/Kconfig                                 |   9 +
 block/Makefile                                |   1 +
 block/blk-nvmem.c                             | 175 ++++++++++++++++++
 block/partitions/core.c                       |  41 ++++
 drivers/mmc/core/block.c                      |   8 +
 drivers/mmc/core/bus.c                        |   2 +
 include/linux/blkdev.h                        |   2 +
 11 files changed, 376 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/block/block-device.yaml
 create mode 100644 Documentation/devicetree/bindings/block/partition.yaml
 create mode 100644 Documentation/devicetree/bindings/block/partitions.yaml
 create mode 100644 block/blk-nvmem.c
Signature · 1 line
2.44.0
#1 lore raw

RFC PATCH v2 1/8 dt-bindings: block: add basic bindings for block devices

Add bindings for block devices which are used to allow referencing nvmem bits on them.

---
 .../bindings/block/block-device.yaml          | 22 ++++++++
 .../devicetree/bindings/block/partition.yaml  | 51 +++++++++++++++++++
 .../devicetree/bindings/block/partitions.yaml | 20 ++++++++
 3 files changed, 93 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/block/block-device.yaml
 create mode 100644 Documentation/devicetree/bindings/block/partition.yaml
 create mode 100644 Documentation/devicetree/bindings/block/partitions.yaml
Documentation/devicetree/bindings/block/block-device.yaml new file +22 -0
new file mode 100644
index 0000000000000..c83ea525650ba
@@ -0,0 +1,22 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/block/block-device.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: block storage device
+
+description: |
+  This binding is generic and describes a block-oriented storage device.
+
+maintainers:
+  - Daniel Golle <[email protected]>
+
+properties:
+  partitions:
+    $ref: /schemas/block/partitions.yaml
+
+  nvmem-layout:
+    $ref: /schemas/nvmem/layouts/nvmem-layout.yaml#
+
+unevaluatedProperties: false
Documentation/devicetree/bindings/block/partition.yaml new file +51 -0

51 lines not on this page · raw message

Documentation/devicetree/bindings/block/partitions.yaml new file +20 -0
new file mode 100644
index 0000000000000..fd84c3ba8493b
@@ -0,0 +1,20 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/block/partitions.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Partitions on block devices
+
+description: |
+  This binding is generic and describes the content of the partitions container
+  node.
+
+maintainers:
+  - Daniel Golle <[email protected]>
+
+patternProperties:
+  "^block-partition-.+$":
+    $ref: partition.yaml
+
+unevaluatedProperties: false
Signature · 1 line
2.44.0
#2 lore raw

Re: [RFC PATCH v2 1/8] dt-bindings: block: add basic bindings for block devices

Hi Daniel,

Quoted 25 lines · Daniel Golle
Documentation/devicetree/bindings/block/partition.yaml new file +19 -0
new file mode 100644
index 0000000000000..df561dd33cbc9
@@ -0,0 +1,51 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/block/partition.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Partition on a block device
+
+description: |
+  This binding describes a partition on a block storage device.
+  Partitions may be matched by a combination of partition number, name,
+  and UUID.
+
+maintainers:
+  - Daniel Golle <[email protected]>
+
+properties:
+  $nodename:
+    pattern: '^block-partition-.+$'

Documentation/devicetree/bindings/block/partition.yaml line 29

Quoted 10 lines
Documentation/devicetree/bindings/block/partition.yaml new file +10 -0
+
+  partnum:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description:
+      Matches partition by number if present.
+
+  partname:
+    $ref: /schemas/types.yaml#/definitions/string
+    description:
+      Matches partition by PARTNAME if present.

In the mtd world we originally had the partition nodes directly under the hardware device node as well. That was changed to put a partitions subnode between the hardware device node and the partitions.

From fe2585e9c29a ("doc: dt: mtd: support partitions in a special 'partitions' subnode"):

To avoid conflict with other drivers using subnodes of the mtd device create only one ofpart-specific node rather than any number of arbitrary partition subnodes.

Does it make sense to do the same for block devices?

Sascha

Signature · 4 lines
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
#3 lore raw

Re: [RFC PATCH v2 1/8] dt-bindings: block: add basic bindings for block devices

Quoted 43 lines · Sascha Hauer

Hi Daniel,

Quoted 25 lines · Daniel Golle
Documentation/devicetree/bindings/block/partition.yaml new file +19 -0
new file mode 100644
index 0000000000000..df561dd33cbc9
@@ -0,0 +1,51 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/block/partition.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Partition on a block device
+
+description: |
+  This binding describes a partition on a block storage device.
+  Partitions may be matched by a combination of partition number, name,
+  and UUID.
+
+maintainers:
+  - Daniel Golle <[email protected]>
+
+properties:
+  $nodename:
+    pattern: '^block-partition-.+$'

Documentation/devicetree/bindings/block/partition.yaml line 29

Quoted 10 lines
Documentation/devicetree/bindings/block/partition.yaml new file +10 -0
+
+  partnum:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description:
+      Matches partition by number if present.
+
+  partname:
+    $ref: /schemas/types.yaml#/definitions/string
+    description:
+      Matches partition by PARTNAME if present.

In the mtd world we originally had the partition nodes directly under the hardware device node as well. That was changed to put a partitions subnode between the hardware device node and the partitions.

Quoted 8 lines

From fe2585e9c29a ("doc: dt: mtd: support partitions in a special 'partitions' subnode"):

To avoid conflict with other drivers using subnodes of the mtd device create only one ofpart-specific node rather than any number of arbitrary partition subnodes.

Does it make sense to do the same for block devices?

Hm, looking at the example in 5/8 it seems you've already done that. I think I have misread the binding.

Sascha

Signature · 4 lines
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
maintainer
#4 lore raw

Re: [RFC PATCH v2 1/8] dt-bindings: block: add basic bindings for block devices

In reply to Daniel Golle
Quoted 66 lines · Daniel Golle

Add bindings for block devices which are used to allow referencing nvmem bits on them.

---
 .../bindings/block/block-device.yaml          | 22 ++++++++
 .../devicetree/bindings/block/partition.yaml  | 51 +++++++++++++++++++
 .../devicetree/bindings/block/partitions.yaml | 20 ++++++++
 3 files changed, 93 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/block/block-device.yaml
 create mode 100644 Documentation/devicetree/bindings/block/partition.yaml
 create mode 100644 Documentation/devicetree/bindings/block/partitions.yaml
Documentation/devicetree/bindings/block/block-device.yaml new file +22 -0
new file mode 100644
index 0000000000000..c83ea525650ba
@@ -0,0 +1,22 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/block/block-device.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: block storage device
+
+description: |
+  This binding is generic and describes a block-oriented storage device.
+
+maintainers:
+  - Daniel Golle <[email protected]>
+
+properties:
+  partitions:
+    $ref: /schemas/block/partitions.yaml
+
+  nvmem-layout:
+    $ref: /schemas/nvmem/layouts/nvmem-layout.yaml#
+
+unevaluatedProperties: false
Documentation/devicetree/bindings/block/partition.yaml new file +19 -0
new file mode 100644
index 0000000000000..df561dd33cbc9
@@ -0,0 +1,51 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/block/partition.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Partition on a block device
+
+description: |
+  This binding describes a partition on a block storage device.
+  Partitions may be matched by a combination of partition number, name,
+  and UUID.
+
+maintainers:
+  - Daniel Golle <[email protected]>
+
+properties:
+  $nodename:
+    pattern: '^block-partition-.+$'

Documentation/devicetree/bindings/block/partition.yaml line 29

Quoted 10 lines
Documentation/devicetree/bindings/block/partition.yaml new file +10 -0
+
+  partnum:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description:
+      Matches partition by number if present.
+
+  partname:
+    $ref: /schemas/types.yaml#/definitions/string
+    description:
+      Matches partition by PARTNAME if present.

Why do we need something new here? The existing fixed-partitions can already define block device partitions. It just matches by address/offset which works whether its MBR or GPT. Also, in DT we always have an address when there is an address.

I'm sure you want to statically define this and have it work even if the partitions move, but sorry...

Documentation/devicetree/bindings/block/partition.yaml line 34

Quoted 5 lines
Documentation/devicetree/bindings/block/partition.yaml new file +5 -0
+
+  uuid:
+    $ref: /schemas/types.yaml#/definitions/string
+    description:
+      Matches partition by PARTUUID if present.

If this remains it will need some work in the dtschema tools. The reason is json-schema already has support for UUIDs as a defined 'format' key value and we should use that.

Quoted 17 lines
Documentation/devicetree/bindings/block/partition.yaml new file +17 -0
+
+  nvmem-layout:
+    $ref: /schemas/nvmem/layouts/nvmem-layout.yaml#
+    description:
+      This container may reference an NVMEM layout parser.
+
+anyOf:
+  - required:
+      - partnum
+
+  - required:
+      - partname
+
+  - required:
+      - uuid
+
+unevaluatedProperties: false
#5 lore raw

RE: [EXTERNAL] Re: [RFC PATCH v2 1/8] dt-bindings: block: add basic bindings for block devices

Quoted 116 lines

-----Original Message-----
From: Rob Herring <[email protected]>
Sent: Thursday, March 7, 2024 6:51 AM
To: Daniel Golle <[email protected]>
Cc: Krzysztof Kozlowski <[email protected]>; Conor Dooley <[email protected]>; Ulf Hansson <[email protected]>; Jens Axboe <[email protected]>; Dave Chinner <[email protected]>; Jan Kara <[email protected]>; Thomas Weißschuh <[email protected]>; Christian Brauner <[email protected]>; Li Lingfeng <[email protected]>; Damien Le Moal <[email protected]>; Min Li <[email protected]>; Adrian Hunter <[email protected]>; Hannes Reinecke <[email protected]>; Christian Loehle <[email protected]>; Avri Altman <[email protected]>; Bean Huo <[email protected]>; Yeqi Fu <[email protected]>; Victor Shih <[email protected]>; Christophe JAILLET <[email protected]>; Ricardo B. Marliere <[email protected]>; Greg Kroah-Hartman <[email protected]>; [email protected]; [email protected]; [email protected]; linux- [email protected]; Diping Zhang <[email protected]>; Jianhui Zhao <[email protected]>; Jieying Zeng <[email protected]>; Chad Monroe <[email protected]>; Adam Fox <[email protected]>; John Crispin <[email protected]>
Subject: [EXTERNAL] Re: [RFC PATCH v2 1/8] dt-bindings: block: add basic bindings for block devices

Quoted 10 lines · Daniel Golle

Add bindings for block devices which are used to allow referencing nvmem bits on them.

---
.../bindings/block/block-device.yaml | 22 ++++++++ .../devicetree/bindings/block/partition.yaml | 51 +++++++++++++++++++ .../devicetree/bindings/block/partitions.yaml | 20 ++++++++

3 files changed, 93 insertions(+)

create mode 100644 Documentation/devicetree/bindings/block/block-

device.yaml

Review

Quoted 4 lines

create mode 100644 Documentation/devicetree/bindings/block/partition.yaml create mode 100644 Documentation/devicetree/bindings/block/partitions.yaml

(quoted diff) +0 -0

b/Documentation/devicetree/bindings/block/block-device.yaml

Documentation/devicetree/bindings/block/block-device.yaml line 4

Quoted 9 lines

new file mode 100644
index 0000000000000..c83ea525650ba

Documentation/devicetree/bindings/block/block-device.yaml new file +4 -0
@@ -0,0 +1,22 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/block/block-device.yaml# <https://protect-

de.mimecast.com/s/gI6FCDqGk9uBM0gMFZVG39?domain=devicetree.org>

Documentation/devicetree/bindings/block/block-device.yaml line 5

Quoted 1 line
Documentation/devicetree/bindings/block/block-device.yaml new file +1 -0
+$schema: http://devicetree.org/meta-schemas/core.yaml# <https://protect-

de.mimecast.com/s/rGEGCEqJR9uWnMRnHZK6FQ?domain=devicetree.org>

Review

Quoted 18 lines
Documentation/devicetree/bindings/block/block-device.yaml new file +17 -0
+
+title: block storage device
+
+description: |
+ This binding is generic and describes a block-oriented storage device.
+
+maintainers:
+ - Daniel Golle <[email protected]>
+
+properties:
+ partitions:
+ $ref: /schemas/block/partitions.yaml
+
+ nvmem-layout:
+ $ref: /schemas/nvmem/layouts/nvmem-layout.yaml#
+
+unevaluatedProperties: false
(quoted diff) +0 -0

b/Documentation/devicetree/bindings/block/partition.yaml

Documentation/devicetree/bindings/block/partition.yaml line 4

Quoted 9 lines

new file mode 100644
index 0000000000000..df561dd33cbc9

Documentation/devicetree/bindings/block/partition.yaml new file +4 -0
@@ -0,0 +1,51 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/block/partition.yaml# <https://protect-

de.mimecast.com/s/8Tf9CGRL65UJqGjqu07YGR?domain=devicetree.org>

Documentation/devicetree/bindings/block/partition.yaml line 5

Quoted 1 line
Documentation/devicetree/bindings/block/partition.yaml new file +1 -0
+$schema: http://devicetree.org/meta-schemas/core.yaml# <https://protect-

de.mimecast.com/s/rGEGCEqJR9uWnMRnHZK6FQ?domain=devicetree.org>

Quoted 14 lines
Documentation/devicetree/bindings/block/partition.yaml new file +14 -0
+
+title: Partition on a block device
+
+description: |
+ This binding describes a partition on a block storage device.
+ Partitions may be matched by a combination of partition number, name,
+ and UUID.
+
+maintainers:
+ - Daniel Golle <[email protected]>
+
+properties:
+ $nodename:
+ pattern: '^block-partition-.+$'

Documentation/devicetree/bindings/block/partition.yaml line 29

Quoted 10 lines
Documentation/devicetree/bindings/block/partition.yaml new file +10 -0
+
+ partnum:
+ $ref: /schemas/types.yaml#/definitions/uint32
+ description:
+ Matches partition by number if present.
+
+ partname:
+ $ref: /schemas/types.yaml#/definitions/string
+ description:
+ Matches partition by PARTNAME if present.

Why do we need something new here? The existing fixed-partitions can already define block device partitions. It just matches by address/offset which works whether its MBR or GPT. Also, in DT we always have an address when there is an address.

Quoted 2 lines

I'm sure you want to statically define this and have it work even if the partitions move, but sorry...

The partitions which hold this data are typically defined as a MBR or GPT partition and referenced by PARTNAME, PARTUUID or PARTNO. The data is referenced as an offset within that partition. It's possible for the offset of the RF/calibration partition to change if the size of eMMC chip changes between builds of the same device for example. Within the RF partition the data is always available at the same offsets.

Based on this, we don't always know the offset of the RF partition and simply want to use the partition table to point us at the right location.

Quoted 28 lines

Documentation/devicetree/bindings/block/partition.yaml line 34

Quoted 6 lines
Documentation/devicetree/bindings/block/partition.yaml new file +5 -0
+
+ uuid:
+ $ref: /schemas/types.yaml#/definitions/string
+ description:
+ Matches partition by PARTUUID if present.

If this remains it will need some work in the dtschema tools. The reason is json-schema already has support for UUIDs as a defined 'format' key value and we should use that.

Quoted 17 lines
Documentation/devicetree/bindings/block/partition.yaml new file +17 -0
+
+ nvmem-layout:
+ $ref: /schemas/nvmem/layouts/nvmem-layout.yaml#
+ description:
+ This container may reference an NVMEM layout parser.
+
+anyOf:
+ - required:
+ - partnum
+
+ - required:
+ - partname
+
+ - required:
+ - uuid
+
+unevaluatedProperties: false
#6 lore raw

RFC PATCH v2 2/8 block: partitions: populate fwnode

In reply to Daniel Golle

Let block partitions to be represented by a firmware node and hence allow them to being referenced e.g. for use with blk-nvmem.

---
 block/partitions/core.c | 41 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)
block/partitions/core.c +41 -0
index 5f5ed5c75f04d..48d7f01d76c6a 100644
@@ -10,6 +10,8 @@
 #include <linux/ctype.h>
 #include <linux/vmalloc.h>
 #include <linux/raid/detect.h>
+#include <linux/property.h>
+
 #include "check.h"
 
 static int (*const check_part[])(struct parsed_partitions *) = {
@@ -281,6 +283,43 @@ static ssize_t whole_disk_show(struct device *dev,
 }
 static const DEVICE_ATTR(whole_disk, 0444, whole_disk_show, NULL);
 
+static struct fwnode_handle *find_partition_fwnode(struct block_device *bdev)
+{
+	struct fwnode_handle *fw_parts, *fw_part;
+	struct device *ddev = disk_to_dev(bdev->bd_disk);
+	const char *partname, *uuid;
+	u32 partno;
+
+	fw_parts = device_get_named_child_node(ddev, "partitions");
+	if (!fw_parts)
+		fw_parts = device_get_named_child_node(ddev->parent, "partitions");
+
+	if (!fw_parts)
+		return NULL;
+
+	fwnode_for_each_child_node(fw_parts, fw_part) {
+		if (!fwnode_property_read_string(fw_part, "uuid", &uuid) &&
+		    (!bdev->bd_meta_info || strncmp(uuid,
+						    bdev->bd_meta_info->uuid,
+						    PARTITION_META_INFO_UUIDLTH)))
+			continue;
+
+		if (!fwnode_property_read_string(fw_part, "partname", &partname) &&
+		    (!bdev->bd_meta_info || strncmp(partname,
+						    bdev->bd_meta_info->volname,
+						    PARTITION_META_INFO_VOLNAMELTH)))
+			continue;
+
+		if (!fwnode_property_read_u32(fw_part, "partno", &partno) &&
+		    bdev->bd_partno != partno)
+			continue;
+
+		return fw_part;
+	}
+
+	return NULL;
+}
+
 /*
  * Must be called either with open_mutex held, before a disk can be opened or
  * after all disk users are gone.
@@ -355,6 +394,8 @@ static struct block_device *add_partition(struct gendisk *disk, int partno,
 			goto out_put;
 	}
 
+	device_set_node(pdev, find_partition_fwnode(bdev));
+
 	/* delay uevent until 'holders' subdir is created */
 	dev_set_uevent_suppress(pdev, 1);
 	err = device_add(pdev);
Signature · 1 line
2.44.0
#7 lore raw

RFC PATCH v2 3/8 block: add new genhd flag GENHD_FL_NVMEM

In reply to Daniel Golle

Add new flag to destinguish block devices which may act as an NVMEM provider.

---
 include/linux/blkdev.h | 2 ++
 1 file changed, 2 insertions(+)
include/linux/blkdev.h +2 -0
index 715c9201008a6..03e4b1fd5060d 100644
@@ -81,11 +81,13 @@ struct partition_meta_info {
  * ``GENHD_FL_NO_PART``: partition support is disabled.  The kernel will not
  * scan for partitions from add_disk, and users can't add partitions manually.
  *
+ * ``GENHD_FL_NVMEM``: the block device should be considered as NVMEM provider.
  */
 enum {
 	GENHD_FL_REMOVABLE			= 1 << 0,
 	GENHD_FL_HIDDEN				= 1 << 1,
 	GENHD_FL_NO_PART			= 1 << 2,
+	GENHD_FL_NVMEM				= 1 << 3,
 };
 
 enum {
Signature · 1 line
2.44.0
#8 lore raw

RFC PATCH v2 4/8 block: implement NVMEM provider

In reply to Daniel Golle

On embedded devices using an eMMC it is common that one or more partitions on the eMMC are used to store MAC addresses and Wi-Fi calibration EEPROM data. Allow referencing the partition in device tree for the kernel and Wi-Fi drivers accessing it via the NVMEM layer.

---
 block/Kconfig     |   9 +++
 block/Makefile    |   1 +
 block/blk-nvmem.c | 175 ++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 185 insertions(+)
 create mode 100644 block/blk-nvmem.c
block/Kconfig +9 -0
index 1de4682d48ccb..b1d4c88c70040 100644
@@ -229,6 +229,15 @@ config BLK_INLINE_ENCRYPTION_FALLBACK
 	  by falling back to the kernel crypto API when inline
 	  encryption hardware is not present.
 
+config BLK_NVMEM
+	bool "Block device NVMEM provider"
+	depends on OF
+	depends on NVMEM
+	help
+	  Allow block devices (or partitions) to act as NVMEM prodivers,
+	  typically used with eMMC to store MAC addresses or Wi-Fi
+	  calibration data on embedded devices.
+
 source "block/partitions/Kconfig"
 
 config BLK_MQ_PCI
block/Makefile +1 -0
index 46ada9dc8bbfe..03c0bfa8642df 100644
@@ -34,6 +34,7 @@ obj-$(CONFIG_BLK_DEV_ZONED)	+= blk-zoned.o
 obj-$(CONFIG_BLK_WBT)		+= blk-wbt.o
 obj-$(CONFIG_BLK_DEBUG_FS)	+= blk-mq-debugfs.o
 obj-$(CONFIG_BLK_DEBUG_FS_ZONED)+= blk-mq-debugfs-zoned.o
+obj-$(CONFIG_BLK_NVMEM)		+= blk-nvmem.o
 obj-$(CONFIG_BLK_SED_OPAL)	+= sed-opal.o
 obj-$(CONFIG_BLK_PM)		+= blk-pm.o
 obj-$(CONFIG_BLK_INLINE_ENCRYPTION)	+= blk-crypto.o blk-crypto-profile.o \
block/blk-nvmem.c new file +175 -0

175 lines not on this page · raw message

Signature · 1 line
2.44.0
#9 lore raw

Re: [RFC PATCH v2 4/8] block: implement NVMEM provider

Hi Daniel,

Quoted 9 lines · Daniel Golle

static int __init blk_nvmem_init(void)

{
	int ret;
 
	ret = class_interface_register(&blk_nvmem_bus_interface);
	if (ret)
		return ret;
 
	return 0;

Just an idea, why not just:

return class_interface_register(&blk_nvmem_bus_interface);

#10 lore raw

RFC PATCH v2 5/8 dt-bindings: mmc: mmc-card: add block device nodes

In reply to Daniel Golle

Add nodes representing the block devices exposed by an MMC device including an example involving nvmem-cells.

---
 .../devicetree/bindings/mmc/mmc-card.yaml     | 45 +++++++++++++++++++
 1 file changed, 45 insertions(+)
Documentation/devicetree/bindings/mmc/mmc-card.yaml +45 -0
index fd347126449ac..95ccbda871d24 100644
@@ -26,6 +26,18 @@ properties:
       Use this to indicate that the mmc-card has a broken hpi
       implementation, and that hpi should not be used.
 
+  block:
+    $ref: /schemas/block/block-device.yaml#
+    description:
+      Represents the block storage provided by an SD card or the
+      main hardware partition of an eMMC.
+
+patternProperties:
+  '^boot[0-9]+':
+    $ref: /schemas/block/block-device.yaml#
+    description:
+      Represents a boot hardware partition on an eMMC.
+
 required:
   - compatible
   - reg
@@ -42,6 +54,39 @@ examples:
             compatible = "mmc-card";
             reg = <0>;
             broken-hpi;
+
+            block {
+                partitions {
+                    cal_data: block-partition-rf {
+                        partnum = <3>;
+                        partname = "rf";
+
+                        nvmem-layout {
+                            compatible = "fixed-layout";
+                            #address-cells = <1>;
+                            #size-cells = <1>;
+
+                            eeprom@0 {
+                                reg = <0x0 0x1000>;
+                            };
+                        };
+                    };
+                };
+            };
+
+            boot1 {
+                nvmem-layout {
+                    compatible = "fixed-layout";
+                    #address-cells = <1>;
+                    #size-cells = <1>;
+
+                    macaddr: macaddr@a {
+                        compatible = "mac-base";
+                        reg = <0xa 0x6>;
+                        #nvmem-cell-cells = <1>;
+                    };
+                };
+            };
         };
     };
 
Signature · 1 line
2.44.0
#11 lore raw

RFC PATCH v2 6/8 mmc: core: set card fwnode_handle

In reply to Daniel Golle

Set fwnode in case it isn't set yet and of_node is present.

---
 drivers/mmc/core/bus.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/mmc/core/bus.c +2 -0
index 0ddaee0eae54f..e1c5fc1b3ce4b 100644
@@ -364,6 +364,8 @@ int mmc_add_card(struct mmc_card *card)
 
 	mmc_add_card_debugfs(card);
 	card->dev.of_node = mmc_of_find_child_device(card->host, 0);
+	if (card->dev.of_node && !card->dev.fwnode)
+		card->dev.fwnode = &card->dev.of_node->fwnode;
 
 	device_enable_async_suspend(&card->dev);
 
Signature · 1 line
2.44.0
#12 lore raw

RE: [RFC PATCH v2 6/8] mmc: core: set card fwnode_handle

Quoted 13 lines

Set fwnode in case it isn't set yet and of_node is present.

---
 drivers/mmc/core/bus.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/mmc/core/bus.c index renamed from drivers/mmc/core/bus.c +0 -0

0ddaee0eae54f..e1c5fc1b3ce4b 100644

drivers/mmc/core/bus.c int mmc_add_card(struct mmc_card *card) · line 368

Quoted 5 lines
drivers/mmc/core/bus.c +2 -0
@@ -364,6 +364,8 @@ int mmc_add_card(struct mmc_card *card)
 
        mmc_add_card_debugfs(card);
        card->dev.of_node = mmc_of_find_child_device(card->host, 0);
+       if (card->dev.of_node && !card->dev.fwnode)
+               card->dev.fwnode = &card->dev.of_node->fwnode;

Should this be restricted to eMMC only, or is it fine to be called for SD as well?

Thanks,
Avri

Quoted 5 lines
drivers/mmc/core/bus.c +0 -1
        device_enable_async_suspend(&card->dev);
 
--

2.44.0

#13 lore raw

Re: [RFC PATCH v2 6/8] mmc: core: set card fwnode_handle

Quoted 14 lines · Avri Altman
Quoted 14 lines

Set fwnode in case it isn't set yet and of_node is present.

---
 drivers/mmc/core/bus.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/mmc/core/bus.c index renamed from drivers/mmc/core/bus.c +0 -0

0ddaee0eae54f..e1c5fc1b3ce4b 100644

drivers/mmc/core/bus.c +0 -0
@@ -364,6 +364,8 @@ int mmc_add_card(struct mmc_card *card)
 
Quoted 5 lines

drivers/mmc/core/bus.c int mmc_add_card(struct mmc_card *card) · line 368

Quoted 4 lines
drivers/mmc/core/bus.c +2 -0
        mmc_add_card_debugfs(card);
        card->dev.of_node = mmc_of_find_child_device(card->host, 0);
+       if (card->dev.of_node && !card->dev.fwnode)
+               card->dev.fwnode = &card->dev.of_node->fwnode;

Should this be restricted to eMMC only, or is it fine to be called for SD as well?

It's always odd to have of_node set and fwnode unset. And also SD cards can be referenced in device tree, resulting in of_node being set but fwnode being unpopulated, which is no more or less weird than for an eMMC.

So imho it should always be called and shouldn't hurt.

#14 lore raw

RFC PATCH v2 7/8 mmc: block: set fwnode of disk devices

In reply to Daniel Golle

Set fwnode of disk devices to 'block', 'boot0' and 'boot1' subnodes of the mmc-card. This is done in preparation for having the eMMC act as NVMEM provider.

---
 drivers/mmc/core/block.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/mmc/core/block.c +7 -0
index bd165cef2bbc3..c3e9477743515 100644
@@ -2461,6 +2461,7 @@ static struct mmc_blk_data *mmc_blk_alloc_req(struct mmc_card *card,
 					      int area_type,
 					      unsigned int part_type)
 {
+	struct fwnode_handle *fwnode;
 	struct mmc_blk_data *md;
 	int devidx, ret;
 	char cap_str[10];
@@ -2557,6 +2558,12 @@ static struct mmc_blk_data *mmc_blk_alloc_req(struct mmc_card *card,
 
 	blk_queue_write_cache(md->queue.queue, cache_enabled, fua_enabled);
 
+	fwnode = device_get_named_child_node(subname ? md->parent->parent :
+						       md->parent,
+					     subname ? subname : "block");
+	if (fwnode)
+		device_set_node(disk_to_dev(md->disk), fwnode);
+
 	string_get_size((u64)size, 512, STRING_UNITS_2,
 			cap_str, sizeof(cap_str));
 	pr_info("%s: %s %s %s%s\n",
Signature · 1 line
2.44.0
#15 lore raw

RFC PATCH v2 8/8 mmc: block: set GENHD_FL_NVMEM

In reply to Daniel Golle

Set flag to consider MMC block devices as NVMEM providers.

---
 drivers/mmc/core/block.c | 1 +
 1 file changed, 1 insertion(+)
drivers/mmc/core/block.c +1 -0
index c3e9477743515..8cd0400c9887d 100644
@@ -2514,6 +2514,7 @@ static struct mmc_blk_data *mmc_blk_alloc_req(struct mmc_card *card,
 	md->disk->major	= MMC_BLOCK_MAJOR;
 	md->disk->minors = perdev_minors;
 	md->disk->first_minor = devidx * perdev_minors;
+	md->disk->flags = GENHD_FL_NVMEM;
 	md->disk->fops = &mmc_bdops;
 	md->disk->private_data = md;
 	md->parent = parent;
Signature · 1 line
2.44.0
#16 lore raw
In reply to Daniel Golle
Quoted 34 lines · Daniel Golle

On embedded devices using an eMMC it is common that one or more (hw/sw) partitions on the eMMC are used to store MAC addresses and Wi-Fi calibration EEPROM data.

Implement an NVMEM provider backed by block devices as typically the NVMEM framework is used to have kernel drivers read and use binary data from EEPROMs, efuses, flash memory (MTD), ...

In order to be able to reference hardware partitions on an eMMC, add code to bind each hardware partition to a specific firmware subnode.

This series is meant to open the discussion on how exactly the device tree schema for block devices and partitions may look like, and even if using the block layer to back the NVMEM device is at all the way to go -- to me it seemed to be a good solution because it will be reuable e.g. for (normal, software GPT or MBR) partitions of an NVMe SSD.

This series has previously been submitted on July 19th 2023[1] and most of the basic idea did not change since.

However, the recent introduction of bdev_file_open_by_dev() allow to get rid of most use of block layer internals which supposedly was the main objection raised by Christoph Hellwig back then.

Most of the other comments received for in the first RFC have also been addressed, however, what remains is the use of class_interface (lacking an alternative way to get notifications about addition or removal of block devices from the system). As this has been criticized in the past I'm specifically interested in suggestions on how to solve this in another way -- ideally without having to implement a whole new way for in-kernel notifications of appearing or disappearing block devices...

Quoted 4 lines

And, in a way just like in case of MTD and UBI, I believe acting as an NVMEM provider *is* a functionality which belongs to the block layer itself and, other than e.g. filesystems, is inconvenient to implement elsewhere.

I don't object to the above, however to keep things scalable at the block device driver level, such as the MMC subsystem, I think we should avoid having *any* knowledge about the binary format at these kinds of lower levels.

Even if most of the NVMEM format is managed elsewhere, the support for NVMEM partitions seems to be dealt with from the MMC subsystem too. Why can't NVMEM partitions be managed the usual way via the MBR/GPT?

[...]

Kind regards
Uffe

#17 lore raw

Hi Ulf,

Quoted 40 lines · Ulf Hansson
Quoted 34 lines · Daniel Golle

On embedded devices using an eMMC it is common that one or more (hw/sw) partitions on the eMMC are used to store MAC addresses and Wi-Fi calibration EEPROM data.

Implement an NVMEM provider backed by block devices as typically the NVMEM framework is used to have kernel drivers read and use binary data from EEPROMs, efuses, flash memory (MTD), ...

In order to be able to reference hardware partitions on an eMMC, add code to bind each hardware partition to a specific firmware subnode.

This series is meant to open the discussion on how exactly the device tree schema for block devices and partitions may look like, and even if using the block layer to back the NVMEM device is at all the way to go -- to me it seemed to be a good solution because it will be reuable e.g. for (normal, software GPT or MBR) partitions of an NVMe SSD.

This series has previously been submitted on July 19th 2023[1] and most of the basic idea did not change since.

However, the recent introduction of bdev_file_open_by_dev() allow to get rid of most use of block layer internals which supposedly was the main objection raised by Christoph Hellwig back then.

Most of the other comments received for in the first RFC have also been addressed, however, what remains is the use of class_interface (lacking an alternative way to get notifications about addition or removal of block devices from the system). As this has been criticized in the past I'm specifically interested in suggestions on how to solve this in another way -- ideally without having to implement a whole new way for in-kernel notifications of appearing or disappearing block devices...

Quoted 4 lines

And, in a way just like in case of MTD and UBI, I believe acting as an NVMEM provider *is* a functionality which belongs to the block layer itself and, other than e.g. filesystems, is inconvenient to implement elsewhere.

Quoted 7 lines

I don't object to the above, however to keep things scalable at the block device driver level, such as the MMC subsystem, I think we should avoid having *any* knowledge about the binary format at these kinds of lower levels.

Even if most of the NVMEM format is managed elsewhere, the support for NVMEM partitions seems to be dealt with from the MMC subsystem too.

In an earlier iteration of this RFC it was requested to make NVMEM support opt-in (instead of opt-out for mtdblock and ubiblock, which already got their own NVMEM provider implementation).
Hence at least a change to opt-in for NVMEM support is required in the MMC subsystem, together with making sure that MMC devices have their fwnode assigned.

Quoted 1 line

Why can't NVMEM partitions be managed the usual way via the MBR/GPT?

Absolutely, maybe my wording was not clear, but that's exactly what I'm suggesting here. There are no added parsers nor any knowledge about binary formats in this patchset.

Or did I misunderstand your comment?

#18 lore raw
Quoted 52 lines · Daniel Golle

Hi Ulf,

Quoted 40 lines · Ulf Hansson
Quoted 34 lines · Daniel Golle

On embedded devices using an eMMC it is common that one or more (hw/sw) partitions on the eMMC are used to store MAC addresses and Wi-Fi calibration EEPROM data.

Implement an NVMEM provider backed by block devices as typically the NVMEM framework is used to have kernel drivers read and use binary data from EEPROMs, efuses, flash memory (MTD), ...

In order to be able to reference hardware partitions on an eMMC, add code to bind each hardware partition to a specific firmware subnode.

This series is meant to open the discussion on how exactly the device tree schema for block devices and partitions may look like, and even if using the block layer to back the NVMEM device is at all the way to go -- to me it seemed to be a good solution because it will be reuable e.g. for (normal, software GPT or MBR) partitions of an NVMe SSD.

This series has previously been submitted on July 19th 2023[1] and most of the basic idea did not change since.

However, the recent introduction of bdev_file_open_by_dev() allow to get rid of most use of block layer internals which supposedly was the main objection raised by Christoph Hellwig back then.

Most of the other comments received for in the first RFC have also been addressed, however, what remains is the use of class_interface (lacking an alternative way to get notifications about addition or removal of block devices from the system). As this has been criticized in the past I'm specifically interested in suggestions on how to solve this in another way -- ideally without having to implement a whole new way for in-kernel notifications of appearing or disappearing block devices...

Quoted 4 lines

And, in a way just like in case of MTD and UBI, I believe acting as an NVMEM provider *is* a functionality which belongs to the block layer itself and, other than e.g. filesystems, is inconvenient to implement elsewhere.

Quoted 7 lines

I don't object to the above, however to keep things scalable at the block device driver level, such as the MMC subsystem, I think we should avoid having *any* knowledge about the binary format at these kinds of lower levels.

Even if most of the NVMEM format is managed elsewhere, the support for NVMEM partitions seems to be dealt with from the MMC subsystem too.

Quoted 6 lines

In an earlier iteration of this RFC it was requested to make NVMEM support opt-in (instead of opt-out for mtdblock and ubiblock, which already got their own NVMEM provider implementation).
Hence at least a change to opt-in for NVMEM support is required in the MMC subsystem, together with making sure that MMC devices have their fwnode assigned.

So, the NVMEM support needs to be turned on (opt-in) for each and every block device driver?

It's not a big deal for me - and I would be happy to apply such a change. On the other hand, it is just some binary data that is stored on the flash, why should MMC have to opt-in or opt-out at all? It should be the upper layers who decide what to store on the flash, not the MMC subsystem, if you get my point.

Quoted 6 lines
Quoted 2 lines

Why can't NVMEM partitions be managed the usual way via the MBR/GPT?

Absolutely, maybe my wording was not clear, but that's exactly what I'm suggesting here. There are no added parsers nor any knowledge about binary formats in this patchset.

Right, but there are new DT bindings added in the $subject series that allows us to describe NVMEM partitions for an eMMC. Why isn't that parsed from the MBR/GPT, etc, rather than encoded in DT?

Quoted 2 lines

Or did I misunderstand your comment?

Maybe. I am just trying to understand this, so apologize if you find my questions silly. :-)

Kind regards
Uffe

#19 lore raw
Quoted 60 lines · Ulf Hansson
Quoted 52 lines · Daniel Golle

Hi Ulf,

Quoted 40 lines · Ulf Hansson
Quoted 34 lines · Daniel Golle

On embedded devices using an eMMC it is common that one or more (hw/sw) partitions on the eMMC are used to store MAC addresses and Wi-Fi calibration EEPROM data.

Implement an NVMEM provider backed by block devices as typically the NVMEM framework is used to have kernel drivers read and use binary data from EEPROMs, efuses, flash memory (MTD), ...

In order to be able to reference hardware partitions on an eMMC, add code to bind each hardware partition to a specific firmware subnode.

This series is meant to open the discussion on how exactly the device tree schema for block devices and partitions may look like, and even if using the block layer to back the NVMEM device is at all the way to go -- to me it seemed to be a good solution because it will be reuable e.g. for (normal, software GPT or MBR) partitions of an NVMe SSD.

This series has previously been submitted on July 19th 2023[1] and most of the basic idea did not change since.

However, the recent introduction of bdev_file_open_by_dev() allow to get rid of most use of block layer internals which supposedly was the main objection raised by Christoph Hellwig back then.

Most of the other comments received for in the first RFC have also been addressed, however, what remains is the use of class_interface (lacking an alternative way to get notifications about addition or removal of block devices from the system). As this has been criticized in the past I'm specifically interested in suggestions on how to solve this in another way -- ideally without having to implement a whole new way for in-kernel notifications of appearing or disappearing block devices...

Quoted 4 lines

And, in a way just like in case of MTD and UBI, I believe acting as an NVMEM provider *is* a functionality which belongs to the block layer itself and, other than e.g. filesystems, is inconvenient to implement elsewhere.

Quoted 7 lines

I don't object to the above, however to keep things scalable at the block device driver level, such as the MMC subsystem, I think we should avoid having *any* knowledge about the binary format at these kinds of lower levels.

Even if most of the NVMEM format is managed elsewhere, the support for NVMEM partitions seems to be dealt with from the MMC subsystem too.

Quoted 6 lines

In an earlier iteration of this RFC it was requested to make NVMEM support opt-in (instead of opt-out for mtdblock and ubiblock, which already got their own NVMEM provider implementation).
Hence at least a change to opt-in for NVMEM support is required in the MMC subsystem, together with making sure that MMC devices have their fwnode assigned.

Quoted 9 lines

So, the NVMEM support needs to be turned on (opt-in) for each and every block device driver?

It's not a big deal for me - and I would be happy to apply such a change. On the other hand, it is just some binary data that is stored on the flash, why should MMC have to opt-in or opt-out at all? It should be the upper layers who decide what to store on the flash, not the MMC subsystem, if you get my point.

I agree, and that's exactly how I originally wrote it. However, in the first round of rewiew it was requested to be in that way (ie. opt-in for each subsystem; rather than opt-out for subsystems already providing NVMEM in another way, such as MTD or UBI), see here:

https://patchwork.kernel.org/comment/25432948/

Quoted 10 lines
Quoted 6 lines
Quoted 2 lines

Why can't NVMEM partitions be managed the usual way via the MBR/GPT?

Absolutely, maybe my wording was not clear, but that's exactly what I'm suggesting here. There are no added parsers nor any knowledge about binary formats in this patchset.

Right, but there are new DT bindings added in the $subject series that allows us to describe NVMEM partitions for an eMMC. Why isn't that parsed from the MBR/GPT, etc, rather than encoded in DT?

The added dt-bindings merely allow to **identify** the partition by it's PARTNAME, PARTNO or PARTUUID, so we can reference them in DT. We'd still rely on MBR or GPT to do the actual parsing of the on-disk format.

Quoted 6 lines
Quoted 3 lines

Or did I misunderstand your comment?

Maybe. I am just trying to understand this, so apologize if you find my questions silly. :-)

Let's make sure to all be on the same page and everything is fully understood by everyone. Everyone has to bare the noise, but I guess that's ok ;)

Cheers

Daniel

#20 lore raw
Quoted 72 lines · Daniel Golle
Quoted 60 lines · Ulf Hansson
Quoted 52 lines · Daniel Golle

Hi Ulf,

Quoted 40 lines · Ulf Hansson
Quoted 34 lines · Daniel Golle

On embedded devices using an eMMC it is common that one or more (hw/sw) partitions on the eMMC are used to store MAC addresses and Wi-Fi calibration EEPROM data.

Implement an NVMEM provider backed by block devices as typically the NVMEM framework is used to have kernel drivers read and use binary data from EEPROMs, efuses, flash memory (MTD), ...

In order to be able to reference hardware partitions on an eMMC, add code to bind each hardware partition to a specific firmware subnode.

This series is meant to open the discussion on how exactly the device tree schema for block devices and partitions may look like, and even if using the block layer to back the NVMEM device is at all the way to go -- to me it seemed to be a good solution because it will be reuable e.g. for (normal, software GPT or MBR) partitions of an NVMe SSD.

This series has previously been submitted on July 19th 2023[1] and most of the basic idea did not change since.

However, the recent introduction of bdev_file_open_by_dev() allow to get rid of most use of block layer internals which supposedly was the main objection raised by Christoph Hellwig back then.

Most of the other comments received for in the first RFC have also been addressed, however, what remains is the use of class_interface (lacking an alternative way to get notifications about addition or removal of block devices from the system). As this has been criticized in the past I'm specifically interested in suggestions on how to solve this in another way -- ideally without having to implement a whole new way for in-kernel notifications of appearing or disappearing block devices...

Quoted 4 lines

And, in a way just like in case of MTD and UBI, I believe acting as an NVMEM provider *is* a functionality which belongs to the block layer itself and, other than e.g. filesystems, is inconvenient to implement elsewhere.

Quoted 7 lines

I don't object to the above, however to keep things scalable at the block device driver level, such as the MMC subsystem, I think we should avoid having *any* knowledge about the binary format at these kinds of lower levels.

Even if most of the NVMEM format is managed elsewhere, the support for NVMEM partitions seems to be dealt with from the MMC subsystem too.

Quoted 6 lines

In an earlier iteration of this RFC it was requested to make NVMEM support opt-in (instead of opt-out for mtdblock and ubiblock, which already got their own NVMEM provider implementation).
Hence at least a change to opt-in for NVMEM support is required in the MMC subsystem, together with making sure that MMC devices have their fwnode assigned.

Quoted 9 lines

So, the NVMEM support needs to be turned on (opt-in) for each and every block device driver?

It's not a big deal for me - and I would be happy to apply such a change. On the other hand, it is just some binary data that is stored on the flash, why should MMC have to opt-in or opt-out at all? It should be the upper layers who decide what to store on the flash, not the MMC subsystem, if you get my point.

Quoted 6 lines

I agree, and that's exactly how I originally wrote it. However, in the first round of rewiew it was requested to be in that way (ie. opt-in for each subsystem; rather than opt-out for subsystems already providing NVMEM in another way, such as MTD or UBI), see here:

https://patchwork.kernel.org/comment/25432948/

Okay, got it, thanks!

Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
Quoted 3 lines

Why can't NVMEM partitions be managed the usual way via the MBR/GPT?

Absolutely, maybe my wording was not clear, but that's exactly what I'm suggesting here. There are no added parsers nor any knowledge about binary formats in this patchset.

Quoted 8 lines
Quoted 3 lines

Right, but there are new DT bindings added in the $subject series that allows us to describe NVMEM partitions for an eMMC. Why isn't that parsed from the MBR/GPT, etc, rather than encoded in DT?

The added dt-bindings merely allow to **identify** the partition by it's PARTNAME, PARTNO or PARTUUID, so we can reference them in DT. We'd still rely on MBR or GPT to do the actual parsing of the on-disk format.

Thanks for clarifying!

So, it looks like this all relies on what DT maintainers think then.

[...]

Kind regards
Uffe