Skip to contentSkip to conversation

Documentation: devicetree: root node serial-number property documentation

PATCH Superseded Paul Kocialkowski 5 participants 19 messages Mar 28, 2015 – Apr 16, 2015

Subsystems (2)

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 Documentation: devicetree: root node serial-number property documentation

---
 Documentation/devicetree/booting-without-of.txt | 4 ++++
 1 file changed, 4 insertions(+)
Documentation/devicetree/booting-without-of.txt +4 -0
index 7768518..8b055897 100644
@@ -828,6 +828,10 @@ address which can extend beyond that limit.
   name may clash with standard defined ones, you prefix them with your
   vendor name and a comma.
 
+  Additional properties for the root node:
+
+    - serial-number : a string representing the board's serial number
+
   b) The /cpus node
 
   This node is the parent of all individual CPU nodes. It doesn't
Signature · 1 line
1.9.1
#1 lore raw

PATCH 1/2 Documentation: devicetree: root node serial-number property documentation

Le samedi 28 mars 2015 ? 18:39 +0100, Paul Kocialkowski a ?crit :

Quoted 1 line

Since the merge windows on both U-Boot and Linux are now open, I'd like to attract your attention on this again.

Any comments/remarks are welcome!

Quoted 9 lines
---
 Documentation/devicetree/booting-without-of.txt | 4 ++++
 1 file changed, 4 insertions(+)
Documentation/devicetree/booting-without-of.txt +0 -0
index 7768518..8b055897 100644

Documentation/devicetree/booting-without-of.txt address which can extend beyond that limit. · line 837

Quoted 10 lines
Documentation/devicetree/booting-without-of.txt +4 -0
@@ -828,6 +828,10 @@ address which can extend beyond that limit.
   name may clash with standard defined ones, you prefix them with your
   vendor name and a comma.
 
+  Additional properties for the root node:
+
+    - serial-number : a string representing the board's serial number
+
   b) The /cpus node
 
   This node is the parent of all individual CPU nodes. It doesn't

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150414/031c416d/attachment.sig>

#2 lore raw

PATCH 2/2 arch: arm: Show the serial number from devicetree in cpuinfo

In reply to Paul Kocialkowski

This grabs the serial number shown in cpuinfo from the serial-number devicetree property in priority. When booting with ATAGs (and without device-tree), the provided number is still shown instead.

---
 arch/arm/include/asm/system_info.h |  1 +
 arch/arm/kernel/atags_parse.c      |  3 +++
 arch/arm/kernel/devtree.c          | 15 ++++++++++-----
 arch/arm/kernel/setup.c            | 11 +++++++++--
 4 files changed, 23 insertions(+), 7 deletions(-)
arch/arm/include/asm/system_info.h +1 -0
index 720ea03..3860cbd40 100644
@@ -17,6 +17,7 @@
 
 /* information about the system we're running on */
 extern unsigned int system_rev;
+extern const char *system_serial;
 extern unsigned int system_serial_low;
 extern unsigned int system_serial_high;
 extern unsigned int mem_fclk_21285;
arch/arm/kernel/atags_parse.c +3 -0
index 68c6ae0..8384818 100644
@@ -231,6 +231,9 @@ setup_machine_tags(phys_addr_t __atags_pointer, unsigned int machine_nr)
 		parse_tags(tags);
 	}
 
+	/* Serial number is stored in system_serial_low/high */
+	system_serial = NULL;
+
 	/* parse_early_param needs a boot_command_line */
 	strlcpy(boot_command_line, from, COMMAND_LINE_SIZE);
 
arch/arm/kernel/devtree.c +10 -5
index 11c54de..a82a04d 100644
@@ -26,6 +26,7 @@
 #include <asm/smp_plat.h>
 #include <asm/mach/arch.h>
 #include <asm/mach-types.h>
+#include <asm/system_info.h>
 
 
 #ifdef CONFIG_SMP
@@ -204,6 +205,9 @@ static const void * __init arch_get_next_mach(const char *const **match)
 const struct machine_desc * __init setup_machine_fdt(unsigned int dt_phys)
 {
 	const struct machine_desc *mdesc, *mdesc_best = NULL;
+	const char *prop;
+	int size;
+	unsigned long dt_root;
 
 #ifdef CONFIG_ARCH_MULTIPLATFORM
 	DT_MACHINE_START(GENERIC_DT, "Generic DT based system")
@@ -215,17 +219,14 @@ const struct machine_desc * __init setup_machine_fdt(unsigned int dt_phys)
 	if (!dt_phys || !early_init_dt_verify(phys_to_virt(dt_phys)))
 		return NULL;
 
+	dt_root = of_get_flat_dt_root();
+
 	mdesc = of_flat_dt_match_machine(mdesc_best, arch_get_next_mach);
 
 	if (!mdesc) {
-		const char *prop;
-		int size;
-		unsigned long dt_root;
-
 		early_print("\nError: unrecognized/unsupported "
 			    "device tree compatible list:\n[ ");
 
-		dt_root = of_get_flat_dt_root();
 		prop = of_get_flat_dt_prop(dt_root, "compatible", &size);
 		while (size > 0) {
 			early_print("'%s' ", prop);
@@ -243,6 +244,10 @@ const struct machine_desc * __init setup_machine_fdt(unsigned int dt_phys)
 
 	early_init_dt_scan_nodes();
 
+	/* Scan for serial number */
+	prop = of_get_flat_dt_prop(dt_root, "serial-number", &size);
+	system_serial = prop;
+
 	/* Change machine number to match the mdesc we're using */
 	__machine_arch_type = mdesc->nr;
 
arch/arm/kernel/setup.c +9 -2
index 1d60beb..69fa7ef 100644
@@ -93,6 +93,9 @@ unsigned int __atags_pointer __initdata;
 unsigned int system_rev;
 EXPORT_SYMBOL(system_rev);
 
+const char *system_serial;
+EXPORT_SYMBOL(system_serial);
+
 unsigned int system_serial_low;
 EXPORT_SYMBOL(system_serial_low);
 
@@ -1091,8 +1094,12 @@ static int c_show(struct seq_file *m, void *v)
 
 	seq_printf(m, "Hardware\t: %s\n", machine_name);
 	seq_printf(m, "Revision\t: %04x\n", system_rev);
-	seq_printf(m, "Serial\t\t: %08x%08x\n",
-		   system_serial_high, system_serial_low);
+
+	if (system_serial)
+		seq_printf(m, "Serial\t\t: %s\n", system_serial);
+	else
+		seq_printf(m, "Serial\t\t: %08x%08x\n",
+			   system_serial_high, system_serial_low);
 
 	return 0;
 }
Signature · 1 line
1.9.1
#3 lore raw

PATCH 2/2 arch: arm: Show the serial number from devicetree in cpuinfo

Quoted 107 lines · Paul Kocialkowski

This grabs the serial number shown in cpuinfo from the serial-number devicetree property in priority. When booting with ATAGs (and without device-tree), the provided number is still shown instead.

---
 arch/arm/include/asm/system_info.h |  1 +
 arch/arm/kernel/atags_parse.c      |  3 +++
 arch/arm/kernel/devtree.c          | 15 ++++++++++-----
 arch/arm/kernel/setup.c            | 11 +++++++++--
 4 files changed, 23 insertions(+), 7 deletions(-)
arch/arm/include/asm/system_info.h +1 -0
index 720ea03..3860cbd40 100644
@@ -17,6 +17,7 @@
 
 /* information about the system we're running on */
 extern unsigned int system_rev;
+extern const char *system_serial;
 extern unsigned int system_serial_low;
 extern unsigned int system_serial_high;
 extern unsigned int mem_fclk_21285;
arch/arm/kernel/atags_parse.c +3 -0
index 68c6ae0..8384818 100644
@@ -231,6 +231,9 @@ setup_machine_tags(phys_addr_t __atags_pointer, unsigned int machine_nr)
 		parse_tags(tags);
 	}
 
+	/* Serial number is stored in system_serial_low/high */
+	system_serial = NULL;
+
 	/* parse_early_param needs a boot_command_line */
 	strlcpy(boot_command_line, from, COMMAND_LINE_SIZE);
 
arch/arm/kernel/devtree.c +10 -5
index 11c54de..a82a04d 100644
@@ -26,6 +26,7 @@
 #include <asm/smp_plat.h>
 #include <asm/mach/arch.h>
 #include <asm/mach-types.h>
+#include <asm/system_info.h>
 
 
 #ifdef CONFIG_SMP
@@ -204,6 +205,9 @@ static const void * __init arch_get_next_mach(const char *const **match)
 const struct machine_desc * __init setup_machine_fdt(unsigned int dt_phys)
 {
 	const struct machine_desc *mdesc, *mdesc_best = NULL;
+	const char *prop;
+	int size;
+	unsigned long dt_root;
 
 #ifdef CONFIG_ARCH_MULTIPLATFORM
 	DT_MACHINE_START(GENERIC_DT, "Generic DT based system")
@@ -215,17 +219,14 @@ const struct machine_desc * __init setup_machine_fdt(unsigned int dt_phys)
 	if (!dt_phys || !early_init_dt_verify(phys_to_virt(dt_phys)))
 		return NULL;
 
+	dt_root = of_get_flat_dt_root();
+
 	mdesc = of_flat_dt_match_machine(mdesc_best, arch_get_next_mach);
 
 	if (!mdesc) {
-		const char *prop;
-		int size;
-		unsigned long dt_root;
-
 		early_print("\nError: unrecognized/unsupported "
 			    "device tree compatible list:\n[ ");
 
-		dt_root = of_get_flat_dt_root();
 		prop = of_get_flat_dt_prop(dt_root, "compatible", &size);
 		while (size > 0) {
 			early_print("'%s' ", prop);
@@ -243,6 +244,10 @@ const struct machine_desc * __init setup_machine_fdt(unsigned int dt_phys)
 
 	early_init_dt_scan_nodes();
 
+	/* Scan for serial number */
+	prop = of_get_flat_dt_prop(dt_root, "serial-number", &size);
+	system_serial = prop;
+
 	/* Change machine number to match the mdesc we're using */
 	__machine_arch_type = mdesc->nr;
 
arch/arm/kernel/setup.c +3 -0
index 1d60beb..69fa7ef 100644
@@ -93,6 +93,9 @@ unsigned int __atags_pointer __initdata;
 unsigned int system_rev;
 EXPORT_SYMBOL(system_rev);
 
+const char *system_serial;
+EXPORT_SYMBOL(system_serial);
+
 unsigned int system_serial_low;
 EXPORT_SYMBOL(system_serial_low);
 
@@ -1091,8 +1094,12 @@ static int c_show(struct seq_file *m, void *v)
 

arch/arm/kernel/setup.c static int c_show(struct seq_file *m, void *v) · line 1102

Quoted 10 lines
arch/arm/kernel/setup.c +6 -2
 	seq_printf(m, "Hardware\t: %s\n", machine_name);
 	seq_printf(m, "Revision\t: %04x\n", system_rev);
-	seq_printf(m, "Serial\t\t: %08x%08x\n",
-		   system_serial_high, system_serial_low);
+
+	if (system_serial)
+		seq_printf(m, "Serial\t\t: %s\n", system_serial);
+	else
+		seq_printf(m, "Serial\t\t: %08x%08x\n",
+			   system_serial_high, system_serial_low);

How about this becomes just:

	seq_printf(m, "Serial\t\t: %s\n", system_serial);

And we arrange for system_serial to always be initialised later on during boot if it's not already set from the system_serial_high and system_serial_low variables? Eg, adding in init_machine_late():

	if (!system_serial)
		system_serial = kasprintf(GFP_KERNEL, "%08x%08x",
					  system_serial_high,
					  system_serial_low);

and is there a reason we can't look for the serial number in DT at this point as well - is there a reason we might need the stringified serial number early?

Signature · 2 lines
FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up
according to speedtest.net.
#4 lore raw

PATCH 2/2 arch: arm: Show the serial number from devicetree in cpuinfo

Hi Russell, thanks for the review!

Le jeudi 16 avril 2015 ? 10:46 +0100, Russell King - ARM Linux a ?crit :

Quoted 121 lines · Paul Kocialkowski
Quoted 107 lines

This grabs the serial number shown in cpuinfo from the serial-number devicetree property in priority. When booting with ATAGs (and without device-tree), the provided number is still shown instead.

---
 arch/arm/include/asm/system_info.h |  1 +
 arch/arm/kernel/atags_parse.c      |  3 +++
 arch/arm/kernel/devtree.c          | 15 ++++++++++-----
 arch/arm/kernel/setup.c            | 11 +++++++++--
 4 files changed, 23 insertions(+), 7 deletions(-)
arch/arm/include/asm/system_info.h +1 -0
index 720ea03..3860cbd40 100644
@@ -17,6 +17,7 @@
 
 /* information about the system we're running on */
 extern unsigned int system_rev;
+extern const char *system_serial;
 extern unsigned int system_serial_low;
 extern unsigned int system_serial_high;
 extern unsigned int mem_fclk_21285;
arch/arm/kernel/atags_parse.c +3 -0
index 68c6ae0..8384818 100644
@@ -231,6 +231,9 @@ setup_machine_tags(phys_addr_t __atags_pointer, unsigned int machine_nr)
 		parse_tags(tags);
 	}
 
+	/* Serial number is stored in system_serial_low/high */
+	system_serial = NULL;
+
 	/* parse_early_param needs a boot_command_line */
 	strlcpy(boot_command_line, from, COMMAND_LINE_SIZE);
 
arch/arm/kernel/devtree.c +10 -5
index 11c54de..a82a04d 100644
@@ -26,6 +26,7 @@
 #include <asm/smp_plat.h>
 #include <asm/mach/arch.h>
 #include <asm/mach-types.h>
+#include <asm/system_info.h>
 
 
 #ifdef CONFIG_SMP
@@ -204,6 +205,9 @@ static const void * __init arch_get_next_mach(const char *const **match)
 const struct machine_desc * __init setup_machine_fdt(unsigned int dt_phys)
 {
 	const struct machine_desc *mdesc, *mdesc_best = NULL;
+	const char *prop;
+	int size;
+	unsigned long dt_root;
 
 #ifdef CONFIG_ARCH_MULTIPLATFORM
 	DT_MACHINE_START(GENERIC_DT, "Generic DT based system")
@@ -215,17 +219,14 @@ const struct machine_desc * __init setup_machine_fdt(unsigned int dt_phys)
 	if (!dt_phys || !early_init_dt_verify(phys_to_virt(dt_phys)))
 		return NULL;
 
+	dt_root = of_get_flat_dt_root();
+
 	mdesc = of_flat_dt_match_machine(mdesc_best, arch_get_next_mach);
 
 	if (!mdesc) {
-		const char *prop;
-		int size;
-		unsigned long dt_root;
-
 		early_print("\nError: unrecognized/unsupported "
 			    "device tree compatible list:\n[ ");
 
-		dt_root = of_get_flat_dt_root();
 		prop = of_get_flat_dt_prop(dt_root, "compatible", &size);
 		while (size > 0) {
 			early_print("'%s' ", prop);
@@ -243,6 +244,10 @@ const struct machine_desc * __init setup_machine_fdt(unsigned int dt_phys)
 
 	early_init_dt_scan_nodes();
 
+	/* Scan for serial number */
+	prop = of_get_flat_dt_prop(dt_root, "serial-number", &size);
+	system_serial = prop;
+
 	/* Change machine number to match the mdesc we're using */
 	__machine_arch_type = mdesc->nr;
 
arch/arm/kernel/setup.c +3 -0
index 1d60beb..69fa7ef 100644
@@ -93,6 +93,9 @@ unsigned int __atags_pointer __initdata;
 unsigned int system_rev;
 EXPORT_SYMBOL(system_rev);
 
+const char *system_serial;
+EXPORT_SYMBOL(system_serial);
+
 unsigned int system_serial_low;
 EXPORT_SYMBOL(system_serial_low);
 
@@ -1091,8 +1094,12 @@ static int c_show(struct seq_file *m, void *v)
 

arch/arm/kernel/setup.c static int c_show(struct seq_file *m, void *v) · line 1102

Quoted 10 lines
arch/arm/kernel/setup.c +6 -2
 	seq_printf(m, "Hardware\t: %s\n", machine_name);
 	seq_printf(m, "Revision\t: %04x\n", system_rev);
-	seq_printf(m, "Serial\t\t: %08x%08x\n",
-		   system_serial_high, system_serial_low);
+
+	if (system_serial)
+		seq_printf(m, "Serial\t\t: %s\n", system_serial);
+	else
+		seq_printf(m, "Serial\t\t: %08x%08x\n",
+			   system_serial_high, system_serial_low);

How about this becomes just:

Quoted 1 line
	seq_printf(m, "Serial\t\t: %s\n", system_serial);

Okay, always printing the system_serial string in cpuinfo's c_show seems cleaner and clearly states that the string way is preferred over the old one, which becomes legacy.

Quoted 4 lines

And we arrange for system_serial to always be initialised later on during boot if it's not already set from the system_serial_high and system_serial_low variables? Eg, adding in init_machine_late():

Quoted 8 lines
	if (!system_serial)
		system_serial = kasprintf(GFP_KERNEL, "%08x%08x",
					  system_serial_high,
					  system_serial_low);

and is there a reason we can't look for the serial number in DT at this point as well - is there a reason we might need the stringified serial number early?

Not that I know of -- I just thought it would be a good fit to fill-in the string in setup_machine_fdt since ATAGs were being stored in serial_low/high in setup_machine_tags (to preserve some kind of "structure parallelism" in the way the serial number is obtained).

Now if the serial from ATAG is going to end up in the system_serial string too, it doesn't make a lot of sense to keep the structure I suggested, so I agree with your proposal.

We could simply check whether the serial-number property is there (when DT is enabled at all) and fallback to using serial_low/high when it's not the case (which would perhaps be 0), at a later point in initialization. If you think init_machine_late is a good fit, then I'll go for it.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150416/5e725ceb/attachment.sig>

#5 lore raw

Re: [PATCH 2/2] arch: arm: Show the serial number from devicetree in cpuinfo

Quoted 152 lines · Paul Kocialkowski

Hi Russell, thanks for the review!

Quoted 121 lines · Russell King - ARM Linux
Quoted 107 lines · Paul Kocialkowski

This grabs the serial number shown in cpuinfo from the serial-number devicetree property in priority. When booting with ATAGs (and without device-tree), the provided number is still shown instead.

---
 arch/arm/include/asm/system_info.h |  1 +
 arch/arm/kernel/atags_parse.c      |  3 +++
 arch/arm/kernel/devtree.c          | 15 ++++++++++-----
 arch/arm/kernel/setup.c            | 11 +++++++++--
 4 files changed, 23 insertions(+), 7 deletions(-)
arch/arm/include/asm/system_info.h +1 -0
index 720ea03..3860cbd40 100644
@@ -17,6 +17,7 @@
 
 /* information about the system we're running on */
 extern unsigned int system_rev;
+extern const char *system_serial;
 extern unsigned int system_serial_low;
 extern unsigned int system_serial_high;
 extern unsigned int mem_fclk_21285;
arch/arm/kernel/atags_parse.c +3 -0
index 68c6ae0..8384818 100644
@@ -231,6 +231,9 @@ setup_machine_tags(phys_addr_t __atags_pointer, unsigned int machine_nr)
            parse_tags(tags);
    }
 
+   /* Serial number is stored in system_serial_low/high */
+   system_serial = NULL;
+
    /* parse_early_param needs a boot_command_line */
    strlcpy(boot_command_line, from, COMMAND_LINE_SIZE);
 
arch/arm/kernel/devtree.c +10 -5
index 11c54de..a82a04d 100644
@@ -26,6 +26,7 @@
 #include <asm/smp_plat.h>
 #include <asm/mach/arch.h>
 #include <asm/mach-types.h>
+#include <asm/system_info.h>
 
 
 #ifdef CONFIG_SMP
@@ -204,6 +205,9 @@ static const void * __init arch_get_next_mach(const char *const **match)
 const struct machine_desc * __init setup_machine_fdt(unsigned int dt_phys)
 {
    const struct machine_desc *mdesc, *mdesc_best = NULL;
+   const char *prop;
+   int size;
+   unsigned long dt_root;
 
 #ifdef CONFIG_ARCH_MULTIPLATFORM
    DT_MACHINE_START(GENERIC_DT, "Generic DT based system")
@@ -215,17 +219,14 @@ const struct machine_desc * __init setup_machine_fdt(unsigned int dt_phys)
    if (!dt_phys || !early_init_dt_verify(phys_to_virt(dt_phys)))
            return NULL;
 
+   dt_root = of_get_flat_dt_root();
+
    mdesc = of_flat_dt_match_machine(mdesc_best, arch_get_next_mach);
 
    if (!mdesc) {
-           const char *prop;
-           int size;
-           unsigned long dt_root;
-
            early_print("\nError: unrecognized/unsupported "
                        "device tree compatible list:\n[ ");
 
-           dt_root = of_get_flat_dt_root();
            prop = of_get_flat_dt_prop(dt_root, "compatible", &size);
            while (size > 0) {
                    early_print("'%s' ", prop);
@@ -243,6 +244,10 @@ const struct machine_desc * __init setup_machine_fdt(unsigned int dt_phys)
 
    early_init_dt_scan_nodes();
 
+   /* Scan for serial number */
+   prop = of_get_flat_dt_prop(dt_root, "serial-number", &size);
+   system_serial = prop;
+
    /* Change machine number to match the mdesc we're using */
    __machine_arch_type = mdesc->nr;
 
arch/arm/kernel/setup.c +3 -0
index 1d60beb..69fa7ef 100644
@@ -93,6 +93,9 @@ unsigned int __atags_pointer __initdata;
 unsigned int system_rev;
 EXPORT_SYMBOL(system_rev);
 
+const char *system_serial;
+EXPORT_SYMBOL(system_serial);
+
 unsigned int system_serial_low;
 EXPORT_SYMBOL(system_serial_low);
 
@@ -1091,8 +1094,12 @@ static int c_show(struct seq_file *m, void *v)
 

arch/arm/kernel/setup.c static int c_show(struct seq_file *m, void *v) · line 1102

Quoted 10 lines
arch/arm/kernel/setup.c +6 -2
    seq_printf(m, "Hardware\t: %s\n", machine_name);
    seq_printf(m, "Revision\t: %04x\n", system_rev);
-   seq_printf(m, "Serial\t\t: %08x%08x\n",
-              system_serial_high, system_serial_low);
+
+   if (system_serial)
+           seq_printf(m, "Serial\t\t: %s\n", system_serial);
+   else
+           seq_printf(m, "Serial\t\t: %08x%08x\n",
+                      system_serial_high, system_serial_low);

How about this becomes just:

Quoted 1 line
      seq_printf(m, "Serial\t\t: %s\n", system_serial);

Okay, always printing the system_serial string in cpuinfo's c_show seems cleaner and clearly states that the string way is preferred over the old one, which becomes legacy.

Quoted 4 lines

And we arrange for system_serial to always be initialised later on during boot if it's not already set from the system_serial_high and system_serial_low variables? Eg, adding in init_machine_late():

Quoted 8 lines
      if (!system_serial)
              system_serial = kasprintf(GFP_KERNEL, "%08x%08x",
                                        system_serial_high,
                                        system_serial_low);

and is there a reason we can't look for the serial number in DT at this point as well - is there a reason we might need the stringified serial number early?

Not that I know of -- I just thought it would be a good fit to fill-in the string in setup_machine_fdt since ATAGs were being stored in serial_low/high in setup_machine_tags (to preserve some kind of "structure parallelism" in the way the serial number is obtained).

Now if the serial from ATAG is going to end up in the system_serial string too, it doesn't make a lot of sense to keep the structure I suggested, so I agree with your proposal.

Quoted 5 lines

We could simply check whether the serial-number property is there (when DT is enabled at all) and fallback to using serial_low/high when it's not the case (which would perhaps be 0), at a later point in initialization. If you think init_machine_late is a good fit, then I'll go for it.

I agree. There's no reason to do this early on a flattened

#6 lore raw

PATCH 2/2 arch: arm: Show the serial number from devicetree in cpuinfo

In reply to Paul Kocialkowski
Quoted 5 lines · Paul Kocialkowski

We could simply check whether the serial-number property is there (when DT is enabled at all) and fallback to using serial_low/high when it's not the case (which would perhaps be 0), at a later point in initialization. If you think init_machine_late is a good fit, then I'll go for it.

I do. The only user of the string right now is userspace. We don't expect the serial number to change over the lifetime of the kernel, and we expect that it's initialised by the time userspace gets to run.

So, doing this at late_initcall() time seems completely sensible to me.

Signature · 2 lines
FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up
according to speedtest.net.
#7 lore raw

PATCH 1/2 Documentation: devicetree: root node serial-number property documentation

In reply to Paul Kocialkowski
Quoted 1 line · Paul Kocialkowski

I think this is a worthwhile standardization.

Quoted 20 lines
---
 Documentation/devicetree/booting-without-of.txt | 4 ++++
 1 file changed, 4 insertions(+)
Documentation/devicetree/booting-without-of.txt +4 -0
index 7768518..8b055897 100644
@@ -828,6 +828,10 @@ address which can extend beyond that limit.
   name may clash with standard defined ones, you prefix them with your
   vendor name and a comma.
 
+  Additional properties for the root node:
+
+    - serial-number : a string representing the board's serial number
+
   b) The /cpus node
 
   This node is the parent of all individual CPU nodes. It doesn't
#8 lore raw

PATCH 1/2 Documentation: devicetree: root node serial-number property documentation

Le jeudi 16 avril 2015 ? 09:56 +0200, Stefan Agner a ?crit :

Quoted 6 lines · Paul Kocialkowski
Quoted 1 line

I think this is a worthwhile standardization.

Thanks! I should also add a commit message in v2 mentioning that this is already used in open firmware and reported by lshw.

Quoted 13 lines
Quoted 13 lines
---
 Documentation/devicetree/booting-without-of.txt | 4 ++++
 1 file changed, 4 insertions(+)
Documentation/devicetree/booting-without-of.txt +0 -0
index 7768518..8b055897 100644
@@ -828,6 +828,10 @@ address which can extend beyond that limit.
   name may clash with standard defined ones, you prefix them with your
   vendor name and a comma.
 
Quoted 8 lines

Documentation/devicetree/booting-without-of.txt address which can extend beyond that limit. · line 837

Quoted 7 lines
Documentation/devicetree/booting-without-of.txt +4 -0
+  Additional properties for the root node:
+
+    - serial-number : a string representing the board's serial number
+
   b) The /cpus node
 
   This node is the parent of all individual CPU nodes. It doesn't

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150416/02095292/attachment.sig>

#9 lore raw

PATCH 1/2 Documentation: devicetree: root node serial-number property documentation

Quoted 10 lines · Paul Kocialkowski

Le jeudi 16 avril 2015 ? 09:56 +0200, Stefan Agner a ?crit :

Quoted 6 lines · Paul Kocialkowski
Quoted 1 line

I think this is a worthwhile standardization.

Thanks! I should also add a commit message in v2 mentioning that this is already used in open firmware and reported by lshw.

With that,

Quoted 23 lines
Quoted 22 lines
Quoted 21 lines
---
 Documentation/devicetree/booting-without-of.txt | 4 ++++
 1 file changed, 4 insertions(+)
Documentation/devicetree/booting-without-of.txt +4 -0
index 7768518..8b055897 100644
@@ -828,6 +828,10 @@ address which can extend beyond that limit.
   name may clash with standard defined ones, you prefix them with your
   vendor name and a comma.
 
+  Additional properties for the root node:
+
+    - serial-number : a string representing the board's serial number
+
   b) The /cpus node
 
   This node is the parent of all individual CPU nodes. It doesn't
#10 lore raw

PATCH 1/2 Documentation: devicetree: root node serial-number property documentation

Quoted 39 lines · Rob Herring
Quoted 10 lines · Paul Kocialkowski

Le jeudi 16 avril 2015 ? 09:56 +0200, Stefan Agner a ?crit :

Quoted 6 lines · Paul Kocialkowski
Quoted 1 line

I think this is a worthwhile standardization.

Thanks! I should also add a commit message in v2 mentioning that this is already used in open firmware and reported by lshw.

With that,

Quoted 20 lines
Quoted 20 lines
Quoted 20 lines

---
Documentation/devicetree/booting-without-of.txt | 4 ++++

1 file changed, 4 insertions(+)
Documentation/devicetree/booting-without-of.txt +4 -0
index 7768518..8b055897 100644
@@ -828,6 +828,10 @@ address which can extend beyond that limit.
  name may clash with standard defined ones, you prefix them with your
  vendor name and a comma.
 
+  Additional properties for the root node:
+
+    - serial-number : a string representing the board's serial number
+
  b) The /cpus node
 
Quoted 8 lines
Quoted 3 lines
Quoted 2 lines

Documentation/devicetree/booting-without-of.txt address which can extend beyond that limit. · line 837

Quoted 1 line
Documentation/devicetree/booting-without-of.txt +0 -0
  This node is the parent of all individual CPU nodes. It doesn't

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

I feel like this is a little lite either in the doc or commit message. Is the string completely arbitrary? Is it meant to match labeling on a board or case? Is this meant to be used by the kernel at all?

Signature · 3 lines
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
#11 lore raw

PATCH 1/2 Documentation: devicetree: root node serial-number property documentation

Le jeudi 16 avril 2015 ? 10:23 -0500, Kumar Gala a ?crit :

Quoted 17 lines
Quoted 17 lines · Rob Herring
Quoted 10 lines · Paul Kocialkowski

Le jeudi 16 avril 2015 ? 09:56 +0200, Stefan Agner a ?crit :

Quoted 6 lines · Paul Kocialkowski
Quoted 1 line

I think this is a worthwhile standardization.

Thanks! I should also add a commit message in v2 mentioning that this is already used in open firmware and reported by lshw.

With that,

[snip]

Quoted 3 lines

I feel like this is a little lite either in the doc or commit message. Is the string completely arbitrary? Is it meant to match labeling on a board or case? Is this meant to be used by the kernel at all?

I guess it doesn't really matter what it is, as long as it's a string. The kernel does not suggest any use for it either, it's just made available to userspace through cpuinfo.

Now if there is a particular use for this in user-space, it would have to match some standards. For instance, it Android, ro.serialno is usually a 16-bytes (plus one null byte) representation of a 64 bit number. For USB, I recall it is usually a 32 bytes string (including the null byte), but may be extended to more.

What the string actually represents depends and some SOCs have serial number bytes (I know that omap and sunxi have some for instance, that are usually used) while other devices may take it from somewhere else. In any case, it doesn't really matter and is not up to the kernel anyway since it is just passed through from the bootloader.

Thus, I don't think it's very relevant to mention it in either the documentation or the commit message.

Signature · 17 lines
Paul Kocialkowski, Replicant developer

Replicant is a fully free Android distribution running on several
devices, a free software mobile operating system putting the emphasis on
freedom and privacy/security.

Website: http://www.replicant.us/
Blog: http://blog.replicant.us/
Wiki/tracker/forums: http://redmine.replicant.us/

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150416/4fa14dc4/attachment.sig>
#12 lore raw

PATCH 1/2 Documentation: devicetree: root node serial-number property documentation

Quoted 38 lines · Paul Kocialkowski

Le jeudi 16 avril 2015 ? 10:23 -0500, Kumar Gala a ?crit :

Quoted 17 lines
Quoted 17 lines · Rob Herring
Quoted 10 lines · Paul Kocialkowski

Le jeudi 16 avril 2015 ? 09:56 +0200, Stefan Agner a ?crit :

Quoted 6 lines · Paul Kocialkowski
Quoted 1 line

I think this is a worthwhile standardization.

Thanks! I should also add a commit message in v2 mentioning that this is already used in open firmware and reported by lshw.

With that,

[snip]

Quoted 3 lines

I feel like this is a little lite either in the doc or commit message. Is the string completely arbitrary? Is it meant to match labeling on a board or case? Is this meant to be used by the kernel at all?

I guess it doesn't really matter what it is, as long as it's a string. The kernel does not suggest any use for it either, it's just made available to userspace through cpuinfo.

Now if there is a particular use for this in user-space, it would have to match some standards. For instance, it Android, ro.serialno is usually a 16-bytes (plus one null byte) representation of a 64 bit number. For USB, I recall it is usually a 32 bytes string (including the null byte), but may be extended to more.

Quoted 8 lines

What the string actually represents depends and some SOCs have serial number bytes (I know that omap and sunxi have some for instance, that are usually used) while other devices may take it from somewhere else. In any case, it doesn't really matter and is not up to the kernel anyway since it is just passed through from the bootloader.

Thus, I don't think it's very relevant to mention it in either the documentation or the commit message.

So you say ?board? in the patch, since it could be SoC specific, we should probably clean up the wording a bit. I?m just saying when someone reads this 6 months or a year later and tries to figure out what the purpose of the property is they don?t really have enough info. Putting some examples in the commit message of what possibly usages is I think a reasonable thing.

- k

Signature · 3 lines
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
#13 lore raw

PATCH 1/2 Documentation: devicetree: root node serial-number property documentation

Le jeudi 16 avril 2015 ? 10:53 -0500, Kumar Gala a ?crit :

Quoted 43 lines
Quoted 43 lines · Paul Kocialkowski

Le jeudi 16 avril 2015 ? 10:23 -0500, Kumar Gala a ?crit :

Quoted 17 lines
Quoted 17 lines · Rob Herring
Quoted 10 lines · Paul Kocialkowski

Le jeudi 16 avril 2015 ? 09:56 +0200, Stefan Agner a ?crit :

Quoted 6 lines · Paul Kocialkowski
Quoted 1 line

I think this is a worthwhile standardization.

Thanks! I should also add a commit message in v2 mentioning that this is already used in open firmware and reported by lshw.

With that,

[snip]

Quoted 3 lines

I feel like this is a little lite either in the doc or commit message. Is the string completely arbitrary? Is it meant to match labeling on a board or case? Is this meant to be used by the kernel at all?

I guess it doesn't really matter what it is, as long as it's a string. The kernel does not suggest any use for it either, it's just made available to userspace through cpuinfo.

Now if there is a particular use for this in user-space, it would have to match some standards. For instance, it Android, ro.serialno is usually a 16-bytes (plus one null byte) representation of a 64 bit number. For USB, I recall it is usually a 32 bytes string (including the null byte), but may be extended to more.

What the string actually represents depends and some SOCs have serial number bytes (I know that omap and sunxi have some for instance, that are usually used) while other devices may take it from somewhere else. In any case, it doesn't really matter and is not up to the kernel anyway since it is just passed through from the bootloader.

Quoted 5 lines
Quoted 2 lines

Thus, I don't think it's very relevant to mention it in either the documentation or the commit message.

So you say ?board? in the patch, since it could be SoC specific, we should probably clean up the wording a bit.

It really doesn't matter where the string comes from, what it contains or whether some SoCs have provisions to generate one.
I think board is one the most common words that we can use to describe devices. "devices" is also fine, I could go with it if you prefer, but I don't really see what it changes.

Quoted 4 lines

I?m just saying when someone reads this 6 months or a year later and tries to figure out what the purpose of the property is they don?t really have enough info. Putting some examples in the commit message of what possibly usages is I think a reasonable thing.

Okay, that would make sense. Still, the purpose of this is to pass the
serial number string from the bootloader to userspace. All of the
discussion about where to grab the serial from and what it should look
like is not relevant to the kernel. Instead, it's up to the bootloader
that is in charge of generating the serial string, so the discussion
should happen there.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150416/30e5c303/attachment.sig>

#14 lore raw

PATCH 1/2 Documentation: devicetree: root node serial-number property documentation

Quoted 50 lines · Paul Kocialkowski

Le jeudi 16 avril 2015 ? 10:53 -0500, Kumar Gala a ?crit :

Quoted 46 lines
Quoted 45 lines · Paul Kocialkowski

Le jeudi 16 avril 2015 ? 10:23 -0500, Kumar Gala a ?crit :

Quoted 17 lines
Quoted 17 lines · Rob Herring
Quoted 10 lines · Paul Kocialkowski

Le jeudi 16 avril 2015 ? 09:56 +0200, Stefan Agner a ?crit :

Quoted 6 lines · Paul Kocialkowski
Quoted 1 line

I think this is a worthwhile standardization.

Thanks! I should also add a commit message in v2 mentioning that this is already used in open firmware and reported by lshw.

With that,

[snip]

Quoted 3 lines

I feel like this is a little lite either in the doc or commit message. Is the string completely arbitrary? Is it meant to match labeling on a board or case? Is this meant to be used by the kernel at all?

I guess it doesn't really matter what it is, as long as it's a string. The kernel does not suggest any use for it either, it's just made available to userspace through cpuinfo.

Now if there is a particular use for this in user-space, it would have to match some standards. For instance, it Android, ro.serialno is usually a 16-bytes (plus one null byte) representation of a 64 bit number. For USB, I recall it is usually a 32 bytes string (including the null byte), but may be extended to more.

What the string actually represents depends and some SOCs have serial number bytes (I know that omap and sunxi have some for instance, that are usually used) while other devices may take it from somewhere else. In any case, it doesn't really matter and is not up to the kernel anyway since it is just passed through from the bootloader.

Thus, I don't think it's very relevant to mention it in either the documentation or the commit message.

Quoted 8 lines
Quoted 2 lines

So you say ?board? in the patch, since it could be SoC specific, we should probably clean up the wording a bit.

It really doesn't matter where the string comes from, what it contains or whether some SoCs have provisions to generate one.
I think board is one the most common words that we can use to describe devices. "devices" is also fine, I could go with it if you prefer, but I don't really see what it changes.

Lets go with device instead of board.

Quoted 6 lines
Quoted 5 lines

I?m just saying when someone reads this 6 months or a year later and tries to figure out what the purpose of the property is they don?t really have enough info. Putting some examples in the commit message of what possibly usages is I think a reasonable thing.

Quoted 6 lines

Okay, that would make sense. Still, the purpose of this is to pass the serial number string from the bootloader to userspace. All of the discussion about where to grab the serial from and what it should look like is not relevant to the kernel. Instead, it's up to the bootloader that is in charge of generating the serial string, so the discussion should happen there.

Again, I?ve got no issues with the property and its purpose to be used by user space, just saying we need to convey more of the intent via commit message or updating the doc.

- k

Signature · 3 lines
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
#15 lore raw

PATCH 1/2 Documentation: devicetree: root node serial-number property documentation

Le jeudi 16 avril 2015 ? 13:54 -0500, Kumar Gala a ?crit :

Quoted 73 lines
Quoted 49 lines · Paul Kocialkowski

Le jeudi 16 avril 2015 ? 10:53 -0500, Kumar Gala a ?crit :

Quoted 46 lines
Quoted 45 lines · Paul Kocialkowski

Le jeudi 16 avril 2015 ? 10:23 -0500, Kumar Gala a ?crit :

Quoted 17 lines
Quoted 17 lines · Rob Herring
Quoted 10 lines · Paul Kocialkowski

Le jeudi 16 avril 2015 ? 09:56 +0200, Stefan Agner a ?crit :

Quoted 6 lines · Paul Kocialkowski
Quoted 1 line

I think this is a worthwhile standardization.

Thanks! I should also add a commit message in v2 mentioning that this is already used in open firmware and reported by lshw.

With that,

[snip]

Quoted 3 lines

I feel like this is a little lite either in the doc or commit message. Is the string completely arbitrary? Is it meant to match labeling on a board or case? Is this meant to be used by the kernel at all?

I guess it doesn't really matter what it is, as long as it's a string. The kernel does not suggest any use for it either, it's just made available to userspace through cpuinfo.

Now if there is a particular use for this in user-space, it would have to match some standards. For instance, it Android, ro.serialno is usually a 16-bytes (plus one null byte) representation of a 64 bit number. For USB, I recall it is usually a 32 bytes string (including the null byte), but may be extended to more.

What the string actually represents depends and some SOCs have serial number bytes (I know that omap and sunxi have some for instance, that are usually used) while other devices may take it from somewhere else. In any case, it doesn't really matter and is not up to the kernel anyway since it is just passed through from the bootloader.

Thus, I don't think it's very relevant to mention it in either the documentation or the commit message.

Quoted 8 lines
Quoted 2 lines

So you say ?board? in the patch, since it could be SoC specific, we should probably clean up the wording a bit.

It really doesn't matter where the string comes from, what it contains or whether some SoCs have provisions to generate one.
I think board is one the most common words that we can use to describe devices. "devices" is also fine, I could go with it if you prefer, but I don't really see what it changes.

Lets go with device instead of board.

Quoted 6 lines
Quoted 5 lines

I?m just saying when someone reads this 6 months or a year later and tries to figure out what the purpose of the property is they don?t really have enough info. Putting some examples in the commit message of what possibly usages is I think a reasonable thing.

Quoted 6 lines

Okay, that would make sense. Still, the purpose of this is to pass the serial number string from the bootloader to userspace. All of the discussion about where to grab the serial from and what it should look like is not relevant to the kernel. Instead, it's up to the bootloader that is in charge of generating the serial string, so the discussion should happen there.

Quoted 3 lines

Again, I?ve got no issues with the property and its purpose to be used by user space, just saying we need to convey more of the intent via commit message or updating the doc.

Okay so I'll go with "device" and mention a few use cases and what the serial numbers look like for those. Is that satisfying to you?

Quoted 1 line

- k

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150416/840d6ef4/attachment.sig>

#16 lore raw

PATCH 1/2 Documentation: devicetree: root node serial-number property documentation

In reply to Paul Kocialkowski
Quoted 47 lines · Paul Kocialkowski

Le jeudi 16 avril 2015 ? 10:53 -0500, Kumar Gala a ?crit :

Quoted 46 lines
Quoted 45 lines · Paul Kocialkowski

Le jeudi 16 avril 2015 ? 10:23 -0500, Kumar Gala a ?crit :

Quoted 17 lines
Quoted 17 lines · Rob Herring
Quoted 10 lines · Paul Kocialkowski

Le jeudi 16 avril 2015 ? 09:56 +0200, Stefan Agner a ?crit :

Quoted 6 lines · Paul Kocialkowski
Quoted 1 line

I think this is a worthwhile standardization.

Thanks! I should also add a commit message in v2 mentioning that this is already used in open firmware and reported by lshw.

With that,

[snip]

Quoted 3 lines

I feel like this is a little lite either in the doc or commit message. Is the string completely arbitrary? Is it meant to match labeling on a board or case? Is this meant to be used by the kernel at all?

I guess it doesn't really matter what it is, as long as it's a string. The kernel does not suggest any use for it either, it's just made available to userspace through cpuinfo.

Now if there is a particular use for this in user-space, it would have to match some standards. For instance, it Android, ro.serialno is usually a 16-bytes (plus one null byte) representation of a 64 bit number. For USB, I recall it is usually a 32 bytes string (including the null byte), but may be extended to more.

What the string actually represents depends and some SOCs have serial number bytes (I know that omap and sunxi have some for instance, that are usually used) while other devices may take it from somewhere else. In any case, it doesn't really matter and is not up to the kernel anyway since it is just passed through from the bootloader.

Thus, I don't think it's very relevant to mention it in either the documentation or the commit message.

Quoted 8 lines
Quoted 2 lines

So you say ?board? in the patch, since it could be SoC specific, we should probably clean up the wording a bit.

It really doesn't matter where the string comes from, what it contains or whether some SoCs have provisions to generate one.
I think board is one the most common words that we can use to describe devices. "devices" is also fine, I could go with it if you prefer, but I don't really see what it changes.

There is already something related for SoC's in SoC bus called soc_id, see
Documentation/ABI/testing/sysfs-devices-soc

So I would rather prefer that this is more reserved for device/board serial number...

--
Stefan

#17 lore raw

PATCH 1/2 Documentation: devicetree: root node serial-number property documentation

Le jeudi 16 avril 2015 ? 21:40 +0200, Stefan Agner a ?crit :

Quoted 57 lines · Paul Kocialkowski
Quoted 47 lines

Le jeudi 16 avril 2015 ? 10:53 -0500, Kumar Gala a ?crit :

Quoted 46 lines
Quoted 45 lines · Paul Kocialkowski

Le jeudi 16 avril 2015 ? 10:23 -0500, Kumar Gala a ?crit :

Quoted 17 lines
Quoted 17 lines · Rob Herring
Quoted 10 lines · Paul Kocialkowski

Le jeudi 16 avril 2015 ? 09:56 +0200, Stefan Agner a ?crit :

Quoted 6 lines · Paul Kocialkowski
Quoted 1 line

I think this is a worthwhile standardization.

Thanks! I should also add a commit message in v2 mentioning that this is already used in open firmware and reported by lshw.

With that,

[snip]

Quoted 3 lines

I feel like this is a little lite either in the doc or commit message. Is the string completely arbitrary? Is it meant to match labeling on a board or case? Is this meant to be used by the kernel at all?

I guess it doesn't really matter what it is, as long as it's a string. The kernel does not suggest any use for it either, it's just made available to userspace through cpuinfo.

Now if there is a particular use for this in user-space, it would have to match some standards. For instance, it Android, ro.serialno is usually a 16-bytes (plus one null byte) representation of a 64 bit number. For USB, I recall it is usually a 32 bytes string (including the null byte), but may be extended to more.

What the string actually represents depends and some SOCs have serial number bytes (I know that omap and sunxi have some for instance, that are usually used) while other devices may take it from somewhere else. In any case, it doesn't really matter and is not up to the kernel anyway since it is just passed through from the bootloader.

Thus, I don't think it's very relevant to mention it in either the documentation or the commit message.

Quoted 8 lines
Quoted 2 lines

So you say ?board? in the patch, since it could be SoC specific, we should probably clean up the wording a bit.

It really doesn't matter where the string comes from, what it contains or whether some SoCs have provisions to generate one.
I think board is one the most common words that we can use to describe devices. "devices" is also fine, I could go with it if you prefer, but I don't really see what it changes.

Quoted 6 lines

There is already something related for SoC's in SoC bus called soc_id, see
Documentation/ABI/testing/sysfs-devices-soc

So I would rather prefer that this is more reserved for device/board serial number...

Again, I don't wish to define what the number represents in the kernel.

It's whatever string the bootloader sends. I know that e.g. on an omap3 device, I'll be using this with the ID bits provided by the SoC (maybe only part of them, there are 128 bits available and I like to have 64 bit serial numbers). But if you want your device to use something else (e.g. some serial number stored in an external eeprom), it's up to you to decide and in any case, that will be decided at bootloader stage.

Perhaps it would make sense to provide consistency for this among a particular family of devices (say, devices from the same manufacture or devices using the same SoC). We have already set up such a standard for Allwinner (sunxi) devices, in U-Boot.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150416/a51d6615/attachment.sig>

#18 lore raw

PATCH 1/2 Documentation: devicetree: root node serial-number property documentation

Quoted 65 lines · Paul Kocialkowski

Le jeudi 16 avril 2015 ? 21:40 +0200, Stefan Agner a ?crit :

Quoted 57 lines · Paul Kocialkowski
Quoted 47 lines

Le jeudi 16 avril 2015 ? 10:53 -0500, Kumar Gala a ?crit :

Quoted 46 lines
Quoted 45 lines · Paul Kocialkowski

Le jeudi 16 avril 2015 ? 10:23 -0500, Kumar Gala a ?crit :

Quoted 17 lines
Quoted 17 lines · Rob Herring
Quoted 10 lines · Paul Kocialkowski

Le jeudi 16 avril 2015 ? 09:56 +0200, Stefan Agner a ?crit :

Quoted 6 lines · Paul Kocialkowski
Quoted 1 line

I think this is a worthwhile standardization.

Thanks! I should also add a commit message in v2 mentioning that this is already used in open firmware and reported by lshw.

With that,

[snip]

Quoted 3 lines

I feel like this is a little lite either in the doc or commit message. Is the string completely arbitrary? Is it meant to match labeling on a board or case? Is this meant to be used by the kernel at all?

I guess it doesn't really matter what it is, as long as it's a string. The kernel does not suggest any use for it either, it's just made available to userspace through cpuinfo.

Now if there is a particular use for this in user-space, it would have to match some standards. For instance, it Android, ro.serialno is usually a 16-bytes (plus one null byte) representation of a 64 bit number. For USB, I recall it is usually a 32 bytes string (including the null byte), but may be extended to more.

What the string actually represents depends and some SOCs have serial number bytes (I know that omap and sunxi have some for instance, that are usually used) while other devices may take it from somewhere else. In any case, it doesn't really matter and is not up to the kernel anyway since it is just passed through from the bootloader.

Thus, I don't think it's very relevant to mention it in either the documentation or the commit message.

Quoted 8 lines
Quoted 2 lines

So you say ?board? in the patch, since it could be SoC specific, we should probably clean up the wording a bit.

It really doesn't matter where the string comes from, what it contains or whether some SoCs have provisions to generate one.
I think board is one the most common words that we can use to describe devices. "devices" is also fine, I could go with it if you prefer, but I don't really see what it changes.

Quoted 6 lines

There is already something related for SoC's in SoC bus called soc_id, see
Documentation/ABI/testing/sysfs-devices-soc

So I would rather prefer that this is more reserved for device/board serial number...

Quoted 8 lines

Again, I don't wish to define what the number represents in the kernel.

It's whatever string the bootloader sends. I know that e.g. on an omap3 device, I'll be using this with the ID bits provided by the SoC (maybe only part of them, there are 128 bits available and I like to have 64 bit serial numbers). But if you want your device to use something else (e.g. some serial number stored in an external eeprom), it's up to you to decide and in any case, that will be decided at bootloader stage.

For that ID the soc_id attribute is actually much more appropriate.

But if anybody wants to use that as serial-number, fine. I'm not saying we should prohibit that.

Quoted 4 lines

Perhaps it would make sense to provide consistency for this among a particular family of devices (say, devices from the same manufacture or devices using the same SoC). We have already set up such a standard for Allwinner (sunxi) devices, in U-Boot.

That is actually exactly my concern. We (Toradex) are a ARM module provider which populate SoC's of different vendors. However, we would like to keep consistency across modules. If a SoC vendor mandates to use the field for the SoC serial number, we end up with different serial numbers in that field.

IMHO, the top level serial-number should be used for the board/device.

But if you don't like to define that, it is ok for me. But maybe we could just mention soc_id as a possible alternative for SoC serial numbers in the documentation?

--
Stefan