Skip to contentSkip to conversation

Introduce the /proc/socinfo and use it to export OMAP data

PATCH In review Eduardo Valentin 10 participants 38 messages May 11, 2010 – Mar 3, 2011

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

v5 cover Introduce the /proc/socinfo and use it to export OMAP data

Hello all,

Here is the version 5 of the change to export OMAP data to userspace (name, revision, id code, production id and die id).

Basically, this version is still attempting to create a new file under /proc. It is the /proc/socinfo, which should be used to export bits which are SoC specific (not CPU related, nor machine related).

So, differences between previous version are:
- merged patch 02/04 with 03/04 to avoid compilation breakages.
- simplified the seq_file usage by using the single_open and single_release functions
- exported a function to register a seq_operation .show callback
- adapted the changes accordingly

As usual, comments are welcome.

BR,

-------------------------------------------------------------------------------
v4:

Here is the patch set to export OMAP id code, production id and die id. The history of this change is as follows:

1. First attempt tried adding those data under sysfs node. Original patch by Peter De Schrijver [1]. Then, it was suggested to move it to debugfs, which was rejected as this info is actually needed in production systems.

2. Then it has been moved to /proc/cpuinfo [2]. Then, it was suggested to do not add this kind of info there, as it is not really CPU data.

Now, I'm sending this version which will introduce first the /proc/socinfo. Then, following patches will add OMAP data into that node. And finally, will add OMAP id, production and die id code.

Just for reference, I'm also pasting the previous 0/4 message:

-------------------------------------------------------------------------------
v3:
I'm resending this series with minor change in the subject prefix of patch 4/4. Removed the PM: prefix. Everything else is same. So, I kept the v3 prefix as well.

And now v3 of this series. Basically a minor change wrt string manipulation. No need to use strlen in so many places. Previous log for reference:

-------------------------------------------------------------------------------
v2:

Here is the version 2 of this series. Now die id is protected using same x86 protection mechanism to hide x86 product number. Besides, a compilation Kconfig option has been added for DIE ID as well.

Here is previous PATCH 0/4 message:

-------------------------------------------------------------------------------
v1:

This series is to continue what has been discussed several weeks ago wrt IDCODE patch. Original patch was made by Peter and discussion is here:
http://www.mail-archive.com/[email protected]/msg17553.html

So, the conclusion was that IDCODE info is useful even in production systems, and for that debugfs is not a good choice to export it. One suggestion was to add it under /proc/cpuinfo. However this entry nowadays exports only ARM related information.

So this series does the trick by extending the ARM /proc/cpuinfo to include soc info data. There are a few ways to add a hook for soc specific data. But I've decided to implement it via the simplest way I found. Basically it is same thing which is done for system_rev, system_serial_low and system_serial_high. Then, now we have system_soc_info, which is printed only if there is something useful there.

As usual, comments are welcome.

-------------------------------------------------------------------------------
BR,

Eduardo Valentin (3):
procfs: Introduce socinfo under /proc
OMAP: export OMAP info under /proc/socinfo
OMAP3: export chip IDCODE, Production ID and Die ID

 Documentation/filesystems/proc.txt  |    1 +
 Documentation/kernel-parameters.txt |    2 +
 arch/arm/Kconfig                    |    1 +
 arch/arm/mach-omap1/id.c            |   31 ++++++++++---
 arch/arm/mach-omap2/Kconfig         |   10 ++++
 arch/arm/mach-omap2/id.c            |   65 +++++++++++++++++++++++++---
 fs/proc/Kconfig                     |    7 +++
 fs/proc/Makefile                    |    1 +
 fs/proc/socinfo.c                   |   80 +++++++++++++++++++++++++++++++++++
 include/linux/socinfo.h             |   17 +++++++
 10 files changed, 202 insertions(+), 13 deletions(-)
 create mode 100644 fs/proc/socinfo.c
 create mode 100644 include/linux/socinfo.h
#1 lore raw

PATCH v5 1/3 procfs: Introduce socinfo under /proc

From: Eduardo Valentin <[email protected]>

This patch introduce the /proc/socinfo node. Its purpose is to export System on Chip information and specific bits.

---
 Documentation/filesystems/proc.txt |    1 +
 fs/proc/Kconfig                    |    7 +++
 fs/proc/Makefile                   |    1 +
 fs/proc/socinfo.c                  |   80 ++++++++++++++++++++++++++++++++++++
 include/linux/socinfo.h            |   17 ++++++++
 5 files changed, 106 insertions(+), 0 deletions(-)
 create mode 100644 fs/proc/socinfo.c
 create mode 100644 include/linux/socinfo.h
Documentation/filesystems/proc.txt +1 -0
index a4f30fa..039bcb7 100644
@@ -415,6 +415,7 @@ Table 1-5: Kernel info in /proc
  bus         Directory containing bus specific information     
  cmdline     Kernel command line                               
  cpuinfo     Info about the CPU                                
+ socinfo     Info about the System on Chip                     
  devices     Available devices (block and character)           
  dma         Used DMS channels                                 
  filesystems Supported filesystems                             
fs/proc/Kconfig +7 -0
index 50f8f06..e683d62 100644
@@ -67,3 +67,10 @@ config PROC_PAGE_MONITOR
 	  /proc/pid/smaps, /proc/pid/clear_refs, /proc/pid/pagemap,
 	  /proc/kpagecount, and /proc/kpageflags. Disabling these
           interfaces will reduce the size of the kernel by approximately 4kb.
+
+config PROC_SOCINFO
+ 	default y
+	depends on PROC_FS
+	bool "Enable /proc/socinfo" if EMBEDDED
+ 	help
+	  Say Y here if you need to see information about the your System on Chip.
fs/proc/Makefile +1 -0
index 11a7b5c..7757d44 100644
@@ -26,3 +26,4 @@ proc-$(CONFIG_PROC_VMCORE)	+= vmcore.o
 proc-$(CONFIG_PROC_DEVICETREE)	+= proc_devtree.o
 proc-$(CONFIG_PRINTK)	+= kmsg.o
 proc-$(CONFIG_PROC_PAGE_MONITOR)	+= page.o
+proc-$(CONFIG_PROC_SOCINFO)	+= socinfo.o
fs/proc/socinfo.c new file +80 -0

80 lines not on this page · raw message

include/linux/socinfo.h new file +17 -0
new file mode 100644
index 0000000..aa870f1
@@ -0,0 +1,17 @@
+/*
+ *  include/linux/socinfo.h
+ *
+ *  Copyright (C) 2010 Nokia Corporation
+ *
+ *  Contact: Eduardo Valentin <[email protected]>
+ *
+ *  proc socinfo file
+ */
+
+#ifndef __SOCINFO_H
+#define __SOCINFO_H
+
+#include <linux/seq_file.h>
+
+void register_socinfo_show(int (*show)(struct seq_file *, void *), void *data);
+#endif
Signature · 1 line
1.7.0.4.361.g8b5fe.dirty
#2 lore raw

PATCH v5 2/3 OMAP: export OMAP info under /proc/socinfo

In reply to Eduardo Valentin

From: Eduardo Valentin <[email protected]>

Export OMAP name and rev under /proc/socinfo node.

---
 arch/arm/Kconfig         |    1 +
 arch/arm/mach-omap1/id.c |   31 ++++++++++++++++++++++++-------
 arch/arm/mach-omap2/id.c |   32 ++++++++++++++++++++++++++------
 3 files changed, 51 insertions(+), 13 deletions(-)
arch/arm/Kconfig +1 -0
index 92622eb..fbd3c50 100644
@@ -326,6 +326,7 @@ config ARCH_EP93XX
 	select COMMON_CLKDEV
 	select ARCH_REQUIRE_GPIOLIB
 	select ARCH_HAS_HOLES_MEMORYMODEL
+	select PROC_SOC_INFO
 	help
 	  This enables support for the Cirrus EP93xx series of CPUs.
 
arch/arm/mach-omap1/id.c +24 -7
index a0e3560..ef3caf1 100644
@@ -15,6 +15,8 @@
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/io.h>
+#include <linux/socinfo.h>
+#include <linux/seq_file.h>
 #include <plat/cpu.h>
 
 #define OMAP_DIE_ID_0		0xfffe1800
@@ -118,9 +120,21 @@ static u8 __init omap_get_die_rev(void)
 	return die_rev;
 }
 
+#define SOCINFO_SZ		128
+
+static int omap1_socinfo_show(struct seq_file *m, void *v)
+{
+	char *socinfo = v;
+
+	seq_printf(m, "SoC\t: %s\n", socinfo);
+
+	return 0;
+}
+
 void __init omap_check_revision(void)
 {
-	int i;
+	int i, sz;
+	char socinfo[SOCINFO_SZ];
 	u16 jtag_id;
 	u8 die_rev;
 	u32 omap_id;
@@ -194,11 +208,14 @@ void __init omap_check_revision(void)
 		printk(KERN_INFO "Unknown OMAP cpu type: 0x%02x\n", cpu_type);
 	}
 
-	printk(KERN_INFO "OMAP%04x", omap_revision >> 16);
+	sz = snprintf(socinfo, SOCINFO_SZ, "OMAP%04x", omap_revision >> 16);
 	if ((omap_revision >> 8) & 0xff)
-		printk(KERN_INFO "%x", (omap_revision >> 8) & 0xff);
-	printk(KERN_INFO " revision %i handled as %02xxx id: %08x%08x\n",
-	       die_rev, omap_revision & 0xff, system_serial_low,
-	       system_serial_high);
+		snprintf(socinfo + sz, SOCINFO_SZ - sz, "%x",
+						(omap_revision >> 8) & 0xff);
+	pr_info("%s revision %i handled as %02xxx id: %08x%08x\n",
+		socinfo, die_rev, omap_revision & 0xff, system_serial_low,
+		system_serial_high);
+
+	/* register function to show SoC info under /proc/socinfo */
+	register_socinfo_show(omap1_socinfo_show, kstrdup(socinfo, GFP_KERNEL));
 }
-
arch/arm/mach-omap2/id.c +26 -6
index 37b8a1a..b67486b 100644
@@ -18,6 +18,8 @@
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/io.h>
+#include <linux/socinfo.h>
+#include <linux/seq_file.h>
 
 #include <asm/cputype.h>
 
@@ -101,10 +103,12 @@ static struct omap_id omap_ids[] __initdata = {
 
 static void __iomem *tap_base;
 static u16 tap_prod_id;
+#define SOCINFO_SZ		128
+static char socinfo[SOCINFO_SZ];
 
 void __init omap24xx_check_revision(void)
 {
-	int i, j;
+	int i, j, sz;
 	u32 idcode, prod_id;
 	u16 hawkeye;
 	u8  dev_type, rev;
@@ -152,10 +156,11 @@ void __init omap24xx_check_revision(void)
 		j = i;
 	}
 
-	pr_info("OMAP%04x", omap_rev() >> 16);
+	sz = snprintf(socinfo, SOCINFO_SZ, "OMAP%04x", omap_rev() >> 16);
 	if ((omap_rev() >> 8) & 0x0f)
-		pr_info("ES%x", (omap_rev() >> 12) & 0xf);
-	pr_info("\n");
+		snprintf(socinfo + sz, SOCINFO_SZ - sz, "ES%x",
+						(omap_rev() >> 12) & 0xf);
+	pr_info("%s\n", socinfo);
 }
 
 #define OMAP3_CHECK_FEATURE(status,feat)				\
@@ -286,7 +291,9 @@ void __init omap4_check_revision(void)
 	if ((hawkeye == 0xb852) && (rev == 0x0)) {
 		omap_revision = OMAP4430_REV_ES1_0;
 		omap_chip.oc |= CHIP_IS_OMAP4430ES1;
-		pr_info("OMAP%04x %s\n", omap_rev() >> 16, rev_name);
+		snprintf(socinfo, SOCINFO_SZ, "OMAP%04x %s\n",
+				omap_rev() >> 16, rev_name);
+		pr_info("%s\n", socinfo);
 		return;
 	}
 
@@ -356,7 +363,8 @@ void __init omap3_cpuinfo(void)
 	}
 
 	/* Print verbose information */
-	pr_info("%s ES%s (", cpu_name, cpu_rev);
+	snprintf(socinfo, SOCINFO_SZ, "%s ES%s", cpu_name, cpu_rev);
+	pr_info("%s (", socinfo);
 
 	OMAP3_SHOW_FEATURE(l2cache);
 	OMAP3_SHOW_FEATURE(iva);
@@ -368,6 +376,15 @@ void __init omap3_cpuinfo(void)
 	printk(")\n");
 }
 
+static int omap_socinfo_show(struct seq_file *m, void *v)
+{
+	char *socinfop = v;
+
+	seq_printf(m, "SoC\t: %s\n", socinfop);
+
+	return 0;
+}
+
 /*
  * Try to detect the exact revision of the omap we're running on
  */
@@ -391,6 +408,9 @@ void __init omap2_check_revision(void)
 		pr_err("OMAP revision unknown, please fix!\n");
 	}
 
+	/* also register call back to report SoC data under /proc/socinfo */
+	register_socinfo_show(omap_socinfo_show, socinfo);
+
 	/*
 	 * OK, now we know the exact revision. Initialize omap_chip bits
 	 * for powerdowmain and clockdomain code.
Signature · 1 line
1.7.0.4.361.g8b5fe.dirty
#3 lore raw

Re: [PATCHv5 2/3] OMAP: export OMAP info under /proc/socinfo

Eduardo Valentin had written, on 05/11/2010 09:15 AM, the following:

Quoted 11 lines

From: Eduardo Valentin <[email protected]>

Export OMAP name and rev under /proc/socinfo node.

---
 arch/arm/Kconfig         |    1 +
 arch/arm/mach-omap1/id.c |   31 ++++++++++++++++++++++++-------
 arch/arm/mach-omap2/id.c |   32 ++++++++++++++++++++++++++------
 3 files changed, 51 insertions(+), 13 deletions(-)

[..]

Quoted 4 lines
arch/arm/mach-omap2/id.c +0 -0
index 37b8a1a..b67486b 100644

[..]

arch/arm/mach-omap2/id.c void __init omap3_cpuinfo(void) · line 370

Quoted 10 lines
arch/arm/mach-omap2/id.c +2 -1
@@ -356,7 +363,8 @@ void __init omap3_cpuinfo(void)
 	}
 
 	/* Print verbose information */
-	pr_info("%s ES%s (", cpu_name, cpu_rev);
+	snprintf(socinfo, SOCINFO_SZ, "%s ES%s", cpu_name, cpu_rev);
+	pr_info("%s (", socinfo);
 
 	OMAP3_SHOW_FEATURE(l2cache);
 	OMAP3_SHOW_FEATURE(iva);

Just a minor comment -> is it a good idea to pushin the features to SOC info as well? currently this is being displayed at bootlog and not beyond.. might be a better approach to move it into socinfo..

[..]

Signature · 2 lines
Regards,
Nishanth Menon
#4 lore raw

Re: [PATCHv5 2/3] OMAP: export OMAP info under /proc/socinfo

Hello Nishanth,

Quoted 28 lines · ext Nishanth Menon

Eduardo Valentin had written, on 05/11/2010 09:15 AM, the following:

Quoted 11 lines

From: Eduardo Valentin <[email protected]>

Export OMAP name and rev under /proc/socinfo node.

---
 arch/arm/Kconfig         |    1 +
 arch/arm/mach-omap1/id.c |   31 ++++++++++++++++++++++++-------
 arch/arm/mach-omap2/id.c |   32 ++++++++++++++++++++++++++------
 3 files changed, 51 insertions(+), 13 deletions(-)

[..]

Quoted 4 lines
arch/arm/mach-omap2/id.c +0 -0
index 37b8a1a..b67486b 100644

[..]

Quoted 8 lines
arch/arm/mach-omap2/id.c +2 -1
@@ -356,7 +363,8 @@ void __init omap3_cpuinfo(void)
 	}
 
 	/* Print verbose information */
-	pr_info("%s ES%s (", cpu_name, cpu_rev);
+	snprintf(socinfo, SOCINFO_SZ, "%s ES%s", cpu_name, cpu_rev);
+	pr_info("%s (", socinfo);
 
Quoted 5 lines

arch/arm/mach-omap2/id.c void __init omap3_cpuinfo(void) · line 370

Quoted 2 lines
arch/arm/mach-omap2/id.c +0 -0
 	OMAP3_SHOW_FEATURE(l2cache);
 	OMAP3_SHOW_FEATURE(iva);

Just a minor comment -> is it a good idea to pushin the features to SOC info as well? currently this is being displayed at bootlog and not beyond.. might be a better approach to move it into socinfo..

Yeah. I would expect that someone would ask this. When I was writing this part I also thought that would be nice to just duplicate all info which is printed into kernel log buffer. But then I decided to proceed with only the info we are needing from userspace. If you think that would be useful to know those as well, then why not adding them.

Quoted 7 lines

[..]

Signature · 2 lines
Regards,
Nishanth Menon
#5 lore raw

Re: [PATCHv5 2/3] OMAP: export OMAP info under /proc/socinfo

Hello,

Quoted 37 lines · Valentin Eduardo (Nokia-D/Helsinki)

Hello Nishanth,

Quoted 28 lines · ext Nishanth Menon

Eduardo Valentin had written, on 05/11/2010 09:15 AM, the following:

Quoted 11 lines

From: Eduardo Valentin <[email protected]>

Export OMAP name and rev under /proc/socinfo node.

---
 arch/arm/Kconfig         |    1 +
 arch/arm/mach-omap1/id.c |   31 ++++++++++++++++++++++++-------
 arch/arm/mach-omap2/id.c |   32 ++++++++++++++++++++++++++------
 3 files changed, 51 insertions(+), 13 deletions(-)

[..]

Quoted 4 lines
arch/arm/mach-omap2/id.c +0 -0
index 37b8a1a..b67486b 100644

[..]

Quoted 8 lines
arch/arm/mach-omap2/id.c +2 -1
@@ -356,7 +363,8 @@ void __init omap3_cpuinfo(void)
 	}
 
 	/* Print verbose information */
-	pr_info("%s ES%s (", cpu_name, cpu_rev);
+	snprintf(socinfo, SOCINFO_SZ, "%s ES%s", cpu_name, cpu_rev);
+	pr_info("%s (", socinfo);
 
Quoted 5 lines

arch/arm/mach-omap2/id.c void __init omap3_cpuinfo(void) · line 370

Quoted 2 lines
arch/arm/mach-omap2/id.c +0 -0
 	OMAP3_SHOW_FEATURE(l2cache);
 	OMAP3_SHOW_FEATURE(iva);

Just a minor comment -> is it a good idea to pushin the features to SOC info as well? currently this is being displayed at bootlog and not beyond.. might be a better approach to move it into socinfo..

Quoted 5 lines

Yeah. I would expect that someone would ask this. When I was writing this part I also thought that would be nice to just duplicate all info which is printed into kernel log buffer. But then I decided to proceed with only the info we are needing from userspace. If you think that would be useful to know those as well, then why not adding them.

As discussed in #linux-omap IRC channel, we agreed that it would be nice and useful to export the OMAP FEATURES under this interface. But as the code to detect omap features is under re-work currently, for now we are going to leave it out of this patch set.

Quoted 13 lines
Quoted 8 lines

[..]

Signature · 2 lines
Regards,
Nishanth Menon

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

#6 lore raw

Re: [PATCHv5 2/3] OMAP: export OMAP info under /proc/socinfo

Eduardo Valentin had written, on 05/12/2010 07:34 AM, the following:

Quoted 45 lines

Hello,

Quoted 36 lines · Valentin Eduardo (Nokia-D/Helsinki)

Hello Nishanth,

Quoted 28 lines · ext Nishanth Menon

Eduardo Valentin had written, on 05/11/2010 09:15 AM, the following:

Quoted 11 lines

From: Eduardo Valentin <[email protected]>

Export OMAP name and rev under /proc/socinfo node.

---
 arch/arm/Kconfig         |    1 +
 arch/arm/mach-omap1/id.c |   31 ++++++++++++++++++++++++-------
 arch/arm/mach-omap2/id.c |   32 ++++++++++++++++++++++++++------
 3 files changed, 51 insertions(+), 13 deletions(-)

[..]

Quoted 4 lines
arch/arm/mach-omap2/id.c +0 -0
index 37b8a1a..b67486b 100644

[..]

Quoted 8 lines
arch/arm/mach-omap2/id.c +2 -1
@@ -356,7 +363,8 @@ void __init omap3_cpuinfo(void)
 	}
 
 	/* Print verbose information */
-	pr_info("%s ES%s (", cpu_name, cpu_rev);
+	snprintf(socinfo, SOCINFO_SZ, "%s ES%s", cpu_name, cpu_rev);
+	pr_info("%s (", socinfo);
 
Quoted 5 lines

arch/arm/mach-omap2/id.c void __init omap3_cpuinfo(void) · line 370

Quoted 2 lines
arch/arm/mach-omap2/id.c +0 -0
 	OMAP3_SHOW_FEATURE(l2cache);
 	OMAP3_SHOW_FEATURE(iva);

Just a minor comment -> is it a good idea to pushin the features to SOC info as well? currently this is being displayed at bootlog and not beyond.. might be a better approach to move it into socinfo..

Quoted 5 lines

Yeah. I would expect that someone would ask this. When I was writing this part I also thought that would be nice to just duplicate all info which is printed into kernel log buffer. But then I decided to proceed with only the info we are needing from userspace. If you think that would be useful to know those as well, then why not adding them.

Quoted 4 lines

As discussed in #linux-omap IRC channel, we agreed that it would be nice and useful to export the OMAP FEATURES under this interface. But as the code to detect omap features is under re-work currently, for now we are going to leave it out of this patch set.

Agreed. other than this, I dont see an issue :) thanks for the work..

Quoted 11 lines
Quoted 11 lines
Quoted 6 lines

[..]

Signature · 2 lines
Regards,
Nishanth Menon

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

Signature · 2 lines
Regards,
Nishanth Menon
#7 lore raw

PATCH v5 3/3 OMAP3: export chip IDCODE, Production ID and Die ID

In reply to Eduardo Valentin

From: Eduardo Valentin <[email protected]>

This patch exports the OMAP3 IDCODE and Production ID to userspace via /proc/socinfo.

Die ID is also exported depending on what users pass as kernel parameter. It is same protection mechanism made for x86 product number. So, if user passes "omap3_die_id" parameter, it will append die id code into /proc/socinfo as well. A Kconfig option has been added as well, so it can be configurable during compilation time.

This can be used to track down silicon specific issues. The info is exported via /proc/socinfo because then it can be possible to include this in corematic dumps.

This is based on Peter De Schrijver patch, which export same info via sysfs.

---
 Documentation/kernel-parameters.txt |    2 ++
 arch/arm/mach-omap2/Kconfig         |   10 ++++++++++
 arch/arm/mach-omap2/id.c            |   35 ++++++++++++++++++++++++++++++++++-
 3 files changed, 46 insertions(+), 1 deletions(-)
Documentation/kernel-parameters.txt +2 -0
index 839b21b..8010cfb 100644
@@ -1809,6 +1809,8 @@ and is between 256 and 4096 characters. It is defined in the file
 			waiting for the ACK, so if this is set too high
 			interrupts *may* be lost!
 
+	omap3_die_id	[OMAP] Append DIE ID info under /proc/socinfo
+
 	omap_mux=	[OMAP] Override bootloader pin multiplexing.
 			Format: <mux_mode0.mode_name=value>...
 			For example, to override I2C bus2:
arch/arm/mach-omap2/Kconfig +10 -0
index 2455dcc..fb8abed 100644
@@ -169,3 +169,13 @@ config OMAP3_SDRC_AC_TIMING
 	  wish to say no.  Selecting yes without understanding what is
 	  going on could result in system crashes;
 
+config OMAP3_EXPORT_DIE_ID
+	bool "Export DIE ID code under /proc/socinfo"
+	depends on ARCH_OMAP3
+	default n
+	help
+	  Say Y here if you need DIE ID code to be exported via /proc/socinfo
+	  in production systems. You will need also to explicitly flag it by
+	  appending the "omap3_die_id" parameter to your boot command line.
+
+
arch/arm/mach-omap2/id.c +34 -1
index b67486b..b4f5630 100644
@@ -78,6 +78,10 @@ EXPORT_SYMBOL(omap_type);
 /*----------------------------------------------------------------------------*/
 
 #define OMAP_TAP_IDCODE		0x0204
+#define OMAP_TAP_PROD_ID_0      0x0208
+#define OMAP_TAP_PROD_ID_1      0x020c
+#define OMAP_TAP_PROD_ID_2      0x0210
+#define OMAP_TAP_PROD_ID_3      0x0214
 #define OMAP_TAP_DIE_ID_0	0x0218
 #define OMAP_TAP_DIE_ID_1	0x021C
 #define OMAP_TAP_DIE_ID_2	0x0220
@@ -306,6 +310,7 @@ void __init omap4_check_revision(void)
 
 void __init omap3_cpuinfo(void)
 {
+	int sz;
 	u8 rev = GET_OMAP_REVISION();
 	char cpu_name[16], cpu_rev[16];
 
@@ -363,7 +368,7 @@ void __init omap3_cpuinfo(void)
 	}
 
 	/* Print verbose information */
-	snprintf(socinfo, SOCINFO_SZ, "%s ES%s", cpu_name, cpu_rev);
+	sz = snprintf(socinfo, SOCINFO_SZ, "%s ES%s", cpu_name, cpu_rev);
 	pr_info("%s (", socinfo);
 
 	OMAP3_SHOW_FEATURE(l2cache);
@@ -374,7 +379,35 @@ void __init omap3_cpuinfo(void)
 	OMAP3_SHOW_FEATURE(192mhz_clk);
 
 	printk(")\n");
+
+	/* Append OMAP3 IDCODE and Production ID to /proc/socinfo */
+	snprintf(socinfo + sz, SOCINFO_SZ - sz,
+			"\nIDCODE\t: %08x\nPr. ID\t: %08x %08x %08x %08x",
+			read_tap_reg(OMAP_TAP_IDCODE),
+			read_tap_reg(OMAP_TAP_PROD_ID_0),
+			read_tap_reg(OMAP_TAP_PROD_ID_1),
+			read_tap_reg(OMAP_TAP_PROD_ID_2),
+			read_tap_reg(OMAP_TAP_PROD_ID_3));
+
+}
+
+#ifdef CONFIG_OMAP3_EXPORT_DIE_ID
+static int __init omap3_die_id_setup(char *s)
+{
+	int sz;
+
+	sz = strlen(socinfo);
+	snprintf(socinfo + sz, SOCINFO_SZ - sz,
+			"\nDie ID\t: %08x %08x %08x %08x",
+			read_tap_reg(OMAP_TAP_DIE_ID_0),
+			read_tap_reg(OMAP_TAP_DIE_ID_1),
+			read_tap_reg(OMAP_TAP_DIE_ID_2),
+			read_tap_reg(OMAP_TAP_DIE_ID_3));
+
+	return 1;
 }
+__setup("omap3_die_id", omap3_die_id_setup);
+#endif
 
 static int omap_socinfo_show(struct seq_file *m, void *v)
 {
Signature · 1 line
1.7.0.4.361.g8b5fe.dirty
#8 lore raw
In reply to Eduardo Valentin
Quoted 7 lines · On Tue, 11 May 2010 17:15:28 +0300 Eduardo Valentin…

Here is the version 5 of the change to export OMAP data to userspace (name, revision, id code, production id and die id).

Basically, this version is still attempting to create a new file under /proc. It is the /proc/socinfo, which should be used to export bits which are SoC specific (not CPU related, nor machine related).

Quoted 7 lines

So, differences between previous version are:
- merged patch 02/04 with 03/04 to avoid compilation breakages.
- simplified the seq_file usage by using the single_open and single_release functions
- exported a function to register a seq_operation .show callback
- adapted the changes accordingly

As usual, comments are welcome.

This changelog would be rather more useful if it was to show us some sample output from /proc/socinfo, perhaps accompanied with an explanation for people who aren't familar with this area of the kernel.

I'd have thought that sysfs was an appropriate place for this info. Perhaps under /sys/devices/platform? Or /sys/devices/system? Peter's original patch didn't tell us where in the hierarchy the file was placed, nor why it was placed there, not what its contents look like. But crappy changelogs are the norm :(

The objections stated in this email:
http://www.mail-archive.com/linux-omap at vger.kernel.org/msg17630.html appear to still apply to this version of the patches?

Kevin didn't explain why he said "Please export these via debugfs". Tony didn't clearly explain why he said "I don't think we want to export unique chip identifiers by default".

So apart from having certain opinions regarding communication skills and wondering why people cc me on stuff without vaguely providing enough info for me to understand what they're thinking, I don't know what to make of it all :(

#9 lore raw

Hello Andrew,

Quoted 16 lines · Andrew Morton
Quoted 13 lines · On Tue, 11 May 2010 17:15:28 +0300 Eduardo Valentin…

Here is the version 5 of the change to export OMAP data to userspace (name, revision, id code, production id and die id).

Basically, this version is still attempting to create a new file under /proc. It is the /proc/socinfo, which should be used to export bits which are SoC specific (not CPU related, nor machine related).

So, differences between previous version are:
- merged patch 02/04 with 03/04 to avoid compilation breakages.
- simplified the seq_file usage by using the single_open and single_release functions
- exported a function to register a seq_operation .show callback
- adapted the changes accordingly

Quoted 5 lines
Quoted 1 line

As usual, comments are welcome.

This changelog would be rather more useful if it was to show us some sample output from /proc/socinfo, perhaps accompanied with an explanation for people who aren't familar with this area of the kernel.

Indeed. So, after applying this series, one example of output would be, in case of OMAP3:

/ # cat /proc/socinfo
SoC : OMAP3430 ES3.1
IDCODE : 4b7ae02f
Pr. ID : 00000000 00000000 000000cc cafeb7ae

These ids can be used, for instance, to track down silicon specific issues.

Quoted 6 lines

I'd have thought that sysfs was an appropriate place for this info. Perhaps under /sys/devices/platform? Or /sys/devices/system? Peter's original patch didn't tell us where in the hierarchy the file was placed, nor why it was placed there, not what its contents look like. But crappy changelogs are the norm :(

IIRC, originally, Peter's patch was creating /sys/power/idcode. The content was very similar:

Nokia-N900:~# cat /sys/power/idcode 
IDCODE: 4b7ae02f
Production ID: 00000000 00000000 000000cc cafeb7ae
Die ID: 05018019 04033312 00000000 54500024
Quoted 4 lines

The objections stated in this email:
http://www.mail-archive.com/[email protected]/msg17630.html
appear to still apply to this version of the patches?

Yeah, it is not applied on all IDs actually. At some point, the complain has changed. More recently, Tony complained about Die ID:
http://marc.info/?l=linux-omap&m=127230649306842&w=2

And that's what is in patch 03/03 of this series. So, there are two things:
1. A separated config option to have DIE ID code in
2. User also have to explicitly pass the omap3_die_id kernel parameter. Just like the "serialnumber" parameter for x86's.

Once the user has a kernel with CONFIG_OMAP3_EXPORT_DIE_ID and boots it with omap3_die_id parameter, the first output I posted above would also include die id:

/ # cat /proc/socinfo
SoC : OMAP3430 ES3.1
IDCODE : 4b7ae02f
Pr. ID : 00000000 00000000 000000cc cafeb7ae
Die ID : 05018019 04033312 00000000 54500024

Quoted 11 lines

Kevin didn't explain why he said "Please export these via debugfs". Tony didn't clearly explain why he said "I don't think we want to export unique chip identifiers by default".

So apart from having certain opinions regarding communication skills and wondering why people cc me on stuff without vaguely providing enough info for me to understand what they're thinking, I don't know what to make of it all :(

Yeah, I agree here that there are some piece of info missing here and there. Anyways, I believe the main point here is what is the best place to export these bits.

Originally was under sysfs (maybe not the correct place: /sys/power/idcode). Then I suggested
to move it to /proc/cpuinfo, which has been denied because these bits do not belong to CPU.
Then, it has been suggested to be under /proc/socinfo, which is the current version.
Now, I think your suggestion is to move back to sysfs, but under sys/devices/platform or /sys/devices/system, right ?

Thanks for your comments,

--
Eduardo Valentin

maintainer
#10 lore raw
In reply to Andrew Morton
Quoted 6 lines · Andrew Morton

I'd have thought that sysfs was an appropriate place for this info. Perhaps under /sys/devices/platform? Or /sys/devices/system? Peter's original patch didn't tell us where in the hierarchy the file was placed, nor why it was placed there, not what its contents look like. But crappy changelogs are the norm :(

To me both proc and sys work, I'm fine either way.

Quoted 7 lines

The objections stated in this email:
http://www.mail-archive.com/linux-omap at vger.kernel.org/msg17630.html appear to still apply to this version of the patches?

Kevin didn't explain why he said "Please export these via debugfs". Tony didn't clearly explain why he said "I don't think we want to export unique chip identifiers by default".

The issue I had was with the unique silicon ID getting exposed by default to avoid the Pentium id number situation :)

It's now handled with a Kconfig and cmdline option, basically the same way as the id on x86. So the issues in the email thread above are sorted out.

Regards,

Tony

#11 lore raw
In reply to Eduardo Valentin

2010/5/11 Eduardo Valentin <[email protected]>:

Quoted 7 lines

Here is the version 5 of the change to export OMAP data to userspace (name, revision, id code, production id and die id).

Basically, this version is still attempting to create a new file under /proc. It is the /proc/socinfo, which should be used to export bits which are SoC specific (not CPU related, nor machine related).

Quoted 7 lines

So, differences between previous version are:
- merged patch 02/04 with 03/04 to avoid compilation breakages.
- simplified the seq_file usage by using the single_open and single_release functions
- exported a function to register a seq_operation .show callback
- adapted the changes accordingly

As usual, comments are welcome.

Eduardo, what has happened to this patchset?

Now we need something similar for arch/arm/mach-ux500 and I was sort of hoping that this infrastructure would be in place already... wrong I was.

Do you want help in picking it up and try to polish it up?

Yours,
Linus Walleij

#12 lore raw

Hello Linus,

Quoted 15 lines · ext Linus Walleij

2010/5/11 Eduardo Valentin <[email protected]>:

Quoted 13 lines

Here is the version 5 of the change to export OMAP data to userspace (name, revision, id code, production id and die id).

Basically, this version is still attempting to create a new file under /proc. It is the /proc/socinfo, which should be used to export bits which are SoC specific (not CPU related, nor machine related).

So, differences between previous version are:
- merged patch 02/04 with 03/04 to avoid compilation breakages.
- simplified the seq_file usage by using the single_open and single_release functions
- exported a function to register a seq_operation .show callback
- adapted the changes accordingly

Quoted 3 lines
Quoted 1 line

As usual, comments are welcome.

Eduardo, what has happened to this patchset?

Got forgotten :-(. Unfortunately I didn't pushed it hard enough.

Quoted 3 lines

Now we need something similar for arch/arm/mach-ux500 and I was sort of hoping that this infrastructure would be in place already... wrong I was.

Right.

Quoted 2 lines

Do you want help in picking it up and try to polish it up?

Yeah, but it would need a refactoring. IIRC, result of last discussion was that we should not mess with /proc. So, maybe moving back to something under sysfs. Perhaps /sys/devices/soc or so?

Quoted 3 lines

Yours,
Linus Walleij

Signature · 1 line
Eduardo Valentin
#13 lore raw

Hello Eduardo,

Quoted 18 lines · Eduardo Valentin

Hello Linus,

Quoted 15 lines · ext Linus Walleij

2010/5/11 Eduardo Valentin<[email protected]>:

Quoted 13 lines

Here is the version 5 of the change to export OMAP data to userspace (name, revision, id code, production id and die id).

Basically, this version is still attempting to create a new file under /proc. It is the /proc/socinfo, which should be used to export bits which are SoC specific (not CPU related, nor machine related).

So, differences between previous version are:
- merged patch 02/04 with 03/04 to avoid compilation breakages.
- simplified the seq_file usage by using the single_open and single_release functions
- exported a function to register a seq_operation .show callback
- adapted the changes accordingly

Quoted 3 lines
Quoted 2 lines
Quoted 1 line

As usual, comments are welcome.

Eduardo, what has happened to this patchset?

Got forgotten :-(. Unfortunately I didn't pushed it hard enough.

I propose to refactor your patchset, moving from procfs to sysfs.

Quoted 4 lines
Quoted 1 line

Do you want help in picking it up and try to polish it up?

Yeah, but it would need a refactoring. IIRC, result of last discussion was that we should not mess with /proc. So, maybe moving back to something under sysfs. Perhaps /sys/devices/soc or so?

About the location of this new sysfs entry, where do you think it should be? I propose to create a new directory named "soc" in /sys/devices/system/.

As platform vendors have several/different kind of IDs to export to sysfs, I propose each vendor to create file entries related to their IDs (eg. /sys/devices/system/soc/idcode for OMAP platforms).

However, I think we should have a common file entry to export the unique ID of the platforms. Indeed, user-space applications should have a unified way to get this kind of ID, regardless of the platform (eg. /sys/devices/system/soc/unique_id).

Do you agree with my proposal?

Thanks for your comments.

Regards,

Maxime Coquelin

#14 lore raw
Quoted 11 lines · Maxime Coquelin

Hello Eduardo,

Quoted 2 lines · Eduardo Valentin
Quoted 1 line

Eduardo, what has happened to this patchset?

Got forgotten :-(. Unfortunately I didn't pushed it hard enough.

I propose to refactor your patchset, moving from procfs to sysfs.

Quoted 4 lines
Quoted 1 line

Do you want help in picking it up and try to polish it up?

Yeah, but it would need a refactoring. IIRC, result of last discussion was that we should not mess with /proc. So, maybe moving back to something under sysfs. Perhaps /sys/devices/soc or so?

Quoted 7 lines

About the location of this new sysfs entry, where do you think it should be?
I propose to create a new directory named "soc" in /sys/devices/system/.

As platform vendors have several/different kind of IDs to export to sysfs, I propose each vendor to create file entries related to their IDs (eg. /sys/devices/system/soc/idcode for OMAP platforms).

I think the path /sys/devices/system/soc/ will work for the MSM too. I would have ideally liked it to be /sys/devices/system/soc/msm, /sys/devices/system/soc/omap, etc, but we can't get to pick names for devices under a class. So, we can make do with /sys/devices/system/soc/.

Quoted 4 lines

However, I think we should have a common file entry to export the unique ID of the platforms. Indeed, user-space applications should have a unified way to get this kind of ID, regardless of the platform (eg. /sys/devices/system/soc/unique_id).

I like the idea of have a common file across all implementations that will let user space identify what implementation is exporting the other files and how to interpret them.

I would like to propose an "arch" file to identify the arch the soc info file are for. I'm guessing within an arch, the soc files would mostly be the same? If there are other minor differences, we can let the arch specific code deal with how the files are interpreted.

Does "arch" work for everyone?

Thanks,
Saravana

Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
#15 lore raw
Quoted 41 lines · Saravana Kannan
Quoted 18 lines · Maxime Coquelin

Hello Eduardo,

Quoted 4 lines · Eduardo Valentin
Quoted 2 lines

Eduardo, what has happened to this patchset?

Got forgotten :-(. Unfortunately I didn't pushed it hard enough.

I propose to refactor your patchset, moving from procfs to sysfs.

Quoted 6 lines
Quoted 1 line

Do you want help in picking it up and try to polish it up?

Yeah, but it would need a refactoring. IIRC, result of last discussion was that we should not mess with /proc. So, maybe moving back

to something under sysfs. Perhaps /sys/devices/soc or so?

Quoted 7 lines

About the location of this new sysfs entry, where do you think it should be?
I propose to create a new directory named "soc" in /sys/devices/system/.

As platform vendors have several/different kind of IDs to export to sysfs, I propose each vendor to create file entries related to their IDs (eg. /sys/devices/system/soc/idcode for OMAP platforms).

I think the path /sys/devices/system/soc/ will work for the MSM too. I would have ideally liked it to be /sys/devices/system/soc/msm, /sys/devices/system/soc/omap, etc, but we can't get to pick names for devices under a class. So, we can make do with /sys/devices/system/soc/.

Quoted 4 lines

However, I think we should have a common file entry to export the unique ID of the platforms. Indeed, user-space applications should have a unified way to get this kind of ID, regardless of the platform (eg. /sys/devices/system/soc/unique_id).

I like the idea of have a common file across all implementations that will let user space identify what implementation is exporting the other files and how to interpret them.

Quoted 7 lines

I would like to propose an "arch" file to identify the arch the soc info file are for. I'm guessing within an arch, the soc files would mostly be the same? If there are other minor differences, we can let the arch specific code deal with how the files are interpreted.

Does "arch" work for everyone?

Sorry to butt in, but what kind of info are you guys talking about? Like SOC revision, serial numbers, etc...?

What would an "arch" file mean? The name of the soc platform?

#16 lore raw
Quoted 48 lines · Andrei Warkentin
Quoted 46 lines · Saravana Kannan
Quoted 18 lines · Maxime Coquelin

Hello Eduardo,

Quoted 4 lines · Eduardo Valentin
Quoted 2 lines

Eduardo, what has happened to this patchset?

Got forgotten :-(. Unfortunately I didn't pushed it hard enough.

I propose to refactor your patchset, moving from procfs to sysfs.

Quoted 6 lines
Quoted 1 line

Do you want help in picking it up and try to polish it up?

Yeah, but it would need a refactoring. IIRC, result of last discussion was that we should not mess with /proc. So, maybe moving back

to something under sysfs. Perhaps /sys/devices/soc or so?

Quoted 7 lines

About the location of this new sysfs entry, where do you think it should be?
I propose to create a new directory named "soc" in /sys/devices/system/.

As platform vendors have several/different kind of IDs to export to sysfs, I propose each vendor to create file entries related to their IDs (eg. /sys/devices/system/soc/idcode for OMAP platforms).

I think the path /sys/devices/system/soc/ will work for the MSM too. I would have ideally liked it to be /sys/devices/system/soc/msm, /sys/devices/system/soc/omap, etc, but we can't get to pick names for devices under a class. So, we can make do with /sys/devices/system/soc/.

Quoted 4 lines

However, I think we should have a common file entry to export the unique ID of the platforms. Indeed, user-space applications should have a unified way to get this kind of ID, regardless of the platform (eg. /sys/devices/system/soc/unique_id).

I like the idea of have a common file across all implementations that will let user space identify what implementation is exporting the other files and how to interpret them.

I would like to propose an "arch" file to identify the arch the soc info file are for. I'm guessing within an arch, the soc files would mostly be the same? If there are other minor differences, we can let the arch specific code deal with how the files are interpreted.

Quoted 4 lines
Quoted 2 lines

Does "arch" work for everyone?

Sorry to butt in, but what kind of info are you guys talking about?

Please do butt in :-), that's what a community discussion is for.

Quoted 1 line

Like SOC revision, serial numbers, etc...?

Like SOC type (to identify different chipsets), revision, etc.

Quoted 1 line

What would an "arch" file mean? The name of the soc platform?

The arch file would pretty much be the "xxxx" from arch/arm/mach-xxxx or similar paths. If that info is already available elsewhere, then that file is not needed. I proposed using the arch since that will remove the need to maintain some database of unique/reserved names/numbers for each implementation of socinfo (like the machinetypes list we have).

-Saravana

Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
#17 lore raw

v5 cover Introduce the /proc/socinfo and use it to export OMAP data

Quoted 3 lines · Saravana Kannan
Quoted 2 lines · Andrei Warkentin

On Mon, Feb 28, 2011 at 10:51 PM, Saravana Kannan
<[email protected]> wrote:

<snip>

Quoted 7 lines
Quoted 1 line

What would an "arch" file mean? The name of the soc platform?

The arch file would pretty much be the "xxxx" from arch/arm/mach-xxxx or similar paths. If that info is already available elsewhere, then that file is not needed. I proposed using the arch since that will remove the need to maintain some database of unique/reserved names/numbers for each implementation of socinfo (like the machinetypes list we have).

/proc/cpuinfo already tells you what the CPU is, which gives more information than just the architecture name.

Why is the arch information even required by userspace?

~Ryan

Signature · 7 lines
Bluewater Systems Ltd - ARM Technology Solution Centre

Ryan Mallon         		5 Amuri Park, 404 Barbadoes St
ryan at bluewatersys.com         	PO Box 13 889, Christchurch 8013
http://www.bluewatersys.com	New Zealand
Phone: +64 3 3779127		Freecall: Australia 1800 148 751
Fax:   +64 3 3779135			  USA 1800 261 2934
#18 lore raw

v5 cover Introduce the /proc/socinfo and use it to export OMAP data

Quoted 15 lines · Ryan Mallon
Quoted 3 lines · Saravana Kannan
Quoted 2 lines · Andrei Warkentin

On Mon, Feb 28, 2011 at 10:51 PM, Saravana Kannan
<[email protected]> wrote:

<snip>

Quoted 7 lines
Quoted 1 line

What would an "arch" file mean? The name of the soc platform?

The arch file would pretty much be the "xxxx" from arch/arm/mach-xxxx or similar paths. If that info is already available elsewhere, then that file is not needed. I proposed using the arch since that will remove the need to maintain some database of unique/reserved names/numbers for each implementation of socinfo (like the machinetypes list we have).

Quoted 4 lines

/proc/cpuinfo already tells you what the CPU is, which gives more information than just the architecture name.

Why is the arch information even required by userspace?

The socinfo exported by each soc is different. If userspace is trying to make decisions based on socinfo, it will need to know what type of soc (really what type of socinfo implementation) it is before trying to interpret the rest of the socinfo files. Keep in mind that cpuinfo is different from socinfo -- the cpu is just a small part of a soc.

Thanks,
Saravana

Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
#19 lore raw

v5 cover Introduce the /proc/socinfo and use it to export OMAP data

Quoted 19 lines · Saravana Kannan
Quoted 18 lines · Ryan Mallon
Quoted 3 lines · Saravana Kannan
Quoted 2 lines · Andrei Warkentin

On Mon, Feb 28, 2011 at 10:51 PM, Saravana Kannan
<[email protected]> wrote:

<snip>

Quoted 7 lines
Quoted 1 line

What would an "arch" file mean? The name of the soc platform?

The arch file would pretty much be the "xxxx" from arch/arm/mach-xxxx or similar paths. If that info is already available elsewhere, then that file is not needed. I proposed using the arch since that will remove the need to maintain some database of unique/reserved names/numbers for each implementation of socinfo (like the machinetypes list we have).

/proc/cpuinfo already tells you what the CPU is, which gives more information than just the architecture name.

Quoted 7 lines
Quoted 1 line

Why is the arch information even required by userspace?

The socinfo exported by each soc is different. If userspace is trying to make decisions based on socinfo, it will need to know what type of soc (really what type of socinfo implementation) it is before trying to interpret the rest of the socinfo files. Keep in mind that cpuinfo is different from socinfo -- the cpu is just a small part of a soc.

I understand that having a socinfo file for obtaining information about a particular SoC would be useful. A similar discussion came up a few years ago when we talked about having a socinfo file for exposing the ep93xx Maverick crunch id, but nothing ever came out of it.

What I don't understand is why you want the 'arch' file (ie the mach-xxxx) name. /proc/cpuinfo already gives you more information than an 'arch' file would. I also can't think of a particularly good situation why userspace would need to know at runtime what the architecture is.

Have a socinfo file to expose implementation details of the particular SoC I am fine with (assuming those details are useful to userspace), having an 'arch' file to expose the architecture I am against.

~Ryan

Signature · 7 lines
Bluewater Systems Ltd - ARM Technology Solution Centre

Ryan Mallon         		5 Amuri Park, 404 Barbadoes St
ryan at bluewatersys.com         	PO Box 13 889, Christchurch 8013
http://www.bluewatersys.com	New Zealand
Phone: +64 3 3779127		Freecall: Australia 1800 148 751
Fax:   +64 3 3779135			  USA 1800 261 2934
#20 lore raw

v5 cover Introduce the /proc/socinfo and use it to export OMAP data

Quoted 39 lines · Ryan Mallon
Quoted 19 lines · Saravana Kannan
Quoted 18 lines · Ryan Mallon
Quoted 3 lines · Saravana Kannan
Quoted 2 lines · Andrei Warkentin

On Mon, Feb 28, 2011 at 10:51 PM, Saravana Kannan
<[email protected]> wrote:

<snip>

Quoted 7 lines
Quoted 1 line

What would an "arch" file mean? The name of the soc platform?

The arch file would pretty much be the "xxxx" from arch/arm/mach-xxxx or similar paths. If that info is already available elsewhere, then that file is not needed. I proposed using the arch since that will remove the need to maintain some database of unique/reserved names/numbers for each implementation of socinfo (like the machinetypes list we have).

/proc/cpuinfo already tells you what the CPU is, which gives more information than just the architecture name.

Quoted 7 lines
Quoted 1 line

Why is the arch information even required by userspace?

The socinfo exported by each soc is different. If userspace is trying to make decisions based on socinfo, it will need to know what type of soc (really what type of socinfo implementation) it is before trying to interpret the rest of the socinfo files. Keep in mind that cpuinfo is different from socinfo -- the cpu is just a small part of a soc.

I understand that having a socinfo file for obtaining information about a particular SoC would be useful. A similar discussion came up a few years ago when we talked about having a socinfo file for exposing the ep93xx Maverick crunch id, but nothing ever came out of it.

What I don't understand is why you want the 'arch' file (ie the mach-xxxx) name. /proc/cpuinfo already gives you more information than an 'arch' file would. I also can't think of a particularly good situation why userspace would need to know at runtime what the architecture is.

Quoted 3 lines

Have a socinfo file to expose implementation details of the particular SoC I am fine with (assuming those details are useful to userspace), having an 'arch' file to expose the architecture I am against.

You probably already understood this, but just to be sure, when I say "socinfo implementation" I mean the various ways the socinfo data should be interpreted by userspace. "socid" of 1 would mean a different thing depending on whether it's for omap, msm, kirkwood, etc.

I don't have any attachment to the "arch" file suggestion. If there is a better solution to identify the different implementations of socinfo without having to maintain some "unique id" list in the kernel, then I'm all for it. But cpuinfo is not it.

Which data listed in cpuinfo do you think will let you identify the socinfo implementation in a unique manner? The only thing that's even remotely possible is vendor_id, but I'm not sure what it's supposed to be if the CPU core is licensed from some vendor and used in a SOC by another vendor. What is a Samsung with an ARM11 core supposed to list for vendor_id? What if the another Samsung SOC has a Samsung's own CPU core? What about non-ARM architectures? I would rather not add implicit dependency on cpuinfo that's hard to maintain or guarantee and instead have the socinfo implementation explicitly exported.

The "arch" filename and what it's supposed to contain was just a suggestion. Another alternative might be to call it soc-family and the a general guideline to keep it as close as possible to the mach-xxxx name. For example, omap3 and omap4 might not care for having different socinfo implementations and can decide to use the socfamily name of "omap".

Thanks,
Saravana

Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
#21 lore raw

v5 cover Introduce the /proc/socinfo and use it to export OMAP data

Quoted 52 lines · Saravana Kannan
Quoted 42 lines · Ryan Mallon
Quoted 22 lines · Saravana Kannan
Quoted 21 lines · Ryan Mallon
Quoted 3 lines · Saravana Kannan
Quoted 2 lines · Andrei Warkentin

On Mon, Feb 28, 2011 at 10:51 PM, Saravana Kannan
<[email protected]> wrote:

<snip>

Quoted 10 lines
Quoted 1 line

What would an "arch" file mean? The name of the soc platform?

The arch file would pretty much be the "xxxx" from arch/arm/mach-xxxx or
similar paths. If that info is already available elsewhere, then that file is not needed. I proposed using the arch since that will remove the
need to maintain some database of unique/reserved names/numbers for each
implementation of socinfo (like the machinetypes list we have).

/proc/cpuinfo already tells you what the CPU is, which gives more information than just the architecture name.

Quoted 7 lines
Quoted 1 line

Why is the arch information even required by userspace?

The socinfo exported by each soc is different. If userspace is trying to make decisions based on socinfo, it will need to know what type of soc (really what type of socinfo implementation) it is before trying to interpret the rest of the socinfo files. Keep in mind that cpuinfo is different from socinfo -- the cpu is just a small part of a soc.

I understand that having a socinfo file for obtaining information about a particular SoC would be useful. A similar discussion came up a few years ago when we talked about having a socinfo file for exposing the ep93xx Maverick crunch id, but nothing ever came out of it.

What I don't understand is why you want the 'arch' file (ie the mach-xxxx) name. /proc/cpuinfo already gives you more information than an 'arch' file would. I also can't think of a particularly good situation why userspace would need to know at runtime what the architecture is.

Quoted 3 lines

Have a socinfo file to expose implementation details of the particular SoC I am fine with (assuming those details are useful to userspace), having an 'arch' file to expose the architecture I am against.

You probably already understood this, but just to be sure, when I say "socinfo implementation" I mean the various ways the socinfo data should be interpreted by userspace. "socid" of 1 would mean a different thing depending on whether it's for omap, msm, kirkwood, etc.

Quoted 4 lines

I don't have any attachment to the "arch" file suggestion. If there is a better solution to identify the different implementations of socinfo without having to maintain some "unique id" list in the kernel, then I'm all for it. But cpuinfo is not it.

Sorry I am confusing the 'arch' and 'mach' bits here. I definitely have an objection to having an 'arch' file (i.e. ARM). A 'mach' (i.e. omap) file makes a bit more sense, but should probably be called 'mach' rather than 'arch' to avoid this confusion :-).

I still think it is a solution in search of a problem though. What userspace programs need to know what specific SoC they are on? My feeling is that if userspace needs to know this information, then it is probably dicking around with things that should be managed by the kernel. Differences in available peripherals, etc can be determined by looking at existing sysfs files.

~Ryan

Signature · 7 lines
Bluewater Systems Ltd - ARM Technology Solution Centre

Ryan Mallon         		5 Amuri Park, 404 Barbadoes St
ryan at bluewatersys.com         	PO Box 13 889, Christchurch 8013
http://www.bluewatersys.com	New Zealand
Phone: +64 3 3779127		Freecall: Australia 1800 148 751
Fax:   +64 3 3779135			  USA 1800 261 2934
#22 lore raw
Quoted 10 lines · Ryan Mallon
Quoted 4 lines · Saravana Kannan

I don't have any attachment to the "arch" file suggestion. If there is a better solution to identify the different implementations of socinfo without having to maintain some "unique id" list in the kernel, then I'm all for it. But cpuinfo is not it.

Sorry I am confusing the 'arch' and 'mach' bits here. I definitely have an objection to having an 'arch' file (i.e. ARM). A 'mach' (i.e. omap) file makes a bit more sense, but should probably be called 'mach' rather than 'arch' to avoid this confusion :-).

Sorry for the confusion. Sure, I don't care much for the filename as long as we can all agree on it. I care more about the content of the file (using names very close to xxxx in mach-xxxx). I like "soc-family" better since it's generic enough to not force, say omap3 and omap4, to report different values.

Linus Walleij, Eduardo, Maxime, Andrei,

Would like to hear your opinion on the file name (soc-family vs. mach vs <somethingelse>) and the path /sys/devices/system/soc/.

If we settle on this, may be it would be easier to get this through.

Quoted 6 lines

I still think it is a solution in search of a problem though. What userspace programs need to know what specific SoC they are on? My feeling is that if userspace needs to know this information, then it is probably dicking around with things that should be managed by the kernel. Differences in available peripherals, etc can be determined by looking at existing sysfs files.

I certainly have seen several use cases. Couple of easy examples:

* A lot of test scripts would find this very useful. For example, some clock (present is all/most MSMs) shouldn't be tested on some SOCs as it would lock up the system if you try to turn it off while the CPU is running.

* Some of the user space tools might want to report different "product id/type" (nothing to do with USB, etc) depending on what SOC it is running on.

Thank,
Saravana
P.S: Removed felipe.balbi at nokia.com <[email protected]> since I keep getting delivery failure emails.

Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
#23 lore raw
Quoted 18 lines · Saravana Kannan
Quoted 10 lines · Ryan Mallon
Quoted 4 lines · Saravana Kannan

I don't have any attachment to the "arch" file suggestion. If there is a better solution to identify the different implementations of socinfo without having to maintain some "unique id" list in the kernel, then I'm all for it. But cpuinfo is not it.

Sorry I am confusing the 'arch' and 'mach' bits here. I definitely have an objection to having an 'arch' file (i.e. ARM). A 'mach' (i.e. omap) file makes a bit more sense, but should probably be called 'mach' rather than 'arch' to avoid this confusion :-).

Sorry for the confusion. Sure, I don't care much for the filename as long as we can all agree on it. I care more about the content of the file (using names very close to xxxx in mach-xxxx). I like "soc-family" better since it's generic enough to not force, say omap3 and omap4, to report different values.

Quoted 4 lines

Linus Walleij, Eduardo, Maxime, Andrei,

Would like to hear your opinion on the file name (soc-family vs. mach vs <somethingelse>) and the path /sys/devices/system/soc/.

'family' sounds good. I don't think we need the 'soc-' prefix on filenames if they are already in /sys/devices/system/soc/.

Quoted 10 lines

If we settle on this, may be it would be easier to get this through.

Quoted 6 lines

I still think it is a solution in search of a problem though. What userspace programs need to know what specific SoC they are on? My feeling is that if userspace needs to know this information, then it is probably dicking around with things that should be managed by the kernel. Differences in available peripherals, etc can be determined by looking at existing sysfs files.

Quoted 6 lines

I certainly have seen several use cases. Couple of easy examples:

* A lot of test scripts would find this very useful. For example, some clock (present is all/most MSMs) shouldn't be tested on some SOCs as it would lock up the system if you try to turn it off while the CPU is running.

I don't follow here. Do you mean a struct clk clock or something else? Why is userspace allowed to disable a clock which will effectively hang the system? :-).

Quoted 3 lines

* Some of the user space tools might want to report different "product id/type" (nothing to do with USB, etc) depending on what SOC it is running on.

This makes more sense. It would actually be useful for custom USB devices (gadget) which can be done from user space.

~Ryan

Signature · 7 lines
Bluewater Systems Ltd - ARM Technology Solution Centre

Ryan Mallon         		5 Amuri Park, 404 Barbadoes St
ryan at bluewatersys.com         	PO Box 13 889, Christchurch 8013
http://www.bluewatersys.com	New Zealand
Phone: +64 3 3779127		Freecall: Australia 1800 148 751
Fax:   +64 3 3779135			  USA 1800 261 2934
#24 lore raw
Quoted 19 lines · Ryan Mallon
Quoted 18 lines · Saravana Kannan
Quoted 10 lines · Ryan Mallon
Quoted 4 lines · Saravana Kannan

I don't have any attachment to the "arch" file suggestion. If there is a better solution to identify the different implementations of socinfo without having to maintain some "unique id" list in the kernel, then I'm all for it. But cpuinfo is not it.

Sorry I am confusing the 'arch' and 'mach' bits here. I definitely have an objection to having an 'arch' file (i.e. ARM). A 'mach' (i.e. omap) file makes a bit more sense, but should probably be called 'mach' rather than 'arch' to avoid this confusion :-).

Sorry for the confusion. Sure, I don't care much for the filename as long as we can all agree on it. I care more about the content of the file (using names very close to xxxx in mach-xxxx). I like "soc-family" better since it's generic enough to not force, say omap3 and omap4, to report different values.

Quoted 7 lines
Quoted 4 lines

Linus Walleij, Eduardo, Maxime, Andrei,

Would like to hear your opinion on the file name (soc-family vs. mach vs <somethingelse>) and the path /sys/devices/system/soc/.

'family' sounds good. I don't think we need the 'soc-' prefix on filenames if they are already in /sys/devices/system/soc/.

Makes sense. We can drop the soc- prefix. So the contenders left: family vs <somethingelse>. Would still be nice if the other folks chime in.

Quoted 11 lines
Quoted 11 lines

If we settle on this, may be it would be easier to get this through.

Quoted 6 lines

I still think it is a solution in search of a problem though. What userspace programs need to know what specific SoC they are on? My feeling is that if userspace needs to know this information, then it is probably dicking around with things that should be managed by the kernel. Differences in available peripherals, etc can be determined by looking at existing sysfs files.

I certainly have seen several use cases. Couple of easy examples:

Quoted 8 lines
Quoted 4 lines

* A lot of test scripts would find this very useful. For example, some clock (present is all/most MSMs) shouldn't be tested on some SOCs as it would lock up the system if you try to turn it off while the CPU is running.

I don't follow here. Do you mean a struct clk clock or something else? Why is userspace allowed to disable a clock which will effectively hang the system? :-).

Ah, sorry. Didn't give enough details. To give some context, I manage the clock stuff for MSM. The MSM clock driver exports clock control thru debugfs. We have test scripts that bang the clocks to test them. Each SoC has a different set of "touch me and you die" clocks that the test script shouldn't mess with. This socinfo would be useful for those test cases.

Quoted 6 lines
Quoted 3 lines

* Some of the user space tools might want to report different "product id/type" (nothing to do with USB, etc) depending on what SOC it is running on.

This makes more sense. It would actually be useful for custom USB devices (gadget) which can be done from user space.

Hmm... didn't know USB devices/gadgets could be handled from userspace.

Thanks,
Saravana

Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
#25 lore raw
Quoted 54 lines · Saravana Kannan
Quoted 22 lines · Ryan Mallon
Quoted 21 lines · Saravana Kannan
Quoted 8 lines · Ryan Mallon
Quoted 6 lines · Saravana Kannan

I don't have any attachment to the "arch" file suggestion. If there is a
better solution to identify the different implementations of socinfo without having to maintain some "unique id" list in the kernel, then I'm
all for it. But cpuinfo is not it.

Quoted 5 lines

Sorry I am confusing the 'arch' and 'mach' bits here. I definitely have an objection to having an 'arch' file (i.e. ARM). A 'mach' (i.e. omap) file makes a bit more sense, but should probably be called 'mach' rather
than 'arch' to avoid this confusion :-).

Sorry for the confusion. Sure, I don't care much for the filename as long as we can all agree on it. I care more about the content of the file (using names very close to xxxx in mach-xxxx). I like "soc-family" better since it's generic enough to not force, say omap3 and omap4, to report different values.

Quoted 7 lines
Quoted 4 lines

Linus Walleij, Eduardo, Maxime, Andrei,

Would like to hear your opinion on the file name (soc-family vs. mach vs <somethingelse>) and the path /sys/devices/system/soc/.

'family' sounds good. I don't think we need the 'soc-' prefix on filenames if they are already in /sys/devices/system/soc/.

Makes sense. We can drop the soc- prefix. So the contenders left: family vs <somethingelse>. Would still be nice if the other folks chime in.

Quoted 11 lines
Quoted 11 lines

If we settle on this, may be it would be easier to get this through.

Quoted 6 lines

I still think it is a solution in search of a problem though. What userspace programs need to know what specific SoC they are on? My feeling is that if userspace needs to know this information, then it is probably dicking around with things that should be managed by the kernel. Differences in available peripherals, etc can be determined by looking at existing sysfs files.

I certainly have seen several use cases. Couple of easy examples:

Quoted 8 lines
Quoted 4 lines

* A lot of test scripts would find this very useful. For example, some clock (present is all/most MSMs) shouldn't be tested on some SOCs as it would lock up the system if you try to turn it off while the CPU is running.

I don't follow here. Do you mean a struct clk clock or something else? Why is userspace allowed to disable a clock which will effectively hang the system? :-).

Quoted 6 lines

Ah, sorry. Didn't give enough details. To give some context, I manage the clock stuff for MSM. The MSM clock driver exports clock control thru debugfs. We have test scripts that bang the clocks to test them. Each SoC has a different set of "touch me and you die" clocks that the test script shouldn't mess with. This socinfo would be useful for those test cases.

Ah, okay. This is still within a single SoC family though since we don't yet (AFAIK) support mutliple SoCs in a single kernel.

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

* Some of the user space tools might want to report different "product id/type" (nothing to do with USB, etc) depending on what SOC it is running on.

This makes more sense. It would actually be useful for custom USB devices (gadget) which can be done from user space.

Hmm... didn't know USB devices/gadgets could be handled from userspace.

The gadgetfs driver allows for writing custom usb device implementations. The SoC info could be used to set the USB vendor/product id. Again, I see this more useful within the SoC family (ie at91sam9260 vs at91sam9263) rather than between families. From an embedded perspective at least, I think it is unlikely for an application to need to work on multiple SoC families.

The only real objection I have to adding the SoC family information is basically to discourage it being abused by userspace. I can see it being useful in debug situations, but I can also see stupid userspace applications explicitly testing for some particular SoC, rather than more correctly (IMHO) checking for presence of certain drivers etc.

~Ryan

Signature · 7 lines
Bluewater Systems Ltd - ARM Technology Solution Centre

Ryan Mallon         		5 Amuri Park, 404 Barbadoes St
ryan at bluewatersys.com         	PO Box 13 889, Christchurch 8013
http://www.bluewatersys.com	New Zealand
Phone: +64 3 3779127		Freecall: Australia 1800 148 751
Fax:   +64 3 3779135			  USA 1800 261 2934
#26 lore raw
Quoted 62 lines · Ryan Mallon
Quoted 54 lines · Saravana Kannan
Quoted 22 lines · Ryan Mallon
Quoted 21 lines · Saravana Kannan
Quoted 8 lines · Ryan Mallon
Quoted 6 lines · Saravana Kannan

I don't have any attachment to the "arch" file suggestion. If there is a
better solution to identify the different implementations of socinfo without having to maintain some "unique id" list in the kernel, then I'm
all for it. But cpuinfo is not it.

Quoted 5 lines

Sorry I am confusing the 'arch' and 'mach' bits here. I definitely have an objection to having an 'arch' file (i.e. ARM). A 'mach' (i.e. omap) file makes a bit more sense, but should probably be called 'mach' rather
than 'arch' to avoid this confusion :-).

Sorry for the confusion. Sure, I don't care much for the filename as long as we can all agree on it. I care more about the content of the file (using names very close to xxxx in mach-xxxx). I like "soc-family" better since it's generic enough to not force, say omap3 and omap4, to report different values.

Quoted 7 lines
Quoted 4 lines

Linus Walleij, Eduardo, Maxime, Andrei,

Would like to hear your opinion on the file name (soc-family vs. mach vs <somethingelse>) and the path /sys/devices/system/soc/.

'family' sounds good. I don't think we need the 'soc-' prefix on filenames if they are already in /sys/devices/system/soc/.

Makes sense. We can drop the soc- prefix. So the contenders left: family vs<somethingelse>. Would still be nice if the other folks chime in.

Quoted 11 lines
Quoted 11 lines

If we settle on this, may be it would be easier to get this through.

Quoted 6 lines

I still think it is a solution in search of a problem though. What userspace programs need to know what specific SoC they are on? My feeling is that if userspace needs to know this information, then it is probably dicking around with things that should be managed by the kernel. Differences in available peripherals, etc can be determined by looking at existing sysfs files.

I certainly have seen several use cases. Couple of easy examples:

Quoted 8 lines
Quoted 4 lines

* A lot of test scripts would find this very useful. For example, some clock (present is all/most MSMs) shouldn't be tested on some SOCs as it would lock up the system if you try to turn it off while the CPU is running.

I don't follow here. Do you mean a struct clk clock or something else? Why is userspace allowed to disable a clock which will effectively hang the system? :-).

Quoted 6 lines

Ah, sorry. Didn't give enough details. To give some context, I manage the clock stuff for MSM. The MSM clock driver exports clock control thru debugfs. We have test scripts that bang the clocks to test them. Each SoC has a different set of "touch me and you die" clocks that the test script shouldn't mess with. This socinfo would be useful for those test cases.

Quoted 2 lines

Ah, okay. This is still within a single SoC family though since we don't yet (AFAIK) support mutliple SoCs in a single kernel.

Yes, my example was within a single SoC family. But since this is user space example, it doesn't matter if a single kernel can support multiple SoCs/SoC families. We could still have one userspace code that might want to support multiple SoC families.

Anyway, I think we are in agreement here. So, will stop discussing this point.

Quoted 16 lines
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

* Some of the user space tools might want to report different "product id/type" (nothing to do with USB, etc) depending on what SOC it is running on.

This makes more sense. It would actually be useful for custom USB devices (gadget) which can be done from user space.

Hmm... didn't know USB devices/gadgets could be handled from userspace.

The gadgetfs driver allows for writing custom usb device implementations. The SoC info could be used to set the USB vendor/product id. Again, I see this more useful within the SoC family (ie at91sam9260 vs at91sam9263) rather than between families. From an embedded perspective at least, I think it is unlikely for an application to need to work on multiple SoC families.

Quoted 5 lines

The only real objection I have to adding the SoC family information is basically to discourage it being abused by userspace. I can see it being useful in debug situations, but I can also see stupid userspace applications explicitly testing for some particular SoC, rather than more correctly (IMHO) checking for presence of certain drivers etc.

True, but so many other things could be misused by stupid userspace programs. When there are legitimate usecases, I think we shouldn't prevent them just because we think a stupid userspace program could misuse it.

Again, although you might not be gung-ho about this, I think I have at least made you indifferent/mildly supportive to adding socinfo. If you don't mind, I would like to wait for others to chime in before continuing this discussion.

-Saravana

Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
#27 lore raw
Quoted 6 lines · Saravana Kannan
Quoted 5 lines · Ryan Mallon
Quoted 4 lines · Saravana Kannan
Quoted 3 lines · Ryan Mallon
Quoted 2 lines · Saravana Kannan
Quoted 1 line · Ryan Mallon

On 03/02/2011 03:23 PM, Saravana Kannan wrote:

<snip>

Quoted 11 lines
Quoted 5 lines

The only real objection I have to adding the SoC family information is basically to discourage it being abused by userspace. I can see it being useful in debug situations, but I can also see stupid userspace applications explicitly testing for some particular SoC, rather than more correctly (IMHO) checking for presence of certain drivers etc.

True, but so many other things could be misused by stupid userspace programs. When there are legitimate usecases, I think we shouldn't prevent them just because we think a stupid userspace program could misuse it.

Quoted 4 lines

Again, although you might not be gung-ho about this, I think I have at least made you indifferent/mildly supportive to adding socinfo. If you don't mind, I would like to wait for others to chime in before continuing this discussion.

Agreed.

In general I am in support of having the SoC information exposed somewhere. I think we just want to be careful that it doesn't become a dumping ground for anything and everything SoC related whether the information is useful or not. I think each piece of exposed information should have a genuine use case, not just "because we can".

~Ryan

Signature · 7 lines
Bluewater Systems Ltd - ARM Technology Solution Centre

Ryan Mallon         		5 Amuri Park, 404 Barbadoes St
ryan at bluewatersys.com         	PO Box 13 889, Christchurch 8013
http://www.bluewatersys.com	New Zealand
Phone: +64 3 3779127		Freecall: Australia 1800 148 751
Fax:   +64 3 3779135			  USA 1800 261 2934
#28 lore raw

v5 cover Introduce the /proc/socinfo and use it to export OMAP data

Quoted 16 lines · Ryan Mallon
Quoted 11 lines · Saravana Kannan
Quoted 5 lines · Ryan Mallon

The only real objection I have to adding the SoC family information is basically to discourage it being abused by userspace. I can see it being useful in debug situations, but I can also see stupid userspace applications explicitly testing for some particular SoC, rather than more correctly (IMHO) checking for presence of certain drivers etc.

True, but so many other things could be misused by stupid userspace programs. When there are legitimate usecases, I think we shouldn't prevent them just because we think a stupid userspace program could misuse it.

Quoted 4 lines

Again, although you might not be gung-ho about this, I think I have at least made you indifferent/mildly supportive to adding socinfo. If you don't mind, I would like to wait for others to chime in before continuing this discussion.

Quoted 7 lines

Agreed.

In general I am in support of having the SoC information exposed somewhere. I think we just want to be careful that it doesn't become a dumping ground for anything and everything SoC related whether the information is useful or not. I think each piece of exposed information should have a genuine use case, not just "because we can".

I definitely agree we should not export every SoC-related information just because we can do it.
The first goal of this interface was to export some SoCs IDs, as we need this kind of information for some user-space tools.
Does someone need to export other information than the mach name and some IDs?

As proposed in my previous mail, do you agree to have a unified file for all vendors, which exports the unique silicon ID of the chip?

Regards,
Maxime

#29 lore raw

v5 cover Introduce the /proc/socinfo and use it to export OMAP data

Quoted 32 lines · Maxime Coquelin
Quoted 17 lines · Ryan Mallon
Quoted 12 lines · Saravana Kannan
Quoted 6 lines · Ryan Mallon

The only real objection I have to adding the SoC family information is basically to discourage it being abused by userspace. I can see it being
useful in debug situations, but I can also see stupid userspace applications explicitly testing for some particular SoC, rather than more correctly (IMHO) checking for presence of certain drivers etc.

True, but so many other things could be misused by stupid userspace programs. When there are legitimate usecases, I think we shouldn't prevent them just because we think a stupid userspace program could misuse it.

Quoted 4 lines

Again, although you might not be gung-ho about this, I think I have at least made you indifferent/mildly supportive to adding socinfo. If you don't mind, I would like to wait for others to chime in before continuing this discussion.

Quoted 7 lines

Agreed.

In general I am in support of having the SoC information exposed somewhere. I think we just want to be careful that it doesn't become a dumping ground for anything and everything SoC related whether the information is useful or not. I think each piece of exposed information should have a genuine use case, not just "because we can".

I definitely agree we should not export every SoC-related information just because we can do it.
The first goal of this interface was to export some SoCs IDs, as we need this kind of information for some user-space tools.
Does someone need to export other information than the mach name and some IDs?

Quoted 2 lines

As proposed in my previous mail, do you agree to have a unified file for all vendors, which exports the unique silicon ID of the chip?

As mentioned earlier, on ep93xx we would like to export the Maverick Crunch ID, which is a unique identifier for the chip.

I think the ABI should specify a minimum set of values which are guaranteed to be provided on all SoCs, but allow individual SoCs to provide additional information as necessary.

~Ryan

Signature · 7 lines
Bluewater Systems Ltd - ARM Technology Solution Centre

Ryan Mallon         		5 Amuri Park, 404 Barbadoes St
ryan at bluewatersys.com         	PO Box 13 889, Christchurch 8013
http://www.bluewatersys.com	New Zealand
Phone: +64 3 3779127		Freecall: Australia 1800 148 751
Fax:   +64 3 3779135			  USA 1800 261 2934
#30 lore raw

v5 cover Introduce the /proc/socinfo and use it to export OMAP data

In reply to Saravana Kannan
Quoted 16 lines · Saravana Kannan
Quoted 9 lines · Ryan Mallon
Quoted 4 lines · Saravana Kannan

I don't have any attachment to the "arch" file suggestion. If there is a better solution to identify the different implementations of socinfo without having to maintain some "unique id" list in the kernel, then I'm all for it. But cpuinfo is not it.

Sorry I am confusing the 'arch' and 'mach' bits here. I definitely have an objection to having an 'arch' file (i.e. ARM). A 'mach' (i.e. omap) file makes a bit more sense, but should probably be called 'mach' rather than 'arch' to avoid this confusion :-).

Sorry for the confusion. Sure, I don't care much for the filename as long as we can all agree on it. I care more about the content of the file (using names very close to xxxx in mach-xxxx). I like "soc-family" better since it's generic enough to not force, say omap3 and omap4, to report different values.

Quoted 7 lines

Linus Walleij, Eduardo, Maxime, Andrei,

Would like to hear your opinion on the file name (soc-family vs. mach vs <somethingelse>) and the path /sys/devices/system/soc/.

If we settle on this, may be it would be easier to get this through.

I think we should have a tree like this :

/sys/devices/system/soc/
/sys/devices/system/soc/unique_id<- Unified way to export an ID for all machs /sys/devices/system/soc/mach/
/sys/devices/system/soc/mach/name<- Name of the mach
/sys/devices/system/soc/mach/foo_id
/sys/devices/system/soc/mach/bar_id<- Vendors may have several/different IDs to export (IDCODE for OMAP, Production ID...)

Linus, do you agree?

Quoted 8 lines
Quoted 6 lines

I still think it is a solution in search of a problem though. What userspace programs need to know what specific SoC they are on? My feeling is that if userspace needs to know this information, then it is probably dicking around with things that should be managed by the kernel. Differences in available peripherals, etc can be determined by looking at existing sysfs files.

I certainly have seen several use cases. Couple of easy examples:

Quoted 8 lines

* A lot of test scripts would find this very useful. For example, some clock (present is all/most MSMs) shouldn't be tested on some SOCs as it would lock up the system if you try to turn it off while the CPU is running.

* Some of the user space tools might want to report different "product id/type" (nothing to do with USB, etc) depending on what SOC it is running on.

For example, we have some user-space tools which need to have serial number to write it in logs.

Quoted 5 lines

Thank,
Saravana
P.S: Removed felipe.balbi at nokia.com<[email protected]> since I keep getting delivery failure emails.

#31 lore raw

v5 cover Introduce the /proc/socinfo and use it to export OMAP data

Quoted 4 lines · Maxime Coquelin

I think we should have a tree like this :

/sys/devices/system/soc/
/sys/devices/system/soc/unique_id<- Unified way to export an ID for all machs

Arbitrary number of bits? Some will have a 64-bit ID, some will have 32-bit etc.

Should we say it's a hex string of 64 bits?

Quoted 5 lines

/sys/devices/system/soc/mach/ /sys/devices/system/soc/mach/name<- Name of the mach /sys/devices/system/soc/mach/foo_id /sys/devices/system/soc/mach/bar_id<- Vendors may have several/different IDs to export (IDCODE for OMAP, Production ID...)

For Ux500 we can export the stuff we print today in mach-ux500/id.c, put in place earlier by Rabin, I'd prefer if you hook in the new ID stuff there as well, since it's so little platform code, and a logical place to have it in.

Quoted 1 line

Linus, do you agree?

Yeah, sounds good.

Yours,
Linus Walleij

#32 lore raw

v5 cover Introduce the /proc/socinfo and use it to export OMAP data

Quoted 9 lines · Linus Walleij
Quoted 4 lines · Maxime Coquelin

I think we should have a tree like this :

/sys/devices/system/soc/
/sys/devices/system/soc/unique_id<- Unified way to export an ID for all machs

Arbitrary number of bits? Some will have a 64-bit ID, some will have 32-bit etc.

Yes, here is the difficulty. For example, in our case, the SoC unique ID is 160 bits long.
Maybe it would be a better solution to get rid of this unified file, and keep only mach specific entries? I mean :

/sys/devices/system/soc/
/sys/devices/system/soc/mach_name
/sys/devices/system/soc/foo_id
/sys/devices/system/soc/bar_id

Quoted 11 lines

Should we say it's a hex string of 64 bits?

Quoted 5 lines

/sys/devices/system/soc/mach/ /sys/devices/system/soc/mach/name<- Name of the mach /sys/devices/system/soc/mach/foo_id /sys/devices/system/soc/mach/bar_id<- Vendors may have several/different IDs to export (IDCODE for OMAP, Production ID...)

For Ux500 we can export the stuff we print today in mach-ux500/id.c, put in place earlier by Rabin, I'd prefer if you hook in the new ID stuff there as well, since it's so little platform code, and a logical place to have it in.

I agree.

Regards,
Maxime

#33 lore raw

v5 cover Introduce the /proc/socinfo and use it to export OMAP data

Quoted 18 lines · Maxime Coquelin
Quoted 11 lines · Linus Walleij
Quoted 5 lines · Maxime Coquelin

I think we should have a tree like this :

/sys/devices/system/soc/ /sys/devices/system/soc/unique_id<- Unified way to export an ID for all machs

Arbitrary number of bits? Some will have a 64-bit ID, some will have 32-bit
etc.

Yes, here is the difficulty. For example, in our case, the SoC unique ID is 160 bits long.
Maybe it would be a better solution to get rid of this unified file, and keep only mach specific entries? I mean :

Quoted 4 lines

/sys/devices/system/soc/
/sys/devices/system/soc/mach_name
/sys/devices/system/soc/foo_id
/sys/devices/system/soc/bar_id

Sorry for the late reply guys. Got wrapped up is some other stuff.

I'm with Maxime on getting rid of the unique id file. It's not as if it's unique across all machs and archs. Any user space caring to look at the id will anyway have to check the mach/family first. So, there is no point in having this unique id file. It just adds more weirdness and complexity to deal with the different formats or ways each family wants to export the id. Actually, in the case of MSM, we don't have any need to export unique id. We just want to export what type of soc it is within the MSM family.

As for the path, it's not clear we have settled on the final path. I see us ping-pong between /sys/devices/system/soc/ and /sys/devices/system/soc/mach/. Can we drop the "mach" subdir? Seems pointless.

The mandatory file, I would like to call it "family", since "mach" is too specific (omap3 and omap4 is my usual example -- they can have one implementation of socinfo and report the family as "omap"). We don't want people to misunderstand "mach" to be an accurate representation of the xxxx in mach-xxxx.

The patch that adds this should probably allow each socinfo implementation to specify the family name and an array of attributes (struct attribute *) that can be used to expose whatever else they want to export.

Thanks,
Saravana

Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
#34 lore raw

v5 cover Introduce the /proc/socinfo and use it to export OMAP data

In reply to Linus Walleij
Quoted 5 lines · Linus Walleij
Quoted 2 lines · Maxime Coquelin

I think we should have a tree like this :

Quoted 7 lines
Quoted 2 lines

/sys/devices/system/soc/
/sys/devices/system/soc/unique_id<- Unified way to export an ID for all machs

Arbitrary number of bits? Some will have a 64-bit ID, some will have 32-bit etc.

Should we say it's a hex string of 64 bits?

Could we provide hooks for the platform that takes the buffer and length and let the platform do the snprintf()? Our devices have a 128-bit serial number and I'm sure there must be others.

Quoted 5 lines
Quoted 5 lines

/sys/devices/system/soc/mach/ /sys/devices/system/soc/mach/name<- Name of the mach /sys/devices/system/soc/mach/foo_id /sys/devices/system/soc/mach/bar_id<- Vendors may have several/different IDs to export (IDCODE for OMAP, Production ID...)

Do we need a way to allow platforms to specify additional attributes to co into the socinfo? For our devices we can boot in different modes and how we boot determines how the firmware is upgraded. In the case above the platform could specify that it needs foo_id and bar_id and the callbacks to fill them in.

Jamie

#35 lore raw

v5 cover Introduce the /proc/socinfo and use it to export OMAP data

Quoted 8 lines · Jamie Iles
Quoted 7 lines · Linus Walleij
Quoted 4 lines · Maxime Coquelin

I think we should have a tree like this :

/sys/devices/system/soc/
/sys/devices/system/soc/unique_id<- Unified way to export an ID for all machs

Quoted 7 lines
Quoted 4 lines

Arbitrary number of bits? Some will have a 64-bit ID, some will have 32-bit etc.

Should we say it's a hex string of 64 bits?

Could we provide hooks for the platform that takes the buffer and length and let the platform do the snprintf()? Our devices have a 128-bit serial number and I'm sure there must be others.

This is one possibility, another one is to let the platform specify how it exports this serial, as you proposed bellow.

Quoted 10 lines
Quoted 5 lines
Quoted 5 lines

/sys/devices/system/soc/mach/ /sys/devices/system/soc/mach/name<- Name of the mach /sys/devices/system/soc/mach/foo_id /sys/devices/system/soc/mach/bar_id<- Vendors may have several/different IDs to export (IDCODE for OMAP, Production ID...)

Do we need a way to allow platforms to specify additional attributes to co into the socinfo? For our devices we can boot in different modes and how we boot determines how the firmware is upgraded. In the case above the platform could specify that it needs foo_id and bar_id and the callbacks to fill them in.

Yes it was what I thought with the foo and bar IDs exports.

Maxime

#36 lore raw

v5 cover Introduce the /proc/socinfo and use it to export OMAP data

In reply to Jamie Iles

2011/3/2 Jamie Iles <[email protected]>:

Quoted 11 lines
Quoted 7 lines
Quoted 2 lines

/sys/devices/system/soc/
/sys/devices/system/soc/unique_id<- Unified way to export an ID for all machs

Arbitrary number of bits? Some will have a 64-bit ID, some will have 32-bit etc.

Should we say it's a hex string of 64 bits?

Could we provide hooks for the platform that takes the buffer and length and let the platform do the snprintf()? ?Our devices have a 128-bit serial number and I'm sure there must be others.

Isn't it better to just make it 64-bit so that apps can always parse it, and then you can have your high-res numbers under mach?

If there is no solid ABI for this there is no point to make it generic under /soc/unique_id at all.

/soc/name is another useful thing to have I think.

Apart from this we are now en route to the same color of bikeshed discussion this patchset saw earlier, Maxime please just implement something that works for you/us so others can patch in whatever they need on top later.

Yours,
Linus Walleij

#37 lore raw

v5 cover Introduce the /proc/socinfo and use it to export OMAP data

Quoted 14 lines · Linus Walleij

2011/3/2 Jamie Iles <[email protected]>:

Quoted 11 lines
Quoted 7 lines
Quoted 2 lines

/sys/devices/system/soc/
/sys/devices/system/soc/unique_id<- Unified way to export an ID for all machs

Arbitrary number of bits? Some will have a 64-bit ID, some will have 32-bit etc.

Should we say it's a hex string of 64 bits?

Could we provide hooks for the platform that takes the buffer and length and let the platform do the snprintf()? ?Our devices have a 128-bit serial number and I'm sure there must be others.

Quoted 5 lines

Isn't it better to just make it 64-bit so that apps can always parse it, and then you can have your high-res numbers under mach?

If there is no solid ABI for this there is no point to make it generic under /soc/unique_id at all.

I guess I'd argue that a arbitrary length hex string could be considered as a solid ABI but you're right that it's probably more important to get something out there and I'm probably being too picky, so apologies!

Jamie