Skip to contentSkip to conversation

Allow for removal of DT nodes and properties

RFC PATCH In review Sughosh Ganu 9 participants 65 messages Aug 26, 2023 – Sep 21, 2023 Library code

lore
Share & tools
lore
#0 lore raw

cover Allow for removal of DT nodes and properties

Provide a way for removing certain devicetree nodes and/or properties from the devicetree. This is needed to purge certain nodes and properties which may be relevant only in U-Boot. Such nodes and properties are then removed from the devicetree before it is passed to the kernel. This ensures that the devicetree passed to the OS does not contain any non-compliant nodes and properties.

The removal of the nodes and properties is being done through an EVT_FT_FIXUP handler. I am not sure if the removal code needs to be behind any Kconfig symbol.

I have only build tested this on sandbox, and tested on qemu arm64 virt platform. This being a RFC, I have not put this through a CI run.

Sughosh Ganu (5):
dt: Provide a way to remove non-compliant nodes and properties
fwu: Add the fwu-mdata node for removal from devicetree
capsule: Add the capsule-key property for removal from devicetree
bootefi: Call the EVT_FT_FIXUP event handler
doc: Add a document for non-compliant DT node/property removal

 cmd/bootefi.c                                 | 18 +++++
 .../devicetree/dt_non_compliant_purge.rst     | 64 ++++++++++++++++
 drivers/fwu-mdata/fwu-mdata-uclass.c          |  5 ++
 include/dt-structs.h                          | 11 +++
 lib/Makefile                                  |  1 +
 lib/dt_purge.c                                | 73 +++++++++++++++++++
 lib/efi_loader/efi_capsule.c                  |  7 ++
 7 files changed, 179 insertions(+)
 create mode 100644 doc/develop/devicetree/dt_non_compliant_purge.rst
 create mode 100644 lib/dt_purge.c
Signature · 1 line
2.34.1
#1 lore raw

RFC PATCH 1/5 dt: Provide a way to remove non-compliant nodes and properties

Add a function which is registered to spy for a EVT_FT_FIXUP event, and removes the non upstreamed nodes and properties from the devicetree before it gets passed to the OS.

This allows removing entire nodes, or specific properties under nodes from the devicetree. The required nodes and properties can be registered for removal through the DT_NON_COMPLIANT_PURGE and DT_NON_COMPLIANT_PURGE_LIST macros.

---
 include/dt-structs.h | 11 +++++++
 lib/Makefile         |  1 +
 lib/dt_purge.c       | 73 ++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 85 insertions(+)
 create mode 100644 lib/dt_purge.c
include/dt-structs.h +11 -0
index fa1622cb1d..f535c60471 100644
@@ -57,3 +57,14 @@ struct phandle_2_arg {
 #endif
 
 #endif
+
+struct dt_non_compliant_purge {
+	const char *node_path;
+	const char *prop;
+};
+
+#define DT_NON_COMPLIANT_PURGE(__name)	\
+	ll_entry_declare(struct dt_non_compliant_purge, __name, dt_purge)
+
+#define DT_NON_COMPLIANT_PURGE_LIST(__name)	\
+	ll_entry_declare_list(struct dt_non_compliant_purge, __name, dt_purge)
lib/Makefile +1 -0
index 8d8ccc8bbc..82a906daa0 100644
@@ -37,6 +37,7 @@ endif
 obj-y += crc8.o
 obj-y += crc16.o
 obj-y += crc16-ccitt.o
+obj-y += dt_purge.o
 obj-$(CONFIG_ERRNO_STR) += errno_str.o
 obj-$(CONFIG_FIT) += fdtdec_common.o
 obj-$(CONFIG_TEST_FDTDEC) += fdtdec_test.o
lib/dt_purge.c new file +73 -0

73 lines not on this page · raw message

Signature · 1 line
2.34.1
#2 lore raw

Re: [RFC PATCH 1/5] dt: Provide a way to remove non-compliant nodes and properties

Quoted 117 lines · Sughosh Ganu

Add a function which is registered to spy for a EVT_FT_FIXUP event, and removes the non upstreamed nodes and properties from the devicetree before it gets passed to the OS.

This allows removing entire nodes, or specific properties under nodes from the devicetree. The required nodes and properties can be registered for removal through the DT_NON_COMPLIANT_PURGE and DT_NON_COMPLIANT_PURGE_LIST macros.

---
  include/dt-structs.h | 11 +++++++
  lib/Makefile         |  1 +
  lib/dt_purge.c       | 73 ++++++++++++++++++++++++++++++++++++++++++++
  3 files changed, 85 insertions(+)

create mode 100644 lib/dt_purge.c

include/dt-structs.h +11 -0
index fa1622cb1d..f535c60471 100644
@@ -57,3 +57,14 @@ struct phandle_2_arg {
  #endif
 
  #endif
+
+struct dt_non_compliant_purge {
+	const char *node_path;
+	const char *prop;
+};
+
+#define DT_NON_COMPLIANT_PURGE(__name)	\
+	ll_entry_declare(struct dt_non_compliant_purge, __name, dt_purge)
+
+#define DT_NON_COMPLIANT_PURGE_LIST(__name)	\
+	ll_entry_declare_list(struct dt_non_compliant_purge, __name, dt_purge)
lib/Makefile +1 -0
index 8d8ccc8bbc..82a906daa0 100644
@@ -37,6 +37,7 @@ endif
  obj-y += crc8.o
  obj-y += crc16.o
  obj-y += crc16-ccitt.o
+obj-y += dt_purge.o
  obj-$(CONFIG_ERRNO_STR) += errno_str.o
  obj-$(CONFIG_FIT) += fdtdec_common.o
  obj-$(CONFIG_TEST_FDTDEC) += fdtdec_test.o
lib/dt_purge.c new file +63 -0
new file mode 100644
index 0000000000..f893ba9796
@@ -0,0 +1,73 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) 2023, Linaro Limited
+ */
+
+#include <dt-structs.h>
+#include <event.h>
+#include <linker_lists.h>
+
+#include <linux/libfdt.h>
+
+/**
+ * dt_non_compliant_purge() -	Remove non-upstreamed nodes and properties
+ *				from the DT
+ * @ctx: Context for event
+ * @event: Event to process
+ *
+ * Iterate through an array of DT nodes and properties, and remove them
+ * from the device-tree before the DT gets handed over to the kernel.
+ * These are nodes and properties which do not have upstream bindings
+ * and need to be purged before being handed over to the kernel.
+ *
+ * If both the node and property are specified, delete the property. If
+ * only the node is specified, delete the entire node, including it's
+ * subnodes, if any.
+ *
+ * Return: 0 if OK, -ve on error
+ */
+static int dt_non_compliant_purge(void *ctx, struct event *event)
+{
+	int nodeoff = 0;
+	int err = 0;
+	void *fdt;
+	const struct event_ft_fixup *fixup = &event->data.ft_fixup;
+	struct dt_non_compliant_purge *purge_entry;
+	struct dt_non_compliant_purge *purge_start =
+		ll_entry_start(struct dt_non_compliant_purge, dt_purge);
+	int nentries = ll_entry_count(struct dt_non_compliant_purge, dt_purge);
+
+	if (fixup->images)
+		return 0;
+
+	fdt = fixup->tree.fdt;
+	for (purge_entry = purge_start; purge_entry != purge_start + nentries;
+	     purge_entry++) {
+		nodeoff = fdt_path_offset(fdt, purge_entry->node_path);
+		if (nodeoff < 0) {
+			log_debug("Error (%d) getting node offset for %s\n",
+				  nodeoff, purge_entry->node_path);
+			continue;
+		}
+
+		if (purge_entry->prop) {
+			err = fdt_delprop(fdt, nodeoff, purge_entry->prop);
+			if (err < 0 && err != -FDT_ERR_NOTFOUND) {
+				log_debug("Error (%d) deleting %s\n",
+					  err, purge_entry->prop);
+				goto out;
+			}
+		} else {
+			err = fdt_del_node(fdt, nodeoff);
+			if (err) {
+				log_debug("Error (%d) trying to delete node %s\n",

lib/dt_purge.c line 73

Quoted 10 lines
lib/dt_purge.c new file +10 -0
+					  err, purge_entry->node_path);
+				goto out;
+			}
+		}
+	}
+
+out:
+	return err;
+}
+EVENT_SPY(EVT_FT_FIXUP, dt_non_compliant_purge);

This may interfere with other fixup code requiring U-Boot specific properties like bootmeth_vbe_ft_fixup().

We should ensure that call dt_non_compliant_purge() is the last fixup action. Please, consider a separate event.

This code does not check if the property or node complies to the device tree scheme or not. So why not call the function dt_purge()?

Best regards

Heinrich

#3 lore raw

Re: [RFC PATCH 1/5] dt: Provide a way to remove non-compliant nodes and properties

Quoted 126 lines · Heinrich Schuchardt
Quoted 122 lines · Sughosh Ganu

Add a function which is registered to spy for a EVT_FT_FIXUP event, and removes the non upstreamed nodes and properties from the devicetree before it gets passed to the OS.

This allows removing entire nodes, or specific properties under nodes from the devicetree. The required nodes and properties can be registered for removal through the DT_NON_COMPLIANT_PURGE and DT_NON_COMPLIANT_PURGE_LIST macros.

---
  include/dt-structs.h | 11 +++++++
  lib/Makefile         |  1 +
  lib/dt_purge.c       | 73 ++++++++++++++++++++++++++++++++++++++++++++
  3 files changed, 85 insertions(+)

create mode 100644 lib/dt_purge.c

include/dt-structs.h +11 -0
index fa1622cb1d..f535c60471 100644
@@ -57,3 +57,14 @@ struct phandle_2_arg {
  #endif
 
  #endif
+
+struct dt_non_compliant_purge {
+     const char *node_path;
+     const char *prop;
+};
+
+#define DT_NON_COMPLIANT_PURGE(__name)       \
+     ll_entry_declare(struct dt_non_compliant_purge, __name, dt_purge)
+
+#define DT_NON_COMPLIANT_PURGE_LIST(__name)  \
+     ll_entry_declare_list(struct dt_non_compliant_purge, __name, dt_purge)
lib/Makefile +1 -0
index 8d8ccc8bbc..82a906daa0 100644
@@ -37,6 +37,7 @@ endif
  obj-y += crc8.o
  obj-y += crc16.o
  obj-y += crc16-ccitt.o
+obj-y += dt_purge.o
  obj-$(CONFIG_ERRNO_STR) += errno_str.o
  obj-$(CONFIG_FIT) += fdtdec_common.o
  obj-$(CONFIG_TEST_FDTDEC) += fdtdec_test.o
lib/dt_purge.c new file +68 -0
new file mode 100644
index 0000000000..f893ba9796
@@ -0,0 +1,73 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) 2023, Linaro Limited
+ */
+
+#include <dt-structs.h>
+#include <event.h>
+#include <linker_lists.h>
+
+#include <linux/libfdt.h>
+
+/**
+ * dt_non_compliant_purge() -        Remove non-upstreamed nodes and properties
+ *                           from the DT
+ * @ctx: Context for event
+ * @event: Event to process
+ *
+ * Iterate through an array of DT nodes and properties, and remove them
+ * from the device-tree before the DT gets handed over to the kernel.
+ * These are nodes and properties which do not have upstream bindings
+ * and need to be purged before being handed over to the kernel.
+ *
+ * If both the node and property are specified, delete the property. If
+ * only the node is specified, delete the entire node, including it's
+ * subnodes, if any.
+ *
+ * Return: 0 if OK, -ve on error
+ */
+static int dt_non_compliant_purge(void *ctx, struct event *event)
+{
+     int nodeoff = 0;
+     int err = 0;
+     void *fdt;
+     const struct event_ft_fixup *fixup = &event->data.ft_fixup;
+     struct dt_non_compliant_purge *purge_entry;
+     struct dt_non_compliant_purge *purge_start =
+             ll_entry_start(struct dt_non_compliant_purge, dt_purge);
+     int nentries = ll_entry_count(struct dt_non_compliant_purge, dt_purge);
+
+     if (fixup->images)
+             return 0;
+
+     fdt = fixup->tree.fdt;
+     for (purge_entry = purge_start; purge_entry != purge_start + nentries;
+          purge_entry++) {
+             nodeoff = fdt_path_offset(fdt, purge_entry->node_path);
+             if (nodeoff < 0) {
+                     log_debug("Error (%d) getting node offset for %s\n",
+                               nodeoff, purge_entry->node_path);
+                     continue;
+             }
+
+             if (purge_entry->prop) {
+                     err = fdt_delprop(fdt, nodeoff, purge_entry->prop);
+                     if (err < 0 && err != -FDT_ERR_NOTFOUND) {
+                             log_debug("Error (%d) deleting %s\n",
+                                       err, purge_entry->prop);
+                             goto out;
+                     }
+             } else {
+                     err = fdt_del_node(fdt, nodeoff);
+                     if (err) {
+                             log_debug("Error (%d) trying to delete node %s\n",
+                                       err, purge_entry->node_path);
+                             goto out;
+                     }
+             }
+     }
Quoted 8 lines

lib/dt_purge.c line 73

Quoted 5 lines
lib/dt_purge.c new file +5 -0
+
+out:
+     return err;
+}
+EVENT_SPY(EVT_FT_FIXUP, dt_non_compliant_purge);

This may interfere with other fixup code requiring U-Boot specific properties like bootmeth_vbe_ft_fixup().

Okay, I was thinking if we can have a flag to indicate which event handler is to be run. I will check this, and add a separate event if this solution turns to be overly complex.

Quoted 3 lines

We should ensure that call dt_non_compliant_purge() is the last fixup action. Please, consider a separate event.

Will check.

Quoted 3 lines

This code does not check if the property or node complies to the device tree scheme or not. So why not call the function dt_purge()?

Okay

-sughosh

#4 lore raw

Re: [RFC PATCH 1/5] dt: Provide a way to remove non-compliant nodes and properties

In reply to Sughosh Ganu
Quoted 41 lines · Sughosh Ganu

Add a function which is registered to spy for a EVT_FT_FIXUP event, and removes the non upstreamed nodes and properties from the devicetree before it gets passed to the OS.

This allows removing entire nodes, or specific properties under nodes from the devicetree. The required nodes and properties can be registered for removal through the DT_NON_COMPLIANT_PURGE and DT_NON_COMPLIANT_PURGE_LIST macros.

---
  include/dt-structs.h | 11 +++++++
  lib/Makefile         |  1 +
  lib/dt_purge.c       | 73 ++++++++++++++++++++++++++++++++++++++++++++
  3 files changed, 85 insertions(+)

create mode 100644 lib/dt_purge.c

include/dt-structs.h +11 -0
index fa1622cb1d..f535c60471 100644
@@ -57,3 +57,14 @@ struct phandle_2_arg {
  #endif
 
  #endif
+
+struct dt_non_compliant_purge {
+	const char *node_path;
+	const char *prop;
+};
+
+#define DT_NON_COMPLIANT_PURGE(__name)	\
+	ll_entry_declare(struct dt_non_compliant_purge, __name, dt_purge)
+
+#define DT_NON_COMPLIANT_PURGE_LIST(__name)	\
+	ll_entry_declare_list(struct dt_non_compliant_purge, __name, dt_purge)
lib/Makefile +0 -0
index 8d8ccc8bbc..82a906daa0 100644

lib/Makefile endif · line 40

Quoted 4 lines
lib/Makefile +1 -0
@@ -37,6 +37,7 @@ endif
  obj-y += crc8.o
  obj-y += crc16.o
  obj-y += crc16-ccitt.o
+obj-y += dt_purge.o

SPL can be the last boot stage (e.g. for Falcon Mode). So placing this under 'ifndef CONFIG_SPL_BUILD' is not correct.

You need some logic that identifies into which boot stage this code belongs, e.g. use obj-$(CONFIG_$(SPL_TPL_)OF_LIBFDT).

Best regards

Heinrich

Quoted 82 lines
lib/Makefile +0 -0
  obj-$(CONFIG_ERRNO_STR) += errno_str.o
  obj-$(CONFIG_FIT) += fdtdec_common.o
  obj-$(CONFIG_TEST_FDTDEC) += fdtdec_test.o
lib/dt_purge.c new file +73 -0
new file mode 100644
index 0000000000..f893ba9796
@@ -0,0 +1,73 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) 2023, Linaro Limited
+ */
+
+#include <dt-structs.h>
+#include <event.h>
+#include <linker_lists.h>
+
+#include <linux/libfdt.h>
+
+/**
+ * dt_non_compliant_purge() -	Remove non-upstreamed nodes and properties
+ *				from the DT
+ * @ctx: Context for event
+ * @event: Event to process
+ *
+ * Iterate through an array of DT nodes and properties, and remove them
+ * from the device-tree before the DT gets handed over to the kernel.
+ * These are nodes and properties which do not have upstream bindings
+ * and need to be purged before being handed over to the kernel.
+ *
+ * If both the node and property are specified, delete the property. If
+ * only the node is specified, delete the entire node, including it's
+ * subnodes, if any.
+ *
+ * Return: 0 if OK, -ve on error
+ */
+static int dt_non_compliant_purge(void *ctx, struct event *event)
+{
+	int nodeoff = 0;
+	int err = 0;
+	void *fdt;
+	const struct event_ft_fixup *fixup = &event->data.ft_fixup;
+	struct dt_non_compliant_purge *purge_entry;
+	struct dt_non_compliant_purge *purge_start =
+		ll_entry_start(struct dt_non_compliant_purge, dt_purge);
+	int nentries = ll_entry_count(struct dt_non_compliant_purge, dt_purge);
+
+	if (fixup->images)
+		return 0;
+
+	fdt = fixup->tree.fdt;
+	for (purge_entry = purge_start; purge_entry != purge_start + nentries;
+	     purge_entry++) {
+		nodeoff = fdt_path_offset(fdt, purge_entry->node_path);
+		if (nodeoff < 0) {
+			log_debug("Error (%d) getting node offset for %s\n",
+				  nodeoff, purge_entry->node_path);
+			continue;
+		}
+
+		if (purge_entry->prop) {
+			err = fdt_delprop(fdt, nodeoff, purge_entry->prop);
+			if (err < 0 && err != -FDT_ERR_NOTFOUND) {
+				log_debug("Error (%d) deleting %s\n",
+					  err, purge_entry->prop);
+				goto out;
+			}
+		} else {
+			err = fdt_del_node(fdt, nodeoff);
+			if (err) {
+				log_debug("Error (%d) trying to delete node %s\n",
+					  err, purge_entry->node_path);
+				goto out;
+			}
+		}
+	}
+
+out:
+	return err;
+}
+EVENT_SPY(EVT_FT_FIXUP, dt_non_compliant_purge);
#5 lore raw

Re: [RFC PATCH 1/5] dt: Provide a way to remove non-compliant nodes and properties

Quoted 51 lines · Heinrich Schuchardt
Quoted 41 lines · Sughosh Ganu

Add a function which is registered to spy for a EVT_FT_FIXUP event, and removes the non upstreamed nodes and properties from the devicetree before it gets passed to the OS.

This allows removing entire nodes, or specific properties under nodes from the devicetree. The required nodes and properties can be registered for removal through the DT_NON_COMPLIANT_PURGE and DT_NON_COMPLIANT_PURGE_LIST macros.

---
  include/dt-structs.h | 11 +++++++
  lib/Makefile         |  1 +
  lib/dt_purge.c       | 73 ++++++++++++++++++++++++++++++++++++++++++++
  3 files changed, 85 insertions(+)

create mode 100644 lib/dt_purge.c

include/dt-structs.h +11 -0
index fa1622cb1d..f535c60471 100644
@@ -57,3 +57,14 @@ struct phandle_2_arg {
  #endif
 
  #endif
+
+struct dt_non_compliant_purge {
+     const char *node_path;
+     const char *prop;
+};
+
+#define DT_NON_COMPLIANT_PURGE(__name)       \
+     ll_entry_declare(struct dt_non_compliant_purge, __name, dt_purge)
+
+#define DT_NON_COMPLIANT_PURGE_LIST(__name)  \
+     ll_entry_declare_list(struct dt_non_compliant_purge, __name, dt_purge)
lib/Makefile +0 -0
index 8d8ccc8bbc..82a906daa0 100644

lib/Makefile endif · line 40

Quoted 4 lines
lib/Makefile +1 -0
@@ -37,6 +37,7 @@ endif
  obj-y += crc8.o
  obj-y += crc16.o
  obj-y += crc16-ccitt.o
+obj-y += dt_purge.o

SPL can be the last boot stage (e.g. for Falcon Mode). So placing this under 'ifndef CONFIG_SPL_BUILD' is not correct.

Quoted 2 lines

You need some logic that identifies into which boot stage this code belongs, e.g. use obj-$(CONFIG_$(SPL_TPL_)OF_LIBFDT).

Okay. Will check and add this under the suggested config symbol.

-sughosh

Quoted 88 lines

Best regards

Heinrich

Quoted 82 lines
lib/Makefile +0 -0
  obj-$(CONFIG_ERRNO_STR) += errno_str.o
  obj-$(CONFIG_FIT) += fdtdec_common.o
  obj-$(CONFIG_TEST_FDTDEC) += fdtdec_test.o
lib/dt_purge.c new file +73 -0
new file mode 100644
index 0000000000..f893ba9796
@@ -0,0 +1,73 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) 2023, Linaro Limited
+ */
+
+#include <dt-structs.h>
+#include <event.h>
+#include <linker_lists.h>
+
+#include <linux/libfdt.h>
+
+/**
+ * dt_non_compliant_purge() -        Remove non-upstreamed nodes and properties
+ *                           from the DT
+ * @ctx: Context for event
+ * @event: Event to process
+ *
+ * Iterate through an array of DT nodes and properties, and remove them
+ * from the device-tree before the DT gets handed over to the kernel.
+ * These are nodes and properties which do not have upstream bindings
+ * and need to be purged before being handed over to the kernel.
+ *
+ * If both the node and property are specified, delete the property. If
+ * only the node is specified, delete the entire node, including it's
+ * subnodes, if any.
+ *
+ * Return: 0 if OK, -ve on error
+ */
+static int dt_non_compliant_purge(void *ctx, struct event *event)
+{
+     int nodeoff = 0;
+     int err = 0;
+     void *fdt;
+     const struct event_ft_fixup *fixup = &event->data.ft_fixup;
+     struct dt_non_compliant_purge *purge_entry;
+     struct dt_non_compliant_purge *purge_start =
+             ll_entry_start(struct dt_non_compliant_purge, dt_purge);
+     int nentries = ll_entry_count(struct dt_non_compliant_purge, dt_purge);
+
+     if (fixup->images)
+             return 0;
+
+     fdt = fixup->tree.fdt;
+     for (purge_entry = purge_start; purge_entry != purge_start + nentries;
+          purge_entry++) {
+             nodeoff = fdt_path_offset(fdt, purge_entry->node_path);
+             if (nodeoff < 0) {
+                     log_debug("Error (%d) getting node offset for %s\n",
+                               nodeoff, purge_entry->node_path);
+                     continue;
+             }
+
+             if (purge_entry->prop) {
+                     err = fdt_delprop(fdt, nodeoff, purge_entry->prop);
+                     if (err < 0 && err != -FDT_ERR_NOTFOUND) {
+                             log_debug("Error (%d) deleting %s\n",
+                                       err, purge_entry->prop);
+                             goto out;
+                     }
+             } else {
+                     err = fdt_del_node(fdt, nodeoff);
+                     if (err) {
+                             log_debug("Error (%d) trying to delete node %s\n",
+                                       err, purge_entry->node_path);
+                             goto out;
+                     }
+             }
+     }
+
+out:
+     return err;
+}
+EVENT_SPY(EVT_FT_FIXUP, dt_non_compliant_purge);
#6 lore raw

Re: [RFC PATCH 1/5] dt: Provide a way to remove non-compliant nodes and properties

In reply to Sughosh Ganu
Quoted 10 lines · Sughosh Ganu

Add a function which is registered to spy for a EVT_FT_FIXUP event, and removes the non upstreamed nodes and properties from the devicetree before it gets passed to the OS.

This allows removing entire nodes, or specific properties under nodes from the devicetree. The required nodes and properties can be registered for removal through the DT_NON_COMPLIANT_PURGE and DT_NON_COMPLIANT_PURGE_LIST macros.

So, the conceptual problem here is that while we do need to have a way to purge nodes and properties that have been rejected by upstream, we also need to ensure an upstream attempt was made. To that end, how I envision things is:
- When we build the docs, something under doc/develop/ has a page / section for each binding we're purging, which links to and summarizes why it's not appropriate for upstream.
- It's non-default to purge said nodes.
- We at least make checkpatch / et al complain about new purges being added, and CI failing on the number of purges increasing without also increasing the number of allowed purges.

Signature · 1 line
Tom
#7 lore raw

RFC PATCH 2/5 fwu: Add the fwu-mdata node for removal from devicetree

In reply to Sughosh Ganu

The FWU metadata devicetree node points to the device which stores the metadata structure. This node is relevant only in U-Boot, and is not to be passed to the OS. Register for purging this node from the devicetree, before passing it to the OS.

---
 drivers/fwu-mdata/fwu-mdata-uclass.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/fwu-mdata/fwu-mdata-uclass.c +5 -0
index 0a8edaaa41..71411d9c19 100644
@@ -7,6 +7,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <dt-structs.h>
 #include <efi_loader.h>
 #include <fwu.h>
 #include <fwu_mdata.h>
@@ -53,3 +54,7 @@ UCLASS_DRIVER(fwu_mdata) = {
 	.id		= UCLASS_FWU_MDATA,
 	.name		= "fwu-mdata",
 };
+
+DT_NON_COMPLIANT_PURGE(fwu_mdata) = {
+	.node_path	= "/fwu-mdata",
+};
Signature · 1 line
2.34.1
#8 lore raw

RFC PATCH 3/5 capsule: Add the capsule-key property for removal from devicetree

In reply to Sughosh Ganu

The capsule-key property contains the public key in the form of an EFI Signature List(ESL) structure. This property is relevant only in U-Boot, and is not to be passed to the OS. Register for purging this property from the devicetree, before passing it to the OS.

---
 lib/efi_loader/efi_capsule.c | 7 +++++++
 1 file changed, 7 insertions(+)
lib/efi_loader/efi_capsule.c +7 -0
index af8a2ee940..5c6c87458f 100644
@@ -9,6 +9,7 @@
 #define LOG_CATEGORY LOGC_EFI
 
 #include <common.h>
+#include <dt-structs.h>
 #include <efi_loader.h>
 #include <efi_variable.h>
 #include <env.h>
@@ -403,6 +404,12 @@ out:
 
 	return status;
 }
+
+DT_NON_COMPLIANT_PURGE(capsule_key) = {
+	.node_path	= "/signature",
+	.prop		= "capsule-key",
+};
+
 #endif /* CONFIG_EFI_CAPSULE_AUTHENTICATE */
 
 static __maybe_unused bool fwu_empty_capsule(struct efi_capsule_header *capsule)
Signature · 1 line
2.34.1
#9 lore raw

RFC PATCH 4/5 bootefi: Call the EVT_FT_FIXUP event handler

In reply to Sughosh Ganu

The bootefi command passes the devicetree to the kernel through the EFI config table. Call the event handlers for fixing the devicetree before jumping into the kernel. This removes any devicetree nodes and/or properties that are specific only to U-Boot, and are not to be passed to the OS.

---
 cmd/bootefi.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
cmd/bootefi.c +18 -0
index f73d6eb0e2..c359a46ec4 100644
@@ -237,6 +237,23 @@ static void *get_config_table(const efi_guid_t *guid)
 	return NULL;
 }
 
+/**
+ * event_notify_dt_fixup() - call ft_fixup event
+ *
+ * @fdt:	address of the device tree to be passed to the kernel
+ *		through the configuration table
+ * Return:	None
+ */
+static void event_notify_dt_fixup(void *fdt)
+{
+	int ret;
+	struct event_ft_fixup fixup = {0};
+
+	fixup.tree.fdt = fdt;
+	ret = event_notify(EVT_FT_FIXUP, &fixup, sizeof(fixup));
+	if (ret)
+		printf("Error: %d: FDT Fixup event failed\n", ret);
+}
 #endif /* !CONFIG_IS_ENABLED(GENERATE_ACPI_TABLE) */
 
 /**
@@ -318,6 +335,7 @@ efi_status_t efi_install_fdt(void *fdt)
 	efi_carve_out_dt_rsv(fdt);
 
 	efi_try_purge_kaslr_seed(fdt);
+	event_notify_dt_fixup(fdt);
 
 	if (CONFIG_IS_ENABLED(EFI_TCG2_PROTOCOL_MEASURE_DTB)) {
 		ret = efi_tcg2_measure_dtb(fdt);
Signature · 1 line
2.34.1
#10 lore raw

Re: [RFC PATCH 4/5] bootefi: Call the EVT_FT_FIXUP event handler

Quoted 40 lines · Sughosh Ganu

The bootefi command passes the devicetree to the kernel through the EFI config table. Call the event handlers for fixing the devicetree before jumping into the kernel. This removes any devicetree nodes and/or properties that are specific only to U-Boot, and are not to be passed to the OS.

---
  cmd/bootefi.c | 18 ++++++++++++++++++
  1 file changed, 18 insertions(+)
cmd/bootefi.c +17 -0
index f73d6eb0e2..c359a46ec4 100644
@@ -237,6 +237,23 @@ static void *get_config_table(const efi_guid_t *guid)
  	return NULL;
  }
 
+/**
+ * event_notify_dt_fixup() - call ft_fixup event
+ *
+ * @fdt:	address of the device tree to be passed to the kernel
+ *		through the configuration table
+ * Return:	None
+ */
+static void event_notify_dt_fixup(void *fdt)
+{
+	int ret;
+	struct event_ft_fixup fixup = {0};
+
+	fixup.tree.fdt = fdt;
+	ret = event_notify(EVT_FT_FIXUP, &fixup, sizeof(fixup));
+	if (ret)
+		printf("Error: %d: FDT Fixup event failed\n", ret);
+}
  #endif /* !CONFIG_IS_ENABLED(GENERATE_ACPI_TABLE) */
 
  /**

cmd/bootefi.c efi_status_t efi_install_fdt(void *fdt) · line 338

Quoted 4 lines
cmd/bootefi.c +1 -0
@@ -318,6 +335,7 @@ efi_status_t efi_install_fdt(void *fdt)
  	efi_carve_out_dt_rsv(fdt);
 
  	efi_try_purge_kaslr_seed(fdt);
+	event_notify_dt_fixup(fdt);

The event is already triggered in image_setup_libfdt(). Don't trigger it twice.

Best regards

Heinrich

Quoted 3 lines
cmd/bootefi.c +0 -0
  	if (CONFIG_IS_ENABLED(EFI_TCG2_PROTOCOL_MEASURE_DTB)) {
  		ret = efi_tcg2_measure_dtb(fdt);
#11 lore raw

Re: [RFC PATCH 4/5] bootefi: Call the EVT_FT_FIXUP event handler

Quoted 44 lines · Heinrich Schuchardt
Quoted 42 lines · Sughosh Ganu

The bootefi command passes the devicetree to the kernel through the EFI config table. Call the event handlers for fixing the devicetree before jumping into the kernel. This removes any devicetree nodes and/or properties that are specific only to U-Boot, and are not to be passed to the OS.

---
  cmd/bootefi.c | 18 ++++++++++++++++++
  1 file changed, 18 insertions(+)
cmd/bootefi.c +17 -0
index f73d6eb0e2..c359a46ec4 100644
@@ -237,6 +237,23 @@ static void *get_config_table(const efi_guid_t *guid)
      return NULL;
  }
 
+/**
+ * event_notify_dt_fixup() - call ft_fixup event
+ *
+ * @fdt:     address of the device tree to be passed to the kernel
+ *           through the configuration table
+ * Return:   None
+ */
+static void event_notify_dt_fixup(void *fdt)
+{
+     int ret;
+     struct event_ft_fixup fixup = {0};
+
+     fixup.tree.fdt = fdt;
+     ret = event_notify(EVT_FT_FIXUP, &fixup, sizeof(fixup));
+     if (ret)
+             printf("Error: %d: FDT Fixup event failed\n", ret);
+}
  #endif /* !CONFIG_IS_ENABLED(GENERATE_ACPI_TABLE) */
 
  /**
@@ -318,6 +335,7 @@ efi_status_t efi_install_fdt(void *fdt)
      efi_carve_out_dt_rsv(fdt);
 
Quoted 5 lines

cmd/bootefi.c efi_status_t efi_install_fdt(void *fdt) · line 338

Quoted 2 lines
cmd/bootefi.c +1 -0
      efi_try_purge_kaslr_seed(fdt);
+     event_notify_dt_fixup(fdt);

The event is already triggered in image_setup_libfdt(). Don't trigger it twice.

The reason I put an explicit event_notify call is because the image_setup_libfdt() call only calls the ft_fixup handlers if the livetree is not active. So the fixup handlers would not be called on platforms that enable livetree. Although I'm not sure if livetree should be disabled before the ft fixup has to happen, or platforms that need ft fixup should not enable OF_LIVE. Disabling the livetree is not happening now, so I am not sure how the fixup event should work on platforms which have OF_LIVE enabled.

-sughosh

Quoted 9 lines

Best regards

Heinrich

Quoted 3 lines
cmd/bootefi.c +0 -0
      if (CONFIG_IS_ENABLED(EFI_TCG2_PROTOCOL_MEASURE_DTB)) {
              ret = efi_tcg2_measure_dtb(fdt);
#12 lore raw

Re: [RFC PATCH 4/5] bootefi: Call the EVT_FT_FIXUP event handler

Quoted 51 lines · Sughosh Ganu
Quoted 44 lines · Heinrich Schuchardt
Quoted 42 lines · Sughosh Ganu

The bootefi command passes the devicetree to the kernel through the EFI config table. Call the event handlers for fixing the devicetree before jumping into the kernel. This removes any devicetree nodes and/or properties that are specific only to U-Boot, and are not to be passed to the OS.

---
   cmd/bootefi.c | 18 ++++++++++++++++++
   1 file changed, 18 insertions(+)
cmd/bootefi.c +17 -0
index f73d6eb0e2..c359a46ec4 100644
@@ -237,6 +237,23 @@ static void *get_config_table(const efi_guid_t *guid)
       return NULL;
   }
 
+/**
+ * event_notify_dt_fixup() - call ft_fixup event
+ *
+ * @fdt:     address of the device tree to be passed to the kernel
+ *           through the configuration table
+ * Return:   None
+ */
+static void event_notify_dt_fixup(void *fdt)
+{
+     int ret;
+     struct event_ft_fixup fixup = {0};
+
+     fixup.tree.fdt = fdt;
+     ret = event_notify(EVT_FT_FIXUP, &fixup, sizeof(fixup));
+     if (ret)
+             printf("Error: %d: FDT Fixup event failed\n", ret);
+}
   #endif /* !CONFIG_IS_ENABLED(GENERATE_ACPI_TABLE) */
 
   /**
@@ -318,6 +335,7 @@ efi_status_t efi_install_fdt(void *fdt)
       efi_carve_out_dt_rsv(fdt);
 
Quoted 5 lines

cmd/bootefi.c efi_status_t efi_install_fdt(void *fdt) · line 338

Quoted 2 lines
cmd/bootefi.c +1 -0
       efi_try_purge_kaslr_seed(fdt);
+     event_notify_dt_fixup(fdt);

The event is already triggered in image_setup_libfdt(). Don't trigger it twice.

Quoted 8 lines

The reason I put an explicit event_notify call is because the image_setup_libfdt() call only calls the ft_fixup handlers if the livetree is not active. So the fixup handlers would not be called on platforms that enable livetree. Although I'm not sure if livetree should be disabled before the ft fixup has to happen, or platforms that need ft fixup should not enable OF_LIVE. Disabling the livetree is not happening now, so I am not sure how the fixup event should work on platforms which have OF_LIVE enabled.

We still must not call the same event twice. We further must ensure that our fix-up is called last (e.g. by calling it zzz_something) and not before adding VBE nodes.

Is there any need to use the event mechanism here?

@Simon:
None of the other function calls in image_setup_libfdt() depend on of_live_active(). I think it would be preferable to move that check into the listeners. If instead of of_live_active() you could use a configuration setting for the decision, gcc could eliminate a lot of code.

We definitely need better descriptions in include/event.h and a man-page generated from that include:

EVT_NONE
undescribed
EVT_TEST
undescribed
EVT_DM_POST_INIT_F
undescribed
EVT_DM_POST_INIT_R
undescribed
EVT_DM_PRE_PROBE
Device is about to be probed
EVT_DM_POST_PROBE
undescribed
EVT_DM_PRE_REMOVE
undescribed
EVT_DM_POST_REMOVE
undescribed
EVT_MISC_INIT_F
undescribed
EVT_FPGA_LOAD
undescribed
EVT_FT_FIXUP
undescribed
EVT_MAIN_LOOP
undescribed
EVT_COUNT
undescribed

Best regards

Heinrich

#13 lore raw

Re: [RFC PATCH 4/5] bootefi: Call the EVT_FT_FIXUP event handler

Hi Heinrich,

Quoted 66 lines · Heinrich Schuchardt
Quoted 51 lines · Sughosh Ganu
Quoted 44 lines · Heinrich Schuchardt
Quoted 42 lines · Sughosh Ganu

The bootefi command passes the devicetree to the kernel through the EFI config table. Call the event handlers for fixing the devicetree before jumping into the kernel. This removes any devicetree nodes and/or properties that are specific only to U-Boot, and are not to be passed to the OS.

---
   cmd/bootefi.c | 18 ++++++++++++++++++
   1 file changed, 18 insertions(+)
cmd/bootefi.c +17 -0
index f73d6eb0e2..c359a46ec4 100644
@@ -237,6 +237,23 @@ static void *get_config_table(const efi_guid_t *guid)
       return NULL;
   }
 
+/**
+ * event_notify_dt_fixup() - call ft_fixup event
+ *
+ * @fdt:     address of the device tree to be passed to the kernel
+ *           through the configuration table
+ * Return:   None
+ */
+static void event_notify_dt_fixup(void *fdt)
+{
+     int ret;
+     struct event_ft_fixup fixup = {0};
+
+     fixup.tree.fdt = fdt;
+     ret = event_notify(EVT_FT_FIXUP, &fixup, sizeof(fixup));
+     if (ret)
+             printf("Error: %d: FDT Fixup event failed\n", ret);
+}
   #endif /* !CONFIG_IS_ENABLED(GENERATE_ACPI_TABLE) */
 
   /**
@@ -318,6 +335,7 @@ efi_status_t efi_install_fdt(void *fdt)
       efi_carve_out_dt_rsv(fdt);
 
Quoted 5 lines

cmd/bootefi.c efi_status_t efi_install_fdt(void *fdt) · line 338

Quoted 2 lines
cmd/bootefi.c +1 -0
       efi_try_purge_kaslr_seed(fdt);
+     event_notify_dt_fixup(fdt);

The event is already triggered in image_setup_libfdt(). Don't trigger it twice.

Quoted 8 lines

The reason I put an explicit event_notify call is because the image_setup_libfdt() call only calls the ft_fixup handlers if the livetree is not active. So the fixup handlers would not be called on platforms that enable livetree. Although I'm not sure if livetree should be disabled before the ft fixup has to happen, or platforms that need ft fixup should not enable OF_LIVE. Disabling the livetree is not happening now, so I am not sure how the fixup event should work on platforms which have OF_LIVE enabled.

We still must not call the same event twice. We further must ensure that our fix-up is called last (e.g. by calling it zzz_something) and not before adding VBE nodes.

Quoted 7 lines

Is there any need to use the event mechanism here?

@Simon:
None of the other function calls in image_setup_libfdt() depend on of_live_active(). I think it would be preferable to move that check into the listeners. If instead of of_live_active() you could use a configuration setting for the decision, gcc could eliminate a lot of code.

Firstly, of_live_active() should check CONFIG_IS_ENABLED(OF_LIVE) first. I noticed this over the weekend when looking at something else.

The original code was due to a limitation with U-Boot's ofnode implementation, in that it did not support multiple devicetrees without OF_LIVE. We need to support at least two, since we have the 'control' DTB and the one being set up to boot the OS.

Anyway, that limitation can be removed, so long as CONFIG_MULTI_DTB_FIT is set. In other words, we should enable MULTI_DTB_FIT if !OF_LIVE and all will be well.

Quoted 22 lines

We definitely need better descriptions in include/event.h and a man-page generated from that include:

EVT_NONE
undescribed
EVT_TEST
undescribed
EVT_DM_POST_INIT_F
undescribed
EVT_DM_POST_INIT_R
undescribed
EVT_DM_PRE_PROBE
Device is about to be probed
EVT_DM_POST_PROBE
undescribed
EVT_DM_PRE_REMOVE
undescribed
EVT_DM_POST_REMOVE
undescribed
EVT_MISC_INIT_F
undescribed

Quoted 8 lines

EVT_FPGA_LOAD
undescribed
EVT_FT_FIXUP
undescribed
EVT_MAIN_LOOP
undescribed
EVT_COUNT
undescribed

Yes indeed. I added some for the latest patch in this area.

https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/

Regards,
Simon

#14 lore raw

RFC PATCH 5/5 doc: Add a document for non-compliant DT node/property removal

In reply to Sughosh Ganu

Add a document explaining the need for removal of non-compliant devicetree nodes and properties. Also describe in brief, the macros that can be used for this removal.

---
 .../devicetree/dt_non_compliant_purge.rst     | 64 +++++++++++++++++++
 1 file changed, 64 insertions(+)
 create mode 100644 doc/develop/devicetree/dt_non_compliant_purge.rst
doc/develop/devicetree/dt_non_compliant_purge.rst new file +64 -0
new file mode 100644
index 0000000000..c3a8feab5b
@@ -0,0 +1,64 @@
+.. SPDX-License-Identifier: GPL-2.0+
+
+Removal of non-compliant nodes and properties
+=============================================
+
+The devicetree used in U-Boot might contain nodes and properties which
+are specific only to U-Boot, and are not necessarily being used to
+describe hardware but to pass information to U-Boot. An example of
+such a property would be the public key being passed to U-Boot for
+verification.
+
+This devicetree can then be passed to the OS. Since certain nodes and
+properties are not really describing hardware, and more importantly,
+these are only relevant to U-Boot, bindings for these cannot be
+upstreamed into the devicetree repository. There have been instances
+of attempts being made to upstream such bindings, and these deemed not
+fit for upstreaming. Not having a binding for these nodes and
+properties means that the devicetree fails the schema compliance tests
+[1]. This also means that the platform cannot get certifications like
+SystemReady [2] which, among other things require a devicetree which
+passes the schema compliance tests.
+
+For such nodes and properties, it has been suggested by the devicetree
+maintainers that the right thing to do is to remove them from the
+devicetree before it gets passed on to the OS [3].
+
+Removing nodes/properties
+-------------------------
+
+In U-Boot, this is been done through adding information on such nodes
+and properties in a list. The entire node can be deleted, or a
+specific property under a node can be deleted. The list of such nodes
+and properties is generated at compile time, and the function to purge
+these can be invoked through a EVT_FT_FIXUP event notify call.
+
+For deleting a node, this can be done by declaring a macro::
+
+	DT_NON_COMPLIANT_PURGE(fwu_mdata) = {
+		.node_path      = "/fwu-mdata",
+	};
+
+Similarly, for deleting a property under a node, that can be done by
+specifying the property name::
+
+	DT_NON_COMPLIANT_PURGE(capsule_key) = {
+		.node_path      = "/signature",
+		.prop           = "capsule-key",
+	};
+
+In the first example, the entire node with path /fwu-mdata will be
+removed. In the second example, the property capsule-key
+under /signature node will be removed.
+
+Similarly, a list of nodes and properties can be specified using the
+following macro::
+
+	DT_NON_COMPLIANT_PURGE_LIST(foo) = {
+		{ .node_path = "/some_node", .prop = "some_bar" },
+		{ .node_path = "/some_node" },
+	};
+
+[1] - https://github.com/devicetree-org/dt-schema
+[2] - https://www.arm.com/architecture/system-architectures/systemready-certification-program
+[3] - https://lore.kernel.org/u-boot/CAL_JsqJN4FeHomL7z3yj0WJ9bpx1oSE7zf26L_GV2oS6cg-5qg@mail.gmail.com/
Signature · 1 line
2.34.1
#15 lore raw

Re: [RFC PATCH 5/5] doc: Add a document for non-compliant DT node/property removal

Quoted 5 lines · Sughosh Ganu

Add a document explaining the need for removal of non-compliant devicetree nodes and properties. Also describe in brief, the macros that can be used for this removal.

Thanks for properly documenting the change.

Warning, treated as error:
doc/develop/devicetree/dt_non_compliant_purge.rst:
document isn't included in any toctree

Please, add the document to doc/develop/devicetree/index.rst

Please, run make htmldocs before resubmitting.

Quoted 17 lines
---
  .../devicetree/dt_non_compliant_purge.rst     | 64 +++++++++++++++++++
  1 file changed, 64 insertions(+)

create mode 100644 doc/develop/devicetree/dt_non_compliant_purge.rst

doc/develop/devicetree/dt_non_compliant_purge.rst new file +6 -0
new file mode 100644
index 0000000000..c3a8feab5b
@@ -0,0 +1,64 @@
+.. SPDX-License-Identifier: GPL-2.0+
+
+Removal of non-compliant nodes and properties
+=============================================
+
+The devicetree used in U-Boot might contain nodes and properties which

doc/develop/devicetree/dt_non_compliant_purge.rst line 16

Quoted 10 lines
doc/develop/devicetree/dt_non_compliant_purge.rst new file +10 -0
+are specific only to U-Boot, and are not necessarily being used to
+describe hardware but to pass information to U-Boot. An example of
+such a property would be the public key being passed to U-Boot for
+verification.
+
+This devicetree can then be passed to the OS. Since certain nodes and
+properties are not really describing hardware, and more importantly,
+these are only relevant to U-Boot, bindings for these cannot be
+upstreamed into the devicetree repository. There have been instances
+of attempts being made to upstream such bindings, and these deemed not

but these were not deemed fit

doc/develop/devicetree/dt_non_compliant_purge.rst line 20

Quoted 4 lines
doc/develop/devicetree/dt_non_compliant_purge.rst new file +4 -0
+fit for upstreaming. Not having a binding for these nodes and
+properties means that the devicetree fails the schema compliance tests
+[1]. This also means that the platform cannot get certifications like
+SystemReady [2] which, among other things require a devicetree which

%s/require/requires/

doc/develop/devicetree/dt_non_compliant_purge.rst line 24

Quoted 4 lines
doc/develop/devicetree/dt_non_compliant_purge.rst new file +4 -0
+passes the schema compliance tests.
+
+For such nodes and properties, it has been suggested by the devicetree
+maintainers that the right thing to do is to remove them from the

%s/that the right thing to do is//

doc/develop/devicetree/dt_non_compliant_purge.rst line 25

Quoted 1 line
doc/develop/devicetree/dt_non_compliant_purge.rst new file +1 -0
+devicetree before it gets passed on to the OS [3].

%s/on to/to/

doc/develop/devicetree/dt_non_compliant_purge.rst line 30

Quoted 5 lines
doc/develop/devicetree/dt_non_compliant_purge.rst new file +5 -0
+
+Removing nodes/properties
+-------------------------
+
+In U-Boot, this is been done through adding information on such nodes

%s/is been done through/is done by/

doc/develop/devicetree/dt_non_compliant_purge.rst line 40

Quoted 10 lines
doc/develop/devicetree/dt_non_compliant_purge.rst new file +10 -0
+and properties in a list. The entire node can be deleted, or a
+specific property under a node can be deleted. The list of such nodes
+and properties is generated at compile time, and the function to purge
+these can be invoked through a EVT_FT_FIXUP event notify call.
+
+For deleting a node, this can be done by declaring a macro::
+
+	DT_NON_COMPLIANT_PURGE(fwu_mdata) = {
+		.node_path      = "/fwu-mdata",
+	};

Where should such a macro be placed?

doc/develop/devicetree/dt_non_compliant_purge.rst line 48

Quoted 8 lines
doc/develop/devicetree/dt_non_compliant_purge.rst new file +8 -0
+
+Similarly, for deleting a property under a node, that can be done by
+specifying the property name::
+
+	DT_NON_COMPLIANT_PURGE(capsule_key) = {
+		.node_path      = "/signature",
+		.prop           = "capsule-key",
+	};

Why is capsule_key needed twice here? What would be the effect of:

DT_NON_COMPLIANT_PURGE(voodoo) = {
.node_path = "/signature",
.prop = "capsule-key",
};

doc/develop/devicetree/dt_non_compliant_purge.rst line 57

Quoted 9 lines
doc/develop/devicetree/dt_non_compliant_purge.rst new file +9 -0
+
+In the first example, the entire node with path /fwu-mdata will be
+removed. In the second example, the property capsule-key
+under /signature node will be removed.
+
+Similarly, a list of nodes and properties can be specified using the
+following macro::
+
+	DT_NON_COMPLIANT_PURGE_LIST(foo) = {

What does foo refer to here? Can this parameter be eliminated from the syntax?

Will the application of the removals be sorted alphabetically by this argument?

What will happen if a property or node does not exist at time of removal? Hopefully that does not stop the boot process but is silently ignored.

doc/develop/devicetree/dt_non_compliant_purge.rst line 60

Quoted 3 lines
doc/develop/devicetree/dt_non_compliant_purge.rst new file +3 -0
+		{ .node_path = "/some_node", .prop = "some_bar" },
+		{ .node_path = "/some_node" },
+	};

Why do you need the first element in your example? Wouldn't deleting /some/node imply that all its children are deleted?

Why do we need separate properties .node_path and .prop. It would be less effort to write:

DT_NON_COMPLIANT_PURGE_LIST() =

{
	"/some_node_1/some_property_1",
	"/some_node_1/some_property_2",
	"/some_node_2",
}

I assume the macro does its job irrespective of non-compliance. Why not call it DT_PURGE()?

Best regards

Heinrich

Quoted 4 lines
doc/develop/devicetree/dt_non_compliant_purge.rst new file +4 -0
+
+[1] - https://github.com/devicetree-org/dt-schema
+[2] - https://www.arm.com/architecture/system-architectures/systemready-certification-program
+[3] - https://lore.kernel.org/u-boot/CAL_JsqJN4FeHomL7z3yj0WJ9bpx1oSE7zf26L_GV2oS6cg-5qg@mail.gmail.com/
#16 lore raw

Re: [RFC PATCH 5/5] doc: Add a document for non-compliant DT node/property removal

Quoted 74 lines · Heinrich Schuchardt
Quoted 5 lines · Sughosh Ganu

Add a document explaining the need for removal of non-compliant devicetree nodes and properties. Also describe in brief, the macros that can be used for this removal.

Thanks for properly documenting the change.

Warning, treated as error:
doc/develop/devicetree/dt_non_compliant_purge.rst:
document isn't included in any toctree

Please, add the document to doc/develop/devicetree/index.rst

Please, run make htmldocs before resubmitting.

Quoted 17 lines
---
  .../devicetree/dt_non_compliant_purge.rst     | 64 +++++++++++++++++++
  1 file changed, 64 insertions(+)

create mode 100644 doc/develop/devicetree/dt_non_compliant_purge.rst

doc/develop/devicetree/dt_non_compliant_purge.rst new file +6 -0
new file mode 100644
index 0000000000..c3a8feab5b
@@ -0,0 +1,64 @@
+.. SPDX-License-Identifier: GPL-2.0+
+
+Removal of non-compliant nodes and properties
+=============================================
+
+The devicetree used in U-Boot might contain nodes and properties which

doc/develop/devicetree/dt_non_compliant_purge.rst line 16

Quoted 10 lines
doc/develop/devicetree/dt_non_compliant_purge.rst new file +10 -0
+are specific only to U-Boot, and are not necessarily being used to
+describe hardware but to pass information to U-Boot. An example of
+such a property would be the public key being passed to U-Boot for
+verification.
+
+This devicetree can then be passed to the OS. Since certain nodes and
+properties are not really describing hardware, and more importantly,
+these are only relevant to U-Boot, bindings for these cannot be
+upstreamed into the devicetree repository. There have been instances
+of attempts being made to upstream such bindings, and these deemed not

but these were not deemed fit

doc/develop/devicetree/dt_non_compliant_purge.rst line 20

Quoted 4 lines
doc/develop/devicetree/dt_non_compliant_purge.rst new file +4 -0
+fit for upstreaming. Not having a binding for these nodes and
+properties means that the devicetree fails the schema compliance tests
+[1]. This also means that the platform cannot get certifications like
+SystemReady [2] which, among other things require a devicetree which

%s/require/requires/

doc/develop/devicetree/dt_non_compliant_purge.rst line 24

Quoted 4 lines
doc/develop/devicetree/dt_non_compliant_purge.rst new file +4 -0
+passes the schema compliance tests.
+
+For such nodes and properties, it has been suggested by the devicetree
+maintainers that the right thing to do is to remove them from the

%s/that the right thing to do is//

doc/develop/devicetree/dt_non_compliant_purge.rst line 25

Quoted 1 line
doc/develop/devicetree/dt_non_compliant_purge.rst new file +1 -0
+devicetree before it gets passed on to the OS [3].

%s/on to/to/

doc/develop/devicetree/dt_non_compliant_purge.rst line 30

Quoted 5 lines
doc/develop/devicetree/dt_non_compliant_purge.rst new file +5 -0
+
+Removing nodes/properties
+-------------------------
+
+In U-Boot, this is been done through adding information on such nodes

%s/is been done through/is done by/

Quoted 12 lines

doc/develop/devicetree/dt_non_compliant_purge.rst line 40

Quoted 10 lines
doc/develop/devicetree/dt_non_compliant_purge.rst new file +10 -0
+and properties in a list. The entire node can be deleted, or a
+specific property under a node can be deleted. The list of such nodes
+and properties is generated at compile time, and the function to purge
+these can be invoked through a EVT_FT_FIXUP event notify call.
+
+For deleting a node, this can be done by declaring a macro::
+
+     DT_NON_COMPLIANT_PURGE(fwu_mdata) = {
+             .node_path      = "/fwu-mdata",
+     };

Where should such a macro be placed?

It should be placed in any file that will get compiled.

Quoted 12 lines

doc/develop/devicetree/dt_non_compliant_purge.rst line 48

Quoted 9 lines
doc/develop/devicetree/dt_non_compliant_purge.rst new file +8 -0
+
+Similarly, for deleting a property under a node, that can be done by
+specifying the property name::
+
+     DT_NON_COMPLIANT_PURGE(capsule_key) = {
+             .node_path      = "/signature",
+             .prop           = "capsule-key",
+     };

Why is capsule_key needed twice here? What would be the effect of:

Quoted 4 lines

DT_NON_COMPLIANT_PURGE(voodoo) = {
.node_path = "/signature",
.prop = "capsule-key",
};

In your above example, voodoo just happens to be the name of the entry that will be created. But the property that will be searched in the devicetree for removal is "capsule-key".

Quoted 13 lines

doc/develop/devicetree/dt_non_compliant_purge.rst line 57

Quoted 10 lines
doc/develop/devicetree/dt_non_compliant_purge.rst new file +9 -0
+
+In the first example, the entire node with path /fwu-mdata will be
+removed. In the second example, the property capsule-key
+under /signature node will be removed.
+
+Similarly, a list of nodes and properties can be specified using the
+following macro::
+
+     DT_NON_COMPLIANT_PURGE_LIST(foo) = {

What does foo refer to here? Can this parameter be eliminated from the syntax?

foo is the name of the entry being generated through the ll_entry_declare macro. We do need this parameter for ll_entry_declare to generate a unique entry. Using a common name results in a linker error.

Quoted 3 lines

Will the application of the removals be sorted alphabetically by this argument?

I am not sure how the linker arranges the entries in the list. Why does it matter?

Quoted 4 lines

What will happen if a property or node does not exist at time of removal? Hopefully that does not stop the boot process but is silently ignored.

Yes, it will not cause the boot to fail.

Quoted 7 lines

doc/develop/devicetree/dt_non_compliant_purge.rst line 60

Quoted 4 lines
doc/develop/devicetree/dt_non_compliant_purge.rst new file +3 -0
+             { .node_path = "/some_node", .prop = "some_bar" },
+             { .node_path = "/some_node" },
+     };

Why do you need the first element in your example? Wouldn't deleting /some/node imply that all its children are deleted?

Ah, this is a bad example. I should be using a different name for the second entry here. Will fix.

Quoted 5 lines

Why do we need separate properties .node_path and .prop. It would be less effort to write:

DT_NON_COMPLIANT_PURGE_LIST() =

Quoted 8 lines
{
        "/some_node_1/some_property_1",
        "/some_node_1/some_property_2",
        "/some_node_2",
}

I assume the macro does its job irrespective of non-compliance. Why not call it DT_PURGE()?

Yes, it can be called DT_PURGE. I was using the term non_compliant simply to highlight the fact that we would need to use this for removal of non-compliant nodes or properties.

-sughosh

Quoted 9 lines

Best regards

Heinrich

Quoted 4 lines
doc/develop/devicetree/dt_non_compliant_purge.rst new file +4 -0
+
+[1] - https://github.com/devicetree-org/dt-schema
+[2] - https://www.arm.com/architecture/system-architectures/systemready-certification-program
+[3] - https://lore.kernel.org/u-boot/CAL_JsqJN4FeHomL7z3yj0WJ9bpx1oSE7zf26L_GV2oS6cg-5qg@mail.gmail.com/
#17 lore raw

Re: [RFC PATCH 5/5] doc: Add a document for non-compliant DT node/property removal

In reply to Sughosh Ganu

Hi Sughosh,

Quoted 17 lines · Sughosh Ganu

Add a document explaining the need for removal of non-compliant devicetree nodes and properties. Also describe in brief, the macros that can be used for this removal.

---
 .../devicetree/dt_non_compliant_purge.rst     | 64 +++++++++++++++++++
 1 file changed, 64 insertions(+)
 create mode 100644 doc/develop/devicetree/dt_non_compliant_purge.rst
doc/develop/devicetree/dt_non_compliant_purge.rst new file +0 -0
new file mode 100644
index 0000000000..c3a8feab5b

doc/develop/devicetree/dt_non_compliant_purge.rst line 10

Quoted 10 lines
doc/develop/devicetree/dt_non_compliant_purge.rst new file +10 -0
@@ -0,0 +1,64 @@
+.. SPDX-License-Identifier: GPL-2.0+
+
+Removal of non-compliant nodes and properties
+=============================================
+
+The devicetree used in U-Boot might contain nodes and properties which
+are specific only to U-Boot, and are not necessarily being used to
+describe hardware but to pass information to U-Boot. An example of
+such a property would be the public key being passed to U-Boot for
+verification.

It has nothing to do with describing hardware. The DT can describe other things too. See the /options node, for example.

Please don't bring this highly misleading language into U-Boot.

doc/develop/devicetree/dt_non_compliant_purge.rst

Quoted 7 lines
doc/develop/devicetree/dt_non_compliant_purge.rst new file +7 -0
+
+This devicetree can then be passed to the OS. Since certain nodes and
+properties are not really describing hardware, and more importantly,
+these are only relevant to U-Boot, bindings for these cannot be
+upstreamed into the devicetree repository. There have been instances
+of attempts being made to upstream such bindings, and these deemed not
+fit for upstreaming.

Then either they should not be in U-Boot, or there is a problem with the process.

doc/develop/devicetree/dt_non_compliant_purge.rst line 25

Quoted 9 lines

Not having a binding for these nodes and

doc/develop/devicetree/dt_non_compliant_purge.rst new file +8 -0
+properties means that the devicetree fails the schema compliance tests
+[1]. This also means that the platform cannot get certifications like
+SystemReady [2] which, among other things require a devicetree which
+passes the schema compliance tests.
+
+For such nodes and properties, it has been suggested by the devicetree
+maintainers that the right thing to do is to remove them from the
+devicetree before it gets passed on to the OS [3].

Hard NAK. If we go this way, then no one will ever have an incentive to do the right thing.

Please send bindings for Linaro's work, instead. If something is entirely U-Boot-specific, then it can go in /options/u-boot but it still must be in the dt-schema.

Quoted 40 lines
doc/develop/devicetree/dt_non_compliant_purge.rst new file +39 -1
+
+Removing nodes/properties
+-------------------------
+
+In U-Boot, this is been done through adding information on such nodes
+and properties in a list. The entire node can be deleted, or a
+specific property under a node can be deleted. The list of such nodes
+and properties is generated at compile time, and the function to purge
+these can be invoked through a EVT_FT_FIXUP event notify call.
+
+For deleting a node, this can be done by declaring a macro::
+
+       DT_NON_COMPLIANT_PURGE(fwu_mdata) = {
+               .node_path      = "/fwu-mdata",
+       };
+
+Similarly, for deleting a property under a node, that can be done by
+specifying the property name::
+
+       DT_NON_COMPLIANT_PURGE(capsule_key) = {
+               .node_path      = "/signature",
+               .prop           = "capsule-key",
+       };
+
+In the first example, the entire node with path /fwu-mdata will be
+removed. In the second example, the property capsule-key
+under /signature node will be removed.
+
+Similarly, a list of nodes and properties can be specified using the
+following macro::
+
+       DT_NON_COMPLIANT_PURGE_LIST(foo) = {
+               { .node_path = "/some_node", .prop = "some_bar" },
+               { .node_path = "/some_node" },
+       };
+
+[1] - https://github.com/devicetree-org/dt-schema
+[2] - https://www.arm.com/architecture/system-architectures/systemready-certification-program
+[3] - https://lore.kernel.org/u-boot/CAL_JsqJN4FeHomL7z3yj0WJ9bpx1oSE7zf26L_GV2oS6cg-5qg@mail.gmail.com/
--
Quoted 2 lines

2.34.1

Regards,
Simon

#18 lore raw

Re: [RFC PATCH 5/5] doc: Add a document for non-compliant DT node/property removal

hi Simon,

Quoted 35 lines · Simon Glass

Hi Sughosh,

Quoted 17 lines · Sughosh Ganu

Add a document explaining the need for removal of non-compliant devicetree nodes and properties. Also describe in brief, the macros that can be used for this removal.

---
 .../devicetree/dt_non_compliant_purge.rst     | 64 +++++++++++++++++++
 1 file changed, 64 insertions(+)
 create mode 100644 doc/develop/devicetree/dt_non_compliant_purge.rst
doc/develop/devicetree/dt_non_compliant_purge.rst new file +0 -0
new file mode 100644
index 0000000000..c3a8feab5b

doc/develop/devicetree/dt_non_compliant_purge.rst line 10

Quoted 10 lines
doc/develop/devicetree/dt_non_compliant_purge.rst new file +10 -0
@@ -0,0 +1,64 @@
+.. SPDX-License-Identifier: GPL-2.0+
+
+Removal of non-compliant nodes and properties
+=============================================
+
+The devicetree used in U-Boot might contain nodes and properties which
+are specific only to U-Boot, and are not necessarily being used to
+describe hardware but to pass information to U-Boot. An example of
+such a property would be the public key being passed to U-Boot for
+verification.

It has nothing to do with describing hardware. The DT can describe other things too. See the /options node, for example.

Quoted 1 line

Please don't bring this highly misleading language into U-Boot.

Please point out what is misleading in the above paragraph. What is being emphasised in the above paragraph is that certain nodes and properties in the devicetree are relevant only in u-boot, and not the kernel. And this is precisely what the devicetree maintainers are saying [1].

Quoted 25 lines

doc/develop/devicetree/dt_non_compliant_purge.rst

Quoted 8 lines
doc/develop/devicetree/dt_non_compliant_purge.rst new file +7 -0
+
+This devicetree can then be passed to the OS. Since certain nodes and
+properties are not really describing hardware, and more importantly,
+these are only relevant to U-Boot, bindings for these cannot be
+upstreamed into the devicetree repository. There have been instances
+of attempts being made to upstream such bindings, and these deemed not
+fit for upstreaming.

Then either they should not be in U-Boot, or there is a problem with the process.

doc/develop/devicetree/dt_non_compliant_purge.rst line 25

Quoted 9 lines

Not having a binding for these nodes and

doc/develop/devicetree/dt_non_compliant_purge.rst new file +8 -0
+properties means that the devicetree fails the schema compliance tests
+[1]. This also means that the platform cannot get certifications like
+SystemReady [2] which, among other things require a devicetree which
+passes the schema compliance tests.
+
+For such nodes and properties, it has been suggested by the devicetree
+maintainers that the right thing to do is to remove them from the
+devicetree before it gets passed on to the OS [3].

Hard NAK. If we go this way, then no one will ever have an incentive to do the right thing.

Quoted 3 lines

Please send bindings for Linaro's work, instead. If something is entirely U-Boot-specific, then it can go in /options/u-boot but it still must be in the dt-schema.

Please re-read the document including the last link [1]. If you go through that entire thread, you will notice that this is precisely what Linaro was trying to do here -- upstream the binding for the fwu-mdata node. It is only based on the feedback of the devicetree maintainers that this patchset was required.

-sughosh

[1] - https://lore.kernel.org/u-boot/CAL_JsqJN4FeHomL7z3yj0WJ9bpx1oSE7zf26L_GV2oS6cg-5qg@mail.gmail.com/#t

Quoted 46 lines
Quoted 41 lines
doc/develop/devicetree/dt_non_compliant_purge.rst new file +39 -1
+
+Removing nodes/properties
+-------------------------
+
+In U-Boot, this is been done through adding information on such nodes
+and properties in a list. The entire node can be deleted, or a
+specific property under a node can be deleted. The list of such nodes
+and properties is generated at compile time, and the function to purge
+these can be invoked through a EVT_FT_FIXUP event notify call.
+
+For deleting a node, this can be done by declaring a macro::
+
+       DT_NON_COMPLIANT_PURGE(fwu_mdata) = {
+               .node_path      = "/fwu-mdata",
+       };
+
+Similarly, for deleting a property under a node, that can be done by
+specifying the property name::
+
+       DT_NON_COMPLIANT_PURGE(capsule_key) = {
+               .node_path      = "/signature",
+               .prop           = "capsule-key",
+       };
+
+In the first example, the entire node with path /fwu-mdata will be
+removed. In the second example, the property capsule-key
+under /signature node will be removed.
+
+Similarly, a list of nodes and properties can be specified using the
+following macro::
+
+       DT_NON_COMPLIANT_PURGE_LIST(foo) = {
+               { .node_path = "/some_node", .prop = "some_bar" },
+               { .node_path = "/some_node" },
+       };
+
+[1] - https://github.com/devicetree-org/dt-schema
+[2] - https://www.arm.com/architecture/system-architectures/systemready-certification-program
+[3] - https://lore.kernel.org/u-boot/CAL_JsqJN4FeHomL7z3yj0WJ9bpx1oSE7zf26L_GV2oS6cg-5qg@mail.gmail.com/
--
Quoted 2 lines

2.34.1

Regards,
Simon

#19 lore raw

Re: [RFC PATCH 5/5] doc: Add a document for non-compliant DT node/property removal

Quoted 81 lines · Sughosh Ganu

hi Simon,

Quoted 35 lines · Simon Glass

Hi Sughosh,

Quoted 17 lines · Sughosh Ganu

Add a document explaining the need for removal of non-compliant devicetree nodes and properties. Also describe in brief, the macros that can be used for this removal.

---
 .../devicetree/dt_non_compliant_purge.rst     | 64 +++++++++++++++++++
 1 file changed, 64 insertions(+)
 create mode 100644 doc/develop/devicetree/dt_non_compliant_purge.rst
doc/develop/devicetree/dt_non_compliant_purge.rst new file +0 -0
new file mode 100644
index 0000000000..c3a8feab5b

doc/develop/devicetree/dt_non_compliant_purge.rst line 10

Quoted 10 lines
doc/develop/devicetree/dt_non_compliant_purge.rst new file +10 -0
@@ -0,0 +1,64 @@
+.. SPDX-License-Identifier: GPL-2.0+
+
+Removal of non-compliant nodes and properties
+=============================================
+
+The devicetree used in U-Boot might contain nodes and properties which
+are specific only to U-Boot, and are not necessarily being used to
+describe hardware but to pass information to U-Boot. An example of
+such a property would be the public key being passed to U-Boot for
+verification.

It has nothing to do with describing hardware. The DT can describe other things too. See the /options node, for example.

Quoted 1 line

Please don't bring this highly misleading language into U-Boot.

Please point out what is misleading in the above paragraph. What is being emphasised in the above paragraph is that certain nodes and properties in the devicetree are relevant only in u-boot, and not the kernel. And this is precisely what the devicetree maintainers are saying [1].

Quoted 25 lines

doc/develop/devicetree/dt_non_compliant_purge.rst

Quoted 8 lines
doc/develop/devicetree/dt_non_compliant_purge.rst new file +7 -0
+
+This devicetree can then be passed to the OS. Since certain nodes and
+properties are not really describing hardware, and more importantly,
+these are only relevant to U-Boot, bindings for these cannot be
+upstreamed into the devicetree repository. There have been instances
+of attempts being made to upstream such bindings, and these deemed not
+fit for upstreaming.

Then either they should not be in U-Boot, or there is a problem with the process.

doc/develop/devicetree/dt_non_compliant_purge.rst line 25

Quoted 9 lines

Not having a binding for these nodes and

doc/develop/devicetree/dt_non_compliant_purge.rst new file +8 -0
+properties means that the devicetree fails the schema compliance tests
+[1]. This also means that the platform cannot get certifications like
+SystemReady [2] which, among other things require a devicetree which
+passes the schema compliance tests.
+
+For such nodes and properties, it has been suggested by the devicetree
+maintainers that the right thing to do is to remove them from the
+devicetree before it gets passed on to the OS [3].

Hard NAK. If we go this way, then no one will ever have an incentive to do the right thing.

Quoted 3 lines

Please send bindings for Linaro's work, instead. If something is entirely U-Boot-specific, then it can go in /options/u-boot but it still must be in the dt-schema.

Please re-read the document including the last link [1]. If you go through that entire thread, you will notice that this is precisely what Linaro was trying to do here -- upstream the binding for the fwu-mdata node. It is only based on the feedback of the devicetree maintainers that this patchset was required.

Quoted 3 lines

-sughosh

[1] - https://lore.kernel.org/u-boot/CAL_JsqJN4FeHomL7z3yj0WJ9bpx1oSE7zf26L_GV2oS6cg-5qg@mail.gmail.com/#t

Please note that this right here, that the explanation of why we need to delete this node, not being a bright shiny visible object is one of the big problems with this patchset and implementation. It cannot be footnotes in email threads as to why such-and-such node/property isn't upstream, it needs to be documented and visible in the code base / documentation and an obvious you must do this for future cases.

Signature · 1 line
Tom
#20 lore raw

Re: [RFC PATCH 5/5] doc: Add a document for non-compliant DT node/property removal

Hi Tom

Quoted 85 lines · Tom Rini
Quoted 83 lines · Sughosh Ganu

hi Simon,

Quoted 35 lines · Simon Glass

Hi Sughosh,

Quoted 17 lines · Sughosh Ganu

Add a document explaining the need for removal of non-compliant devicetree nodes and properties. Also describe in brief, the macros that can be used for this removal.

---
 .../devicetree/dt_non_compliant_purge.rst     | 64 +++++++++++++++++++
 1 file changed, 64 insertions(+)
 create mode 100644 doc/develop/devicetree/dt_non_compliant_purge.rst
doc/develop/devicetree/dt_non_compliant_purge.rst new file +0 -0
new file mode 100644
index 0000000000..c3a8feab5b

doc/develop/devicetree/dt_non_compliant_purge.rst line 10

Quoted 10 lines
doc/develop/devicetree/dt_non_compliant_purge.rst new file +10 -0
@@ -0,0 +1,64 @@
+.. SPDX-License-Identifier: GPL-2.0+
+
+Removal of non-compliant nodes and properties
+=============================================
+
+The devicetree used in U-Boot might contain nodes and properties which
+are specific only to U-Boot, and are not necessarily being used to
+describe hardware but to pass information to U-Boot. An example of
+such a property would be the public key being passed to U-Boot for
+verification.

It has nothing to do with describing hardware. The DT can describe other things too. See the /options node, for example.

Quoted 1 line

Please don't bring this highly misleading language into U-Boot.

Please point out what is misleading in the above paragraph. What is being emphasised in the above paragraph is that certain nodes and properties in the devicetree are relevant only in u-boot, and not the kernel. And this is precisely what the devicetree maintainers are saying [1].

Quoted 25 lines

doc/develop/devicetree/dt_non_compliant_purge.rst

Quoted 8 lines
doc/develop/devicetree/dt_non_compliant_purge.rst new file +7 -0
+
+This devicetree can then be passed to the OS. Since certain nodes and
+properties are not really describing hardware, and more importantly,
+these are only relevant to U-Boot, bindings for these cannot be
+upstreamed into the devicetree repository. There have been instances
+of attempts being made to upstream such bindings, and these deemed not
+fit for upstreaming.

Then either they should not be in U-Boot, or there is a problem with the process.

doc/develop/devicetree/dt_non_compliant_purge.rst line 25

Quoted 9 lines

Not having a binding for these nodes and

doc/develop/devicetree/dt_non_compliant_purge.rst new file +8 -0
+properties means that the devicetree fails the schema compliance tests
+[1]. This also means that the platform cannot get certifications like
+SystemReady [2] which, among other things require a devicetree which
+passes the schema compliance tests.
+
+For such nodes and properties, it has been suggested by the devicetree
+maintainers that the right thing to do is to remove them from the
+devicetree before it gets passed on to the OS [3].

Hard NAK. If we go this way, then no one will ever have an incentive to do the right thing.

Quoted 3 lines

Please send bindings for Linaro's work, instead. If something is entirely U-Boot-specific, then it can go in /options/u-boot but it still must be in the dt-schema.

Please re-read the document including the last link [1]. If you go through that entire thread, you will notice that this is precisely what Linaro was trying to do here -- upstream the binding for the fwu-mdata node. It is only based on the feedback of the devicetree maintainers that this patchset was required.

-sughosh

Quoted 8 lines
Quoted 1 line

[1] - https://lore.kernel.org/u-boot/CAL_JsqJN4FeHomL7z3yj0WJ9bpx1oSE7zf26L_GV2oS6cg-5qg@mail.gmail.com/#t

Please note that this right here, that the explanation of why we need to delete this node, not being a bright shiny visible object is one of the big problems with this patchset and implementation. It cannot be footnotes in email threads as to why such-and-such node/property isn't upstream, it needs to be documented and visible in the code base / documentation and an obvious you must do this for future cases.

I thought we agreed that deleting nodes that won't be accepted upstream is the right approach since that would break the systemready 2.0 compatibility.

Yes, it can't be footnotes or hidden links, but this is totally different than what I am reading on this thread.

Thanks
/Ilias

Quoted 3 lines

--
Tom

#21 lore raw

Re: [RFC PATCH 5/5] doc: Add a document for non-compliant DT node/property removal

Quoted 97 lines · Ilias Apalodimas

Hi Tom

Quoted 85 lines · Tom Rini
Quoted 83 lines · Sughosh Ganu

hi Simon,

Quoted 35 lines · Simon Glass

Hi Sughosh,

Quoted 17 lines · Sughosh Ganu

Add a document explaining the need for removal of non-compliant devicetree nodes and properties. Also describe in brief, the macros that can be used for this removal.

---
 .../devicetree/dt_non_compliant_purge.rst     | 64 +++++++++++++++++++
 1 file changed, 64 insertions(+)
 create mode 100644 doc/develop/devicetree/dt_non_compliant_purge.rst
doc/develop/devicetree/dt_non_compliant_purge.rst new file +0 -0
new file mode 100644
index 0000000000..c3a8feab5b

doc/develop/devicetree/dt_non_compliant_purge.rst line 10

Quoted 10 lines
doc/develop/devicetree/dt_non_compliant_purge.rst new file +10 -0
@@ -0,0 +1,64 @@
+.. SPDX-License-Identifier: GPL-2.0+
+
+Removal of non-compliant nodes and properties
+=============================================
+
+The devicetree used in U-Boot might contain nodes and properties which
+are specific only to U-Boot, and are not necessarily being used to
+describe hardware but to pass information to U-Boot. An example of
+such a property would be the public key being passed to U-Boot for
+verification.

It has nothing to do with describing hardware. The DT can describe other things too. See the /options node, for example.

Quoted 1 line

Please don't bring this highly misleading language into U-Boot.

Please point out what is misleading in the above paragraph. What is being emphasised in the above paragraph is that certain nodes and properties in the devicetree are relevant only in u-boot, and not the kernel. And this is precisely what the devicetree maintainers are saying [1].

Quoted 25 lines

doc/develop/devicetree/dt_non_compliant_purge.rst

Quoted 8 lines
doc/develop/devicetree/dt_non_compliant_purge.rst new file +7 -0
+
+This devicetree can then be passed to the OS. Since certain nodes and
+properties are not really describing hardware, and more importantly,
+these are only relevant to U-Boot, bindings for these cannot be
+upstreamed into the devicetree repository. There have been instances
+of attempts being made to upstream such bindings, and these deemed not
+fit for upstreaming.

Then either they should not be in U-Boot, or there is a problem with the process.

doc/develop/devicetree/dt_non_compliant_purge.rst line 25

Quoted 9 lines

Not having a binding for these nodes and

doc/develop/devicetree/dt_non_compliant_purge.rst new file +8 -0
+properties means that the devicetree fails the schema compliance tests
+[1]. This also means that the platform cannot get certifications like
+SystemReady [2] which, among other things require a devicetree which
+passes the schema compliance tests.
+
+For such nodes and properties, it has been suggested by the devicetree
+maintainers that the right thing to do is to remove them from the
+devicetree before it gets passed on to the OS [3].

Hard NAK. If we go this way, then no one will ever have an incentive to do the right thing.

Quoted 3 lines

Please send bindings for Linaro's work, instead. If something is entirely U-Boot-specific, then it can go in /options/u-boot but it still must be in the dt-schema.

Please re-read the document including the last link [1]. If you go through that entire thread, you will notice that this is precisely what Linaro was trying to do here -- upstream the binding for the fwu-mdata node. It is only based on the feedback of the devicetree maintainers that this patchset was required.

-sughosh

Quoted 8 lines
Quoted 1 line

[1] - https://lore.kernel.org/u-boot/CAL_JsqJN4FeHomL7z3yj0WJ9bpx1oSE7zf26L_GV2oS6cg-5qg@mail.gmail.com/#t

Please note that this right here, that the explanation of why we need to delete this node, not being a bright shiny visible object is one of the big problems with this patchset and implementation. It cannot be footnotes in email threads as to why such-and-such node/property isn't upstream, it needs to be documented and visible in the code base / documentation and an obvious you must do this for future cases.

Quoted 6 lines

I thought we agreed that deleting nodes that won't be accepted upstream is the right approach since that would break the systemready 2.0 compatibility.

Yes, it can't be footnotes or hidden links, but this is totally different than what I am reading on this thread.

An issue is that the functionality got posted without clear links as to why the initial nodes to be deleted had been rejected, in the patchset itself (and so not preserved long term). Being able to show that yes, really, it was attempted to upstream the nodes, and not "delete first upstream later (never)" is critical.

Signature · 1 line
Tom
#22 lore raw

Re: [RFC PATCH 5/5] doc: Add a document for non-compliant DT node/property removal

In reply to Ilias Apalodimas

Hi Ilias,

Quoted 98 lines · Ilias Apalodimas

Hi Tom

Quoted 85 lines · Tom Rini
Quoted 83 lines · Sughosh Ganu

hi Simon,

Quoted 35 lines · Simon Glass

Hi Sughosh,

Quoted 17 lines · Sughosh Ganu

Add a document explaining the need for removal of non-compliant devicetree nodes and properties. Also describe in brief, the macros that can be used for this removal.

---
 .../devicetree/dt_non_compliant_purge.rst     | 64 +++++++++++++++++++
 1 file changed, 64 insertions(+)
 create mode 100644 doc/develop/devicetree/dt_non_compliant_purge.rst
doc/develop/devicetree/dt_non_compliant_purge.rst new file +0 -0
new file mode 100644
index 0000000000..c3a8feab5b

doc/develop/devicetree/dt_non_compliant_purge.rst line 10

Quoted 10 lines
doc/develop/devicetree/dt_non_compliant_purge.rst new file +10 -0
@@ -0,0 +1,64 @@
+.. SPDX-License-Identifier: GPL-2.0+
+
+Removal of non-compliant nodes and properties
+=============================================
+
+The devicetree used in U-Boot might contain nodes and properties which
+are specific only to U-Boot, and are not necessarily being used to
+describe hardware but to pass information to U-Boot. An example of
+such a property would be the public key being passed to U-Boot for
+verification.

It has nothing to do with describing hardware. The DT can describe other things too. See the /options node, for example.

Quoted 1 line

Please don't bring this highly misleading language into U-Boot.

Please point out what is misleading in the above paragraph. What is being emphasised in the above paragraph is that certain nodes and properties in the devicetree are relevant only in u-boot, and not the kernel. And this is precisely what the devicetree maintainers are saying [1].

Quoted 25 lines

doc/develop/devicetree/dt_non_compliant_purge.rst

Quoted 8 lines
doc/develop/devicetree/dt_non_compliant_purge.rst new file +7 -0
+
+This devicetree can then be passed to the OS. Since certain nodes and
+properties are not really describing hardware, and more importantly,
+these are only relevant to U-Boot, bindings for these cannot be
+upstreamed into the devicetree repository. There have been instances
+of attempts being made to upstream such bindings, and these deemed not
+fit for upstreaming.

Then either they should not be in U-Boot, or there is a problem with the process.

doc/develop/devicetree/dt_non_compliant_purge.rst line 25

Quoted 9 lines

Not having a binding for these nodes and

doc/develop/devicetree/dt_non_compliant_purge.rst new file +8 -0
+properties means that the devicetree fails the schema compliance tests
+[1]. This also means that the platform cannot get certifications like
+SystemReady [2] which, among other things require a devicetree which
+passes the schema compliance tests.
+
+For such nodes and properties, it has been suggested by the devicetree
+maintainers that the right thing to do is to remove them from the
+devicetree before it gets passed on to the OS [3].

Hard NAK. If we go this way, then no one will ever have an incentive to do the right thing.

Quoted 3 lines

Please send bindings for Linaro's work, instead. If something is entirely U-Boot-specific, then it can go in /options/u-boot but it still must be in the dt-schema.

Please re-read the document including the last link [1]. If you go through that entire thread, you will notice that this is precisely what Linaro was trying to do here -- upstream the binding for the fwu-mdata node. It is only based on the feedback of the devicetree maintainers that this patchset was required.

-sughosh

Quoted 8 lines
Quoted 1 line

[1] - https://lore.kernel.org/u-boot/CAL_JsqJN4FeHomL7z3yj0WJ9bpx1oSE7zf26L_GV2oS6cg-5qg@mail.gmail.com/#t

Please note that this right here, that the explanation of why we need to delete this node, not being a bright shiny visible object is one of the big problems with this patchset and implementation. It cannot be footnotes in email threads as to why such-and-such node/property isn't upstream, it needs to be documented and visible in the code base / documentation and an obvious you must do this for future cases.

Quoted 3 lines

I thought we agreed that deleting nodes that won't be accepted upstream is the right approach since that would break the systemready 2.0 compatibility.

Isn't that controlled by ARM/Linaros, as are the devicetree bindings? What am I missing? Let's just fix the bindings so they can be accepted. What we decide here will have enormous repercussions in the future. SoC vendors are watching to see whether they should bother to upstream bindings or not.

Quoted 3 lines

Yes, it can't be footnotes or hidden links, but this is totally different than what I am reading on this thread.

Regards,
Simon

#23 lore raw

Re: [RFC PATCH 5/5] doc: Add a document for non-compliant DT node/property removal

Hi Simon,

Quoted 11 lines · Simon Glass

Hi Ilias,

Quoted 6 lines · Ilias Apalodimas

Hi Tom

Quoted 2 lines · Tom Rini

On Tue, Aug 29, 2023 at 12:04:53AM +0530, Sughosh Ganu wrote:

[...]

Quoted 18 lines
Quoted 18 lines
Quoted 17 lines
Quoted 10 lines

Please re-read the document including the last link [1]. If you go through that entire thread, you will notice that this is precisely what Linaro was trying to do here -- upstream the binding for the fwu-mdata node. It is only based on the feedback of the devicetree maintainers that this patchset was required.

-sughosh

[1] - https://lore.kernel.org/u-boot/CAL_JsqJN4FeHomL7z3yj0WJ9bpx1oSE7zf26L_GV2oS6cg-5qg@mail.gmail.com/#t

Please note that this right here, that the explanation of why we need to delete this node, not being a bright shiny visible object is one of the big problems with this patchset and implementation. It cannot be footnotes in email threads as to why such-and-such node/property isn't upstream, it needs to be documented and visible in the code base / documentation and an obvious you must do this for future cases.

Quoted 5 lines
Quoted 3 lines

I thought we agreed that deleting nodes that won't be accepted upstream is the right approach since that would break the systemready 2.0 compatibility.

Isn't that controlled by ARM/Linaros, as are the devicetree bindings?

The device tree validation happens through the dt schema validation. You can read a bit more here [0]

Quoted 2 lines

What am I missing? Let's just fix the bindings so they can be accepted.

I can go through the mailing lists, but I am pretty sure you've been trying to do this for a number of years and got pushback for many of those bindings. Has that changed? Can you guarantee to all the vendors that all the bindings will get merged and they won't have a problem getting their boards certified?

Quoted 3 lines

What we decide here will have enormous repercussions in the future. SoC vendors are watching to see whether they should bother to upstream bindings or not.

How is that remotely relevant to the discussion we have here? If it's hardware that the OS has to use they *will* have to upstream it, otherwise their device won't work with upstream kernels (not that they care, I am just pointing it out). If it's an internal thing they need to perform an X action in U-Boot and the OS has no interest in that property (e.g. the driver model nodes), they can just get rid of it.

Quoted 7 lines
Quoted 4 lines

Yes, it can't be footnotes or hidden links, but this is totally different than what I am reading on this thread.

Regards,
Simon

[0] https://www.linaro.org/blog/tips-and-tricks-for-validating-devicetree-sources-with-the-devicetree-schema/

Thanks
/Ilias

#24 lore raw

Re: [RFC PATCH 5/5] doc: Add a document for non-compliant DT node/property removal

Quoted 44 lines · Ilias Apalodimas

Hi Simon,

Quoted 11 lines · Simon Glass

Hi Ilias,

Quoted 6 lines · Ilias Apalodimas

Hi Tom

Quoted 2 lines · Tom Rini

On Tue, Aug 29, 2023 at 12:04:53AM +0530, Sughosh Ganu wrote:

[...]

Quoted 18 lines
Quoted 18 lines
Quoted 17 lines
Quoted 10 lines

Please re-read the document including the last link [1]. If you go through that entire thread, you will notice that this is precisely what Linaro was trying to do here -- upstream the binding for the fwu-mdata node. It is only based on the feedback of the devicetree maintainers that this patchset was required.

-sughosh

[1] - https://lore.kernel.org/u-boot/CAL_JsqJN4FeHomL7z3yj0WJ9bpx1oSE7zf26L_GV2oS6cg-5qg@mail.gmail.com/#t

Please note that this right here, that the explanation of why we need to delete this node, not being a bright shiny visible object is one of the big problems with this patchset and implementation. It cannot be footnotes in email threads as to why such-and-such node/property isn't upstream, it needs to be documented and visible in the code base / documentation and an obvious you must do this for future cases.

Quoted 5 lines
Quoted 3 lines

I thought we agreed that deleting nodes that won't be accepted upstream is the right approach since that would break the systemready 2.0 compatibility.

Isn't that controlled by ARM/Linaros, as are the devicetree bindings?

The device tree validation happens through the dt schema validation. You can read a bit more here [0]

Quoted 6 lines
Quoted 2 lines

What am I missing? Let's just fix the bindings so they can be accepted.

I can go through the mailing lists, but I am pretty sure you've been trying to do this for a number of years and got pushback for many of those bindings. Has that changed?

Yes, yes it has changed. It has changed for the better, and we're all working together to get things accepted. Hence Simon's big concern that adding the framework to delete things from the tree easily will cause people to stop trying.

Quoted 3 lines

Can you guarantee to all the
vendors that all the bindings will get merged and they won't have a problem getting their boards certified?

It certainly seems that, ahem, no reasonable binding will be refused.

Signature · 1 line
Tom
#25 lore raw

Re: [RFC PATCH 5/5] doc: Add a document for non-compliant DT node/property removal

In reply to Sughosh Ganu

Hi Sughosh,

Quoted 39 lines · Sughosh Ganu

hi Simon,

Quoted 35 lines · Simon Glass

Hi Sughosh,

Quoted 17 lines · Sughosh Ganu

Add a document explaining the need for removal of non-compliant devicetree nodes and properties. Also describe in brief, the macros that can be used for this removal.

---
 .../devicetree/dt_non_compliant_purge.rst     | 64 +++++++++++++++++++
 1 file changed, 64 insertions(+)
 create mode 100644 doc/develop/devicetree/dt_non_compliant_purge.rst
doc/develop/devicetree/dt_non_compliant_purge.rst new file +0 -0
new file mode 100644
index 0000000000..c3a8feab5b

doc/develop/devicetree/dt_non_compliant_purge.rst line 10

Quoted 10 lines
doc/develop/devicetree/dt_non_compliant_purge.rst new file +10 -0
@@ -0,0 +1,64 @@
+.. SPDX-License-Identifier: GPL-2.0+
+
+Removal of non-compliant nodes and properties
+=============================================
+
+The devicetree used in U-Boot might contain nodes and properties which
+are specific only to U-Boot, and are not necessarily being used to
+describe hardware but to pass information to U-Boot. An example of
+such a property would be the public key being passed to U-Boot for
+verification.

It has nothing to do with describing hardware. The DT can describe other things too. See the /options node, for example.

Quoted 7 lines
Quoted 1 line

Please don't bring this highly misleading language into U-Boot.

Please point out what is misleading in the above paragraph. What is being emphasised in the above paragraph is that certain nodes and properties in the devicetree are relevant only in u-boot, and not the kernel. And this is precisely what the devicetree maintainers are saying [1].

That is not relevant though...we need to make sure all the nodes are in the dt schema.

It is misleading because you imply that DT should only describe hardware. That is not true.

Quoted 30 lines
Quoted 26 lines

doc/develop/devicetree/dt_non_compliant_purge.rst

Quoted 9 lines
doc/develop/devicetree/dt_non_compliant_purge.rst new file +7 -0
+
+This devicetree can then be passed to the OS. Since certain nodes and
+properties are not really describing hardware, and more importantly,
+these are only relevant to U-Boot, bindings for these cannot be
+upstreamed into the devicetree repository. There have been instances
+of attempts being made to upstream such bindings, and these deemed not
+fit for upstreaming.

Then either they should not be in U-Boot, or there is a problem with the process.

doc/develop/devicetree/dt_non_compliant_purge.rst line 25

Quoted 9 lines

Not having a binding for these nodes and

doc/develop/devicetree/dt_non_compliant_purge.rst new file +8 -0
+properties means that the devicetree fails the schema compliance tests
+[1]. This also means that the platform cannot get certifications like
+SystemReady [2] which, among other things require a devicetree which
+passes the schema compliance tests.
+
+For such nodes and properties, it has been suggested by the devicetree
+maintainers that the right thing to do is to remove them from the
+devicetree before it gets passed on to the OS [3].

Hard NAK. If we go this way, then no one will ever have an incentive to do the right thing.

Quoted 3 lines

Please send bindings for Linaro's work, instead. If something is entirely U-Boot-specific, then it can go in /options/u-boot but it still must be in the dt-schema.

Quoted 5 lines

Please re-read the document including the last link [1]. If you go through that entire thread, you will notice that this is precisely what Linaro was trying to do here -- upstream the binding for the fwu-mdata node. It is only based on the feedback of the devicetree maintainers that this patchset was required.

It looks like it should go in /options/u-boot ? Can you resubmit it there?

The stripping is a no-go for me, sorry. It is absolutely going to destroy any chance of tidying up DT in U-Boot.

Please also figure out how to add DT validation to U-Boot, so we can see what the gap is. Once we have that in, I will be happier to do workarounds.

Regards,
Simon

Quoted 51 lines

-sughosh

[1] - https://lore.kernel.org/u-boot/CAL_JsqJN4FeHomL7z3yj0WJ9bpx1oSE7zf26L_GV2oS6cg-5qg@mail.gmail.com/#t

Quoted 46 lines
Quoted 41 lines
doc/develop/devicetree/dt_non_compliant_purge.rst new file +39 -1
+
+Removing nodes/properties
+-------------------------
+
+In U-Boot, this is been done through adding information on such nodes
+and properties in a list. The entire node can be deleted, or a
+specific property under a node can be deleted. The list of such nodes
+and properties is generated at compile time, and the function to purge
+these can be invoked through a EVT_FT_FIXUP event notify call.
+
+For deleting a node, this can be done by declaring a macro::
+
+       DT_NON_COMPLIANT_PURGE(fwu_mdata) = {
+               .node_path      = "/fwu-mdata",
+       };
+
+Similarly, for deleting a property under a node, that can be done by
+specifying the property name::
+
+       DT_NON_COMPLIANT_PURGE(capsule_key) = {
+               .node_path      = "/signature",
+               .prop           = "capsule-key",
+       };
+
+In the first example, the entire node with path /fwu-mdata will be
+removed. In the second example, the property capsule-key
+under /signature node will be removed.
+
+Similarly, a list of nodes and properties can be specified using the
+following macro::
+
+       DT_NON_COMPLIANT_PURGE_LIST(foo) = {
+               { .node_path = "/some_node", .prop = "some_bar" },
+               { .node_path = "/some_node" },
+       };
+
+[1] - https://github.com/devicetree-org/dt-schema
+[2] - https://www.arm.com/architecture/system-architectures/systemready-certification-program
+[3] - https://lore.kernel.org/u-boot/CAL_JsqJN4FeHomL7z3yj0WJ9bpx1oSE7zf26L_GV2oS6cg-5qg@mail.gmail.com/
--
Quoted 2 lines

2.34.1

Regards,
Simon

#26 lore raw

Re: [RFC PATCH 5/5] doc: Add a document for non-compliant DT node/property removal

hi Simon,

Quoted 87 lines · Simon Glass

Hi Sughosh,

Quoted 39 lines · Sughosh Ganu

hi Simon,

Quoted 35 lines · Simon Glass

Hi Sughosh,

Quoted 17 lines · Sughosh Ganu

Add a document explaining the need for removal of non-compliant devicetree nodes and properties. Also describe in brief, the macros that can be used for this removal.

---
 .../devicetree/dt_non_compliant_purge.rst     | 64 +++++++++++++++++++
 1 file changed, 64 insertions(+)
 create mode 100644 doc/develop/devicetree/dt_non_compliant_purge.rst
doc/develop/devicetree/dt_non_compliant_purge.rst new file +0 -0
new file mode 100644
index 0000000000..c3a8feab5b

doc/develop/devicetree/dt_non_compliant_purge.rst line 10

Quoted 10 lines
doc/develop/devicetree/dt_non_compliant_purge.rst new file +10 -0
@@ -0,0 +1,64 @@
+.. SPDX-License-Identifier: GPL-2.0+
+
+Removal of non-compliant nodes and properties
+=============================================
+
+The devicetree used in U-Boot might contain nodes and properties which
+are specific only to U-Boot, and are not necessarily being used to
+describe hardware but to pass information to U-Boot. An example of
+such a property would be the public key being passed to U-Boot for
+verification.

It has nothing to do with describing hardware. The DT can describe other things too. See the /options node, for example.

Quoted 7 lines
Quoted 1 line

Please don't bring this highly misleading language into U-Boot.

Please point out what is misleading in the above paragraph. What is being emphasised in the above paragraph is that certain nodes and properties in the devicetree are relevant only in u-boot, and not the kernel. And this is precisely what the devicetree maintainers are saying [1].

That is not relevant though...we need to make sure all the nodes are in the dt schema.

It is misleading because you imply that DT should only describe hardware. That is not true.

Quoted 30 lines
Quoted 29 lines

doc/develop/devicetree/dt_non_compliant_purge.rst

Quoted 9 lines
doc/develop/devicetree/dt_non_compliant_purge.rst new file +7 -0
+
+This devicetree can then be passed to the OS. Since certain nodes and
+properties are not really describing hardware, and more importantly,
+these are only relevant to U-Boot, bindings for these cannot be
+upstreamed into the devicetree repository. There have been instances
+of attempts being made to upstream such bindings, and these deemed not
+fit for upstreaming.

Then either they should not be in U-Boot, or there is a problem with the process.

doc/develop/devicetree/dt_non_compliant_purge.rst line 25

Quoted 9 lines

Not having a binding for these nodes and

doc/develop/devicetree/dt_non_compliant_purge.rst new file +8 -0
+properties means that the devicetree fails the schema compliance tests
+[1]. This also means that the platform cannot get certifications like
+SystemReady [2] which, among other things require a devicetree which
+passes the schema compliance tests.
+
+For such nodes and properties, it has been suggested by the devicetree
+maintainers that the right thing to do is to remove them from the
+devicetree before it gets passed on to the OS [3].

Hard NAK. If we go this way, then no one will ever have an incentive to do the right thing.

Please send bindings for Linaro's work, instead. If something is entirely U-Boot-specific, then it can go in /options/u-boot but it still must be in the dt-schema.

Quoted 7 lines
Quoted 5 lines

Please re-read the document including the last link [1]. If you go through that entire thread, you will notice that this is precisely what Linaro was trying to do here -- upstream the binding for the fwu-mdata node. It is only based on the feedback of the devicetree maintainers that this patchset was required.

It looks like it should go in /options/u-boot ? Can you resubmit it there?

Okay. I will try this approach. If I face any hurdles, or the devicetree maintainers have a different take on this, I will let you know.

-sughosh

Quoted 62 lines

The stripping is a no-go for me, sorry. It is absolutely going to destroy any chance of tidying up DT in U-Boot.

Please also figure out how to add DT validation to U-Boot, so we can see what the gap is. Once we have that in, I will be happier to do workarounds.

Regards,
Simon

Quoted 51 lines

-sughosh

[1] - https://lore.kernel.org/u-boot/CAL_JsqJN4FeHomL7z3yj0WJ9bpx1oSE7zf26L_GV2oS6cg-5qg@mail.gmail.com/#t

Quoted 46 lines
Quoted 41 lines
doc/develop/devicetree/dt_non_compliant_purge.rst new file +39 -1
+
+Removing nodes/properties
+-------------------------
+
+In U-Boot, this is been done through adding information on such nodes
+and properties in a list. The entire node can be deleted, or a
+specific property under a node can be deleted. The list of such nodes
+and properties is generated at compile time, and the function to purge
+these can be invoked through a EVT_FT_FIXUP event notify call.
+
+For deleting a node, this can be done by declaring a macro::
+
+       DT_NON_COMPLIANT_PURGE(fwu_mdata) = {
+               .node_path      = "/fwu-mdata",
+       };
+
+Similarly, for deleting a property under a node, that can be done by
+specifying the property name::
+
+       DT_NON_COMPLIANT_PURGE(capsule_key) = {
+               .node_path      = "/signature",
+               .prop           = "capsule-key",
+       };
+
+In the first example, the entire node with path /fwu-mdata will be
+removed. In the second example, the property capsule-key
+under /signature node will be removed.
+
+Similarly, a list of nodes and properties can be specified using the
+following macro::
+
+       DT_NON_COMPLIANT_PURGE_LIST(foo) = {
+               { .node_path = "/some_node", .prop = "some_bar" },
+               { .node_path = "/some_node" },
+       };
+
+[1] - https://github.com/devicetree-org/dt-schema
+[2] - https://www.arm.com/architecture/system-architectures/systemready-certification-program
+[3] - https://lore.kernel.org/u-boot/CAL_JsqJN4FeHomL7z3yj0WJ9bpx1oSE7zf26L_GV2oS6cg-5qg@mail.gmail.com/
--
Quoted 2 lines

2.34.1

Regards,
Simon

#27 lore raw
In reply to Sughosh Ganu
Quoted 8 lines · Sughosh Ganu

Provide a way for removing certain devicetree nodes and/or properties from the devicetree. This is needed to purge certain nodes and properties which may be relevant only in U-Boot. Such nodes and properties are then removed from the devicetree before it is passed to the kernel. This ensures that the devicetree passed to the OS does not contain any non-compliant nodes and properties.

Quoted 6 lines

The removal of the nodes and properties is being done through an EVT_FT_FIXUP handler. I am not sure if the removal code needs to be behind any Kconfig symbol.

I have only build tested this on sandbox, and tested on qemu arm64 virt platform. This being a RFC, I have not put this through a CI run.

We should have a test for the new functionality. E.g. add some superfluous properties and nodes to arch/sandbox/dts/test.dts, delete them via the DT_PURGE macro, and check that the device-tree passed to an EFI binary does not contain these properties and nodes.

Best regards

Heinrich

Quoted 19 lines

Sughosh Ganu (5):
dt: Provide a way to remove non-compliant nodes and properties
fwu: Add the fwu-mdata node for removal from devicetree
capsule: Add the capsule-key property for removal from devicetree
bootefi: Call the EVT_FT_FIXUP event handler
doc: Add a document for non-compliant DT node/property removal

  cmd/bootefi.c                                 | 18 +++++
  .../devicetree/dt_non_compliant_purge.rst     | 64 ++++++++++++++++
  drivers/fwu-mdata/fwu-mdata-uclass.c          |  5 ++
  include/dt-structs.h                          | 11 +++
  lib/Makefile                                  |  1 +
  lib/dt_purge.c                                | 73 +++++++++++++++++++
  lib/efi_loader/efi_capsule.c                  |  7 ++
  7 files changed, 179 insertions(+)

create mode 100644 doc/develop/devicetree/dt_non_compliant_purge.rst create mode 100644 lib/dt_purge.c

#28 lore raw
Quoted 14 lines · Heinrich Schuchardt
Quoted 12 lines · Sughosh Ganu

Provide a way for removing certain devicetree nodes and/or properties from the devicetree. This is needed to purge certain nodes and properties which may be relevant only in U-Boot. Such nodes and properties are then removed from the devicetree before it is passed to the kernel. This ensures that the devicetree passed to the OS does not contain any non-compliant nodes and properties.

The removal of the nodes and properties is being done through an EVT_FT_FIXUP handler. I am not sure if the removal code needs to be behind any Kconfig symbol.

Quoted 7 lines
Quoted 2 lines

I have only build tested this on sandbox, and tested on qemu arm64 virt platform. This being a RFC, I have not put this through a CI run.

We should have a test for the new functionality. E.g. add some superfluous properties and nodes to arch/sandbox/dts/test.dts, delete them via the DT_PURGE macro, and check that the device-tree passed to an EFI binary does not contain these properties and nodes.

Yes, I plan to have a test in the non-RFC version. I was thinking of adding a command and then using that to test the functionality.

-sughosh

Quoted 24 lines

Best regards

Heinrich

Quoted 19 lines

Sughosh Ganu (5):
dt: Provide a way to remove non-compliant nodes and properties
fwu: Add the fwu-mdata node for removal from devicetree
capsule: Add the capsule-key property for removal from devicetree
bootefi: Call the EVT_FT_FIXUP event handler
doc: Add a document for non-compliant DT node/property removal

  cmd/bootefi.c                                 | 18 +++++
  .../devicetree/dt_non_compliant_purge.rst     | 64 ++++++++++++++++
  drivers/fwu-mdata/fwu-mdata-uclass.c          |  5 ++
  include/dt-structs.h                          | 11 +++
  lib/Makefile                                  |  1 +
  lib/dt_purge.c                                | 73 +++++++++++++++++++
  lib/efi_loader/efi_capsule.c                  |  7 ++
  7 files changed, 179 insertions(+)

create mode 100644 doc/develop/devicetree/dt_non_compliant_purge.rst create mode 100644 lib/dt_purge.c

#29 lore raw
In reply to Sughosh Ganu

Hi,

Quoted 23 lines · Sughosh Ganu

Provide a way for removing certain devicetree nodes and/or properties from the devicetree. This is needed to purge certain nodes and properties which may be relevant only in U-Boot. Such nodes and properties are then removed from the devicetree before it is passed to the kernel. This ensures that the devicetree passed to the OS does not contain any non-compliant nodes and properties.

The removal of the nodes and properties is being done through an EVT_FT_FIXUP handler. I am not sure if the removal code needs to be behind any Kconfig symbol.

I have only build tested this on sandbox, and tested on qemu arm64 virt platform. This being a RFC, I have not put this through a CI run.

Sughosh Ganu (5):
dt: Provide a way to remove non-compliant nodes and properties
fwu: Add the fwu-mdata node for removal from devicetree
capsule: Add the capsule-key property for removal from devicetree
bootefi: Call the EVT_FT_FIXUP event handler
doc: Add a document for non-compliant DT node/property removal

Quoted 10 lines
 cmd/bootefi.c                                 | 18 +++++
 .../devicetree/dt_non_compliant_purge.rst     | 64 ++++++++++++++++
 drivers/fwu-mdata/fwu-mdata-uclass.c          |  5 ++
 include/dt-structs.h                          | 11 +++
 lib/Makefile                                  |  1 +
 lib/dt_purge.c                                | 73 +++++++++++++++++++
 lib/efi_loader/efi_capsule.c                  |  7 ++
 7 files changed, 179 insertions(+)
 create mode 100644 doc/develop/devicetree/dt_non_compliant_purge.rst
 create mode 100644 lib/dt_purge.c

What is the point of removing them? Instead, we should make sure that we upstream the bindings and encourage SoC vendors to sync them. If we remove them, no one will bother and U-Boot just becomes a dumping ground.

Instead of this, how about working on bringing the DT validation into U-Boot so we can see what state things are in?

Please send the bindings for Linaro's recent series (which I suspect are motivating this series) so we can start the process.

Regards,
Simon

#30 lore raw
Quoted 38 lines · Simon Glass

Hi,

Quoted 23 lines · Sughosh Ganu

Provide a way for removing certain devicetree nodes and/or properties from the devicetree. This is needed to purge certain nodes and properties which may be relevant only in U-Boot. Such nodes and properties are then removed from the devicetree before it is passed to the kernel. This ensures that the devicetree passed to the OS does not contain any non-compliant nodes and properties.

The removal of the nodes and properties is being done through an EVT_FT_FIXUP handler. I am not sure if the removal code needs to be behind any Kconfig symbol.

I have only build tested this on sandbox, and tested on qemu arm64 virt platform. This being a RFC, I have not put this through a CI run.

Sughosh Ganu (5):
dt: Provide a way to remove non-compliant nodes and properties
fwu: Add the fwu-mdata node for removal from devicetree
capsule: Add the capsule-key property for removal from devicetree
bootefi: Call the EVT_FT_FIXUP event handler
doc: Add a document for non-compliant DT node/property removal

Quoted 10 lines
 cmd/bootefi.c                                 | 18 +++++
 .../devicetree/dt_non_compliant_purge.rst     | 64 ++++++++++++++++
 drivers/fwu-mdata/fwu-mdata-uclass.c          |  5 ++
 include/dt-structs.h                          | 11 +++
 lib/Makefile                                  |  1 +
 lib/dt_purge.c                                | 73 +++++++++++++++++++
 lib/efi_loader/efi_capsule.c                  |  7 ++
 7 files changed, 179 insertions(+)
 create mode 100644 doc/develop/devicetree/dt_non_compliant_purge.rst
 create mode 100644 lib/dt_purge.c
Quoted 4 lines

What is the point of removing them? Instead, we should make sure that we upstream the bindings and encourage SoC vendors to sync them. If we remove them, no one will bother and U-Boot just becomes a dumping ground.

Well things like the binman entries in DT are U-Boot specific and not useful for HW related descriptions or for Linux or another OS being able to deal with HW so arguably we're already a dumping ground to some degree for not defining hardware.

Quoted 8 lines

Instead of this, how about working on bringing the DT validation into U-Boot so we can see what state things are in?

Please send the bindings for Linaro's recent series (which I suspect are motivating this series) so we can start the process.

Regards,
Simon

#31 lore raw
Quoted 44 lines · Peter Robinson
Quoted 38 lines · Simon Glass

Hi,

Quoted 23 lines · Sughosh Ganu

Provide a way for removing certain devicetree nodes and/or properties from the devicetree. This is needed to purge certain nodes and properties which may be relevant only in U-Boot. Such nodes and properties are then removed from the devicetree before it is passed to the kernel. This ensures that the devicetree passed to the OS does not contain any non-compliant nodes and properties.

The removal of the nodes and properties is being done through an EVT_FT_FIXUP handler. I am not sure if the removal code needs to be behind any Kconfig symbol.

I have only build tested this on sandbox, and tested on qemu arm64 virt platform. This being a RFC, I have not put this through a CI run.

Sughosh Ganu (5):
dt: Provide a way to remove non-compliant nodes and properties
fwu: Add the fwu-mdata node for removal from devicetree
capsule: Add the capsule-key property for removal from devicetree
bootefi: Call the EVT_FT_FIXUP event handler
doc: Add a document for non-compliant DT node/property removal

Quoted 10 lines
 cmd/bootefi.c                                 | 18 +++++
 .../devicetree/dt_non_compliant_purge.rst     | 64 ++++++++++++++++
 drivers/fwu-mdata/fwu-mdata-uclass.c          |  5 ++
 include/dt-structs.h                          | 11 +++
 lib/Makefile                                  |  1 +
 lib/dt_purge.c                                | 73 +++++++++++++++++++
 lib/efi_loader/efi_capsule.c                  |  7 ++
 7 files changed, 179 insertions(+)
 create mode 100644 doc/develop/devicetree/dt_non_compliant_purge.rst
 create mode 100644 lib/dt_purge.c
Quoted 4 lines

What is the point of removing them? Instead, we should make sure that we upstream the bindings and encourage SoC vendors to sync them. If we remove them, no one will bother and U-Boot just becomes a dumping ground.

Quoted 4 lines

Well things like the binman entries in DT are U-Boot specific and not useful for HW related descriptions or for Linux or another OS being able to deal with HW so arguably we're already a dumping ground to some degree for not defining hardware.

It's about validation and Simon is literally in the process of having the binman bindings upstreamed.

Signature · 1 line
Tom
#32 lore raw
In reply to Peter Robinson

Hi Peter,

Quoted 45 lines · Peter Robinson
Quoted 38 lines · Simon Glass

Hi,

Quoted 23 lines · Sughosh Ganu

Provide a way for removing certain devicetree nodes and/or properties from the devicetree. This is needed to purge certain nodes and properties which may be relevant only in U-Boot. Such nodes and properties are then removed from the devicetree before it is passed to the kernel. This ensures that the devicetree passed to the OS does not contain any non-compliant nodes and properties.

The removal of the nodes and properties is being done through an EVT_FT_FIXUP handler. I am not sure if the removal code needs to be behind any Kconfig symbol.

I have only build tested this on sandbox, and tested on qemu arm64 virt platform. This being a RFC, I have not put this through a CI run.

Sughosh Ganu (5):
dt: Provide a way to remove non-compliant nodes and properties
fwu: Add the fwu-mdata node for removal from devicetree
capsule: Add the capsule-key property for removal from devicetree
bootefi: Call the EVT_FT_FIXUP event handler
doc: Add a document for non-compliant DT node/property removal

Quoted 10 lines
 cmd/bootefi.c                                 | 18 +++++
 .../devicetree/dt_non_compliant_purge.rst     | 64 ++++++++++++++++
 drivers/fwu-mdata/fwu-mdata-uclass.c          |  5 ++
 include/dt-structs.h                          | 11 +++
 lib/Makefile                                  |  1 +
 lib/dt_purge.c                                | 73 +++++++++++++++++++
 lib/efi_loader/efi_capsule.c                  |  7 ++
 7 files changed, 179 insertions(+)
 create mode 100644 doc/develop/devicetree/dt_non_compliant_purge.rst
 create mode 100644 lib/dt_purge.c
Quoted 4 lines

What is the point of removing them? Instead, we should make sure that we upstream the bindings and encourage SoC vendors to sync them. If we remove them, no one will bother and U-Boot just becomes a dumping ground.

Quoted 4 lines

Well things like the binman entries in DT are U-Boot specific and not useful for HW related descriptions or for Linux or another OS being able to deal with HW so arguably we're already a dumping ground to some degree for not defining hardware.

I have started the process to upstream the binman bindings.

Perhaps we should use the issue tracker[1] to follow progress on all of this. We need to clean it up.

Quoted 6 lines
Quoted 6 lines

Instead of this, how about working on bringing the DT validation into U-Boot so we can see what state things are in?

Please send the bindings for Linaro's recent series (which I suspect are motivating this series) so we can start the process.

Regards,
Simon

[1] https://source.denx.de/u-boot/u-boot/-/issues

#33 lore raw
Quoted 49 lines · Simon Glass

Hi Peter,

Quoted 45 lines · Peter Robinson
Quoted 42 lines · Simon Glass

Hi,

Quoted 23 lines · Sughosh Ganu

Provide a way for removing certain devicetree nodes and/or properties from the devicetree. This is needed to purge certain nodes and properties which may be relevant only in U-Boot. Such nodes and properties are then removed from the devicetree before it is passed to the kernel. This ensures that the devicetree passed to the OS does not contain any non-compliant nodes and properties.

The removal of the nodes and properties is being done through an EVT_FT_FIXUP handler. I am not sure if the removal code needs to be behind any Kconfig symbol.

I have only build tested this on sandbox, and tested on qemu arm64 virt platform. This being a RFC, I have not put this through a CI run.

Sughosh Ganu (5):
dt: Provide a way to remove non-compliant nodes and properties
fwu: Add the fwu-mdata node for removal from devicetree
capsule: Add the capsule-key property for removal from devicetree
bootefi: Call the EVT_FT_FIXUP event handler
doc: Add a document for non-compliant DT node/property removal

Quoted 10 lines
 cmd/bootefi.c                                 | 18 +++++
 .../devicetree/dt_non_compliant_purge.rst     | 64 ++++++++++++++++
 drivers/fwu-mdata/fwu-mdata-uclass.c          |  5 ++
 include/dt-structs.h                          | 11 +++
 lib/Makefile                                  |  1 +
 lib/dt_purge.c                                | 73 +++++++++++++++++++
 lib/efi_loader/efi_capsule.c                  |  7 ++
 7 files changed, 179 insertions(+)
 create mode 100644 doc/develop/devicetree/dt_non_compliant_purge.rst
 create mode 100644 lib/dt_purge.c

What is the point of removing them? Instead, we should make sure that we upstream the bindings and encourage SoC vendors to sync them. If we remove them, no one will bother and U-Boot just becomes a dumping ground.

Quoted 6 lines
Quoted 4 lines

Well things like the binman entries in DT are U-Boot specific and not useful for HW related descriptions or for Linux or another OS being able to deal with HW so arguably we're already a dumping ground to some degree for not defining hardware.

I have started the process to upstream the binman bindings.

I don't think they should be in DT at all, they don't describe anything to do with hardware, or generally even the runtime of a device, they don't even describe the boot/runtime state of the firmware, they describe build time, so I don't see what that has to do with device tree? Can you explain that? To me those sorts of things should live in a build time style config file.

Quoted 14 lines

Perhaps we should use the issue tracker[1] to follow progress on all of this. We need to clean it up.

Quoted 6 lines
Quoted 6 lines

Instead of this, how about working on bringing the DT validation into U-Boot so we can see what state things are in?

Please send the bindings for Linaro's recent series (which I suspect are motivating this series) so we can start the process.

Regards,
Simon

[1] https://source.denx.de/u-boot/u-boot/-/issues

#34 lore raw

Hi Peter,

Quoted 56 lines · Peter Robinson
Quoted 54 lines · Simon Glass

Hi Peter,

Quoted 49 lines · Peter Robinson
Quoted 38 lines · Simon Glass

Hi,

Quoted 23 lines · Sughosh Ganu

Provide a way for removing certain devicetree nodes and/or properties from the devicetree. This is needed to purge certain nodes and properties which may be relevant only in U-Boot. Such nodes and properties are then removed from the devicetree before it is passed to the kernel. This ensures that the devicetree passed to the OS does not contain any non-compliant nodes and properties.

The removal of the nodes and properties is being done through an EVT_FT_FIXUP handler. I am not sure if the removal code needs to be behind any Kconfig symbol.

I have only build tested this on sandbox, and tested on qemu arm64 virt platform. This being a RFC, I have not put this through a CI run.

Sughosh Ganu (5):
dt: Provide a way to remove non-compliant nodes and properties
fwu: Add the fwu-mdata node for removal from devicetree
capsule: Add the capsule-key property for removal from devicetree
bootefi: Call the EVT_FT_FIXUP event handler
doc: Add a document for non-compliant DT node/property removal

Quoted 10 lines
 cmd/bootefi.c                                 | 18 +++++
 .../devicetree/dt_non_compliant_purge.rst     | 64 ++++++++++++++++
 drivers/fwu-mdata/fwu-mdata-uclass.c          |  5 ++
 include/dt-structs.h                          | 11 +++
 lib/Makefile                                  |  1 +
 lib/dt_purge.c                                | 73 +++++++++++++++++++
 lib/efi_loader/efi_capsule.c                  |  7 ++
 7 files changed, 179 insertions(+)
 create mode 100644 doc/develop/devicetree/dt_non_compliant_purge.rst
 create mode 100644 lib/dt_purge.c
Quoted 4 lines

What is the point of removing them? Instead, we should make sure that we upstream the bindings and encourage SoC vendors to sync them. If we remove them, no one will bother and U-Boot just becomes a dumping ground.

Well things like the binman entries in DT are U-Boot specific and not useful for HW related descriptions or for Linux or another OS being able to deal with HW so arguably we're already a dumping ground to some degree for not defining hardware.

Quoted 8 lines
Quoted 1 line

I have started the process to upstream the binman bindings.

I don't think they should be in DT at all, they don't describe anything to do with hardware, or generally even the runtime of a device, they don't even describe the boot/runtime state of the firmware, they describe build time, so I don't see what that has to do with device tree? Can you explain that? To me those sorts of things should live in a build time style config file.

I beg to differ. Devicetree is more than just hardware and always has been. See, for example the /chosen and /options nodes.

We need run-time configuration here, since we cannot know at build time what we will be asked to do by a previous firmware phase.

Quoted 8 lines
Quoted 8 lines

Perhaps we should use the issue tracker[1] to follow progress on all of this. We need to clean it up.

Quoted 4 lines
Quoted 4 lines

Instead of this, how about working on bringing the DT validation into U-Boot so we can see what state things are in?

Quoted 7 lines
Quoted 7 lines
Quoted 2 lines
Quoted 2 lines

Please send the bindings for Linaro's recent series (which I suspect are motivating this series) so we can start the process.

Regards,
Simon

[1] https://source.denx.de/u-boot/u-boot/-/issues

Regards,
Simon

#35 lore raw
Quoted 51 lines
Quoted 42 lines
Quoted 42 lines
Quoted 41 lines
Quoted 32 lines
Quoted 21 lines

Provide a way for removing certain devicetree nodes and/or properties from the devicetree. This is needed to purge certain nodes and properties which may be relevant only in U-Boot. Such nodes and properties are then removed from the devicetree before it is passed to the kernel. This ensures that the devicetree passed to the OS does not contain any non-compliant nodes and properties.

The removal of the nodes and properties is being done through an EVT_FT_FIXUP handler. I am not sure if the removal code needs to be behind any Kconfig symbol.

I have only build tested this on sandbox, and tested on qemu arm64 virt platform. This being a RFC, I have not put this through a CI run.

Sughosh Ganu (5):
dt: Provide a way to remove non-compliant nodes and properties
fwu: Add the fwu-mdata node for removal from devicetree
capsule: Add the capsule-key property for removal from devicetree
bootefi: Call the EVT_FT_FIXUP event handler
doc: Add a document for non-compliant DT node/property removal

Quoted 10 lines
 cmd/bootefi.c                                 | 18 +++++
 .../devicetree/dt_non_compliant_purge.rst     | 64 ++++++++++++++++
 drivers/fwu-mdata/fwu-mdata-uclass.c          |  5 ++
 include/dt-structs.h                          | 11 +++
 lib/Makefile                                  |  1 +
 lib/dt_purge.c                                | 73 +++++++++++++++++++
 lib/efi_loader/efi_capsule.c                  |  7 ++
 7 files changed, 179 insertions(+)
 create mode 100644 doc/develop/devicetree/dt_non_compliant_purge.rst
 create mode 100644 lib/dt_purge.c
Quoted 4 lines

What is the point of removing them? Instead, we should make sure that we upstream the bindings and encourage SoC vendors to sync them. If we remove them, no one will bother and U-Boot just becomes a dumping ground.

Well things like the binman entries in DT are U-Boot specific and not useful for HW related descriptions or for Linux or another OS being able to deal with HW so arguably we're already a dumping ground to some degree for not defining hardware.

Quoted 8 lines
Quoted 1 line

I have started the process to upstream the binman bindings.

I don't think they should be in DT at all, they don't describe anything to do with hardware, or generally even the runtime of a device, they don't even describe the boot/runtime state of the firmware, they describe build time, so I don't see what that has to do with device tree? Can you explain that? To me those sorts of things should live in a build time style config file.

Quoted 2 lines

I beg to differ. Devicetree is more than just hardware and always has been. See, for example the /chosen and /options nodes.

Can you give me an example of "options" as grep doesn't give me a single one in the kernel tree? I think we can just agree to disagree here.

Quoted 2 lines

We need run-time configuration here, since we cannot know at build time what we will be asked to do by a previous firmware phase.

Can you provide an example as to how that is used during runtime? Do you mean runtime during the build process or runtime on the device?

Quoted 18 lines
Quoted 8 lines
Quoted 8 lines

Perhaps we should use the issue tracker[1] to follow progress on all of this. We need to clean it up.

Quoted 4 lines
Quoted 4 lines

Instead of this, how about working on bringing the DT validation into U-Boot so we can see what state things are in?

Quoted 7 lines
Quoted 7 lines
Quoted 2 lines
Quoted 2 lines

Please send the bindings for Linaro's recent series (which I suspect are motivating this series) so we can start the process.

Regards,
Simon

[1] https://source.denx.de/u-boot/u-boot/-/issues

Regards,
Simon

#36 lore raw

Hi Peter,

Quoted 52 lines · Peter Robinson
Quoted 52 lines
Quoted 51 lines
Quoted 38 lines
Quoted 38 lines
Quoted 37 lines
Quoted 22 lines

Provide a way for removing certain devicetree nodes and/or properties from the devicetree. This is needed to purge certain nodes and properties which may be relevant only in U-Boot. Such nodes and properties are then removed from the devicetree before it is passed to the kernel. This ensures that the devicetree passed to the OS does not contain any non-compliant nodes and properties.

The removal of the nodes and properties is being done through an EVT_FT_FIXUP handler. I am not sure if the removal code needs to be behind any Kconfig symbol.

I have only build tested this on sandbox, and tested on qemu arm64 virt platform. This being a RFC, I have not put this through a CI run.

Sughosh Ganu (5):
dt: Provide a way to remove non-compliant nodes and properties
fwu: Add the fwu-mdata node for removal from devicetree
capsule: Add the capsule-key property for removal from devicetree
bootefi: Call the EVT_FT_FIXUP event handler
doc: Add a document for non-compliant DT node/property removal

Quoted 10 lines
 cmd/bootefi.c                                 | 18 +++++
 .../devicetree/dt_non_compliant_purge.rst     | 64 ++++++++++++++++
 drivers/fwu-mdata/fwu-mdata-uclass.c          |  5 ++
 include/dt-structs.h                          | 11 +++
 lib/Makefile                                  |  1 +
 lib/dt_purge.c                                | 73 +++++++++++++++++++
 lib/efi_loader/efi_capsule.c                  |  7 ++
 7 files changed, 179 insertions(+)
 create mode 100644 doc/develop/devicetree/dt_non_compliant_purge.rst
 create mode 100644 lib/dt_purge.c

What is the point of removing them? Instead, we should make sure that we upstream the bindings and encourage SoC vendors to sync them. If we remove them, no one will bother and U-Boot just becomes a dumping ground.

Quoted 6 lines
Quoted 4 lines

Well things like the binman entries in DT are U-Boot specific and not useful for HW related descriptions or for Linux or another OS being able to deal with HW so arguably we're already a dumping ground to some degree for not defining hardware.

I have started the process to upstream the binman bindings.

I don't think they should be in DT at all, they don't describe anything to do with hardware, or generally even the runtime of a device, they don't even describe the boot/runtime state of the firmware, they describe build time, so I don't see what that has to do with device tree? Can you explain that? To me those sorts of things should live in a build time style config file.

Quoted 6 lines
Quoted 2 lines

I beg to differ. Devicetree is more than just hardware and always has been. See, for example the /chosen and /options nodes.

Can you give me an example of "options" as grep doesn't give me a single one in the kernel tree? I think we can just agree to disagree here.

See here: https://github.com/devicetree-org/dt-schema/blob/main/dtschema/schemas/options/u-boot.yaml

I don't mind disagreeing, so long as it doesn't result in any restrictions on using devicetree in firmware. But it is very important to the success of firmware that we can make full use of the devicetree.

Quoted 5 lines
Quoted 2 lines

We need run-time configuration here, since we cannot know at build time what we will be asked to do by a previous firmware phase.

Can you provide an example as to how that is used during runtime? Do you mean runtime during the build process or runtime on the device?

I mean runtime on the device. An example is that we might want to control whether the serial UART is enabled, without having to rebuild each program in the firmware stack.

Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines

Perhaps we should use the issue tracker[1] to follow progress on all of this. We need to clean it up.

Quoted 6 lines
Quoted 6 lines

Instead of this, how about working on bringing the DT validation into U-Boot so we can see what state things are in?

Please send the bindings for Linaro's recent series (which I suspect are motivating this series) so we can start the process.

Quoted 7 lines
Quoted 7 lines
Quoted 4 lines
Quoted 4 lines

Regards,
Simon

[1] https://source.denx.de/u-boot/u-boot/-/issues

Regards,
Simon

Regards,
Simon

#37 lore raw
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 8 lines
Quoted 1 line

I have started the process to upstream the binman bindings.

I don't think they should be in DT at all, they don't describe anything to do with hardware, or generally even the runtime of a device, they don't even describe the boot/runtime state of the firmware, they describe build time, so I don't see what that has to do with device tree? Can you explain that? To me those sorts of things should live in a build time style config file.

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

I beg to differ. Devicetree is more than just hardware and always has been. See, for example the /chosen and /options nodes.

Can you give me an example of "options" as grep doesn't give me a single one in the kernel tree? I think we can just agree to disagree here.

See here: https://github.com/devicetree-org/dt-schema/blob/main/dtschema/schemas/options/u-boot.yaml

All of those options look to me like they would work just fine in a .env file like you've added board/raspberrypi/rpi/rpi.env

Quoted 4 lines

I don't mind disagreeing, so long as it doesn't result in any restrictions on using devicetree in firmware. But it is very important to the success of firmware that we can make full use of the devicetree.

That statement doesn't make sense, of course the firmware makes full use of the DT because it needs it to instantiate the HW. You don't actually answer my question though.

Quoted 9 lines
Quoted 5 lines
Quoted 2 lines

We need run-time configuration here, since we cannot know at build time what we will be asked to do by a previous firmware phase.

Can you provide an example as to how that is used during runtime? Do you mean runtime during the build process or runtime on the device?

I mean runtime on the device. An example is that we might want to control whether the serial UART is enabled, without having to rebuild each program in the firmware stack.

That is describing the HW though, such as whether a serial port is enabled or not, it's not how the binman pieces you're adding to DT are used during runtime which is the question I was asking.

Quoted 22 lines
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines

Perhaps we should use the issue tracker[1] to follow progress on all of this. We need to clean it up.

Quoted 6 lines
Quoted 6 lines

Instead of this, how about working on bringing the DT validation into U-Boot so we can see what state things are in?

Please send the bindings for Linaro's recent series (which I suspect are motivating this series) so we can start the process.

Quoted 7 lines
Quoted 7 lines
Quoted 4 lines
Quoted 4 lines

Regards,
Simon

[1] https://source.denx.de/u-boot/u-boot/-/issues

Regards,
Simon

Regards,
Simon

#38 lore raw

Hi Peter,

Quoted 13 lines · Peter Robinson
Quoted 13 lines
Quoted 13 lines
Quoted 12 lines
Quoted 9 lines
Quoted 2 lines

I have started the process to upstream the binman bindings.

I don't think they should be in DT at all, they don't describe anything to do with hardware, or generally even the runtime of a device, they don't even describe the boot/runtime state of the firmware, they describe build time, so I don't see what that has to do with device tree? Can you explain that? To me those sorts of things should live in a build time style config file.

I beg to differ. Devicetree is more than just hardware and always has been. See, for example the /chosen and /options nodes.

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

Can you give me an example of "options" as grep doesn't give me a single one in the kernel tree? I think we can just agree to disagree here.

See here: https://github.com/devicetree-org/dt-schema/blob/main/dtschema/schemas/options/u-boot.yaml

All of those options look to me like they would work just fine in a .env file like you've added board/raspberrypi/rpi/rpi.env

But that is built into U-Boot. How can it be controlled by another previous progress in the firmware stack?

Quoted 9 lines
Quoted 5 lines

I don't mind disagreeing, so long as it doesn't result in any restrictions on using devicetree in firmware. But it is very important to the success of firmware that we can make full use of the devicetree.

That statement doesn't make sense, of course the firmware makes full use of the DT because it needs it to instantiate the HW. You don't actually answer my question though.

I think I tried to answer your question but we are not on the same page. Please don't say that DT is just for hardware, since that is a sore point with me. It helf back U-Boot for many years, to no useful purpose.

Perhaps you could restate the question?

Also, why are you trying to keep things out of the DT?

Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
Quoted 3 lines

We need run-time configuration here, since we cannot know at build time what we will be asked to do by a previous firmware phase.

Can you provide an example as to how that is used during runtime? Do you mean runtime during the build process or runtime on the device?

Quoted 7 lines
Quoted 3 lines

I mean runtime on the device. An example is that we might want to control whether the serial UART is enabled, without having to rebuild each program in the firmware stack.

That is describing the HW though, such as whether a serial port is enabled or not, it's not how the binman pieces you're adding to DT are used during runtime which is the question I was asking.

There is:

1. whether the serial device is enabled in the DT
2. whether it emits character or not

Often we always want 1, in case we need to emit something. But for 2 we want to control it with a global setting that applies to all programs in the firmware flow.

Another example would be a framebuffer address, where we want to provide it in the DT so that all programs can use the same one.

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines

Perhaps we should use the issue tracker[1] to follow progress on all of this. We need to clean it up.

Quoted 4 lines
Quoted 4 lines

Instead of this, how about working on bringing the DT validation into U-Boot so we can see what state things are in?

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 2 lines
Quoted 2 lines

Please send the bindings for Linaro's recent series (which I suspect are motivating this series) so we can start the process.

Regards,
Simon

[1] https://source.denx.de/u-boot/u-boot/-/issues

Regards,
Simon

#39 lore raw
In reply to Simon Glass
Quoted 67 lines · Simon Glass

Hi Peter,

Quoted 64 lines · Peter Robinson
Quoted 49 lines · Simon Glass

Hi Peter,

Quoted 45 lines · Peter Robinson
Quoted 42 lines · Simon Glass

Hi,

Quoted 23 lines · Sughosh Ganu

Provide a way for removing certain devicetree nodes and/or properties from the devicetree. This is needed to purge certain nodes and properties which may be relevant only in U-Boot. Such nodes and properties are then removed from the devicetree before it is passed to the kernel. This ensures that the devicetree passed to the OS does not contain any non-compliant nodes and properties.

The removal of the nodes and properties is being done through an EVT_FT_FIXUP handler. I am not sure if the removal code needs to be behind any Kconfig symbol.

I have only build tested this on sandbox, and tested on qemu arm64 virt platform. This being a RFC, I have not put this through a CI run.

Sughosh Ganu (5):
dt: Provide a way to remove non-compliant nodes and properties
fwu: Add the fwu-mdata node for removal from devicetree
capsule: Add the capsule-key property for removal from devicetree
bootefi: Call the EVT_FT_FIXUP event handler
doc: Add a document for non-compliant DT node/property removal

Quoted 10 lines
 cmd/bootefi.c                                 | 18 +++++
 .../devicetree/dt_non_compliant_purge.rst     | 64 ++++++++++++++++
 drivers/fwu-mdata/fwu-mdata-uclass.c          |  5 ++
 include/dt-structs.h                          | 11 +++
 lib/Makefile                                  |  1 +
 lib/dt_purge.c                                | 73 +++++++++++++++++++
 lib/efi_loader/efi_capsule.c                  |  7 ++
 7 files changed, 179 insertions(+)
 create mode 100644 doc/develop/devicetree/dt_non_compliant_purge.rst
 create mode 100644 lib/dt_purge.c

What is the point of removing them? Instead, we should make sure that we upstream the bindings and encourage SoC vendors to sync them. If we remove them, no one will bother and U-Boot just becomes a dumping ground.

Quoted 6 lines
Quoted 4 lines

Well things like the binman entries in DT are U-Boot specific and not useful for HW related descriptions or for Linux or another OS being able to deal with HW so arguably we're already a dumping ground to some degree for not defining hardware.

I have started the process to upstream the binman bindings.

I don't think they should be in DT at all, they don't describe anything to do with hardware, or generally even the runtime of a device, they don't even describe the boot/runtime state of the firmware, they describe build time, so I don't see what that has to do with device tree? Can you explain that? To me those sorts of things should live in a build time style config file.

For the record, I tend to agree.

Quoted 2 lines

I beg to differ. Devicetree is more than just hardware and always has been. See, for example the /chosen and /options nodes.

There are exceptions...

Quoted 2 lines

We need run-time configuration here, since we cannot know at build time what we will be asked to do by a previous firmware phase.

Really, I don't want to have to care about the binman binding. If it is u-boot specific, then it should stay in u-boot. I took /options/u-boot/, but now I'm starting to have second thoughts on that being in dtschema if it is going to be continually and frequently extended. Validating it in SR does little. If a vendor is abusing /options/u-boot/ in some way they could just as easily remove the node in their u-boot fork to pass. SR is certainly not going to require the node be there.

On A/B updates, that really doesn't seem like a u-boot specific problem to me. No one wants A/B updates in EDK2 or anything else?

Rob

#40 lore raw

Hi Rob,

Quoted 70 lines · Rob Herring
Quoted 67 lines · Simon Glass

Hi Peter,

Quoted 64 lines · Peter Robinson
Quoted 49 lines · Simon Glass

Hi Peter,

Quoted 45 lines · Peter Robinson
Quoted 42 lines · Simon Glass

Hi,

Quoted 23 lines · Sughosh Ganu

Provide a way for removing certain devicetree nodes and/or properties from the devicetree. This is needed to purge certain nodes and properties which may be relevant only in U-Boot. Such nodes and properties are then removed from the devicetree before it is passed to the kernel. This ensures that the devicetree passed to the OS does not contain any non-compliant nodes and properties.

The removal of the nodes and properties is being done through an EVT_FT_FIXUP handler. I am not sure if the removal code needs to be behind any Kconfig symbol.

I have only build tested this on sandbox, and tested on qemu arm64 virt platform. This being a RFC, I have not put this through a CI run.

Sughosh Ganu (5):
dt: Provide a way to remove non-compliant nodes and properties
fwu: Add the fwu-mdata node for removal from devicetree
capsule: Add the capsule-key property for removal from devicetree
bootefi: Call the EVT_FT_FIXUP event handler
doc: Add a document for non-compliant DT node/property removal

Quoted 10 lines
 cmd/bootefi.c                                 | 18 +++++
 .../devicetree/dt_non_compliant_purge.rst     | 64 ++++++++++++++++
 drivers/fwu-mdata/fwu-mdata-uclass.c          |  5 ++
 include/dt-structs.h                          | 11 +++
 lib/Makefile                                  |  1 +
 lib/dt_purge.c                                | 73 +++++++++++++++++++
 lib/efi_loader/efi_capsule.c                  |  7 ++
 7 files changed, 179 insertions(+)
 create mode 100644 doc/develop/devicetree/dt_non_compliant_purge.rst
 create mode 100644 lib/dt_purge.c

What is the point of removing them? Instead, we should make sure that we upstream the bindings and encourage SoC vendors to sync them. If we remove them, no one will bother and U-Boot just becomes a dumping ground.

Quoted 6 lines
Quoted 4 lines

Well things like the binman entries in DT are U-Boot specific and not useful for HW related descriptions or for Linux or another OS being able to deal with HW so arguably we're already a dumping ground to some degree for not defining hardware.

I have started the process to upstream the binman bindings.

I don't think they should be in DT at all, they don't describe anything to do with hardware, or generally even the runtime of a device, they don't even describe the boot/runtime state of the firmware, they describe build time, so I don't see what that has to do with device tree? Can you explain that? To me those sorts of things should live in a build time style config file.

Quoted 6 lines

For the record, I tend to agree.

Quoted 2 lines

I beg to differ. Devicetree is more than just hardware and always has been. See, for example the /chosen and /options nodes.

There are exceptions...

I wish we could stop having this discussion entirely...to me the devicetree is all that firmware has to handle its configuration, both within projects and across project boundaries. There is no user space, no filesystem, etc.

Quoted 6 lines
Quoted 3 lines

We need run-time configuration here, since we cannot know at build time what we will be asked to do by a previous firmware phase.

Really, I don't want to have to care about the binman binding. If it is u-boot specific, then it should stay in u-boot.

I don't believe it is U-Boot-specific since it describes the system firmware as a whole. It collects things from multiple projects and we want to know where they ended up, so we can do firmware update, etc.

Quoted 6 lines

I took /options/u-boot/,
but now I'm starting to have second thoughts on that being in dtschema if it is going to be continually and frequently extended. Validating it in SR does little. If a vendor is abusing /options/u-boot/ in some way they could just as easily remove the node in their u-boot fork to pass. SR is certainly not going to require the node be there.

The challenge here is that we are trying to validate that the U-Boot DT matches the schema. We don't want to have people adding things willy nilly, even in /options/u-boot.

Quoted 3 lines

On A/B updates, that really doesn't seem like a u-boot specific problem to me. No one wants A/B updates in EDK2 or anything else?

I agree we should specify it correctly and in a general manner.

Regards,
Simon

#41 lore raw
In reply to Rob Herring

On Wed, Sep 06, 2023 at 09:21:39AM -0500, Rob Herring wrote:

[snip]

Quoted 2 lines

On A/B updates, that really doesn't seem like a u-boot specific problem to me. No one wants A/B updates in EDK2 or anything else?

This specific case goes back to:
https://lore.kernel.org/u-boot/[email protected]/

But I believe Sughosh and Ilias are basically the people who are in charge of the code at this point? So perhaps a step here is some advice on whatever they need to redo/rethink to get something that is acceptable.

Signature · 1 line
Tom
#42 lore raw
In reply to Rob Herring
Quoted 79 lines · Rob Herring
Quoted 67 lines · Simon Glass

Hi Peter,

Quoted 64 lines · Peter Robinson
Quoted 49 lines · Simon Glass

Hi Peter,

Quoted 45 lines · Peter Robinson
Quoted 42 lines · Simon Glass

Hi,

Quoted 23 lines · Sughosh Ganu

Provide a way for removing certain devicetree nodes and/or properties from the devicetree. This is needed to purge certain nodes and properties which may be relevant only in U-Boot. Such nodes and properties are then removed from the devicetree before it is passed to the kernel. This ensures that the devicetree passed to the OS does not contain any non-compliant nodes and properties.

The removal of the nodes and properties is being done through an EVT_FT_FIXUP handler. I am not sure if the removal code needs to be behind any Kconfig symbol.

I have only build tested this on sandbox, and tested on qemu arm64 virt platform. This being a RFC, I have not put this through a CI run.

Sughosh Ganu (5):
dt: Provide a way to remove non-compliant nodes and properties
fwu: Add the fwu-mdata node for removal from devicetree
capsule: Add the capsule-key property for removal from devicetree
bootefi: Call the EVT_FT_FIXUP event handler
doc: Add a document for non-compliant DT node/property removal

Quoted 10 lines
 cmd/bootefi.c                                 | 18 +++++
 .../devicetree/dt_non_compliant_purge.rst     | 64 ++++++++++++++++
 drivers/fwu-mdata/fwu-mdata-uclass.c          |  5 ++
 include/dt-structs.h                          | 11 +++
 lib/Makefile                                  |  1 +
 lib/dt_purge.c                                | 73 +++++++++++++++++++
 lib/efi_loader/efi_capsule.c                  |  7 ++
 7 files changed, 179 insertions(+)
 create mode 100644 doc/develop/devicetree/dt_non_compliant_purge.rst
 create mode 100644 lib/dt_purge.c

What is the point of removing them? Instead, we should make sure that we upstream the bindings and encourage SoC vendors to sync them. If we remove them, no one will bother and U-Boot just becomes a dumping ground.

Quoted 6 lines
Quoted 4 lines

Well things like the binman entries in DT are U-Boot specific and not useful for HW related descriptions or for Linux or another OS being able to deal with HW so arguably we're already a dumping ground to some degree for not defining hardware.

I have started the process to upstream the binman bindings.

I don't think they should be in DT at all, they don't describe anything to do with hardware, or generally even the runtime of a device, they don't even describe the boot/runtime state of the firmware, they describe build time, so I don't see what that has to do with device tree? Can you explain that? To me those sorts of things should live in a build time style config file.

For the record, I tend to agree.

Quoted 2 lines

I beg to differ. Devicetree is more than just hardware and always has been. See, for example the /chosen and /options nodes.

There are exceptions...

Quoted 2 lines

We need run-time configuration here, since we cannot know at build time what we will be asked to do by a previous firmware phase.

Quoted 7 lines

Really, I don't want to have to care about the binman binding. If it is u-boot specific, then it should stay in u-boot. I took /options/u-boot/, but now I'm starting to have second thoughts on that being in dtschema if it is going to be continually and frequently extended. Validating it in SR does little. If a vendor is abusing /options/u-boot/ in some way they could just as easily remove the node in their u-boot fork to pass. SR is certainly not going to require the node be there.

It's going to continue to be a "fun" tight-rope to walk. No one wants an easy way for vendors to cheat the requirements which is why in some other parts of this thread (you may or may not have been on, I don't recall, sorry) I've been trying to make it clear that the removal mechanism should be both a slight pain to add to, and at least wrt upstream, clear that effort was made to upstream things. Cheaters are going to cheat and they could just chain a bunch of "fdt rm" together to do it today.

Signature · 1 line
Tom
#43 lore raw
Quoted 80 lines · Tom Rini
Quoted 79 lines · Rob Herring
Quoted 67 lines · Simon Glass

Hi Peter,

Quoted 64 lines · Peter Robinson
Quoted 49 lines · Simon Glass

Hi Peter,

Quoted 45 lines · Peter Robinson
Quoted 42 lines · Simon Glass

Hi,

Quoted 31 lines · Sughosh Ganu

Provide a way for removing certain devicetree nodes and/or properties from the devicetree. This is needed to purge certain nodes and properties which may be relevant only in U-Boot. Such nodes and properties are then removed from the devicetree before it is passed to the kernel. This ensures that the devicetree passed to the OS does not contain any non-compliant nodes and properties.

The removal of the nodes and properties is being done through an EVT_FT_FIXUP handler. I am not sure if the removal code needs to be behind any Kconfig symbol.

I have only build tested this on sandbox, and tested on qemu arm64 virt platform. This being a RFC, I have not put this through a CI run.

Sughosh Ganu (5):
dt: Provide a way to remove non-compliant nodes and properties
fwu: Add the fwu-mdata node for removal from devicetree
capsule: Add the capsule-key property for removal from devicetree
bootefi: Call the EVT_FT_FIXUP event handler
doc: Add a document for non-compliant DT node/property removal

  cmd/bootefi.c                                 | 18 +++++
  .../devicetree/dt_non_compliant_purge.rst     | 64 ++++++++++++++++
  drivers/fwu-mdata/fwu-mdata-uclass.c          |  5 ++
  include/dt-structs.h                          | 11 +++
  lib/Makefile                                  |  1 +
  lib/dt_purge.c                                | 73 +++++++++++++++++++
  lib/efi_loader/efi_capsule.c                  |  7 ++
  7 files changed, 179 insertions(+)
Quoted 2 lines

create mode 100644 doc/develop/devicetree/dt_non_compliant_purge.rst create mode 100644 lib/dt_purge.c

What is the point of removing them? Instead, we should make sure that we upstream the bindings and encourage SoC vendors to sync them. If we remove them, no one will bother and U-Boot just becomes a dumping ground.

Quoted 6 lines
Quoted 4 lines

Well things like the binman entries in DT are U-Boot specific and not useful for HW related descriptions or for Linux or another OS being able to deal with HW so arguably we're already a dumping ground to some degree for not defining hardware.

I have started the process to upstream the binman bindings.

I don't think they should be in DT at all, they don't describe anything to do with hardware, or generally even the runtime of a device, they don't even describe the boot/runtime state of the firmware, they describe build time, so I don't see what that has to do with device tree? Can you explain that? To me those sorts of things should live in a build time style config file.

For the record, I tend to agree.

Quoted 2 lines

I beg to differ. Devicetree is more than just hardware and always has been. See, for example the /chosen and /options nodes.

There are exceptions...

Quoted 2 lines

We need run-time configuration here, since we cannot know at build time what we will be asked to do by a previous firmware phase.

Quoted 7 lines
Quoted 7 lines

Really, I don't want to have to care about the binman binding. If it is u-boot specific, then it should stay in u-boot. I took /options/u-boot/, but now I'm starting to have second thoughts on that being in dtschema if it is going to be continually and frequently extended. Validating it in SR does little. If a vendor is abusing /options/u-boot/ in some way they could just as easily remove the node in their u-boot fork to pass. SR is certainly not going to require the node be there.

The missing piece is validation of the U-Boot internal device-trees against a schema in the U-Boot CI. This should be possible even if some of the schema yaml files are maintained inside the U-Boot repo.

Best regards

Heinrich

Quoted 10 lines

It's going to continue to be a "fun" tight-rope to walk. No one wants an easy way for vendors to cheat the requirements which is why in some other parts of this thread (you may or may not have been on, I don't recall, sorry) I've been trying to make it clear that the removal mechanism should be both a slight pain to add to, and at least wrt upstream, clear that effort was made to upstream things. Cheaters are going to cheat and they could just chain a bunch of "fdt rm" together to do it today.

#44 lore raw

On Thu, Sep 07, 2023 at 01:30:01AM +0200, Heinrich Schuchardt wrote:

[snip]

Quoted 3 lines

The missing piece is validation of the U-Boot internal device-trees against a schema in the U-Boot CI. This should be possible even if some of the schema yaml files are maintained inside the U-Boot repo.

Dropping Rob since I don't think he cares about this part. Yes, what we need is some help in re-syncing our Kbuild (and Kconfig, but..) logic with the kernel as it's stuck at v4.20 still and all of the parts that make running the validation targets would be much easier (free) if we were in sync or much closer at least. It would be much appreciated if Linaro or Canonical or one of the other companies doing U-Boot work could get someone to focus on this task. It would help with a number of things, this included.

Signature · 1 line
Tom
#45 lore raw
In reply to Rob Herring

Hi Rob,

[...]

Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 12 lines
Quoted 10 lines
Quoted 5 lines

What is the point of removing them? Instead, we should make sure that we upstream the bindings and encourage SoC vendors to sync them. If we remove them, no one will bother and U-Boot just becomes a dumping ground.

Well things like the binman entries in DT are U-Boot specific and not useful for HW related descriptions or for Linux or another OS being able to deal with HW so arguably we're already a dumping ground to some degree for not defining hardware.

I have started the process to upstream the binman bindings.

Quoted 9 lines
Quoted 6 lines
Quoted 6 lines

I don't think they should be in DT at all, they don't describe anything to do with hardware, or generally even the runtime of a device, they don't even describe the boot/runtime state of the firmware, they describe build time, so I don't see what that has to do with device tree? Can you explain that? To me those sorts of things should live in a build time style config file.

For the record, I tend to agree.

+1

Quoted 5 lines
Quoted 2 lines

I beg to differ. Devicetree is more than just hardware and always has been. See, for example the /chosen and /options nodes.

There are exceptions...

We've been this over and over again and frankly it gets a bit annoying. It's called *DEVICE* tree for a reason. As Rob pointed out there are exceptions, but those made a lot of sense. Having arbitrary internal ABI stuff of various projects in the schema just defeats the definition of a spec.

Quoted 11 lines
Quoted 2 lines

We need run-time configuration here, since we cannot know at build time what we will be asked to do by a previous firmware phase.

Really, I don't want to have to care about the binman binding. If it is u-boot specific, then it should stay in u-boot. I took /options/u-boot/, but now I'm starting to have second thoughts on that being in dtschema if it is going to be continually and frequently extended. Validating it in SR does little. If a vendor is abusing /options/u-boot/ in some way they could just as easily remove the node in their u-boot fork to pass. SR is certainly not going to require the node be there.

Quoted 2 lines

On A/B updates, that really doesn't seem like a u-boot specific problem to me. No one wants A/B updates in EDK2 or anything else?

A/B updates might be implemented in EDK2 or any other bootloader that chooses to implement it. The metadata information a bootloader needs to implement it are documented here [0]. Those metadata are not part of the DT. If they were it would make sense to add them on the schema. The DT entry we are using though serves a different purpose. It tells the bootloader the location of the metadata (iow where can I read them from the disk). Since bootloaders have a different way of storing their configuration, I don't think this needs to be in the spec. EDK2 for example doesn't always use a DT and I don't think they'll ever use it to store configuration information.

[0] https://developer.arm.com/documentation/den0118/b/?lang=en

Thanks
/Ilias

Quoted 2 lines

Rob

#46 lore raw

Hi Ilias,

Quoted 33 lines · Ilias Apalodimas

Hi Rob,

[...]

Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 12 lines
Quoted 10 lines
Quoted 5 lines

What is the point of removing them? Instead, we should make sure that we upstream the bindings and encourage SoC vendors to sync them. If we remove them, no one will bother and U-Boot just becomes a dumping ground.

Well things like the binman entries in DT are U-Boot specific and not useful for HW related descriptions or for Linux or another OS being able to deal with HW so arguably we're already a dumping ground to some degree for not defining hardware.

I have started the process to upstream the binman bindings.

Quoted 9 lines
Quoted 6 lines
Quoted 6 lines

I don't think they should be in DT at all, they don't describe anything to do with hardware, or generally even the runtime of a device, they don't even describe the boot/runtime state of the firmware, they describe build time, so I don't see what that has to do with device tree? Can you explain that? To me those sorts of things should live in a build time style config file.

For the record, I tend to agree.

+1

Quoted 3 lines
Quoted 2 lines

I beg to differ. Devicetree is more than just hardware and always has been. See, for example the /chosen and /options nodes.

Quoted 8 lines
Quoted 2 lines

There are exceptions...

We've been this over and over again and frankly it gets a bit annoying. It's called *DEVICE* tree for a reason. As Rob pointed out there are exceptions, but those made a lot of sense. Having arbitrary internal ABI stuff of various projects in the schema just defeats the definition of a spec.

Our efforts should not just be about internal ABI, but working to provide a consistent configuration system for all firmware elements.

We cannot have it both ways, i.e. refusing to accept non-hardware bindings and then complaining that U-Boot does not pass schema validation. Devicetree should be a shared resource, not just for the use of Linux. We already have reserved-memory, flash layout and other things which don't relate to hardware. I would love to somehome get past this fundamental discussion which seems to come up every time we get close to making progress.

Quoted 15 lines
Quoted 12 lines
Quoted 3 lines

We need run-time configuration here, since we cannot know at build time what we will be asked to do by a previous firmware phase.

Really, I don't want to have to care about the binman binding. If it is u-boot specific, then it should stay in u-boot. I took /options/u-boot/, but now I'm starting to have second thoughts on that being in dtschema if it is going to be continually and frequently extended. Validating it in SR does little. If a vendor is abusing /options/u-boot/ in some way they could just as easily remove the node in their u-boot fork to pass. SR is certainly not going to require the node be there.

Quoted 2 lines

On A/B updates, that really doesn't seem like a u-boot specific problem to me. No one wants A/B updates in EDK2 or anything else?

Quoted 10 lines

A/B updates might be implemented in EDK2 or any other bootloader that chooses to implement it. The metadata information a bootloader needs to implement it are documented here [0]. Those metadata are not part of the DT. If they were it would make sense to add them on the schema. The DT entry we are using though serves a different purpose. It tells the bootloader the location of the metadata (iow where can I read them from the disk). Since bootloaders have a different way of storing their configuration, I don't think this needs to be in the spec. EDK2 for example doesn't always use a DT and I don't think they'll ever use it to store configuration information.

In another thread with Rob involved, we are trying to provide bindings for EDK2 to use.

Whatever the efforts of those trying to fragment the firmware industry, there are efforts to bring it together with a consistent configuration story. Ultimately I believe these will have to prevail, as the complexity increases.

Quoted 7 lines

[0] https://developer.arm.com/documentation/den0118/b/?lang=en

Thanks
/Ilias

Quoted 2 lines

Rob

Regards,
Simon

#47 lore raw

Hi Simon,

Quoted 41 lines · Simon Glass

Hi Ilias,

Quoted 36 lines · Ilias Apalodimas

Hi Rob,

[...]

Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 12 lines
Quoted 10 lines
Quoted 5 lines

What is the point of removing them? Instead, we should make sure that we upstream the bindings and encourage SoC vendors to sync them. If we remove them, no one will bother and U-Boot just becomes a dumping ground.

Well things like the binman entries in DT are U-Boot specific and not useful for HW related descriptions or for Linux or another OS being able to deal with HW so arguably we're already a dumping ground to some degree for not defining hardware.

I have started the process to upstream the binman bindings.

Quoted 9 lines
Quoted 6 lines
Quoted 6 lines

I don't think they should be in DT at all, they don't describe anything to do with hardware, or generally even the runtime of a device, they don't even describe the boot/runtime state of the firmware, they describe build time, so I don't see what that has to do with device tree? Can you explain that? To me those sorts of things should live in a build time style config file.

For the record, I tend to agree.

+1

Quoted 5 lines
Quoted 2 lines

I beg to differ. Devicetree is more than just hardware and always has been. See, for example the /chosen and /options nodes.

There are exceptions...

Quoted 8 lines
Quoted 5 lines

We've been this over and over again and frankly it gets a bit annoying. It's called *DEVICE* tree for a reason. As Rob pointed out there are exceptions, but those made a lot of sense. Having arbitrary internal ABI stuff of various projects in the schema just defeats the definition of a spec.

Our efforts should not just be about internal ABI, but working to provide a consistent configuration system for all firmware elements.

And that's what the firmware handoff was all about.
I get what you are trying to do here. I am just aware of any other project apart from U-Boot which uses DT for it's own configuration. So trying to standardize some bindings that are useful to all projects that use DT is fine. Trying to *enforce* them to use it for config isn't IMHO.

Quoted 5 lines

We cannot have it both ways, i.e. refusing to accept non-hardware bindings and then complaining that U-Boot does not pass schema validation. Devicetree should be a shared resource, not just for the use of Linux.

It's not for the use of Linux, I've wasted enough time repeating that and so has Rob. Please go back to previous emails and read the arguments.

Quoted 4 lines

We already have reserved-memory, flash layout and other things which don't relate to hardware. I would love to somehome get past this fundamental discussion which seems to come up every time we get close to making progress

Most of the nodes we already have were used across projects and made sense to all of them. U-Boot might need to reserve some memory and so does linux etc etc.
Some other nodes make nosense at all to and they just serve internal ABI implementation details. I can't possibly fathom how these would be justifiable. On top of all that, there's a huge danger here. How are you planning on separating arbitrary entries from various projects?

What I am afraid is going to happen here is simple. If a project doesn't use DT to configure itself and wants to provide a DT to U-Boot, then are you going to say "Can you please inject various DT nodes in the tree because U-Boot *needs* them and they are now part of the spec"? Anyway, it's not up to me to decide here, I am just saying what makes sense to me.

Quoted 27 lines
Quoted 16 lines
Quoted 13 lines
Quoted 4 lines

We need run-time configuration here, since we cannot know at build time what we will be asked to do by a previous firmware phase.

Really, I don't want to have to care about the binman binding. If it is u-boot specific, then it should stay in u-boot. I took /options/u-boot/, but now I'm starting to have second thoughts on that being in dtschema if it is going to be continually and frequently extended. Validating it in SR does little. If a vendor is abusing /options/u-boot/ in some way they could just as easily remove the node in their u-boot fork to pass. SR is certainly not going to require the node be there.

Quoted 2 lines

On A/B updates, that really doesn't seem like a u-boot specific problem to me. No one wants A/B updates in EDK2 or anything else?

Quoted 10 lines

A/B updates might be implemented in EDK2 or any other bootloader that chooses to implement it. The metadata information a bootloader needs to implement it are documented here [0]. Those metadata are not part of the DT. If they were it would make sense to add them on the schema. The DT entry we are using though serves a different purpose. It tells the bootloader the location of the metadata (iow where can I read them from the disk). Since bootloaders have a different way of storing their configuration, I don't think this needs to be in the spec. EDK2 for example doesn't always use a DT and I don't think they'll ever use it to store configuration information.

Quoted 7 lines

In another thread with Rob involved, we are trying to provide bindings for EDK2 to use.

Whatever the efforts of those trying to fragment the firmware industry, there are efforts to bring it together with a consistent configuration story. Ultimately I believe these will have to prevail, as the complexity increases.

Regards
/Ilias

#48 lore raw
Quoted 50 lines · Ilias Apalodimas

Hi Simon,

Quoted 47 lines · Simon Glass

Hi Ilias,

Quoted 41 lines · Ilias Apalodimas

Hi Rob,

[...]

Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 12 lines
Quoted 10 lines
Quoted 5 lines

What is the point of removing them? Instead, we should make sure that we upstream the bindings and encourage SoC vendors to sync them. If we remove them, no one will bother and U-Boot just becomes a dumping ground.

Well things like the binman entries in DT are U-Boot specific and not useful for HW related descriptions or for Linux or another OS being able to deal with HW so arguably we're already a dumping ground to some degree for not defining hardware.

I have started the process to upstream the binman bindings.

Quoted 9 lines
Quoted 6 lines
Quoted 6 lines

I don't think they should be in DT at all, they don't describe anything to do with hardware, or generally even the runtime of a device, they don't even describe the boot/runtime state of the firmware, they describe build time, so I don't see what that has to do with device tree? Can you explain that? To me those sorts of things should live in a build time style config file.

For the record, I tend to agree.

+1

Quoted 5 lines
Quoted 2 lines

I beg to differ. Devicetree is more than just hardware and always has been. See, for example the /chosen and /options nodes.

There are exceptions...

We've been this over and over again and frankly it gets a bit annoying. It's called *DEVICE* tree for a reason. As Rob pointed out there are exceptions, but those made a lot of sense. Having arbitrary internal ABI stuff of various projects in the schema just defeats the definition of a spec.

Quoted 5 lines
Quoted 2 lines

Our efforts should not just be about internal ABI, but working to provide a consistent configuration system for all firmware elements.

And that's what the firmware handoff was all about.
I get what you are trying to do here. I am just aware of any other

"just not aware" did you mean?

Quoted 6 lines

project apart from U-Boot which uses DT for it's own configuration. So trying to standardize some bindings that are useful to all projects that use DT is fine. Trying to *enforce* them to use it for config isn't IMHO.

Quoted 1 line
Quoted 8 lines
Quoted 4 lines

We cannot have it both ways, i.e. refusing to accept non-hardware bindings and then complaining that U-Boot does not pass schema validation. Devicetree should be a shared resource, not just for the use of Linux.

It's not for the use of Linux, I've wasted enough time repeating that and so has Rob. Please go back to previous emails and read the arguments.

Right, it's not just for Linux, but Linux is where most of the exceptions to the "ONLY HARDWARE" rule got in, because they also make sense. And the overarching point Simon keeps trying to make I believe can be boiled down to that too. There are things that one does not have a (reasonable) choice about how to do things with when interacting with the hunk of melted sand on your desk and that information needs to go somewhere.

Quoted 5 lines
Quoted 4 lines

We already have reserved-memory, flash layout and other things which don't relate to hardware. I would love to somehome get past this fundamental discussion which seems to come up every time we get close to making progress

Quoted 8 lines

Most of the nodes we already have were used across projects and made sense to all of them. U-Boot might need to reserve some memory and so does linux etc etc.
Some other nodes make nosense at all to and they just serve internal ABI implementation details. I can't possibly fathom how these would be justifiable. On top of all that, there's a huge danger here. How are you planning on separating arbitrary entries from various projects?

I think in some ways this is the whole point of at least what I'm asking for. It's fine to say "Here is the mechanism to remove nodes / properties from the device tree". BUT adding entries to that list MUST document where someone tried to upstream and explain that this is something that belongs in the device tree because it is useful to everyone.

Quoted 6 lines

What I am afraid is going to happen here is simple. If a project doesn't use DT to configure itself and wants to provide a DT to U-Boot, then are you going to say "Can you please inject various DT nodes in the tree because U-Boot *needs* them and they are now part of the spec"? Anyway, it's not up to me to decide here, I am just saying what makes sense to me.

What's the difference between that and "If a project doesn't use DT to configure itself and wants to provide a DT to Linux, ..." ?

Signature · 1 line
Tom
#49 lore raw

Hi Tom,

Quoted 52 lines · Tom Rini
Quoted 50 lines · Ilias Apalodimas

Hi Simon,

Quoted 47 lines · Simon Glass

Hi Ilias,

Quoted 41 lines · Ilias Apalodimas

Hi Rob,

[...]

Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 12 lines
Quoted 10 lines
Quoted 5 lines

What is the point of removing them? Instead, we should make sure that we upstream the bindings and encourage SoC vendors to sync them. If we remove them, no one will bother and U-Boot just becomes a dumping ground.

Well things like the binman entries in DT are U-Boot specific and not useful for HW related descriptions or for Linux or another OS being able to deal with HW so arguably we're already a dumping ground to some degree for not defining hardware.

I have started the process to upstream the binman bindings.

Quoted 9 lines
Quoted 6 lines
Quoted 6 lines

I don't think they should be in DT at all, they don't describe anything to do with hardware, or generally even the runtime of a device, they don't even describe the boot/runtime state of the firmware, they describe build time, so I don't see what that has to do with device tree? Can you explain that? To me those sorts of things should live in a build time style config file.

For the record, I tend to agree.

+1

Quoted 5 lines
Quoted 2 lines

I beg to differ. Devicetree is more than just hardware and always has been. See, for example the /chosen and /options nodes.

There are exceptions...

We've been this over and over again and frankly it gets a bit annoying. It's called *DEVICE* tree for a reason. As Rob pointed out there are exceptions, but those made a lot of sense. Having arbitrary internal ABI stuff of various projects in the schema just defeats the definition of a spec.

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

Our efforts should not just be about internal ABI, but working to provide a consistent configuration system for all firmware elements.

And that's what the firmware handoff was all about.
I get what you are trying to do here. I am just aware of any other

"just not aware" did you mean?

Yep, sorry!

Quoted 12 lines
Quoted 12 lines

project apart from U-Boot which uses DT for it's own configuration. So trying to standardize some bindings that are useful to all projects that use DT is fine. Trying to *enforce* them to use it for config isn't IMHO.

Quoted 5 lines

We cannot have it both ways, i.e. refusing to accept non-hardware bindings and then complaining that U-Boot does not pass schema validation. Devicetree should be a shared resource, not just for the use of Linux.

Quoted 7 lines
Quoted 3 lines

It's not for the use of Linux, I've wasted enough time repeating that and so has Rob. Please go back to previous emails and read the arguments.

Right, it's not just for Linux, but Linux is where most of the exceptions to the "ONLY HARDWARE" rule got in, because they also make sense.

Exactly.

Quoted 5 lines

And the overarching point Simon keeps trying to make I believe can be boiled down to that too. There are things that one does not have a (reasonable) choice about how to do things with when interacting with the hunk of melted sand on your desk and that information needs to go somewhere.

DT is a big hammer indeed, but that doesn't mean we always need to use it. I never disagreed with adding nodes that make sense and will be useful for others. For example, the internal Driver model configuration options used to enable a device early etc etc are probably useful to more projects. On the other hand, if U-Boot is indeed the only project using DT for its internal configuration why should we care?

For example, let's imagine you build TF-A, and TF-A is configured and bundled with a device tree that gets passed along to U-Boot (using OF_BOARD). Why on earth should TF-A be aware of internal DM implementation details and build a device tree containing u-boot,dm-pre-reloc, u-boot,dm-spl, dm-tpl, and every other non-upstreamed nodes we have?
Another example would be the public key that we shoehorn on the DT. In commit ddf67daac39d ("efi_capsule: Move signature from DTB to .rodata") I tried to get rid of that because since I was aware of the dt-schema conformance and honestly having the capsule public portion of the key there makes little sense. Unfortunately, that got reverted in commit 47a25e81d35c8 with a bogus commit message as well. So again imagine building TF-A, which is a first-stage bootloader and has no understanding of UEFI whatsoever, asking the TF-A project to start injecting public keys around that has no idea why or how they will be used.

Can you imagine how the device tree would look like in a couple of
years from now if we allow *every* project to add its own special config needs in there? So perhaps we should take a step back, agree that some level of config is needed, identify the common options, and add that to the spec instead of dumping everything that doesn't fit somewhere else in there.

Quoted 15 lines
Quoted 6 lines
Quoted 5 lines

We already have reserved-memory, flash layout and other things which don't relate to hardware. I would love to somehome get past this fundamental discussion which seems to come up every time we get close to making progress

Quoted 8 lines

Most of the nodes we already have were used across projects and made sense to all of them. U-Boot might need to reserve some memory and so does linux etc etc.
Some other nodes make nosense at all to and they just serve internal ABI implementation details. I can't possibly fathom how these would be justifiable. On top of all that, there's a huge danger here. How are you planning on separating arbitrary entries from various projects?

Quoted 6 lines

I think in some ways this is the whole point of at least what I'm asking for. It's fine to say "Here is the mechanism to remove nodes / properties from the device tree". BUT adding entries to that list MUST document where someone tried to upstream and explain that this is something that belongs in the device tree because it is useful to everyone.

And we don't disagree on that either. That's why the link to the FWU discussion was there (although it should have been in a doc and not in a mail). I am not arguing against adding nodes, I am arguing that we shouldn't rush them and that there's zero chance that we manage to upstream everything and keep some level of sanity on the spec. So, since U-Boot is currently using the DT for its own configuration needs, not having the ability to provide a DT that conforms to the spec and hope that we can upstream everything will just delay all of SystemReady 2.0 conformance efforts (and is unrealistic IMHO).

Quoted 10 lines
Quoted 7 lines

What I am afraid is going to happen here is simple. If a project doesn't use DT to configure itself and wants to provide a DT to U-Boot, then are you going to say "Can you please inject various DT nodes in the tree because U-Boot *needs* them and they are now part of the spec"? Anyway, it's not up to me to decide here, I am just saying what makes sense to me.

What's the difference between that and "If a project doesn't use DT to configure itself and wants to provide a DT to Linux, ..." ?

See the example above with TF-A, I hope that clears it up.

Thanks
/Ilias

Quoted 3 lines

--
Tom

#50 lore raw
Quoted 101 lines · Ilias Apalodimas

Hi Tom,

Quoted 52 lines · Tom Rini
Quoted 50 lines · Ilias Apalodimas

Hi Simon,

Quoted 47 lines · Simon Glass

Hi Ilias,

Quoted 41 lines · Ilias Apalodimas

Hi Rob,

[...]

Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 12 lines
Quoted 10 lines
Quoted 5 lines

What is the point of removing them? Instead, we should make sure that we upstream the bindings and encourage SoC vendors to sync them. If we remove them, no one will bother and U-Boot just becomes a dumping ground.

Well things like the binman entries in DT are U-Boot specific and not useful for HW related descriptions or for Linux or another OS being able to deal with HW so arguably we're already a dumping ground to some degree for not defining hardware.

I have started the process to upstream the binman bindings.

Quoted 9 lines
Quoted 6 lines
Quoted 6 lines

I don't think they should be in DT at all, they don't describe anything to do with hardware, or generally even the runtime of a device, they don't even describe the boot/runtime state of the firmware, they describe build time, so I don't see what that has to do with device tree? Can you explain that? To me those sorts of things should live in a build time style config file.

For the record, I tend to agree.

+1

Quoted 5 lines
Quoted 2 lines

I beg to differ. Devicetree is more than just hardware and always has been. See, for example the /chosen and /options nodes.

There are exceptions...

We've been this over and over again and frankly it gets a bit annoying. It's called *DEVICE* tree for a reason. As Rob pointed out there are exceptions, but those made a lot of sense. Having arbitrary internal ABI stuff of various projects in the schema just defeats the definition of a spec.

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

Our efforts should not just be about internal ABI, but working to provide a consistent configuration system for all firmware elements.

And that's what the firmware handoff was all about.
I get what you are trying to do here. I am just aware of any other

"just not aware" did you mean?

Yep, sorry!

Quoted 12 lines
Quoted 12 lines

project apart from U-Boot which uses DT for it's own configuration. So trying to standardize some bindings that are useful to all projects that use DT is fine. Trying to *enforce* them to use it for config isn't IMHO.

Quoted 5 lines

We cannot have it both ways, i.e. refusing to accept non-hardware bindings and then complaining that U-Boot does not pass schema validation. Devicetree should be a shared resource, not just for the use of Linux.

Quoted 7 lines
Quoted 3 lines

It's not for the use of Linux, I've wasted enough time repeating that and so has Rob. Please go back to previous emails and read the arguments.

Right, it's not just for Linux, but Linux is where most of the exceptions to the "ONLY HARDWARE" rule got in, because they also make sense.

Exactly.

Quoted 5 lines

And the overarching point Simon keeps trying to make I believe can be boiled down to that too. There are things that one does not have a (reasonable) choice about how to do things with when interacting with the hunk of melted sand on your desk and that information needs to go somewhere.

DT is a big hammer indeed, but that doesn't mean we always need to use it. I never disagreed with adding nodes that make sense and will be useful for others. For example, the internal Driver model configuration options used to enable a device early etc etc are probably useful to more projects. On the other hand, if U-Boot is indeed the only project using DT for its internal configuration why should we care?

Quoted 6 lines

For example, let's imagine you build TF-A, and TF-A is configured and bundled with a device tree that gets passed along to U-Boot (using OF_BOARD). Why on earth should TF-A be aware of internal DM implementation details and build a device tree containing u-boot,dm-pre-reloc, u-boot,dm-spl, dm-tpl, and every other non-upstreamed nodes we have?

I don't think this is a clear example, sorry. "dm-pre-reloc" etc are the bootph things now that you say could be useful. So they're an example of how (now that things are more receptive) we need to look at what U-Boot has that doesn't pass validation and see "does this make sense, today" or not.

I guess I'm confused as to why it's a theoretical problem for TF-A to pass along /binman/ but not a problem to pass along /soc/.../snvs/.../linux,snvs_pwrkey on i.MX8. _Sometimes_ internals just need to be there. That also does not mean every single should be there.

Quoted 11 lines

Another example would be the public key that we shoehorn on the DT. In commit ddf67daac39d ("efi_capsule: Move signature from DTB to .rodata") I tried to get rid of that because since I was aware of the dt-schema conformance and honestly having the capsule public portion of the key there makes little sense. Unfortunately, that got reverted in commit 47a25e81d35c8 with a bogus commit message as well. So again imagine building TF-A, which is a first-stage bootloader and has no understanding of UEFI whatsoever, asking the TF-A project to start injecting public keys around that has no idea why or how they will be used.

Quoted 6 lines

Can you imagine how the device tree would look like in a couple of
years from now if we allow *every* project to add its own special config needs in there? So perhaps we should take a step back, agree that some level of config is needed, identify the common options, and add that to the spec instead of dumping everything that doesn't fit somewhere else in there.

Part of the problem here and now with capsule update stuff seems to be that, well, I don't know what the heck we should do. It's a "lovely" specification defined feature and so I honestly don't know how much leeway we have for how we can and can't represent and implement the portions that are left up to the implementation or board specific. I don't see why TF-A would inject something that should have been present already? And/or ...

Quoted 21 lines
Quoted 14 lines
Quoted 5 lines
Quoted 4 lines

We already have reserved-memory, flash layout and other things which don't relate to hardware. I would love to somehome get past this fundamental discussion which seems to come up every time we get close to making progress

Quoted 8 lines

Most of the nodes we already have were used across projects and made sense to all of them. U-Boot might need to reserve some memory and so does linux etc etc.
Some other nodes make nosense at all to and they just serve internal ABI implementation details. I can't possibly fathom how these would be justifiable. On top of all that, there's a huge danger here. How are you planning on separating arbitrary entries from various projects?

Quoted 6 lines

I think in some ways this is the whole point of at least what I'm asking for. It's fine to say "Here is the mechanism to remove nodes / properties from the device tree". BUT adding entries to that list MUST document where someone tried to upstream and explain that this is something that belongs in the device tree because it is useful to everyone.

Quoted 9 lines

And we don't disagree on that either. That's why the link to the FWU discussion was there (although it should have been in a doc and not in a mail). I am not arguing against adding nodes, I am arguing that we shouldn't rush them and that there's zero chance that we manage to upstream everything and keep some level of sanity on the spec. So, since U-Boot is currently using the DT for its own configuration needs, not having the ability to provide a DT that conforms to the spec and hope that we can upstream everything will just delay all of SystemReady 2.0 conformance efforts (and is unrealistic IMHO).

The first problem is how does the capsule update specification specify handling the stuff that we put in the FWU nodes that we then need to delete?

The second problem is that I don't want the discussion link to just be in the cover letter, I want it in the tree, in documentation and heck, an unused-by-the-compiler parameter in the macro that adds a node to delete that is the rST file that documents the "we tried, it was rejected, this still makes sense" or whatever is appropriate as to why we're deleting the node. Cheaters shall cheat here, yes, but upstream will have a record of trying.

Signature · 1 line
Tom
#51 lore raw

Hi Tom,

[...]

Quoted 77 lines
Quoted 70 lines
Quoted 24 lines
Quoted 24 lines
Quoted 24 lines
Quoted 23 lines
Quoted 9 lines
Quoted 6 lines
Quoted 6 lines

I don't think they should be in DT at all, they don't describe anything to do with hardware, or generally even the runtime of a device, they don't even describe the boot/runtime state of the firmware, they describe build time, so I don't see what that has to do with device tree? Can you explain that? To me those sorts of things should live in a build time style config file.

For the record, I tend to agree.

+1

Quoted 5 lines
Quoted 2 lines

I beg to differ. Devicetree is more than just hardware and always has been. See, for example the /chosen and /options nodes.

There are exceptions...

We've been this over and over again and frankly it gets a bit annoying. It's called *DEVICE* tree for a reason. As Rob pointed out there are exceptions, but those made a lot of sense. Having arbitrary internal ABI stuff of various projects in the schema just defeats the definition of a spec.

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

Our efforts should not just be about internal ABI, but working to provide a consistent configuration system for all firmware elements.

And that's what the firmware handoff was all about.
I get what you are trying to do here. I am just aware of any other

"just not aware" did you mean?

Yep, sorry!

Quoted 12 lines
Quoted 12 lines

project apart from U-Boot which uses DT for it's own configuration. So trying to standardize some bindings that are useful to all projects that use DT is fine. Trying to *enforce* them to use it for config isn't IMHO.

Quoted 5 lines

We cannot have it both ways, i.e. refusing to accept non-hardware bindings and then complaining that U-Boot does not pass schema validation. Devicetree should be a shared resource, not just for the use of Linux.

Quoted 7 lines
Quoted 3 lines

It's not for the use of Linux, I've wasted enough time repeating that and so has Rob. Please go back to previous emails and read the arguments.

Right, it's not just for Linux, but Linux is where most of the exceptions to the "ONLY HARDWARE" rule got in, because they also make sense.

Exactly.

Quoted 5 lines

And the overarching point Simon keeps trying to make I believe can be boiled down to that too. There are things that one does not have a (reasonable) choice about how to do things with when interacting with the hunk of melted sand on your desk and that information needs to go somewhere.

DT is a big hammer indeed, but that doesn't mean we always need to use it. I never disagreed with adding nodes that make sense and will be useful for others. For example, the internal Driver model configuration options used to enable a device early etc etc are probably useful to more projects. On the other hand, if U-Boot is indeed the only project using DT for its internal configuration why should we care?

Quoted 6 lines

For example, let's imagine you build TF-A, and TF-A is configured and bundled with a device tree that gets passed along to U-Boot (using OF_BOARD). Why on earth should TF-A be aware of internal DM implementation details and build a device tree containing u-boot,dm-pre-reloc, u-boot,dm-spl, dm-tpl, and every other non-upstreamed nodes we have?

Quoted 6 lines

I don't think this is a clear example, sorry. "dm-pre-reloc" etc are the bootph things now that you say could be useful. So they're an example of how (now that things are more receptive) we need to look at what U-Boot has that doesn't pass validation and see "does this make sense, today" or not.

The point here is a bit different though. We need this in U-Boot *because* we use the DT to configure things. They are useful information, but unless another bootloader uses the same config method, U-Boot is the only consumer.

If we could split those nodes in an internal u-boot .dtsi file that would be much much cleaner. But IIRC we'll have problems with patching DTs in TPL/SPL with limited memory.

Quoted 3 lines

I guess I'm confused as to why it's a theoretical problem for TF-A to pass along /binman/ but not a problem to pass along /soc/.../snvs/.../linux,snvs_pwrkey on i.MX8. _Sometimes_ internals

It's the same problem and I don't think it's ok for TF-A to pass those as either.

Quoted 22 lines

just need to be there. That also does not mean every single should be there.

Quoted 11 lines

Another example would be the public key that we shoehorn on the DT. In commit ddf67daac39d ("efi_capsule: Move signature from DTB to .rodata") I tried to get rid of that because since I was aware of the dt-schema conformance and honestly having the capsule public portion of the key there makes little sense. Unfortunately, that got reverted in commit 47a25e81d35c8 with a bogus commit message as well. So again imagine building TF-A, which is a first-stage bootloader and has no understanding of UEFI whatsoever, asking the TF-A project to start injecting public keys around that has no idea why or how they will be used.

Quoted 6 lines

Can you imagine how the device tree would look like in a couple of
years from now if we allow *every* project to add its own special config needs in there? So perhaps we should take a step back, agree that some level of config is needed, identify the common options, and add that to the spec instead of dumping everything that doesn't fit somewhere else in there.

Quoted 5 lines

Part of the problem here and now with capsule update stuff seems to be that, well, I don't know what the heck we should do. It's a "lovely" specification defined feature and so I honestly don't know how much leeway we have for how we can and can't represent and implement the portions that are left up to the implementation or board specific.

Heinrich and I can help on that. In short, the capsule update chapter doesn't define where the key should be stored. It should obviously be on a tamper resistant medium and it has a specific format, but that's as far as the spec would go.

Quoted 2 lines

I don't see why TF-A would inject something that should have been present already? And/or ...

I am not following you here. The public key is unique per class of devices. If someone builds TF-A and decides to provide a DTB though that, you then need to, unpack the TF-A binary when you build U-Boot, amend it and repack it via binman. On top of that, those binaries will probably be signed, so the repacking exercise becomes pretty painful.

Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Quoted 14 lines
Quoted 5 lines

We already have reserved-memory, flash layout and other things which don't relate to hardware. I would love to somehome get past this fundamental discussion which seems to come up every time we get close to making progress

Most of the nodes we already have were used across projects and made sense to all of them. U-Boot might need to reserve some memory and so does linux etc etc.
Some other nodes make nosense at all to and they just serve internal ABI implementation details. I can't possibly fathom how these would be justifiable. On top of all that, there's a huge danger here. How are you planning on separating arbitrary entries from various projects?

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

I think in some ways this is the whole point of at least what I'm asking for. It's fine to say "Here is the mechanism to remove nodes / properties from the device tree". BUT adding entries to that list MUST document where someone tried to upstream and explain that this is something that belongs in the device tree because it is useful to everyone.

We never disagreed on that. I already said that the FWU link Sughosh sent in the cover letter should be added on a doc. But that's irrelevant to 'hard NAKing' patches [0]. It's also the complete opposite of what we are discussing here, since AFAICT you are fine with the removal mechanism as long as the nodes-to-be-removed are documented properly and there has been an upstream effort of those beforehand.

Quoted 11 lines
Quoted 10 lines

And we don't disagree on that either. That's why the link to the FWU discussion was there (although it should have been in a doc and not in a mail). I am not arguing against adding nodes, I am arguing that we shouldn't rush them and that there's zero chance that we manage to upstream everything and keep some level of sanity on the spec. So, since U-Boot is currently using the DT for its own configuration needs, not having the ability to provide a DT that conforms to the spec and hope that we can upstream everything will just delay all of SystemReady 2.0 conformance efforts (and is unrealistic IMHO).

Quoted 4 lines

The first problem is how does the capsule update specification specify handling the stuff that we put in the FWU nodes that we then need to delete?

It doesn't. The A/B update support is not part of the spec. FWU and the A/B updates are designed on top of the EFI spec to provide an easy way to do firmware updates without bricking the board while at the same time provide rollback protection.

Quoted 7 lines

The second problem is that I don't want the discussion link to just be in the cover letter, I want it in the tree, in documentation and heck, an unused-by-the-compiler parameter in the macro that adds a node to delete that is the rST file that documents the "we tried, it was rejected, this still makes sense" or whatever is appropriate as to why we're deleting the node. Cheaters shall cheat here, yes, but upstream will have a record of trying.

Again, we never disagreed on that

[0] https://lore.kernel.org/u-boot/CAPnjgZ3AexW4vfO-A8WYGE0OD5EZnOUA7tA1QP71Bcw51QArBQ@mail.gmail.com/

Thanks
/Ilias

Quoted 3 lines

--
Tom

#52 lore raw
In reply to Simon Glass

Hi Simon,

Quoted 8 lines · Simon Glass

On Wed, 6 Sept 2023 at 23:20, Ilias Apalodimas

Quoted 7 lines
Quoted 6 lines
Quoted 3 lines

I beg to differ. Devicetree is more than just hardware and always has been. See, for example the /chosen and /options nodes.

There are exceptions...

Quoted 9 lines
Quoted 5 lines

We've been this over and over again and frankly it gets a bit annoying. It's called *DEVICE* tree for a reason. As Rob pointed out there are exceptions, but those made a lot of sense. Having arbitrary internal ABI stuff of various projects in the schema just defeats the definition of a spec.

Our efforts should not just be about internal ABI, but working to provide a consistent configuration system for all firmware elements.

Sure, programmatically we can pass any data/info via DT, however it is only meant to map hardware features onto data structures.

devicetree.org landing page
"The devicetree is a data structure for describing hardware."

devicetree-specification-v0.3.pdf Chapter-2 Line-1
"DTSpec specifies a construct called a devicetree to describe
system hardware."

If we want to digress from the spec, we need the majority of developers to switch sides :) which is unlikely to happen and rightly so, imho.

regards.

#53 lore raw
Quoted 26 lines · Jassi Brar

Hi Simon,

Quoted 8 lines · Simon Glass

On Wed, 6 Sept 2023 at 23:20, Ilias Apalodimas

Quoted 7 lines
Quoted 6 lines
Quoted 3 lines

I beg to differ. Devicetree is more than just hardware and always has been. See, for example the /chosen and /options nodes.

There are exceptions...

Quoted 9 lines
Quoted 5 lines

We've been this over and over again and frankly it gets a bit annoying. It's called *DEVICE* tree for a reason. As Rob pointed out there are exceptions, but those made a lot of sense. Having arbitrary internal ABI stuff of various projects in the schema just defeats the definition of a spec.

Our efforts should not just be about internal ABI, but working to provide a consistent configuration system for all firmware elements.

Sure, programmatically we can pass any data/info via DT, however it is only meant to map hardware features onto data structures.

devicetree.org landing page
"The devicetree is a data structure for describing hardware."

Quoted 7 lines

devicetree-specification-v0.3.pdf Chapter-2 Line-1
"DTSpec specifies a construct called a devicetree to describe
system hardware."

If we want to digress from the spec, we need the majority of developers to switch sides :) which is unlikely to happen and rightly so, imho.

It's the same language-lawyering that's been going on since device trees moved from the neat thing Apple-based PowerPC platforms provided (and extended), and then got ad-hoc'd to support other PowerPC platforms, and then was used to solve "Linus is sick of the patch conflicts on ARM" problems. And everyone is tired of talking about the exceptions to "it must be hardware" because if your software isn't where the software-burned-into-the-hardware wants it to be, the hardware won't work and so on.

Signature · 3 lines
Tom

p.s. Yes, I know Apple didn't invent device trees either.
#54 lore raw
In reply to Jassi Brar
Quoted 26 lines

From: Jassi Brar <[email protected]>
Date: Fri, 8 Sep 2023 09:37:12 -0500

Hi Simon,

Quoted 8 lines · Simon Glass

On Wed, 6 Sept 2023 at 23:20, Ilias Apalodimas

Quoted 7 lines
Quoted 6 lines
Quoted 3 lines

I beg to differ. Devicetree is more than just hardware and always has been. See, for example the /chosen and /options nodes.

There are exceptions...

Quoted 9 lines
Quoted 5 lines

We've been this over and over again and frankly it gets a bit annoying. It's called *DEVICE* tree for a reason. As Rob pointed out there are exceptions, but those made a lot of sense. Having arbitrary internal ABI stuff of various projects in the schema just defeats the definition of a spec.

Our efforts should not just be about internal ABI, but working to provide a consistent configuration system for all firmware elements.

Sure, programmatically we can pass any data/info via DT, however it is only meant to map hardware features onto data structures.

Quoted 6 lines

devicetree.org landing page
"The devicetree is a data structure for describing hardware."

devicetree-specification-v0.3.pdf Chapter-2 Line-1
"DTSpec specifies a construct called a devicetree to describe
system hardware."

But it doesn't say that it describes *only* hardware. And it does describe more than just hardware. There is /chosen to specify firmware configuration and there are several examples of device tree bindings that describe non-discoverable firmware interfaces in the Linux tree. And it has been that way since the days of IEEE 1275. There are also bindings describing things like the firmware partition layout.

Quoted 3 lines

If we want to digress from the spec, we need the majority of developers to switch sides :) which is unlikely to happen and rightly so, imho.

It isn't even clear what the spec is. There is the document you reference above, there are the yaml files at
https://github.com/devicetree-org/dt-schema and then there are additional yaml files in the Linux tree. As far as I know it isn't written down anywhere that those are the only places where device tree bindings can live.

Anyway, let's face it, there is some consensus among developers that what Simon has done in U-Boot is pushing the use of devicetree beyond the point where a significant fraction of developers thinks it makes sense. And I think I agree with that. But you can't beat him with the spec to make your point.

Now the devicetree is cleverly constructed such that it is possible to define additional bindings without the risk of conflicting with bindings developed by other parties. In particular if U-Boot is augmenting a device tree with properties that are prefixed with "u-boot," this isn't going to hurt an operating system that uses such an augmented device tree.

The real problem is that some folks developed a certification program that allegedly requires schema verification and now propose adding code to U-Boot that doesn't really solve any problem. My proposed solution would be to change said certification program to allow firmware to augment the device tree with properties and nodes with compatibles that are in the namespace controlled by the firmware.

Cheers,

Mark

#55 lore raw
Quoted 34 lines · Mark Kettenis
Quoted 27 lines

From: Jassi Brar <[email protected]>
Date: Fri, 8 Sep 2023 09:37:12 -0500

Hi Simon,

Quoted 8 lines · Simon Glass

On Wed, 6 Sept 2023 at 23:20, Ilias Apalodimas

Quoted 7 lines
Quoted 6 lines
Quoted 3 lines

I beg to differ. Devicetree is more than just hardware and always has been. See, for example the /chosen and /options nodes.

There are exceptions...

Quoted 9 lines
Quoted 5 lines

We've been this over and over again and frankly it gets a bit annoying. It's called *DEVICE* tree for a reason. As Rob pointed out there are exceptions, but those made a lot of sense. Having arbitrary internal ABI stuff of various projects in the schema just defeats the definition of a spec.

Our efforts should not just be about internal ABI, but working to provide a consistent configuration system for all firmware elements.

Sure, programmatically we can pass any data/info via DT, however it is only meant to map hardware features onto data structures.

Quoted 6 lines

devicetree.org landing page
"The devicetree is a data structure for describing hardware."

devicetree-specification-v0.3.pdf Chapter-2 Line-1
"DTSpec specifies a construct called a devicetree to describe
system hardware."

Quoted 7 lines

But it doesn't say that it describes *only* hardware. And it does describe more than just hardware. There is /chosen to specify firmware configuration and there are several examples of device tree bindings that describe non-discoverable firmware interfaces in the Linux tree. And it has been that way since the days of IEEE 1275. There are also bindings describing things like the firmware partition layout.

Yes. The exact title for 1275[1] is: IEEE Standard for Boot (Initialization Configuration)
Firmware: Core Requirements and Practices

I see "configuration" in there. However, in the OF case, it's generally how firmware configured the hardware and what it discovered. That's a little different than telling the OS how to configure the hardware which is what we do with FDT. Then there's stuff that's how to configure Linux which we try to reject.

Once we get into configuration of the OS/client (including u-boot), making that an ABI is a lot harder and if we use DT for that, I don't think it should be an ABI.

Quoted 10 lines
Quoted 3 lines

If we want to digress from the spec, we need the majority of developers to switch sides :) which is unlikely to happen and rightly so, imho.

It isn't even clear what the spec is. There is the document you reference above, there are the yaml files at
https://github.com/devicetree-org/dt-schema and then there are additional yaml files in the Linux tree. As far as I know it isn't written down anywhere that those are the only places where device tree bindings can live.

There's not any restriction.

My intention with dtschema schemas is to only have "spec level" schemas. (Stuff we'd add to DTSpec (but don't because no one wants to write specs).) Hardware specific stuff lives somewhere else. That happens to be the Linux tree because that is where all the h/w support is (nothing else is close (by far)). Last I checked, we've got ~3700 schemas and ~1500 unconverted bindings.

Quoted 6 lines

Anyway, let's face it, there is some consensus among developers that what Simon has done in U-Boot is pushing the use of devicetree beyond the point where a significant fraction of developers thinks it makes sense. And I think I agree with that. But you can't beat him with the spec to make your point.

Quoted 6 lines

Now the devicetree is cleverly constructed such that it is possible to define additional bindings without the risk of conflicting with bindings developed by other parties. In particular if U-Boot is augmenting a device tree with properties that are prefixed with "u-boot," this isn't going to hurt an operating system that uses such an augmented device tree.

Until someone has some great idea to start using them. If the OS doesn't need something, then why pass it in the first place? What purpose does it serve? It's an invitation for someone somewhere to start using them.

The downside of keeping the nodes is it creates an ABI where there doesn't need to be one necessarily.

Quoted 6 lines

The real problem is that some folks developed a certification program that allegedly requires schema verification and now propose adding code to U-Boot that doesn't really solve any problem. My proposed solution would be to change said certification program to allow firmware to augment the device tree with properties and nodes with compatibles that are in the namespace controlled by the firmware.

I don't think we should decide what to do here based on said certification program. It can adapt to what's decided. Probably, the /option nodes will be stripped out or ignored for certification.

I accepted u-boot options node schema into dtschema, but now have second thoughts on that. Now I'm getting more u-boot specific (perhaps, not clear) stuff and widevine stuff internal to a TEE.

Rob

#56 lore raw

Hi Rob,

Quoted 44 lines · Rob Herring
Quoted 34 lines · Mark Kettenis
Quoted 27 lines

From: Jassi Brar <[email protected]>
Date: Fri, 8 Sep 2023 09:37:12 -0500

Hi Simon,

Quoted 8 lines · Simon Glass

On Wed, 6 Sept 2023 at 23:20, Ilias Apalodimas

Quoted 7 lines
Quoted 6 lines
Quoted 3 lines

I beg to differ. Devicetree is more than just hardware and always has been. See, for example the /chosen and /options nodes.

There are exceptions...

Quoted 9 lines
Quoted 5 lines

We've been this over and over again and frankly it gets a bit annoying. It's called *DEVICE* tree for a reason. As Rob pointed out there are exceptions, but those made a lot of sense. Having arbitrary internal ABI stuff of various projects in the schema just defeats the definition of a spec.

Our efforts should not just be about internal ABI, but working to provide a consistent configuration system for all firmware elements.

Sure, programmatically we can pass any data/info via DT, however it is only meant to map hardware features onto data structures.

Quoted 6 lines

devicetree.org landing page
"The devicetree is a data structure for describing hardware."

devicetree-specification-v0.3.pdf Chapter-2 Line-1
"DTSpec specifies a construct called a devicetree to describe
system hardware."

Quoted 7 lines

But it doesn't say that it describes *only* hardware. And it does describe more than just hardware. There is /chosen to specify firmware configuration and there are several examples of device tree bindings that describe non-discoverable firmware interfaces in the Linux tree. And it has been that way since the days of IEEE 1275. There are also bindings describing things like the firmware partition layout.

Quoted 8 lines

Yes. The exact title for 1275[1] is: IEEE Standard for Boot (Initialization Configuration)
Firmware: Core Requirements and Practices

I see "configuration" in there. However, in the OF case, it's generally how firmware configured the hardware and what it discovered. That's a little different than telling the OS how to configure the hardware which is what we do with FDT.

For the /options node it says "The properties of this node are the system’s configuration variables."

Then there is section 7.4.4 which has a large list of options which don't seem to be so narrowly defined.

In any case, this is not quite the point, which IMO is that we need DT to support firmware use cases, whether or not a 29-year-old spec thought of it or not. In fact it is amazing to me how forward-looking Open Firmware was.

Quoted 2 lines

Then there's stuff that's how
to configure Linux which we try to reject.

Fair enough: Linux has user-space for that.

Quoted 16 lines

Once we get into configuration of the OS/client (including u-boot), making that an ABI is a lot harder and if we use DT for that, I don't think it should be an ABI.

Quoted 10 lines
Quoted 3 lines

If we want to digress from the spec, we need the majority of developers to switch sides :) which is unlikely to happen and rightly so, imho.

It isn't even clear what the spec is. There is the document you reference above, there are the yaml files at
https://github.com/devicetree-org/dt-schema and then there are additional yaml files in the Linux tree. As far as I know it isn't written down anywhere that those are the only places where device tree bindings can live.

Quoted 8 lines

There's not any restriction.

My intention with dtschema schemas is to only have "spec level" schemas. (Stuff we'd add to DTSpec (but don't because no one wants to write specs).) Hardware specific stuff lives somewhere else. That happens to be the Linux tree because that is where all the h/w support is (nothing else is close (by far)). Last I checked, we've got ~3700 schemas and ~1500 unconverted bindings.

That scope is quite a bit narrower than I understood it to be. It seems to leave a significant gap between the Linux repo and yours.

Quoted 14 lines
Quoted 7 lines

Anyway, let's face it, there is some consensus among developers that what Simon has done in U-Boot is pushing the use of devicetree beyond the point where a significant fraction of developers thinks it makes sense. And I think I agree with that. But you can't beat him with the spec to make your point.

Quoted 6 lines

Now the devicetree is cleverly constructed such that it is possible to define additional bindings without the risk of conflicting with bindings developed by other parties. In particular if U-Boot is augmenting a device tree with properties that are prefixed with "u-boot," this isn't going to hurt an operating system that uses such an augmented device tree.

Quoted 7 lines

Until someone has some great idea to start using them. If the OS doesn't need something, then why pass it in the first place? What purpose does it serve? It's an invitation for someone somewhere to start using them.

The downside of keeping the nodes is it creates an ABI where there doesn't need to be one necessarily.

I'd love to get away from the idea that DT is just for the OS. We are trying to use it for firmware-to-firmware communication, too. The programs on each side of that interface may be different projects. For that, we do need to have a binding, otherwise we end up with series like this one.

Quoted 8 lines
Quoted 7 lines

The real problem is that some folks developed a certification program that allegedly requires schema verification and now propose adding code to U-Boot that doesn't really solve any problem. My proposed solution would be to change said certification program to allow firmware to augment the device tree with properties and nodes with compatibles that are in the namespace controlled by the firmware.

Quoted 7 lines

I don't think we should decide what to do here based on said certification program. It can adapt to what's decided. Probably, the /option nodes will be stripped out or ignored for certification.

I accepted u-boot options node schema into dtschema, but now have second thoughts on that. Now I'm getting more u-boot specific (perhaps, not clear) stuff and widevine stuff internal to a TEE.

Where should these bindings go such that ARM / Linaro are not trying to remove them? I would be OK with moving them out somewhere else, but how are people supposed to deal with such fragmentation? My understanding was that dt-schema was an attempt to set up a neutral area where bindings could be accepted that were not just for Linux...did that change?

U-Boot is certainly the firmware project that is trying hardest to clean up things in this area...but it isn't the only consumer of these bindings. Given that we invent a new bootloader about every 6 months, I'm pretty sure the number of consumers will grow.

Regards,
Simon

#57 lore raw
Quoted 3 lines · Simon Glass

Hi Rob,

On Wed, 13 Sept 2023 at 16:39, Rob Herring <[email protected]> wrote:

[snip]

Quoted 8 lines
Quoted 7 lines

I don't think we should decide what to do here based on said certification program. It can adapt to what's decided. Probably, the /option nodes will be stripped out or ignored for certification.

I accepted u-boot options node schema into dtschema, but now have second thoughts on that. Now I'm getting more u-boot specific (perhaps, not clear) stuff and widevine stuff internal to a TEE.

Quoted 6 lines

Where should these bindings go such that ARM / Linaro are not trying to remove them? I would be OK with moving them out somewhere else, but how are people supposed to deal with such fragmentation? My understanding was that dt-schema was an attempt to set up a neutral area where bindings could be accepted that were not just for Linux...did that change?

Well, part of the problem here is that I've been talking with Ilias more about what's intended here and the fwu-* stuff that Rob rejected is indeed not right. We should drop it and replace it with something that really addresses the underlying problem (which is how do you know how/where to find some GUIDs) and I think we think it's something that can be shared between projects too and so be easier to convince Rob that the next form of it is right (or the right direction).

Signature · 1 line
Tom
#58 lore raw

+CC Jose who's maintaining the metadata spec from Arm side.

Quoted 21 lines · Tom Rini
Quoted 3 lines · Simon Glass

Hi Rob,

On Wed, 13 Sept 2023 at 16:39, Rob Herring <[email protected]> wrote:

[snip]

Quoted 8 lines
Quoted 7 lines

I don't think we should decide what to do here based on said certification program. It can adapt to what's decided. Probably, the /option nodes will be stripped out or ignored for certification.

I accepted u-boot options node schema into dtschema, but now have second thoughts on that. Now I'm getting more u-boot specific (perhaps, not clear) stuff and widevine stuff internal to a TEE.

Quoted 6 lines

Where should these bindings go such that ARM / Linaro are not trying to remove them? I would be OK with moving them out somewhere else, but how are people supposed to deal with such fragmentation? My understanding was that dt-schema was an attempt to set up a neutral area where bindings could be accepted that were not just for Linux...did that change?

Quoted 7 lines

Well, part of the problem here is that I've been talking with Ilias more about what's intended here and the fwu-* stuff that Rob rejected is indeed not right. We should drop it and replace it with something that really addresses the underlying problem (which is how do you know how/where to find some GUIDs) and I think we think it's something that can be shared between projects too and so be easier to convince Rob that the next form of it is right (or the right direction).

Tom, I gave the discussion we had last night a bit of thought (thanks for that) and talked with Jose.
The spec as is written right now recommends a GPT-based partition. It then has various GPT UUIDs that indicate where to find the metadata as well as the various firmware banks that participate in the whole scheme. If you have that GPT, then the only thing you really need is to find the metadata UUID and handle the various banks.

However, the synquacer which boots from a NOR has no GPT. What that fwu node entry does, in order to abstract the rest of the implementation, is map UUIIDs <-> offset + length. That way the core code still thinks it's trying to discover UUIDs but the eventual reads/writes end up on a NOR.
That box boots via SCP [0] , which has no understanding of device trees, instead they hardcode the UUIDS, offsets etc for the Synquacer. But if they ever wanted to switch over having that information would come in handy.

Jose and I discussed this a bit. I'll backpaddle and have someone look into upstreaming the fwu part. There are a few changes required, since we already have some MTD information in the DT and those entries would make more sense there instead of inventing a new node, but we can discuss this when the patches are sent. Once those are sent, we can add a recommendation on the spec, pointing to that DT entry for any future early stage boot loaders that want to implement it, pointing to the DT entry.

That only solves a fraction of the problem though. Other nodes, like the EFI public key etc. still need to be removed.

[0] https://github.com/ARM-software/SCP-firmware

Thanks
/Ilias

Quoted 3 lines

--
Tom

#59 lore raw
In reply to Simon Glass
Quoted 68 lines · Simon Glass

Hi Rob,

Quoted 44 lines · Rob Herring
Quoted 34 lines · Mark Kettenis
Quoted 27 lines

From: Jassi Brar <[email protected]>
Date: Fri, 8 Sep 2023 09:37:12 -0500

Hi Simon,

Quoted 8 lines · Simon Glass

On Wed, 6 Sept 2023 at 23:20, Ilias Apalodimas

Quoted 7 lines
Quoted 6 lines
Quoted 3 lines

I beg to differ. Devicetree is more than just hardware and always has been. See, for example the /chosen and /options nodes.

There are exceptions...

Quoted 9 lines
Quoted 5 lines

We've been this over and over again and frankly it gets a bit annoying. It's called *DEVICE* tree for a reason. As Rob pointed out there are exceptions, but those made a lot of sense. Having arbitrary internal ABI stuff of various projects in the schema just defeats the definition of a spec.

Our efforts should not just be about internal ABI, but working to provide a consistent configuration system for all firmware elements.

Sure, programmatically we can pass any data/info via DT, however it is only meant to map hardware features onto data structures.

Quoted 6 lines

devicetree.org landing page
"The devicetree is a data structure for describing hardware."

devicetree-specification-v0.3.pdf Chapter-2 Line-1
"DTSpec specifies a construct called a devicetree to describe
system hardware."

Quoted 7 lines

But it doesn't say that it describes *only* hardware. And it does describe more than just hardware. There is /chosen to specify firmware configuration and there are several examples of device tree bindings that describe non-discoverable firmware interfaces in the Linux tree. And it has been that way since the days of IEEE 1275. There are also bindings describing things like the firmware partition layout.

Quoted 8 lines

Yes. The exact title for 1275[1] is: IEEE Standard for Boot (Initialization Configuration)
Firmware: Core Requirements and Practices

I see "configuration" in there. However, in the OF case, it's generally how firmware configured the hardware and what it discovered. That's a little different than telling the OS how to configure the hardware which is what we do with FDT.

For the /options node it says "The properties of this node are the system’s configuration variables."

Then there is section 7.4.4 which has a large list of options which don't seem to be so narrowly defined.

In any case, this is not quite the point, which IMO is that we need DT to support firmware use cases, whether or not a 29-year-old spec thought of it or not. In fact it is amazing to me how forward-looking Open Firmware was.

Quoted 4 lines
Quoted 2 lines

Then there's stuff that's how
to configure Linux which we try to reject.

Fair enough: Linux has user-space for that.

Yep, the question I usually ask is who needs to configure something and what determines the config. Changing things with sysfs is much easier than changing the DT provided by firmware.

Quoted 47 lines
Quoted 16 lines

Once we get into configuration of the OS/client (including u-boot), making that an ABI is a lot harder and if we use DT for that, I don't think it should be an ABI.

Quoted 10 lines
Quoted 3 lines

If we want to digress from the spec, we need the majority of developers to switch sides :) which is unlikely to happen and rightly so, imho.

It isn't even clear what the spec is. There is the document you reference above, there are the yaml files at
https://github.com/devicetree-org/dt-schema and then there are additional yaml files in the Linux tree. As far as I know it isn't written down anywhere that those are the only places where device tree bindings can live.

Quoted 8 lines

There's not any restriction.

My intention with dtschema schemas is to only have "spec level" schemas. (Stuff we'd add to DTSpec (but don't because no one wants to write specs).) Hardware specific stuff lives somewhere else. That happens to be the Linux tree because that is where all the h/w support is (nothing else is close (by far)). Last I checked, we've got ~3700 schemas and ~1500 unconverted bindings.

That scope is quite a bit narrower than I understood it to be. It seems to leave a significant gap between the Linux repo and yours.

Quoted 19 lines
Quoted 7 lines

Anyway, let's face it, there is some consensus among developers that what Simon has done in U-Boot is pushing the use of devicetree beyond the point where a significant fraction of developers thinks it makes sense. And I think I agree with that. But you can't beat him with the spec to make your point.

Quoted 6 lines

Now the devicetree is cleverly constructed such that it is possible to define additional bindings without the risk of conflicting with bindings developed by other parties. In particular if U-Boot is augmenting a device tree with properties that are prefixed with "u-boot," this isn't going to hurt an operating system that uses such an augmented device tree.

Until someone has some great idea to start using them. If the OS doesn't need something, then why pass it in the first place? What purpose does it serve? It's an invitation for someone somewhere to start using them.

Quoted 8 lines
Quoted 2 lines

The downside of keeping the nodes is it creates an ABI where there doesn't need to be one necessarily.

I'd love to get away from the idea that DT is just for the OS. We are trying to use it for firmware-to-firmware communication, too. The programs on each side of that interface may be different projects. For that, we do need to have a binding, otherwise we end up with series like this one.

I don't think DT is just for the OS, but DT for the OS is an ABI and other cases may not be. Or they just don't need to follow all the same rules. Zephyr is doing their own thing for example.

I don't think /options/u-boot is an ABI. AIUI, u-boot populates the node and consumes it. No ABI there (or limited to SPL to u-boot proper). I suppose a prior firmware stage could populate it, but that doesn't scale as then the prior stage has to know details of the next stage.

Quoted 15 lines
Quoted 7 lines
Quoted 6 lines

The real problem is that some folks developed a certification program that allegedly requires schema verification and now propose adding code to U-Boot that doesn't really solve any problem. My proposed solution would be to change said certification program to allow firmware to augment the device tree with properties and nodes with compatibles that are in the namespace controlled by the firmware.

Quoted 7 lines

I don't think we should decide what to do here based on said certification program. It can adapt to what's decided. Probably, the /option nodes will be stripped out or ignored for certification.

I accepted u-boot options node schema into dtschema, but now have second thoughts on that. Now I'm getting more u-boot specific (perhaps, not clear) stuff and widevine stuff internal to a TEE.

Quoted 6 lines

Where should these bindings go such that ARM / Linaro are not trying to remove them? I would be OK with moving them out somewhere else, but how are people supposed to deal with such fragmentation? My understanding was that dt-schema was an attempt to set up a neutral area where bindings could be accepted that were not just for Linux...did that change?

No change, just not communicated I guess. And again, bindings are not "just for Linux". They are hosted there because that is where *all* the hardware support is (by far). But we'll probably never get past the "Linux binding" perception no matter what we do or how many times I say it.

To rephrase things a bit, I'm happy to host anything that's multi-project, not a large number of bindings, and not a device/hardware specific binding. The device specific bindings live in the kernel tree primarily. For any new binding (foos/#foo-cell type ones), I want to see multiple users. Really for these, probably best to start with them in Linux repo (or elsewhere) and then promote them to dtschema. That gives a little flexibility in changing/abandoning them.

Removing nodes and/or properties and where things live are mostly independent discussions. SystemReady can adapt to whatever is decided for the former. In general, IMO, when passing DT from stage N to N+1, the N+1 stage should remove things which only apply to N+2 stage. For example, kexec removes /chosen and recreates it for the next kernel.

Rob

#60 lore raw

Hi Rob,

Quoted 139 lines · Rob Herring
Quoted 68 lines · Simon Glass

Hi Rob,

Quoted 44 lines · Rob Herring
Quoted 34 lines · Mark Kettenis
Quoted 27 lines

From: Jassi Brar <[email protected]>
Date: Fri, 8 Sep 2023 09:37:12 -0500

Hi Simon,

Quoted 8 lines · Simon Glass

On Wed, 6 Sept 2023 at 23:20, Ilias Apalodimas

Quoted 7 lines
Quoted 6 lines
Quoted 3 lines

I beg to differ. Devicetree is more than just hardware and always has been. See, for example the /chosen and /options nodes.

There are exceptions...

Quoted 9 lines
Quoted 5 lines

We've been this over and over again and frankly it gets a bit annoying. It's called *DEVICE* tree for a reason. As Rob pointed out there are exceptions, but those made a lot of sense. Having arbitrary internal ABI stuff of various projects in the schema just defeats the definition of a spec.

Our efforts should not just be about internal ABI, but working to provide a consistent configuration system for all firmware elements.

Sure, programmatically we can pass any data/info via DT, however it is only meant to map hardware features onto data structures.

Quoted 6 lines

devicetree.org landing page
"The devicetree is a data structure for describing hardware."

devicetree-specification-v0.3.pdf Chapter-2 Line-1
"DTSpec specifies a construct called a devicetree to describe
system hardware."

Quoted 7 lines

But it doesn't say that it describes *only* hardware. And it does describe more than just hardware. There is /chosen to specify firmware configuration and there are several examples of device tree bindings that describe non-discoverable firmware interfaces in the Linux tree. And it has been that way since the days of IEEE 1275. There are also bindings describing things like the firmware partition layout.

Quoted 8 lines

Yes. The exact title for 1275[1] is: IEEE Standard for Boot (Initialization Configuration)
Firmware: Core Requirements and Practices

I see "configuration" in there. However, in the OF case, it's generally how firmware configured the hardware and what it discovered. That's a little different than telling the OS how to configure the hardware which is what we do with FDT.

For the /options node it says "The properties of this node are the system’s configuration variables."

Then there is section 7.4.4 which has a large list of options which don't seem to be so narrowly defined.

In any case, this is not quite the point, which IMO is that we need DT to support firmware use cases, whether or not a 29-year-old spec thought of it or not. In fact it is amazing to me how forward-looking Open Firmware was.

Quoted 4 lines
Quoted 2 lines

Then there's stuff that's how
to configure Linux which we try to reject.

Fair enough: Linux has user-space for that.

Yep, the question I usually ask is who needs to configure something and what determines the config. Changing things with sysfs is much easier than changing the DT provided by firmware.

Quoted 47 lines
Quoted 16 lines

Once we get into configuration of the OS/client (including u-boot), making that an ABI is a lot harder and if we use DT for that, I don't think it should be an ABI.

Quoted 10 lines
Quoted 3 lines

If we want to digress from the spec, we need the majority of developers to switch sides :) which is unlikely to happen and rightly so, imho.

It isn't even clear what the spec is. There is the document you reference above, there are the yaml files at
https://github.com/devicetree-org/dt-schema and then there are additional yaml files in the Linux tree. As far as I know it isn't written down anywhere that those are the only places where device tree bindings can live.

Quoted 8 lines

There's not any restriction.

My intention with dtschema schemas is to only have "spec level" schemas. (Stuff we'd add to DTSpec (but don't because no one wants to write specs).) Hardware specific stuff lives somewhere else. That happens to be the Linux tree because that is where all the h/w support is (nothing else is close (by far)). Last I checked, we've got ~3700 schemas and ~1500 unconverted bindings.

That scope is quite a bit narrower than I understood it to be. It seems to leave a significant gap between the Linux repo and yours.

Quoted 19 lines
Quoted 7 lines

Anyway, let's face it, there is some consensus among developers that what Simon has done in U-Boot is pushing the use of devicetree beyond the point where a significant fraction of developers thinks it makes sense. And I think I agree with that. But you can't beat him with the spec to make your point.

Quoted 6 lines

Now the devicetree is cleverly constructed such that it is possible to define additional bindings without the risk of conflicting with bindings developed by other parties. In particular if U-Boot is augmenting a device tree with properties that are prefixed with "u-boot," this isn't going to hurt an operating system that uses such an augmented device tree.

Until someone has some great idea to start using them. If the OS doesn't need something, then why pass it in the first place? What purpose does it serve? It's an invitation for someone somewhere to start using them.

Quoted 8 lines
Quoted 2 lines

The downside of keeping the nodes is it creates an ABI where there doesn't need to be one necessarily.

I'd love to get away from the idea that DT is just for the OS. We are trying to use it for firmware-to-firmware communication, too. The programs on each side of that interface may be different projects. For that, we do need to have a binding, otherwise we end up with series like this one.

I don't think DT is just for the OS, but DT for the OS is an ABI and other cases may not be. Or they just don't need to follow all the same rules. Zephyr is doing their own thing for example.

Quoted 5 lines

I don't think /options/u-boot is an ABI. AIUI, u-boot populates the node and consumes it. No ABI there (or limited to SPL to u-boot proper). I suppose a prior firmware stage could populate it, but that doesn't scale as then the prior stage has to know details of the next stage.

I still don't understand the distinction, or really why U-Boot (or u-boot) is different. The main reason for the /options/u-boot node is so that prior phase firmware can tell U-Boot what to do. It is similar to the /chosen node for the OS. If it is not an ABI, how can any project rely on it? It is absolutely not just U-Boot generating something for its own consumption. Where is that idea even coming from? We even have an OF_HAS_PRIOR_STAGE Kconfig option for it in U-Boot, specifically for TF-A, etc.

As to the scaling, I agree. That suggests we try to make things generic, i.e. have an /options node with these sorts of generic settings. Candidates for that are console and logging controls, for example. I would prefer that to /options/u-boot, as you know.

Quoted 29 lines
Quoted 16 lines
Quoted 8 lines
Quoted 7 lines

The real problem is that some folks developed a certification program that allegedly requires schema verification and now propose adding code to U-Boot that doesn't really solve any problem. My proposed solution would be to change said certification program to allow firmware to augment the device tree with properties and nodes with compatibles that are in the namespace controlled by the firmware.

Quoted 7 lines

I don't think we should decide what to do here based on said certification program. It can adapt to what's decided. Probably, the /option nodes will be stripped out or ignored for certification.

I accepted u-boot options node schema into dtschema, but now have second thoughts on that. Now I'm getting more u-boot specific (perhaps, not clear) stuff and widevine stuff internal to a TEE.

Quoted 6 lines

Where should these bindings go such that ARM / Linaro are not trying to remove them? I would be OK with moving them out somewhere else, but how are people supposed to deal with such fragmentation? My understanding was that dt-schema was an attempt to set up a neutral area where bindings could be accepted that were not just for Linux...did that change?

No change, just not communicated I guess. And again, bindings are not "just for Linux". They are hosted there because that is where *all* the hardware support is (by far). But we'll probably never get past the "Linux binding" perception no matter what we do or how many times I say it.

Quoted 8 lines

To rephrase things a bit, I'm happy to host anything that's multi-project, not a large number of bindings, and not a device/hardware specific binding. The device specific bindings live in the kernel tree primarily. For any new binding (foos/#foo-cell type ones), I want to see multiple users. Really for these, probably best to start with them in Linux repo (or elsewhere) and then promote them to dtschema. That gives a little flexibility in changing/abandoning them.

So now I am not sure what you are suggesting. Are you wanting bindings in many places (yours, Linux, U-Boot, TF-A, ...)? I am sure you are aware that if we put bindings in U-Boot they will not be considered as bindings at all, including by Linaro.

To restate the problem, we need (and until your previous email I thought we had) a unified repo where cross-project, firmware-targeted bindings can be accepted and agreed by interested projects.

Quoted 6 lines

Removing nodes and/or properties and where things live are mostly independent discussions. SystemReady can adapt to whatever is decided for the former. In general, IMO, when passing DT from stage N to N+1, the N+1 stage should remove things which only apply to N+2 stage. For example, kexec removes /chosen and recreates it for the next kernel.

Sounds good. But note that the reason for that is a conflict, since the node is used for different things - i.e. the two kernels need different settings. That is quite different from the case I am talking about, where the settings either apply globally (to interested projects) or to a single project (for all boot phases of that project). In my case, I believe there is no need to remove anything.

Regards,
Simon

PS Zephyr is absolutely doing its own thing. Apart from the fact that it doesn't even have a runtime DT, the bindings are entirely within the project. and bear little relation to Linux bindings. I was not around for that decision, but I suspect part of the rationale was that many of the MCUs which Zephyr targets are not supported by Linux. Of course, that is not fully true and I believe it will become less true with time. Then, perhaps, in 5 years it will be Zephyr's turn to think about bindings more deeply.

#61 lore raw
Quoted 148 lines · Simon Glass

Hi Rob,

Quoted 139 lines · Rob Herring
Quoted 68 lines · Simon Glass

Hi Rob,

Quoted 44 lines · Rob Herring
Quoted 34 lines · Mark Kettenis
Quoted 27 lines

From: Jassi Brar <[email protected]>
Date: Fri, 8 Sep 2023 09:37:12 -0500

Hi Simon,

Quoted 8 lines · Simon Glass

On Wed, 6 Sept 2023 at 23:20, Ilias Apalodimas

Quoted 7 lines
Quoted 6 lines
Quoted 3 lines

I beg to differ. Devicetree is more than just hardware and always has been. See, for example the /chosen and /options nodes.

There are exceptions...

Quoted 9 lines
Quoted 5 lines

We've been this over and over again and frankly it gets a bit annoying. It's called *DEVICE* tree for a reason. As Rob pointed out there are exceptions, but those made a lot of sense. Having arbitrary internal ABI stuff of various projects in the schema just defeats the definition of a spec.

Our efforts should not just be about internal ABI, but working to provide a consistent configuration system for all firmware elements.

Sure, programmatically we can pass any data/info via DT, however it is only meant to map hardware features onto data structures.

Quoted 6 lines

devicetree.org landing page
"The devicetree is a data structure for describing hardware."

devicetree-specification-v0.3.pdf Chapter-2 Line-1
"DTSpec specifies a construct called a devicetree to describe
system hardware."

Quoted 7 lines

But it doesn't say that it describes *only* hardware. And it does describe more than just hardware. There is /chosen to specify firmware configuration and there are several examples of device tree bindings that describe non-discoverable firmware interfaces in the Linux tree. And it has been that way since the days of IEEE 1275. There are also bindings describing things like the firmware partition layout.

Quoted 8 lines

Yes. The exact title for 1275[1] is: IEEE Standard for Boot (Initialization Configuration)
Firmware: Core Requirements and Practices

I see "configuration" in there. However, in the OF case, it's generally how firmware configured the hardware and what it discovered. That's a little different than telling the OS how to configure the hardware which is what we do with FDT.

For the /options node it says "The properties of this node are the system’s configuration variables."

Then there is section 7.4.4 which has a large list of options which don't seem to be so narrowly defined.

In any case, this is not quite the point, which IMO is that we need DT to support firmware use cases, whether or not a 29-year-old spec thought of it or not. In fact it is amazing to me how forward-looking Open Firmware was.

Quoted 4 lines
Quoted 2 lines

Then there's stuff that's how
to configure Linux which we try to reject.

Fair enough: Linux has user-space for that.

Yep, the question I usually ask is who needs to configure something and what determines the config. Changing things with sysfs is much easier than changing the DT provided by firmware.

Quoted 47 lines
Quoted 16 lines

Once we get into configuration of the OS/client (including u-boot), making that an ABI is a lot harder and if we use DT for that, I don't think it should be an ABI.

Quoted 10 lines
Quoted 3 lines

If we want to digress from the spec, we need the majority of developers to switch sides :) which is unlikely to happen and rightly so, imho.

It isn't even clear what the spec is. There is the document you reference above, there are the yaml files at
https://github.com/devicetree-org/dt-schema and then there are additional yaml files in the Linux tree. As far as I know it isn't written down anywhere that those are the only places where device tree bindings can live.

Quoted 8 lines

There's not any restriction.

My intention with dtschema schemas is to only have "spec level" schemas. (Stuff we'd add to DTSpec (but don't because no one wants to write specs).) Hardware specific stuff lives somewhere else. That happens to be the Linux tree because that is where all the h/w support is (nothing else is close (by far)). Last I checked, we've got ~3700 schemas and ~1500 unconverted bindings.

That scope is quite a bit narrower than I understood it to be. It seems to leave a significant gap between the Linux repo and yours.

Quoted 19 lines
Quoted 7 lines

Anyway, let's face it, there is some consensus among developers that what Simon has done in U-Boot is pushing the use of devicetree beyond the point where a significant fraction of developers thinks it makes sense. And I think I agree with that. But you can't beat him with the spec to make your point.

Quoted 6 lines

Now the devicetree is cleverly constructed such that it is possible to define additional bindings without the risk of conflicting with bindings developed by other parties. In particular if U-Boot is augmenting a device tree with properties that are prefixed with "u-boot," this isn't going to hurt an operating system that uses such an augmented device tree.

Until someone has some great idea to start using them. If the OS doesn't need something, then why pass it in the first place? What purpose does it serve? It's an invitation for someone somewhere to start using them.

Quoted 8 lines
Quoted 2 lines

The downside of keeping the nodes is it creates an ABI where there doesn't need to be one necessarily.

I'd love to get away from the idea that DT is just for the OS. We are trying to use it for firmware-to-firmware communication, too. The programs on each side of that interface may be different projects. For that, we do need to have a binding, otherwise we end up with series like this one.

I don't think DT is just for the OS, but DT for the OS is an ABI and other cases may not be. Or they just don't need to follow all the same rules. Zephyr is doing their own thing for example.

Quoted 5 lines

I don't think /options/u-boot is an ABI. AIUI, u-boot populates the node and consumes it. No ABI there (or limited to SPL to u-boot proper). I suppose a prior firmware stage could populate it, but that doesn't scale as then the prior stage has to know details of the next stage.

Quoted 8 lines

I still don't understand the distinction, or really why U-Boot (or u-boot) is different. The main reason for the /options/u-boot node is so that prior phase firmware can tell U-Boot what to do. It is similar to the /chosen node for the OS. If it is not an ABI, how can any project rely on it? It is absolutely not just U-Boot generating something for its own consumption. Where is that idea even coming from? We even have an OF_HAS_PRIOR_STAGE Kconfig option for it in U-Boot, specifically for TF-A, etc.

Well, maybe we aren't different, we just need to figure out for ourselves what is useful to have in DT, and what isn't because no one else will use it and it's not the best mechanism for our use either. Or there might be cases where it is useful to us to do it that way and we just delete that part of the tree prior to passing on to the OS.

Signature · 1 line
Tom
#62 lore raw
In reply to Simon Glass
Quoted 149 lines · Simon Glass

Hi Rob,

Quoted 139 lines · Rob Herring
Quoted 68 lines · Simon Glass

Hi Rob,

Quoted 44 lines · Rob Herring
Quoted 34 lines · Mark Kettenis
Quoted 27 lines

From: Jassi Brar <[email protected]>
Date: Fri, 8 Sep 2023 09:37:12 -0500

Hi Simon,

Quoted 8 lines · Simon Glass

On Wed, 6 Sept 2023 at 23:20, Ilias Apalodimas

Quoted 7 lines
Quoted 6 lines
Quoted 3 lines

I beg to differ. Devicetree is more than just hardware and always has been. See, for example the /chosen and /options nodes.

There are exceptions...

Quoted 9 lines
Quoted 5 lines

We've been this over and over again and frankly it gets a bit annoying. It's called *DEVICE* tree for a reason. As Rob pointed out there are exceptions, but those made a lot of sense. Having arbitrary internal ABI stuff of various projects in the schema just defeats the definition of a spec.

Our efforts should not just be about internal ABI, but working to provide a consistent configuration system for all firmware elements.

Sure, programmatically we can pass any data/info via DT, however it is only meant to map hardware features onto data structures.

Quoted 6 lines

devicetree.org landing page
"The devicetree is a data structure for describing hardware."

devicetree-specification-v0.3.pdf Chapter-2 Line-1
"DTSpec specifies a construct called a devicetree to describe
system hardware."

Quoted 7 lines

But it doesn't say that it describes *only* hardware. And it does describe more than just hardware. There is /chosen to specify firmware configuration and there are several examples of device tree bindings that describe non-discoverable firmware interfaces in the Linux tree. And it has been that way since the days of IEEE 1275. There are also bindings describing things like the firmware partition layout.

Quoted 8 lines

Yes. The exact title for 1275[1] is: IEEE Standard for Boot (Initialization Configuration)
Firmware: Core Requirements and Practices

I see "configuration" in there. However, in the OF case, it's generally how firmware configured the hardware and what it discovered. That's a little different than telling the OS how to configure the hardware which is what we do with FDT.

For the /options node it says "The properties of this node are the system’s configuration variables."

Then there is section 7.4.4 which has a large list of options which don't seem to be so narrowly defined.

In any case, this is not quite the point, which IMO is that we need DT to support firmware use cases, whether or not a 29-year-old spec thought of it or not. In fact it is amazing to me how forward-looking Open Firmware was.

Quoted 4 lines
Quoted 2 lines

Then there's stuff that's how
to configure Linux which we try to reject.

Fair enough: Linux has user-space for that.

Yep, the question I usually ask is who needs to configure something and what determines the config. Changing things with sysfs is much easier than changing the DT provided by firmware.

Quoted 47 lines
Quoted 16 lines

Once we get into configuration of the OS/client (including u-boot), making that an ABI is a lot harder and if we use DT for that, I don't think it should be an ABI.

Quoted 10 lines
Quoted 3 lines

If we want to digress from the spec, we need the majority of developers to switch sides :) which is unlikely to happen and rightly so, imho.

It isn't even clear what the spec is. There is the document you reference above, there are the yaml files at
https://github.com/devicetree-org/dt-schema and then there are additional yaml files in the Linux tree. As far as I know it isn't written down anywhere that those are the only places where device tree bindings can live.

Quoted 8 lines

There's not any restriction.

My intention with dtschema schemas is to only have "spec level" schemas. (Stuff we'd add to DTSpec (but don't because no one wants to write specs).) Hardware specific stuff lives somewhere else. That happens to be the Linux tree because that is where all the h/w support is (nothing else is close (by far)). Last I checked, we've got ~3700 schemas and ~1500 unconverted bindings.

That scope is quite a bit narrower than I understood it to be. It seems to leave a significant gap between the Linux repo and yours.

Quoted 19 lines
Quoted 7 lines

Anyway, let's face it, there is some consensus among developers that what Simon has done in U-Boot is pushing the use of devicetree beyond the point where a significant fraction of developers thinks it makes sense. And I think I agree with that. But you can't beat him with the spec to make your point.

Quoted 6 lines

Now the devicetree is cleverly constructed such that it is possible to define additional bindings without the risk of conflicting with bindings developed by other parties. In particular if U-Boot is augmenting a device tree with properties that are prefixed with "u-boot," this isn't going to hurt an operating system that uses such an augmented device tree.

Until someone has some great idea to start using them. If the OS doesn't need something, then why pass it in the first place? What purpose does it serve? It's an invitation for someone somewhere to start using them.

Quoted 8 lines
Quoted 2 lines

The downside of keeping the nodes is it creates an ABI where there doesn't need to be one necessarily.

I'd love to get away from the idea that DT is just for the OS. We are trying to use it for firmware-to-firmware communication, too. The programs on each side of that interface may be different projects. For that, we do need to have a binding, otherwise we end up with series like this one.

I don't think DT is just for the OS, but DT for the OS is an ABI and other cases may not be. Or they just don't need to follow all the same rules. Zephyr is doing their own thing for example.

Quoted 5 lines

I don't think /options/u-boot is an ABI. AIUI, u-boot populates the node and consumes it. No ABI there (or limited to SPL to u-boot proper). I suppose a prior firmware stage could populate it, but that doesn't scale as then the prior stage has to know details of the next stage.

Quoted 8 lines

I still don't understand the distinction, or really why U-Boot (or u-boot) is different. The main reason for the /options/u-boot node is so that prior phase firmware can tell U-Boot what to do. It is similar to the /chosen node for the OS. If it is not an ABI, how can any project rely on it? It is absolutely not just U-Boot generating something for its own consumption. Where is that idea even coming from? We even have an OF_HAS_PRIOR_STAGE Kconfig option for it in U-Boot, specifically for TF-A, etc.

Okay, I misunderstood the intent since I thought u-boot gets its DT from the one in the u-boot tree (at least usually).

Though I just looked at TF-A source and see no evidence of it doing anything with /options or /options/u-boot. I'm really not that interested in what is possible and only used by 1 board and fork somewhere. I'm interested in supporting what the community defines as best practice (e.g. DT (for OS) comes from firmware), but so far that hasn't been defined below the firmware-OS level. Yes, there's efforts addressing aspects of it, but it's not really clear to me what the high-level goals are and what projects are onboard.

Note that I did find "/secure-chosen" though. And if they want to use that, then fine, but I don't want to see it.

Quoted 43 lines

As to the scaling, I agree. That suggests we try to make things generic, i.e. have an /options node with these sorts of generic settings. Candidates for that are console and logging controls, for example. I would prefer that to /options/u-boot, as you know.

Quoted 29 lines
Quoted 16 lines
Quoted 8 lines
Quoted 7 lines

The real problem is that some folks developed a certification program that allegedly requires schema verification and now propose adding code to U-Boot that doesn't really solve any problem. My proposed solution would be to change said certification program to allow firmware to augment the device tree with properties and nodes with compatibles that are in the namespace controlled by the firmware.

Quoted 7 lines

I don't think we should decide what to do here based on said certification program. It can adapt to what's decided. Probably, the /option nodes will be stripped out or ignored for certification.

I accepted u-boot options node schema into dtschema, but now have second thoughts on that. Now I'm getting more u-boot specific (perhaps, not clear) stuff and widevine stuff internal to a TEE.

Quoted 6 lines

Where should these bindings go such that ARM / Linaro are not trying to remove them? I would be OK with moving them out somewhere else, but how are people supposed to deal with such fragmentation? My understanding was that dt-schema was an attempt to set up a neutral area where bindings could be accepted that were not just for Linux...did that change?

No change, just not communicated I guess. And again, bindings are not "just for Linux". They are hosted there because that is where *all* the hardware support is (by far). But we'll probably never get past the "Linux binding" perception no matter what we do or how many times I say it.

Quoted 8 lines

To rephrase things a bit, I'm happy to host anything that's multi-project, not a large number of bindings, and not a device/hardware specific binding. The device specific bindings live in the kernel tree primarily. For any new binding (foos/#foo-cell type ones), I want to see multiple users. Really for these, probably best to start with them in Linux repo (or elsewhere) and then promote them to dtschema. That gives a little flexibility in changing/abandoning them.

Quoted 4 lines

So now I am not sure what you are suggesting. Are you wanting bindings in many places (yours, Linux, U-Boot, TF-A, ...)? I am sure you are aware that if we put bindings in U-Boot they will not be considered as bindings at all, including by Linaro.

If the instances of a binding are only produced and consumed in $project, then it is perfectly fine to host the bindings in $project. It's also not something fixed. It can start out in $project and get moved out if it proves useful elsewhere.

Quoted 3 lines

To restate the problem, we need (and until your previous email I thought we had) a unified repo where cross-project, firmware-targeted bindings can be accepted and agreed by interested projects.

I'm happy to take those (assuming I'm not bombarded with 100s). So far, nothing I've seen is clearly cross project. Send me stuff that has acks from multiple projects.

Quoted 6 lines
Quoted 5 lines

Removing nodes and/or properties and where things live are mostly independent discussions. SystemReady can adapt to whatever is decided for the former. In general, IMO, when passing DT from stage N to N+1, the N+1 stage should remove things which only apply to N+2 stage. For example, kexec removes /chosen and recreates it for the next kernel.

Quoted 6 lines

Sounds good. But note that the reason for that is a conflict, since the node is used for different things - i.e. the two kernels need different settings. That is quite different from the case I am talking about, where the settings either apply globally (to interested projects) or to a single project (for all boot phases of that project). In my case, I believe there is no need to remove anything.

There is also no need to keep it. We can always decide to keep it later if there is a need. We can't decide later to remove it because someone may be relying on it.

Quoted 11 lines

Regards,
Simon

PS Zephyr is absolutely doing its own thing. Apart from the fact that it doesn't even have a runtime DT, the bindings are entirely within the project. and bear little relation to Linux bindings. I was not around for that decision, but I suspect part of the rationale was that many of the MCUs which Zephyr targets are not supported by Linux. Of course, that is not fully true and I believe it will become less true with time. Then, perhaps, in 5 years it will be Zephyr's turn to think about bindings more deeply.

Little overlap is part of it, but a large part of the reason is Zephyr needed something machine parsable and it was before we came up with dtschema. There's desire to adopt dtschema, but at this point I imagine with the first reason, there is little pressing need. They've got something that works for them.

Rob

#63 lore raw

Hi Rob,

Quoted 160 lines · Rob Herring
Quoted 149 lines · Simon Glass

Hi Rob,

Quoted 139 lines · Rob Herring
Quoted 68 lines · Simon Glass

Hi Rob,

Quoted 44 lines · Rob Herring
Quoted 34 lines · Mark Kettenis
Quoted 27 lines

From: Jassi Brar <[email protected]>
Date: Fri, 8 Sep 2023 09:37:12 -0500

Hi Simon,

Quoted 8 lines · Simon Glass

On Wed, 6 Sept 2023 at 23:20, Ilias Apalodimas

Quoted 7 lines
Quoted 6 lines
Quoted 3 lines

I beg to differ. Devicetree is more than just hardware and always has been. See, for example the /chosen and /options nodes.

There are exceptions...

Quoted 9 lines
Quoted 5 lines

We've been this over and over again and frankly it gets a bit annoying. It's called *DEVICE* tree for a reason. As Rob pointed out there are exceptions, but those made a lot of sense. Having arbitrary internal ABI stuff of various projects in the schema just defeats the definition of a spec.

Our efforts should not just be about internal ABI, but working to provide a consistent configuration system for all firmware elements.

Sure, programmatically we can pass any data/info via DT, however it is only meant to map hardware features onto data structures.

Quoted 6 lines

devicetree.org landing page
"The devicetree is a data structure for describing hardware."

devicetree-specification-v0.3.pdf Chapter-2 Line-1
"DTSpec specifies a construct called a devicetree to describe
system hardware."

Quoted 7 lines

But it doesn't say that it describes *only* hardware. And it does describe more than just hardware. There is /chosen to specify firmware configuration and there are several examples of device tree bindings that describe non-discoverable firmware interfaces in the Linux tree. And it has been that way since the days of IEEE 1275. There are also bindings describing things like the firmware partition layout.

Quoted 8 lines

Yes. The exact title for 1275[1] is: IEEE Standard for Boot (Initialization Configuration)
Firmware: Core Requirements and Practices

I see "configuration" in there. However, in the OF case, it's generally how firmware configured the hardware and what it discovered. That's a little different than telling the OS how to configure the hardware which is what we do with FDT.

For the /options node it says "The properties of this node are the system’s configuration variables."

Then there is section 7.4.4 which has a large list of options which don't seem to be so narrowly defined.

In any case, this is not quite the point, which IMO is that we need DT to support firmware use cases, whether or not a 29-year-old spec thought of it or not. In fact it is amazing to me how forward-looking Open Firmware was.

Quoted 4 lines
Quoted 2 lines

Then there's stuff that's how
to configure Linux which we try to reject.

Fair enough: Linux has user-space for that.

Yep, the question I usually ask is who needs to configure something and what determines the config. Changing things with sysfs is much easier than changing the DT provided by firmware.

Quoted 47 lines
Quoted 16 lines

Once we get into configuration of the OS/client (including u-boot), making that an ABI is a lot harder and if we use DT for that, I don't think it should be an ABI.

Quoted 10 lines
Quoted 3 lines

If we want to digress from the spec, we need the majority of developers to switch sides :) which is unlikely to happen and rightly so, imho.

It isn't even clear what the spec is. There is the document you reference above, there are the yaml files at
https://github.com/devicetree-org/dt-schema and then there are additional yaml files in the Linux tree. As far as I know it isn't written down anywhere that those are the only places where device tree bindings can live.

Quoted 8 lines

There's not any restriction.

My intention with dtschema schemas is to only have "spec level" schemas. (Stuff we'd add to DTSpec (but don't because no one wants to write specs).) Hardware specific stuff lives somewhere else. That happens to be the Linux tree because that is where all the h/w support is (nothing else is close (by far)). Last I checked, we've got ~3700 schemas and ~1500 unconverted bindings.

That scope is quite a bit narrower than I understood it to be. It seems to leave a significant gap between the Linux repo and yours.

Quoted 19 lines
Quoted 7 lines

Anyway, let's face it, there is some consensus among developers that what Simon has done in U-Boot is pushing the use of devicetree beyond the point where a significant fraction of developers thinks it makes sense. And I think I agree with that. But you can't beat him with the spec to make your point.

Quoted 6 lines

Now the devicetree is cleverly constructed such that it is possible to define additional bindings without the risk of conflicting with bindings developed by other parties. In particular if U-Boot is augmenting a device tree with properties that are prefixed with "u-boot," this isn't going to hurt an operating system that uses such an augmented device tree.

Until someone has some great idea to start using them. If the OS doesn't need something, then why pass it in the first place? What purpose does it serve? It's an invitation for someone somewhere to start using them.

Quoted 8 lines
Quoted 2 lines

The downside of keeping the nodes is it creates an ABI where there doesn't need to be one necessarily.

I'd love to get away from the idea that DT is just for the OS. We are trying to use it for firmware-to-firmware communication, too. The programs on each side of that interface may be different projects. For that, we do need to have a binding, otherwise we end up with series like this one.

I don't think DT is just for the OS, but DT for the OS is an ABI and other cases may not be. Or they just don't need to follow all the same rules. Zephyr is doing their own thing for example.

Quoted 5 lines

I don't think /options/u-boot is an ABI. AIUI, u-boot populates the node and consumes it. No ABI there (or limited to SPL to u-boot proper). I suppose a prior firmware stage could populate it, but that doesn't scale as then the prior stage has to know details of the next stage.

Quoted 8 lines

I still don't understand the distinction, or really why U-Boot (or u-boot) is different. The main reason for the /options/u-boot node is so that prior phase firmware can tell U-Boot what to do. It is similar to the /chosen node for the OS. If it is not an ABI, how can any project rely on it? It is absolutely not just U-Boot generating something for its own consumption. Where is that idea even coming from? We even have an OF_HAS_PRIOR_STAGE Kconfig option for it in U-Boot, specifically for TF-A, etc.

Quoted 2 lines

Okay, I misunderstood the intent since I thought u-boot gets its DT from the one in the u-boot tree (at least usually).

That sounds right, although it isn't the intended destination. But in any case, we want to use the same DT as is in Linux, so Linux needs to accept DTs with these properties in them.

Quoted 9 lines

Though I just looked at TF-A source and see no evidence of it doing anything with /options or /options/u-boot. I'm really not that interested in what is possible and only used by 1 board and fork somewhere. I'm interested in supporting what the community defines as best practice (e.g. DT (for OS) comes from firmware), but so far that hasn't been defined below the firmware-OS level. Yes, there's efforts addressing aspects of it, but it's not really clear to me what the high-level goals are and what projects are onboard.

So, chicken and egg? U-Boot cannot define /options until other projects add them, but they won't until U-Boot defines them?

Quoted 3 lines

Note that I did find "/secure-chosen" though. And if they want to use that, then fine, but I don't want to see it.

I wonder what that is? Is it in the bindings anywhere?

Quoted 49 lines
Quoted 44 lines

As to the scaling, I agree. That suggests we try to make things generic, i.e. have an /options node with these sorts of generic settings. Candidates for that are console and logging controls, for example. I would prefer that to /options/u-boot, as you know.

Quoted 29 lines
Quoted 16 lines
Quoted 8 lines
Quoted 7 lines

The real problem is that some folks developed a certification program that allegedly requires schema verification and now propose adding code to U-Boot that doesn't really solve any problem. My proposed solution would be to change said certification program to allow firmware to augment the device tree with properties and nodes with compatibles that are in the namespace controlled by the firmware.

Quoted 7 lines

I don't think we should decide what to do here based on said certification program. It can adapt to what's decided. Probably, the /option nodes will be stripped out or ignored for certification.

I accepted u-boot options node schema into dtschema, but now have second thoughts on that. Now I'm getting more u-boot specific (perhaps, not clear) stuff and widevine stuff internal to a TEE.

Quoted 6 lines

Where should these bindings go such that ARM / Linaro are not trying to remove them? I would be OK with moving them out somewhere else, but how are people supposed to deal with such fragmentation? My understanding was that dt-schema was an attempt to set up a neutral area where bindings could be accepted that were not just for Linux...did that change?

No change, just not communicated I guess. And again, bindings are not "just for Linux". They are hosted there because that is where *all* the hardware support is (by far). But we'll probably never get past the "Linux binding" perception no matter what we do or how many times I say it.

Quoted 8 lines

To rephrase things a bit, I'm happy to host anything that's multi-project, not a large number of bindings, and not a device/hardware specific binding. The device specific bindings live in the kernel tree primarily. For any new binding (foos/#foo-cell type ones), I want to see multiple users. Really for these, probably best to start with them in Linux repo (or elsewhere) and then promote them to dtschema. That gives a little flexibility in changing/abandoning them.

Quoted 4 lines

So now I am not sure what you are suggesting. Are you wanting bindings in many places (yours, Linux, U-Boot, TF-A, ...)? I am sure you are aware that if we put bindings in U-Boot they will not be considered as bindings at all, including by Linaro.

Quoted 4 lines

If the instances of a binding are only produced and consumed in $project, then it is perfectly fine to host the bindings in $project. It's also not something fixed. It can start out in $project and get moved out if it proves useful elsewhere.

Does Linaro agree with that, though? We have this thread which suggests not.

I really think we need to resolve this somehow. It is just causing so much churn and confusion.

How about we agree that firmware can have bindings and that the DTs with those bindings can be in Linux, with no conditions other than binding review?

Quoted 8 lines
Quoted 4 lines

To restate the problem, we need (and until your previous email I thought we had) a unified repo where cross-project, firmware-targeted bindings can be accepted and agreed by interested projects.

I'm happy to take those (assuming I'm not bombarded with 100s). So far, nothing I've seen is clearly cross project. Send me stuff that has acks from multiple projects.

Part of the disconnect here is that you seem to be assuming that each project has its own DTs and hacks them up as much as it likes, but that is not the world I advocate. I would like to have one DT which can support both firmware and OS.

Quoted 14 lines
Quoted 7 lines
Quoted 6 lines

Removing nodes and/or properties and where things live are mostly independent discussions. SystemReady can adapt to whatever is decided for the former. In general, IMO, when passing DT from stage N to N+1, the N+1 stage should remove things which only apply to N+2 stage. For example, kexec removes /chosen and recreates it for the next kernel.

Quoted 6 lines

Sounds good. But note that the reason for that is a conflict, since the node is used for different things - i.e. the two kernels need different settings. That is quite different from the case I am talking about, where the settings either apply globally (to interested projects) or to a single project (for all boot phases of that project). In my case, I believe there is no need to remove anything.

Quoted 3 lines

There is also no need to keep it. We can always decide to keep it later if there is a need. We can't decide later to remove it because someone may be relying on it.

Is this an open source project relying on it, or a closed-source one? Bear in mind that if someone removes a firmware feature and the OS doesn't boot, they will fix the firmware.

Anyway, I don't mind what people do here. I was just pointing out that using the same node for two different things seems awkward, to say the least.

Quoted 13 lines
Quoted 4 lines

Regards,
Simon

Quoted 8 lines

PS Zephyr is absolutely doing its own thing. Apart from the fact that it doesn't even have a runtime DT, the bindings are entirely within the project. and bear little relation to Linux bindings. I was not around for that decision, but I suspect part of the rationale was that many of the MCUs which Zephyr targets are not supported by Linux. Of course, that is not fully true and I believe it will become less true with time. Then, perhaps, in 5 years it will be Zephyr's turn to think about bindings more deeply.

Quoted 5 lines

Little overlap is part of it, but a large part of the reason is Zephyr needed something machine parsable and it was before we came up with dtschema. There's desire to adopt dtschema, but at this point I imagine with the first reason, there is little pressing need. They've got something that works for them.

Right, which sounds like where U-Boot started and was for years forced to stay. That is what I am trying to change.

Regards,
Simon

#64 lore raw
In reply to Simon Glass
Quoted 37 lines · Simon Glass

Hi,

Quoted 23 lines · Sughosh Ganu

Provide a way for removing certain devicetree nodes and/or properties from the devicetree. This is needed to purge certain nodes and properties which may be relevant only in U-Boot. Such nodes and properties are then removed from the devicetree before it is passed to the kernel. This ensures that the devicetree passed to the OS does not contain any non-compliant nodes and properties.

The removal of the nodes and properties is being done through an EVT_FT_FIXUP handler. I am not sure if the removal code needs to be behind any Kconfig symbol.

I have only build tested this on sandbox, and tested on qemu arm64 virt platform. This being a RFC, I have not put this through a CI run.

Sughosh Ganu (5):
dt: Provide a way to remove non-compliant nodes and properties
fwu: Add the fwu-mdata node for removal from devicetree
capsule: Add the capsule-key property for removal from devicetree
bootefi: Call the EVT_FT_FIXUP event handler
doc: Add a document for non-compliant DT node/property removal

Quoted 10 lines
 cmd/bootefi.c                                 | 18 +++++
 .../devicetree/dt_non_compliant_purge.rst     | 64 ++++++++++++++++
 drivers/fwu-mdata/fwu-mdata-uclass.c          |  5 ++
 include/dt-structs.h                          | 11 +++
 lib/Makefile                                  |  1 +
 lib/dt_purge.c                                | 73 +++++++++++++++++++
 lib/efi_loader/efi_capsule.c                  |  7 ++
 7 files changed, 179 insertions(+)
 create mode 100644 doc/develop/devicetree/dt_non_compliant_purge.rst
 create mode 100644 lib/dt_purge.c
Quoted 4 lines

What is the point of removing them? Instead, we should make sure that we upstream the bindings and encourage SoC vendors to sync them. If we remove them, no one will bother and U-Boot just becomes a dumping ground.

It's about having a defined process to remove them, rather than an ad-hoc process like one can do today to remove them. And it's about having control over the situation rather than dismissing it, as vendor can already say they used $this version of the software for validation, so patches-on-top aren't out of the question.

Signature · 1 line
Tom