Skip to content

Commit efce6b6

Browse files
committed
generic: 6.6: update block nvmem patchset
While discussions are still ongoing, update the block NVMEM provider patchset to the level submitted upstream to allow testing and validation. Link: https://patchwork.kernel.org/project/linux-block/list/?series=875202 Signed-off-by: Daniel Golle <[email protected]>
1 parent 446d071 commit efce6b6

4 files changed

+151
-34
lines changed

target/linux/generic/pending-6.6/451-block-partitions-populate-fwnode.patch

+80-19
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,42 @@
1-
From 7f4c9c534aabe1315669e076d3fe0af0fd374cda Mon Sep 17 00:00:00 2001
1+
From patchwork Tue Jul 30 19:25:59 2024
2+
Content-Type: text/plain; charset="utf-8"
3+
MIME-Version: 1.0
4+
Content-Transfer-Encoding: 7bit
5+
X-Patchwork-Submitter: Daniel Golle <[email protected]>
6+
X-Patchwork-Id: 13747816
7+
Date: Tue, 30 Jul 2024 20:25:59 +0100
28
From: Daniel Golle <[email protected]>
3-
Date: Thu, 30 May 2024 03:13:19 +0100
4-
Subject: [PATCH 2/9] block: partitions: populate fwnode
9+
To: Rob Herring <[email protected]>, Krzysztof Kozlowski <[email protected]>,
10+
Conor Dooley <[email protected]>, Jens Axboe <[email protected]>,
11+
Daniel Golle <[email protected]>, Christian Brauner <[email protected]>,
12+
Al Viro <[email protected]>, Li Lingfeng <[email protected]>,
13+
Ming Lei <[email protected]>, Christian Heusel <[email protected]>,
14+
=?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= <[email protected]>,
15+
Felix Fietkau <[email protected]>, John Crispin <[email protected]>,
16+
Chad Monroe <[email protected]>, Yangyu Chen <[email protected]>,
17+
Tianling Shen <[email protected]>, Chuanhong Guo <[email protected]>,
18+
19+
20+
Subject: [PATCH v5 2/4] block: partitions: populate fwnode
21+
Message-ID:
22+
<3051ac090ad3b3e2f5adb6b67c923261ead729a5.1722365899.git.daniel@makrotopia.org>
23+
References: <[email protected]>
24+
Precedence: bulk
25+
X-Mailing-List: [email protected]
26+
List-Id: <linux-block.vger.kernel.org>
27+
List-Subscribe: <mailto:[email protected]>
28+
List-Unsubscribe: <mailto:[email protected]>
29+
MIME-Version: 1.0
30+
Content-Disposition: inline
31+
In-Reply-To: <[email protected]>
532

6-
Let block partitions to be represented by a firmware node and hence
7-
allow them to being referenced e.g. for use with blk-nvmem.
33+
Assign matching firmware nodes to block partitions in order to allow
34+
them to be referenced e.g. as NVMEM providers.
835

936
Signed-off-by: Daniel Golle <[email protected]>
1037
---
11-
block/partitions/core.c | 41 +++++++++++++++++++++++++++++++++++++++++
12-
1 file changed, 41 insertions(+)
38+
block/partitions/core.c | 72 +++++++++++++++++++++++++++++++++++++++++
39+
1 file changed, 72 insertions(+)
1340

1441
--- a/block/partitions/core.c
1542
+++ b/block/partitions/core.c
@@ -22,36 +49,70 @@ Signed-off-by: Daniel Golle <[email protected]>
2249
#include "check.h"
2350

2451
static int (*const check_part[])(struct parsed_partitions *) = {
25-
@@ -292,6 +294,40 @@ static ssize_t whole_disk_show(struct de
52+
@@ -292,6 +294,74 @@ static ssize_t whole_disk_show(struct de
2653
}
2754
static const DEVICE_ATTR(whole_disk, 0444, whole_disk_show, NULL);
2855

56+
+static bool part_meta_match(const char *attr, const char *member, size_t length)
57+
+{
58+
+ /* check if length of attr exceeds specified maximum length */
59+
+ if (strnlen(attr, length) == length)
60+
+ return false;
61+
+
62+
+ /* return true if strings match */
63+
+ return !strncmp(attr, member, length);
64+
+}
65+
+
2966
+static struct fwnode_handle *find_partition_fwnode(struct block_device *bdev)
3067
+{
3168
+ struct fwnode_handle *fw_parts, *fw_part;
3269
+ struct device *ddev = disk_to_dev(bdev->bd_disk);
3370
+ const char *partname, *uuid;
3471
+ u32 partno;
72+
+ bool got_uuid, got_partname, got_partno;
3573
+
3674
+ fw_parts = device_get_named_child_node(ddev, "partitions");
3775
+ if (!fw_parts)
3876
+ return NULL;
3977
+
4078
+ fwnode_for_each_child_node(fw_parts, fw_part) {
41-
+ if (!fwnode_property_read_string(fw_part, "uuid", &uuid) &&
42-
+ (!bdev->bd_meta_info || strncmp(uuid,
43-
+ bdev->bd_meta_info->uuid,
44-
+ PARTITION_META_INFO_UUIDLTH)))
79+
+ got_uuid = false;
80+
+ got_partname = false;
81+
+ got_partno = false;
82+
+ /*
83+
+ * In case 'uuid' is defined in the partitions firmware node
84+
+ * require partition meta info being present and the specified
85+
+ * uuid to match.
86+
+ */
87+
+ got_uuid = !fwnode_property_read_string(fw_part, "uuid", &uuid);
88+
+ if (got_uuid && (!bdev->bd_meta_info ||
89+
+ !part_meta_match(uuid, bdev->bd_meta_info->uuid,
90+
+ PARTITION_META_INFO_UUIDLTH)))
91+
+ continue;
92+
+
93+
+ /*
94+
+ * In case 'partname' is defined in the partitions firmware node
95+
+ * require partition meta info being present and the specified
96+
+ * volname to match.
97+
+ */
98+
+ got_partname = !fwnode_property_read_string(fw_part, "partname",
99+
+ &partname);
100+
+ if (got_partname && (!bdev->bd_meta_info ||
101+
+ !part_meta_match(partname,
102+
+ bdev->bd_meta_info->volname,
103+
+ PARTITION_META_INFO_VOLNAMELTH)))
45104
+ continue;
46105
+
47-
+ if (!fwnode_property_read_string(fw_part, "partname", &partname) &&
48-
+ (!bdev->bd_meta_info || strncmp(partname,
49-
+ bdev->bd_meta_info->volname,
50-
+ PARTITION_META_INFO_VOLNAMELTH)))
106+
+ /*
107+
+ * In case 'partno' is defined in the partitions firmware node
108+
+ * the specified partno needs to match.
109+
+ */
110+
+ got_partno = !fwnode_property_read_u32(fw_part, "partno", &partno);
111+
+ if (got_partno && bdev->bd_partno != partno)
51112
+ continue;
52113
+
53-
+ if (!fwnode_property_read_u32(fw_part, "partno", &partno) &&
54-
+ bdev->bd_partno != partno)
114+
+ /* Skip if no matching criteria is present in firmware node */
115+
+ if (!got_uuid && !got_partname && !got_partno)
55116
+ continue;
56117
+
57118
+ return fw_part;
@@ -63,7 +124,7 @@ Signed-off-by: Daniel Golle <[email protected]>
63124
/*
64125
* Must be called either with open_mutex held, before a disk can be opened or
65126
* after all disk users are gone.
66-
@@ -374,6 +410,8 @@ static struct block_device *add_partitio
127+
@@ -374,6 +444,8 @@ static struct block_device *add_partitio
67128
goto out_put;
68129
}
69130

target/linux/generic/pending-6.6/452-block-add-support-for-notifications.patch

+39-10
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,34 @@
1-
From e07ace307ce598847074a096f408bec0e3a392ed Mon Sep 17 00:00:00 2001
1+
From patchwork Tue Jul 30 19:26:42 2024
2+
Content-Type: text/plain; charset="utf-8"
3+
MIME-Version: 1.0
4+
Content-Transfer-Encoding: 7bit
5+
X-Patchwork-Submitter: Daniel Golle <[email protected]>
6+
X-Patchwork-Id: 13747817
7+
Date: Tue, 30 Jul 2024 20:26:42 +0100
28
From: Daniel Golle <[email protected]>
3-
Date: Thu, 30 May 2024 03:14:34 +0100
4-
Subject: [PATCH 3/9] block: add support for notifications
9+
To: Rob Herring <[email protected]>, Krzysztof Kozlowski <[email protected]>,
10+
Conor Dooley <[email protected]>, Jens Axboe <[email protected]>,
11+
Daniel Golle <[email protected]>, Christian Brauner <[email protected]>,
12+
Al Viro <[email protected]>, Li Lingfeng <[email protected]>,
13+
Ming Lei <[email protected]>, Christian Heusel <[email protected]>,
14+
=?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= <[email protected]>,
15+
Felix Fietkau <[email protected]>, John Crispin <[email protected]>,
16+
Chad Monroe <[email protected]>, Yangyu Chen <[email protected]>,
17+
Tianling Shen <[email protected]>, Chuanhong Guo <[email protected]>,
18+
19+
20+
Subject: [PATCH v5 3/4] block: add support for notifications
21+
Message-ID:
22+
<ca0022886e8f211a323a716653a1396a3bc91653.1722365899.git.daniel@makrotopia.org>
23+
References: <[email protected]>
24+
Precedence: bulk
25+
X-Mailing-List: [email protected]
26+
List-Id: <linux-block.vger.kernel.org>
27+
List-Subscribe: <mailto:[email protected]>
28+
List-Unsubscribe: <mailto:[email protected]>
29+
MIME-Version: 1.0
30+
Content-Disposition: inline
31+
In-Reply-To: <[email protected]>
532

633
Add notifier block to notify other subsystems about the addition or
734
removal of block devices.
@@ -10,9 +37,9 @@ Signed-off-by: Daniel Golle <[email protected]>
1037
---
1138
block/Kconfig | 6 +++
1239
block/Makefile | 1 +
13-
block/blk-notify.c | 88 ++++++++++++++++++++++++++++++++++++++++++
14-
include/linux/blkdev.h | 8 ++++
15-
4 files changed, 103 insertions(+)
40+
block/blk-notify.c | 87 ++++++++++++++++++++++++++++++++++++++++++
41+
include/linux/blkdev.h | 11 ++++++
42+
4 files changed, 105 insertions(+)
1643
create mode 100644 block/blk-notify.c
1744

1845
--- a/block/Kconfig
@@ -39,7 +66,7 @@ Signed-off-by: Daniel Golle <[email protected]>
3966
+obj-$(CONFIG_BLOCK_NOTIFIERS) += blk-notify.o
4067
--- /dev/null
4168
+++ b/block/blk-notify.c
42-
@@ -0,0 +1,88 @@
69+
@@ -0,0 +1,87 @@
4370
+// SPDX-License-Identifier: GPL-2.0-or-later
4471
+/*
4572
+ * Notifiers for addition and removal of block devices
@@ -97,7 +124,6 @@ Signed-off-by: Daniel Golle <[email protected]>
97124
+ list_add_tail(&new_blkdev->list, &blk_devices);
98125
+ raw_notifier_call_chain(&blk_notifier_list, BLK_DEVICE_ADD, dev);
99126
+ mutex_unlock(&blk_notifier_lock);
100-
+
101127
+ return 0;
102128
+}
103129
+
@@ -130,16 +156,19 @@ Signed-off-by: Daniel Golle <[email protected]>
130156
+device_initcall(blk_notifications_init);
131157
--- a/include/linux/blkdev.h
132158
+++ b/include/linux/blkdev.h
133-
@@ -1564,4 +1564,12 @@ struct io_comp_batch {
159+
@@ -1564,4 +1564,15 @@ struct io_comp_batch {
134160

135161
#define DEFINE_IO_COMP_BATCH(name) struct io_comp_batch name = { }
136162

137163
+
138-
+#ifdef CONFIG_BLOCK_NOTIFIERS
139164
+#define BLK_DEVICE_ADD 1
140165
+#define BLK_DEVICE_REMOVE 2
166+
+#if defined(CONFIG_BLOCK_NOTIFIERS)
141167
+void blk_register_notify(struct notifier_block *nb);
142168
+void blk_unregister_notify(struct notifier_block *nb);
169+
+#else
170+
+static inline void blk_register_notify(struct notifier_block *nb) { };
171+
+static inline void blk_unregister_notify(struct notifier_block *nb) { };
143172
+#endif
144173
+
145174
#endif /* _LINUX_BLKDEV_H */

target/linux/generic/pending-6.6/453-block-add-new-genhd-flag-GENHD_FL_NVMEM.patch

+30-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,34 @@
1-
From f4487fa1cb7e55b3c17a33f41b9c9d66f4f853b7 Mon Sep 17 00:00:00 2001
1+
From patchwork Tue Jul 30 19:27:07 2024
2+
Content-Type: text/plain; charset="utf-8"
3+
MIME-Version: 1.0
4+
Content-Transfer-Encoding: 7bit
5+
X-Patchwork-Submitter: Daniel Golle <[email protected]>
6+
X-Patchwork-Id: 13747818
7+
Date: Tue, 30 Jul 2024 20:27:07 +0100
28
From: Daniel Golle <[email protected]>
3-
Date: Thu, 30 May 2024 03:14:49 +0100
4-
Subject: [PATCH 4/9] block: add new genhd flag GENHD_FL_NVMEM
9+
To: Rob Herring <[email protected]>, Krzysztof Kozlowski <[email protected]>,
10+
Conor Dooley <[email protected]>, Jens Axboe <[email protected]>,
11+
Daniel Golle <[email protected]>, Christian Brauner <[email protected]>,
12+
Al Viro <[email protected]>, Li Lingfeng <[email protected]>,
13+
Ming Lei <[email protected]>, Christian Heusel <[email protected]>,
14+
=?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= <[email protected]>,
15+
Felix Fietkau <[email protected]>, John Crispin <[email protected]>,
16+
Chad Monroe <[email protected]>, Yangyu Chen <[email protected]>,
17+
Tianling Shen <[email protected]>, Chuanhong Guo <[email protected]>,
18+
19+
20+
Subject: [PATCH v5 4/4] block: add new genhd flag GENHD_FL_NVMEM
21+
Message-ID:
22+
<311ea569c23ce14e2896cd3b069dc494c58c49c2.1722365899.git.daniel@makrotopia.org>
23+
References: <[email protected]>
24+
Precedence: bulk
25+
X-Mailing-List: [email protected]
26+
List-Id: <linux-block.vger.kernel.org>
27+
List-Subscribe: <mailto:[email protected]>
28+
List-Unsubscribe: <mailto:[email protected]>
29+
MIME-Version: 1.0
30+
Content-Disposition: inline
31+
In-Reply-To: <[email protected]>
532

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

target/linux/mediatek/patches-6.6/041-block-fit-partition-parser.patch

+2-2
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ Subject: [PATCH] kernel: add block fit partition parser
9292
#ifdef CONFIG_SGI_PARTITION
9393
sgi_partition,
9494
#endif
95-
@@ -430,6 +436,11 @@ static struct block_device *add_partitio
95+
@@ -462,6 +468,11 @@ static struct block_device *add_partitio
9696
goto out_del;
9797
}
9898

@@ -104,7 +104,7 @@ Subject: [PATCH] kernel: add block fit partition parser
104104
/* everything is up and running, commence */
105105
err = xa_insert(&disk->part_tbl, partno, bdev, GFP_KERNEL);
106106
if (err)
107-
@@ -624,6 +635,11 @@ static bool blk_add_partition(struct gen
107+
@@ -654,6 +665,11 @@ static bool blk_add_partition(struct gen
108108
(state->parts[p].flags & ADDPART_FLAG_RAID))
109109
md_autodetect_dev(part->bd_dev);
110110

0 commit comments

Comments
 (0)