Skip to contentSkip to conversation

base: soc: Add JEP106 manufacturer's identification code

PATCH In review Sudeep Holla 3 participants 10 messages May 22, 2020 – May 28, 2020

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

cover base: soc: Add JEP106 manufacturer's identification code

Hi,

While attempting to add custom sysfs attributes for SMCCC ARCH_SOC_ID Arnd suggested to make it generic. Here is my first attempt.

The original thread/discussion can be found here[1]

Regards,
Sudeep

[1] https://lore.kernel.org/r/CAK8P3a3dV0B26XE3oFQGTFf8EWV0AHoLudNtpSSB_t+pCfkOkQ@mail.gmail.com/

Sudeep Holla (2):
base: soc: Add JEDEC JEP106 manufacturer's identification code attribute
firmware: smccc: Add ARCH_SOC_ID support

 Documentation/ABI/testing/sysfs-devices-soc |  31 ++++++
 drivers/base/soc.c                          |  12 +++
 drivers/firmware/smccc/Kconfig              |   9 ++
 drivers/firmware/smccc/Makefile             |   1 +
 drivers/firmware/smccc/soc_id.c             | 113 ++++++++++++++++++++
 include/linux/arm-smccc.h                   |   5 +
 include/linux/sys_soc.h                     |   1 +
 7 files changed, 172 insertions(+)
 create mode 100644 drivers/firmware/smccc/soc_id.c
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/2 base: soc: Add JEDEC JEP106 manufacturer's identification code attribute

SMCCC v1.2 adds a new optional function SMCCC_ARCH_SOC_ID to obtain a SiP defined SoC identification value. Indeed of making it custom attribute, let us add the same as generic attribute to soc_device.

There are various ways in which it can be represented in shortened form for efficiency and ease of parsing for userspace. The chosen form is described in the ABI document.

---
 Documentation/ABI/testing/sysfs-devices-soc | 31 +++++++++++++++++++++
 drivers/base/soc.c                          | 12 ++++++++
 include/linux/sys_soc.h                     |  1 +
 3 files changed, 44 insertions(+)
Documentation/ABI/testing/sysfs-devices-soc +31 -0
index ba3a3fac0ee1..fd44c9b1e09a 100644
@@ -54,6 +54,37 @@ contact:	Lee Jones <[email protected]>
 		Read-only attribute supported ST-Ericsson's silicon. Contains the
 		the process by which the silicon chip was manufactured.
 
+What:		/sys/devices/socX/jep106_identification_code
+Date:		June 2020
+Contact:	Sudeep Holla <[email protected]>
+Description:
+		Read-only attribute supported on many of ARM based silicon
+		with SMCCC v1.2+ compliant firmware. Contains the JEDEC
+		JEP106 manufacturer’s identification code.
+
+		This manufacturer’s identification code is defined by one
+		or more eight (8) bit fields, each consisting of seven (7)
+		data bits plus one (1) odd parity bit. It is a single field,
+		limiting the possible number of vendors to 126. To expand
+		the maximum number of identification codes, a continuation
+		scheme has been defined.
+
+		The specified mechanism is that an identity code of 0x7F
+		represents the "continuation code" and implies the presence
+		of an additional identity code field, and this mechanism
+		may be extended to multiple continuation codes followed
+		by the manufacturer's identity code.
+
+		For example, ARM has identity code 0x7F 0x7F 0x7F 0x7F 0x3B,
+		which is code 0x3B on the fifth 'page'. This can be shortened
+		as JEP106 identity code of 0x3B and a continuation code of
+		0x4 to represent the four continuation codes preceding the
+		identity code.
+
+		This property represents it in the shortened form:
+		8-bit continuation code followed by 8 bit identity code
+		without the parity bit.
+
 What:		/sys/bus/soc
 Date:		January 2012
 contact:	Lee Jones <[email protected]>
drivers/base/soc.c +12 -0
index 4af11a423475..44dc757aadf4 100644
@@ -36,6 +36,7 @@ static DEVICE_ATTR(family,   S_IRUGO, soc_info_get,  NULL);
 static DEVICE_ATTR(serial_number, S_IRUGO, soc_info_get,  NULL);
 static DEVICE_ATTR(soc_id,   S_IRUGO, soc_info_get,  NULL);
 static DEVICE_ATTR(revision, S_IRUGO, soc_info_get,  NULL);
+static DEVICE_ATTR(jep106_identification_code, S_IRUGO, soc_info_get,  NULL);
 
 struct device *soc_device_to_device(struct soc_device *soc_dev)
 {
@@ -64,6 +65,9 @@ static umode_t soc_attribute_mode(struct kobject *kobj,
 	if ((attr == &dev_attr_soc_id.attr)
 	    && (soc_dev->attr->soc_id != NULL))
 		return attr->mode;
+	if ((attr == &dev_attr_jep106_identification_code.attr)
+	    && (soc_dev->attr->jep106_id != NULL))
+		return attr->mode;
 
 	/* Unknown or unfilled attribute. */
 	return 0;
@@ -85,6 +89,8 @@ static ssize_t soc_info_get(struct device *dev,
 		return sprintf(buf, "%s\n", soc_dev->attr->serial_number);
 	if (attr == &dev_attr_soc_id)
 		return sprintf(buf, "%s\n", soc_dev->attr->soc_id);
+	if (attr == &dev_attr_jep106_identification_code)
+		return sprintf(buf, "%s\n", soc_dev->attr->jep106_id);
 
 	return -EINVAL;
 
@@ -96,6 +102,7 @@ static struct attribute *soc_attr[] = {
 	&dev_attr_serial_number.attr,
 	&dev_attr_soc_id.attr,
 	&dev_attr_revision.attr,
+	&dev_attr_jep106_identification_code.attr,
 	NULL,
 };
 
@@ -214,6 +221,11 @@ static int soc_device_match_attr(const struct soc_device_attribute *attr,
 	    (!attr->soc_id || !glob_match(match->soc_id, attr->soc_id)))
 		return 0;
 
+	if (match->jep106_id &&
+	    (!attr->jep106_id ||
+	     !glob_match(match->jep106_id, attr->jep106_id)))
+		return 0;
+
 	return 1;
 }
 
include/linux/sys_soc.h +1 -0
index d9b3cf0f410c..394fa70ae16f 100644
@@ -14,6 +14,7 @@ struct soc_device_attribute {
 	const char *revision;
 	const char *serial_number;
 	const char *soc_id;
+	const char *jep106_id;
 	const void *data;
 	const struct attribute_group *custom_attr_group;
 };
Signature · 1 line
2.17.1
#2 lore raw

PATCH 2/2 firmware: smccc: Add ARCH_SOC_ID support

In reply to Sudeep Holla

SMCCC v1.2 adds a new optional function SMCCC_ARCH_SOC_ID to obtain a SiP defined SoC identification value. Add support for the same.

Also using the SoC bus infrastructure, let us expose the platform specific SoC atrributes under sysfs.

---
 drivers/firmware/smccc/Kconfig  |   9 +++
 drivers/firmware/smccc/Makefile |   1 +
 drivers/firmware/smccc/soc_id.c | 113 ++++++++++++++++++++++++++++++++
 include/linux/arm-smccc.h       |   5 ++
 4 files changed, 128 insertions(+)
 create mode 100644 drivers/firmware/smccc/soc_id.c
drivers/firmware/smccc/Kconfig +9 -0
index 27b675d76235..15e7466179a6 100644
@@ -14,3 +14,12 @@ config HAVE_ARM_SMCCC_DISCOVERY
 	 to add SMCCC discovery mechanism though the PSCI firmware
 	 implementation of PSCI_FEATURES(SMCCC_VERSION) which returns
 	 success on firmware compliant to SMCCC v1.1 and above.
+
+config ARM_SMCCC_SOC_ID
+	bool "SoC bus device for the ARM SMCCC SOC_ID"
+	depends on HAVE_ARM_SMCCC_DISCOVERY
+	default y
+	select SOC_BUS
+	help
+	  Include support for the SoC bus on the ARM SMCCC firmware based
+	  platforms providing some sysfs information about the SoC variant.
drivers/firmware/smccc/Makefile +1 -0
index 6f369fe3f0b9..72ab84042832 100644
@@ -1,3 +1,4 @@
 # SPDX-License-Identifier: GPL-2.0
 #
 obj-$(CONFIG_HAVE_ARM_SMCCC_DISCOVERY)	+= smccc.o
+obj-$(CONFIG_ARM_SMCCC_SOC_ID)	+= soc_id.o
drivers/firmware/smccc/soc_id.c new file +113 -0

113 lines not on this page · raw message

include/linux/arm-smccc.h +5 -0
index 56d6a5c6e353..8254e11ea857 100644
@@ -71,6 +71,11 @@
 			   ARM_SMCCC_SMC_32,				\
 			   0, 1)
 
+#define ARM_SMCCC_ARCH_SOC_ID						\
+	ARM_SMCCC_CALL_VAL(ARM_SMCCC_FAST_CALL,				\
+			   ARM_SMCCC_SMC_32,				\
+			   0, 2)
+
 #define ARM_SMCCC_ARCH_WORKAROUND_1					\
 	ARM_SMCCC_CALL_VAL(ARM_SMCCC_FAST_CALL,				\
 			   ARM_SMCCC_SMC_32,				\
Signature · 7 lines
2.17.1


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#3 lore raw

Re: [PATCH 2/2] firmware: smccc: Add ARCH_SOC_ID support

Quoted 6 lines · Sudeep Holla
drivers/firmware/smccc/soc_id.c new file +6 -0
+
+       soc_id_rev = res.a0;
+
+       soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL);
+       if (!soc_dev_attr)
+               return -ENOMEM;

drivers/firmware/smccc/soc_id.c line 92

Quoted 10 lines
drivers/firmware/smccc/soc_id.c new file +10 -0
+
+       sprintf(soc_id_str, "0x%04x", IMP_DEF_SOC_ID(soc_id_version));
+       sprintf(soc_id_rev_str, "0x%08x", soc_id_rev);
+       sprintf(soc_id_jep106_id_str, "0x%02x%02x",
+               JEP106_BANK_CONT_CODE(soc_id_version),
+               JEP106_ID_CODE(soc_id_version));
+
+       soc_dev_attr->soc_id = soc_id_str;
+       soc_dev_attr->revision = soc_id_rev_str;
+       soc_dev_attr->jep106_id = soc_id_jep106_id_str;

Ok, let me try to understand how this maps the 64-bit ID into the six strings in user space:

For a chip that identifies as

JEP106_BANK_CONT_CODE = 12
JEP106_ID_CODE = 34
IMP_DEF_SOC_ID = 5678
soc_id_rev = 9abcdef0

the normal sysfs attributes contain these strings:

machine = ""
family = ""
revision = "0x9abcdef0
serial_number = ""
soc_id = "0x5678"

and the new attribute is

jep106_identification_code = "0x1234"

This still looks like a rather poorly designed interface to me, with a number of downsides:

- Nothing in those strings identifies the numbers as using jep106 numbers rather than some something else that might use strings with hexadecimal numbers.

- I think we should have something unique in "family" just because existing scripts can use that as the primary indentifier

- It seems odd that there is no way to read the serial number through the same interface and publish it the usual way. Francois Ozog recently asked for a generic way to find out a serial number for inventory management, and this would be the obvious place to have it. It can of course be added later when the next revision of the spec is there, it just seems like a surprising omission.

How about making the contents:

machine = "" /* could be a future addition, but board specific */ family = "jep106:1234"
revision = "0x9abcdef0
serial_number = "0xfedcba987654321" /* to be implemented later */ soc_id = "jep106:1234:5678" /* duplicates family but makes it unique*/

That would work without any new properties, dropping the other patch, and be easier to use for identification from user space.

Arnd

#4 lore raw

Re: [PATCH 2/2] firmware: smccc: Add ARCH_SOC_ID support

(+ Jose (SMCCC Spec author))

Quoted 38 lines · Arnd Bergmann
Quoted 6 lines · Sudeep Holla
drivers/firmware/smccc/soc_id.c new file +6 -0
+
+       soc_id_rev = res.a0;
+
+       soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL);
+       if (!soc_dev_attr)
+               return -ENOMEM;

drivers/firmware/smccc/soc_id.c line 92

Quoted 10 lines
drivers/firmware/smccc/soc_id.c new file +10 -0
+
+       sprintf(soc_id_str, "0x%04x", IMP_DEF_SOC_ID(soc_id_version));
+       sprintf(soc_id_rev_str, "0x%08x", soc_id_rev);
+       sprintf(soc_id_jep106_id_str, "0x%02x%02x",
+               JEP106_BANK_CONT_CODE(soc_id_version),
+               JEP106_ID_CODE(soc_id_version));
+
+       soc_dev_attr->soc_id = soc_id_str;
+       soc_dev_attr->revision = soc_id_rev_str;
+       soc_dev_attr->jep106_id = soc_id_jep106_id_str;

Ok, let me try to understand how this maps the 64-bit ID into the six strings in user space:

For a chip that identifies as

JEP106_BANK_CONT_CODE = 12
JEP106_ID_CODE = 34
IMP_DEF_SOC_ID = 5678
soc_id_rev = 9abcdef0

the normal sysfs attributes contain these strings:

machine = ""
family = ""
revision = "0x9abcdef0
serial_number = ""
soc_id = "0x5678"

and the new attribute is

Quoted 9 lines

jep106_identification_code = "0x1234"

This still looks like a rather poorly designed interface to me, with a number of downsides:

- Nothing in those strings identifies the numbers as using jep106 numbers rather than some something else that might use strings with hexadecimal numbers.

Not sure if I understand your concerns completely here.

Anyways I wanted to clarify that the jep106 encoding is applicable only for manufacturer's id and not for SoC ID or revision. Not sure if that changes anything about your concerns.

Quoted 3 lines

- I think we should have something unique in "family" just because existing scripts can use that as the primary indentifier

I agree with your idea of combining attributes, not sure exactly which ones yet.

Quoted 2 lines

- It seems odd that there is no way to read the serial number through the same interface and publish it the usual way.

Valid concern and I will pass this to interface authors.

Quoted 3 lines

Francois Ozog
recently asked for a generic way to find out a serial number for inventory management, and this would be the obvious place to have it.

Agreed, but not sure what author(s) have to say. I have cc-ed one of them.

Quoted 3 lines

It can of course be added later when the next revision of the spec is there, it just seems like a surprising omission.

Yes, definitely. Good to get feedback.

Quoted 4 lines

How about making the contents:

machine = "" /* could be a future addition, but board specific */ family = "jep106:1234"

But this just indicates manufacturer id and nothing related to SoC family. If it is jep106:043b, all it indicates is Arm Ltd and assigning it to family doesn't sound right to me.

I had requests for both of the above during the design of interface but I was told vendors were happy with the interface. I will let the authors speak about that.

Quoted 2 lines

revision = "0x9abcdef0
serial_number = "0xfedcba987654321" /* to be implemented later */

Sure.

Quoted 1 line

soc_id = "jep106:1234:5678" /* duplicates family but makes it unique*/

Not sure again.

Quoted 4 lines

That would work without any new properties, dropping the other patch, and be easier to use for identification from user space.

OK, I agree on ease part. But for me, we don't have any property in the list to indicate the vendor/manufacturer's name. I don't see issue adding one, name can be fixed as jep106_identification_code is too specific.

How about manufacturer with the value in the format "jep106:1234" if it is not normal string but jep106 encoding.

--
Regards,
Sudeep

#5 lore raw

Re: [PATCH 2/2] firmware: smccc: Add ARCH_SOC_ID support

Quoted 84 lines · Sudeep Holla

(+ Jose (SMCCC Spec author))

Quoted 38 lines · Arnd Bergmann
Quoted 6 lines · Sudeep Holla
drivers/firmware/smccc/soc_id.c new file +6 -0
+
+       soc_id_rev = res.a0;
+
+       soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL);
+       if (!soc_dev_attr)
+               return -ENOMEM;

drivers/firmware/smccc/soc_id.c line 92

Quoted 10 lines
drivers/firmware/smccc/soc_id.c new file +10 -0
+
+       sprintf(soc_id_str, "0x%04x", IMP_DEF_SOC_ID(soc_id_version));
+       sprintf(soc_id_rev_str, "0x%08x", soc_id_rev);
+       sprintf(soc_id_jep106_id_str, "0x%02x%02x",
+               JEP106_BANK_CONT_CODE(soc_id_version),
+               JEP106_ID_CODE(soc_id_version));
+
+       soc_dev_attr->soc_id = soc_id_str;
+       soc_dev_attr->revision = soc_id_rev_str;
+       soc_dev_attr->jep106_id = soc_id_jep106_id_str;

Ok, let me try to understand how this maps the 64-bit ID into the six strings in user space:

For a chip that identifies as

JEP106_BANK_CONT_CODE = 12
JEP106_ID_CODE = 34
IMP_DEF_SOC_ID = 5678
soc_id_rev = 9abcdef0

the normal sysfs attributes contain these strings:

machine = ""
family = ""
revision = "0x9abcdef0
serial_number = ""
soc_id = "0x5678"

and the new attribute is

Quoted 9 lines

jep106_identification_code = "0x1234"

This still looks like a rather poorly designed interface to me, with a number of downsides:

- Nothing in those strings identifies the numbers as using jep106 numbers rather than some something else that might use strings with hexadecimal numbers.

Not sure if I understand your concerns completely here.

Anyways I wanted to clarify that the jep106 encoding is applicable only for manufacturer's id and not for SoC ID or revision. Not sure if that changes anything about your concerns.

Quoted 3 lines

- I think we should have something unique in "family" just because existing scripts can use that as the primary indentifier

I agree with your idea of combining attributes, not sure exactly which ones yet.

Quoted 2 lines

- It seems odd that there is no way to read the serial number through the same interface and publish it the usual way.

Valid concern and I will pass this to interface authors.

Quoted 3 lines

Francois Ozog
recently asked for a generic way to find out a serial number for inventory management, and this would be the obvious place to have it.

Agreed, but not sure what author(s) have to say. I have cc-ed one of them.

Quoted 3 lines

It can of course be added later when the next revision of the spec is there, it just seems like a surprising omission.

Yes, definitely. Good to get feedback.

Quoted 3 lines

How about making the contents:

machine = "" /* could be a future addition, but board specific */

[...]

Quoted 1 line
Quoted 1 line

serial_number = "0xfedcba987654321" /* to be implemented later */

OK more thoughts and few points I missed earlier. The SoC infrastructure is more wider than the SoC itself IMO. The machine and serial_number are beyond the SoC and this SMCCC SOC_ID confined itself to SoC for simple reason that it is part of SoC vendor firmware which could be used across various machines/boards/platforms.

I wonder now that rather than adding this as a SoC sysfs driver on it's own, does it make sense to keep it as library which existing drivers can use. Or we need to standardise the machine level interface that may like outside SoC firmware and use both to have a generic SoC sysfs driver.

Sorry, I am just writing as I am thinking and may be talking garbage.

Signature · 2 lines
Regards,
Sudeep
#6 lore raw

Re: [PATCH 2/2] firmware: smccc: Add ARCH_SOC_ID support

In reply to Sudeep Holla
Quoted 52 lines · Sudeep Holla

(+ Jose (SMCCC Spec author))

Quoted 38 lines · Arnd Bergmann
Quoted 6 lines · Sudeep Holla
drivers/firmware/smccc/soc_id.c new file +6 -0
+
+       soc_id_rev = res.a0;
+
+       soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL);
+       if (!soc_dev_attr)
+               return -ENOMEM;

drivers/firmware/smccc/soc_id.c line 92

Quoted 10 lines
drivers/firmware/smccc/soc_id.c new file +10 -0
+
+       sprintf(soc_id_str, "0x%04x", IMP_DEF_SOC_ID(soc_id_version));
+       sprintf(soc_id_rev_str, "0x%08x", soc_id_rev);
+       sprintf(soc_id_jep106_id_str, "0x%02x%02x",
+               JEP106_BANK_CONT_CODE(soc_id_version),
+               JEP106_ID_CODE(soc_id_version));
+
+       soc_dev_attr->soc_id = soc_id_str;
+       soc_dev_attr->revision = soc_id_rev_str;
+       soc_dev_attr->jep106_id = soc_id_jep106_id_str;

Ok, let me try to understand how this maps the 64-bit ID into the six strings in user space:

For a chip that identifies as

JEP106_BANK_CONT_CODE = 12
JEP106_ID_CODE = 34
IMP_DEF_SOC_ID = 5678
soc_id_rev = 9abcdef0

the normal sysfs attributes contain these strings:

machine = ""
family = ""
revision = "0x9abcdef0
serial_number = ""
soc_id = "0x5678"

and the new attribute is

Quoted 9 lines

jep106_identification_code = "0x1234"

This still looks like a rather poorly designed interface to me, with a number of downsides:

- Nothing in those strings identifies the numbers as using jep106 numbers rather than some something else that might use strings with hexadecimal numbers.

Quoted 5 lines

Not sure if I understand your concerns completely here.

Anyways I wanted to clarify that the jep106 encoding is applicable only for manufacturer's id and not for SoC ID or revision. Not sure if that changes anything about your concerns.

The problem I see is that by looking at just the existing attributes, you have no way of telling what namespace the strings are in, and a script that tries pattern matching could confuse two hexadecimal numbers from a different namespace, such as pci vendor/device or usb vendor/device IDs that are similar in spirit to the jep106 codes.

Quoted 2 lines
Quoted 2 lines

- I think we should have something unique in "family" just because existing scripts can use that as the primary indentifier

This is part of the same issue: If we put just "jep106 identified SoC" as the "family", it would be something a driver could match against.

Quoted 5 lines
Quoted 4 lines

How about making the contents:

machine = "" /* could be a future addition, but board specific */ family = "jep106:1234"

Quoted 7 lines

But this just indicates manufacturer id and nothing related to SoC family. If it is jep106:043b, all it indicates is Arm Ltd and assigning it to family doesn't sound right to me.

I had requests for both of the above during the design of interface but I was told vendors were happy with the interface. I will let the authors speak about that.

In most cases, the existing drivers put a hardcoded string into the family, such as

"Samsung Exynos"
"Freescale i.MX"
"Amlogic Meson"

or slightly more specific

"R-Car Gen2"

Having a numeric identifier for the SoC manufacturer here is a bit more coarse than that, but would be similar in spirit.

Quoted 8 lines
Quoted 1 line

soc_id = "jep106:1234:5678" /* duplicates family but makes it unique*/

Not sure again.

Quoted 3 lines

That would work without any new properties, dropping the other patch, and be easier to use for identification from user space.

Quoted 6 lines

OK, I agree on ease part. But for me, we don't have any property in the list to indicate the vendor/manufacturer's name. I don't see issue adding one, name can be fixed as jep106_identification_code is too specific.

How about manufacturer with the value in the format "jep106:1234" if it is not normal string but jep106 encoding.

I don't think we need a real name like "Arm" or "Samsung" here, but just a number is not enough, it should at least be something that can be assumed to never conflict with the name of a chip by another scheme.

jep106:5678 (the IMP_DEF_SOC_ID field in my example) would probably be sufficient to not conflict with a another soc_device driver, but is quite likely to clash with an ID used by another manufacturer.

jep106:1234 (the manufacturer ID) in turn seems too broad from the soc_id field, as that would include every chip made by one company.

Arnd

#7 lore raw

Re: [PATCH 2/2] firmware: smccc: Add ARCH_SOC_ID support

Quoted 1 line · Arnd Bergmann

On Fri, May 22, 2020 at 6:54 PM Sudeep Holla <[email protected]> wrote:

[...]

Quoted 7 lines
Quoted 6 lines

Not sure if I understand your concerns completely here.

Anyways I wanted to clarify that the jep106 encoding is applicable only for manufacturer's id and not for SoC ID or revision. Not sure if that changes anything about your concerns.

Quoted 7 lines

The problem I see is that by looking at just the existing attributes, you have no way of telling what namespace the strings are in, and a script that tries pattern matching could confuse two hexadecimal numbers from a different namespace, such as pci vendor/device or usb vendor/device IDs that are similar in spirit to the jep106 codes.

Ah OK, understood.

Quoted 6 lines
Quoted 2 lines
Quoted 2 lines

- I think we should have something unique in "family" just because existing scripts can use that as the primary indentifier

This is part of the same issue: If we put just "jep106 identified SoC" as the "family", it would be something a driver could match against.

I understand that and that's the reason I was introducing new field as manufacture but I now see there is no point in adding that.

[...]

Quoted 11 lines
Quoted 7 lines

But this just indicates manufacturer id and nothing related to SoC family. If it is jep106:043b, all it indicates is Arm Ltd and assigning it to family doesn't sound right to me.

I had requests for both of the above during the design of interface but I was told vendors were happy with the interface. I will let the authors speak about that.

In most cases, the existing drivers put a hardcoded string into the family, such as

Quoted 8 lines

"Samsung Exynos"
"Freescale i.MX"
"Amlogic Meson"

or slightly more specific

"R-Car Gen2"

Hmmm....

Quoted 3 lines

Having a numeric identifier for the SoC manufacturer here is a bit more coarse than that, but would be similar in spirit.

Agreed.

[..]

Quoted 5 lines
Quoted 5 lines

OK, I agree on ease part. But for me, we don't have any property in the list to indicate the vendor/manufacturer's name. I don't see issue adding one, name can be fixed as jep106_identification_code is too specific.

Quoted 8 lines
Quoted 2 lines

How about manufacturer with the value in the format "jep106:1234" if it is not normal string but jep106 encoding.

I don't think we need a real name like "Arm" or "Samsung" here, but just a number is not enough, it should at least be something that can be assumed to never conflict with the name of a chip by another scheme.

Fair enough.

Quoted 5 lines

jep106:5678 (the IMP_DEF_SOC_ID field in my example) would probably be sufficient to not conflict with a another soc_device driver, but is quite likely to clash with an ID used by another manufacturer.

IIUC, you are fine with "jep106:1234:5678" where 1234 is jep106 manufacture id code and 5678 is soc_id as it may avoid all the conflicts across the manufacture namespaces.

Quoted 4 lines

jep106:1234 (the manufacturer ID) in turn seems too broad from the soc_id field, as that would include every chip made by one company.

I understand, and IIUC you prefer this to be embedded with soc_id especially to avoid namespace conflicts which makes sense.

Thanks for all the discussion and valuable inputs. I am now bit nervous to add SoC info from SMCCC ARCH_SOC_ID to sysfs yet as we need more info especially "machine" and "serial_number" for elsewhere(OEM firmware mostly from DT or ACPI).

TBH, the mix might be bit of a mess as there are soc drivers that rely on DT completely today. Anyways, this SOC_ID can be added as library that can be used by a *generic* soc driver once we define a standard way to fetch other information("machine" and "serial_number"). I am happy to get suggestions on that front especially from you and Francois as you have got some context already.

--
Regards,
Sudeep

#8 lore raw

Re: [PATCH 2/2] firmware: smccc: Add ARCH_SOC_ID support

Quoted 9 lines · Sudeep Holla
Quoted 7 lines · Arnd Bergmann

On Fri, May 22, 2020 at 6:54 PM Sudeep Holla <[email protected]> wrote:

jep106:5678 (the IMP_DEF_SOC_ID field in my example) would probably be sufficient to not conflict with a another soc_device driver, but is quite likely to clash with an ID used by another manufacturer.

Quoted 3 lines

IIUC, you are fine with "jep106:1234:5678" where 1234 is jep106 manufacture id code and 5678 is soc_id as it may avoid all the conflicts across the manufacture namespaces.

I think either jep106:5678 or jep106:1234:5678 (or some variation with different field separators if you prefer) would be fine here.

Quoted 5 lines
Quoted 4 lines

jep106:1234 (the manufacturer ID) in turn seems too broad from the soc_id field, as that would include every chip made by one company.

Quoted 7 lines

I understand, and IIUC you prefer this to be embedded with soc_id especially to avoid namespace conflicts which makes sense.

Thanks for all the discussion and valuable inputs. I am now bit nervous to add SoC info from SMCCC ARCH_SOC_ID to sysfs yet as we need more info especially "machine" and "serial_number" for elsewhere(OEM firmware mostly from DT or ACPI).

I probably wouldn't mix those in with the same driver. If machine and serial_number have no smccc interface, then they should be left out, but there could be a separate soc_device that gets that information by other means, usually using one of the existing hardware id register drivers.

Quoted 6 lines

TBH, the mix might be bit of a mess as there are soc drivers that rely on DT completely today. Anyways, this SOC_ID can be added as library that can be used by a *generic* soc driver once we define a standard way to fetch other information("machine" and "serial_number"). I am happy to get suggestions on that front especially from you and Francois as you have got some context already.

Well, I suppose we could have the entire data from the smccc interface in a central place somewhere, such as (to stay with my example) "1234:5678:9abcdef0" in an attribute of any soc_device driver that adds a call to a library function for the jep106 ID, or possibly in /sys/firmware or even a field added to /proc/cpuinfo.

Arnd

#9 lore raw

RE: [PATCH 2/2] firmware: smccc: Add ARCH_SOC_ID support

Quoted 48 lines
Quoted 2 lines · Sudeep Holla
Quoted 1 line · Arnd Bergmann

On Fri, May 22, 2020 at 6:54 PM Sudeep Holla <[email protected]>

Quoted 7 lines · wrote:
Quoted 5 lines

jep106:5678 (the IMP_DEF_SOC_ID field in my example) would probably be sufficient to not conflict with a another soc_device driver, but is quite likely to clash with an ID used by another manufacturer.

IIUC, you are fine with "jep106:1234:5678" where 1234 is jep106

manufacture

Quoted 2 lines

id code and 5678 is soc_id as it may avoid all the conflicts across the manufacture namespaces.

I think either jep106:5678 or jep106:1234:5678 (or some variation with different field separators if you prefer) would be fine here.

Quoted 10 lines
Quoted 4 lines

jep106:1234 (the manufacturer ID) in turn seems too broad from the soc_id field, as that would include every chip made by one company.

I understand, and IIUC you prefer this to be embedded with soc_id especially to avoid namespace conflicts which makes sense.

Thanks for all the discussion and valuable inputs. I am now bit nervous to add SoC info from SMCCC ARCH_SOC_ID to sysfs yet as we need more

info

Quoted 1 line

especially "machine" and "serial_number" for elsewhere(OEM firmware

mostly

Quoted 1 line

from DT or ACPI).

I probably wouldn't mix those in with the same driver. If machine and serial_number have no smccc interface, then they should be left out, but there could be a separate soc_device that gets that information by other means, usually using one of the existing hardware id register drivers.

Quoted 6 lines

TBH, the mix might be bit of a mess as there are soc drivers that rely on DT completely today. Anyways, this SOC_ID can be added as library that can be used by a *generic* soc driver once we define a standard way to fetch other information("machine" and "serial_number"). I am happy to get suggestions on that front especially from you and Francois as you have got some context already.

Quoted 5 lines

Well, I suppose we could have the entire data from the smccc interface in a central place somewhere, such as (to stay with my example) "1234:5678:9abcdef0" in an attribute of any soc_device driver that adds a call to a library function for the jep106 ID, or possibly in /sys/firmware or even a field added to /proc/cpuinfo.

I think this is a great way to expose the SoC ID info. It's important to have the SoC ID as a whole in a sysfs (or somewhere where it's easy to obtain and parse from user-space). The information provided by SoC ID should be listed in this form jep106:1234:5678, that is jep106:<manufacturer ID>:<SoC ID> .

Regards,

Jose
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel