LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] firmware: dmi: Add access to the SKU ID string
@ 2018-04-24 21:11 Simon Glass
  2018-04-25  2:51 ` Vinod Koul
  2018-04-27  7:58 ` Jean Delvare
  0 siblings, 2 replies; 7+ messages in thread
From: Simon Glass @ 2018-04-24 21:11 UTC (permalink / raw)
  To: LKML
  Cc: C Shapiro, Aaron Durbin, Simon Glass, Mika Westerberg,
	Jonathan Corbet, Philippe Ombredanne, Andy Shevchenko, Alex Hung,
	Dmitry Torokhov, Greg Kroah-Hartman, Jean Delvare, sayli karnik,
	Vinod Koul, Sagar Dharia

This is used in some systems from user space for determining the identity
of the device.

Expose this as a file so that that user-space tools don't need to read
from /sys/firmware/dmi/tables/DMI

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 drivers/firmware/dmi-id.c       | 2 ++
 drivers/firmware/dmi_scan.c     | 1 +
 include/linux/mod_devicetable.h | 1 +
 3 files changed, 4 insertions(+)

diff --git a/drivers/firmware/dmi-id.c b/drivers/firmware/dmi-id.c
index 951b6c79f166a..fe78c7f801163 100644
--- a/drivers/firmware/dmi-id.c
+++ b/drivers/firmware/dmi-id.c
@@ -48,6 +48,7 @@ DEFINE_DMI_ATTR_WITH_SHOW(product_version,	0444, DMI_PRODUCT_VERSION);
 DEFINE_DMI_ATTR_WITH_SHOW(product_serial,	0400, DMI_PRODUCT_SERIAL);
 DEFINE_DMI_ATTR_WITH_SHOW(product_uuid,		0400, DMI_PRODUCT_UUID);
 DEFINE_DMI_ATTR_WITH_SHOW(product_family,	0444, DMI_PRODUCT_FAMILY);
+DEFINE_DMI_ATTR_WITH_SHOW(product_sku,		0444, DMI_PRODUCT_SKU);
 DEFINE_DMI_ATTR_WITH_SHOW(board_vendor,		0444, DMI_BOARD_VENDOR);
 DEFINE_DMI_ATTR_WITH_SHOW(board_name,		0444, DMI_BOARD_NAME);
 DEFINE_DMI_ATTR_WITH_SHOW(board_version,	0444, DMI_BOARD_VERSION);
@@ -193,6 +194,7 @@ static void __init dmi_id_init_attr_table(void)
 	ADD_DMI_ATTR(product_serial,    DMI_PRODUCT_SERIAL);
 	ADD_DMI_ATTR(product_uuid,      DMI_PRODUCT_UUID);
 	ADD_DMI_ATTR(product_family,    DMI_PRODUCT_FAMILY);
+	ADD_DMI_ATTR(product_sku,       DMI_PRODUCT_SKU);
 	ADD_DMI_ATTR(board_vendor,      DMI_BOARD_VENDOR);
 	ADD_DMI_ATTR(board_name,        DMI_BOARD_NAME);
 	ADD_DMI_ATTR(board_version,     DMI_BOARD_VERSION);
diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c
index 54e66adef2525..f2483548cde92 100644
--- a/drivers/firmware/dmi_scan.c
+++ b/drivers/firmware/dmi_scan.c
@@ -447,6 +447,7 @@ static void __init dmi_decode(const struct dmi_header *dm, void *dummy)
 		dmi_save_ident(dm, DMI_PRODUCT_VERSION, 6);
 		dmi_save_ident(dm, DMI_PRODUCT_SERIAL, 7);
 		dmi_save_uuid(dm, DMI_PRODUCT_UUID, 8);
+		dmi_save_ident(dm, DMI_PRODUCT_SKU, 25);
 		dmi_save_ident(dm, DMI_PRODUCT_FAMILY, 26);
 		break;
 	case 2:		/* Base Board Information */
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index 7d361be2e24f4..cb8487e29d3ae 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -491,6 +491,7 @@ enum dmi_field {
 	DMI_PRODUCT_SERIAL,
 	DMI_PRODUCT_UUID,
 	DMI_PRODUCT_FAMILY,
+	DMI_PRODUCT_SKU,
 	DMI_BOARD_VENDOR,
 	DMI_BOARD_NAME,
 	DMI_BOARD_VERSION,
-- 
2.17.0.484.g0c8726318c-goog

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] firmware: dmi: Add access to the SKU ID string
  2018-04-24 21:11 [PATCH] firmware: dmi: Add access to the SKU ID string Simon Glass
@ 2018-04-25  2:51 ` Vinod Koul
  2018-04-25 21:17   ` Simon Glass
  2018-04-27  7:58 ` Jean Delvare
  1 sibling, 1 reply; 7+ messages in thread
From: Vinod Koul @ 2018-04-25  2:51 UTC (permalink / raw)
  To: Simon Glass
  Cc: LKML, C Shapiro, Aaron Durbin, Mika Westerberg, Jonathan Corbet,
	Philippe Ombredanne, Andy Shevchenko, Alex Hung, Dmitry Torokhov,
	Greg Kroah-Hartman, Jean Delvare, sayli karnik, Sagar Dharia

On Tue, Apr 24, 2018 at 03:11:11PM -0600, Simon Glass wrote:
> This is used in some systems from user space for determining the identity
> of the device.
> 
> Expose this as a file so that that user-space tools don't need to read
> from /sys/firmware/dmi/tables/DMI

sysfs is an ABI and needs to be documented, I don't see that in this patch,
pls add.

> 
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
> 
>  drivers/firmware/dmi-id.c       | 2 ++
>  drivers/firmware/dmi_scan.c     | 1 +
>  include/linux/mod_devicetable.h | 1 +
>  3 files changed, 4 insertions(+)
> 
> diff --git a/drivers/firmware/dmi-id.c b/drivers/firmware/dmi-id.c
> index 951b6c79f166a..fe78c7f801163 100644
> --- a/drivers/firmware/dmi-id.c
> +++ b/drivers/firmware/dmi-id.c
> @@ -48,6 +48,7 @@ DEFINE_DMI_ATTR_WITH_SHOW(product_version,	0444, DMI_PRODUCT_VERSION);
>  DEFINE_DMI_ATTR_WITH_SHOW(product_serial,	0400, DMI_PRODUCT_SERIAL);
>  DEFINE_DMI_ATTR_WITH_SHOW(product_uuid,		0400, DMI_PRODUCT_UUID);
>  DEFINE_DMI_ATTR_WITH_SHOW(product_family,	0444, DMI_PRODUCT_FAMILY);
> +DEFINE_DMI_ATTR_WITH_SHOW(product_sku,		0444, DMI_PRODUCT_SKU);
>  DEFINE_DMI_ATTR_WITH_SHOW(board_vendor,		0444, DMI_BOARD_VENDOR);
>  DEFINE_DMI_ATTR_WITH_SHOW(board_name,		0444, DMI_BOARD_NAME);
>  DEFINE_DMI_ATTR_WITH_SHOW(board_version,	0444, DMI_BOARD_VERSION);
> @@ -193,6 +194,7 @@ static void __init dmi_id_init_attr_table(void)
>  	ADD_DMI_ATTR(product_serial,    DMI_PRODUCT_SERIAL);
>  	ADD_DMI_ATTR(product_uuid,      DMI_PRODUCT_UUID);
>  	ADD_DMI_ATTR(product_family,    DMI_PRODUCT_FAMILY);
> +	ADD_DMI_ATTR(product_sku,       DMI_PRODUCT_SKU);
>  	ADD_DMI_ATTR(board_vendor,      DMI_BOARD_VENDOR);
>  	ADD_DMI_ATTR(board_name,        DMI_BOARD_NAME);
>  	ADD_DMI_ATTR(board_version,     DMI_BOARD_VERSION);
> diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c
> index 54e66adef2525..f2483548cde92 100644
> --- a/drivers/firmware/dmi_scan.c
> +++ b/drivers/firmware/dmi_scan.c
> @@ -447,6 +447,7 @@ static void __init dmi_decode(const struct dmi_header *dm, void *dummy)
>  		dmi_save_ident(dm, DMI_PRODUCT_VERSION, 6);
>  		dmi_save_ident(dm, DMI_PRODUCT_SERIAL, 7);
>  		dmi_save_uuid(dm, DMI_PRODUCT_UUID, 8);
> +		dmi_save_ident(dm, DMI_PRODUCT_SKU, 25);
>  		dmi_save_ident(dm, DMI_PRODUCT_FAMILY, 26);
>  		break;
>  	case 2:		/* Base Board Information */
> diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
> index 7d361be2e24f4..cb8487e29d3ae 100644
> --- a/include/linux/mod_devicetable.h
> +++ b/include/linux/mod_devicetable.h
> @@ -491,6 +491,7 @@ enum dmi_field {
>  	DMI_PRODUCT_SERIAL,
>  	DMI_PRODUCT_UUID,
>  	DMI_PRODUCT_FAMILY,
> +	DMI_PRODUCT_SKU,
>  	DMI_BOARD_VENDOR,
>  	DMI_BOARD_NAME,
>  	DMI_BOARD_VERSION,
> -- 
> 2.17.0.484.g0c8726318c-goog
> 

-- 
~Vinod

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] firmware: dmi: Add access to the SKU ID string
  2018-04-25  2:51 ` Vinod Koul
@ 2018-04-25 21:17   ` Simon Glass
  2018-04-26  9:33     ` Vinod Koul
  0 siblings, 1 reply; 7+ messages in thread
From: Simon Glass @ 2018-04-25 21:17 UTC (permalink / raw)
  To: Vinod Koul
  Cc: LKML, C Shapiro, Aaron Durbin, Mika Westerberg, Jonathan Corbet,
	Philippe Ombredanne, Andy Shevchenko, Alex Hung, Dmitry Torokhov,
	Greg Kroah-Hartman, Jean Delvare, sayli karnik, Sagar Dharia

Hi Vinod,

On 24 April 2018 at 20:51, Vinod Koul <vinod.koul@intel.com> wrote:
> On Tue, Apr 24, 2018 at 03:11:11PM -0600, Simon Glass wrote:
>> This is used in some systems from user space for determining the identity
>> of the device.
>>
>> Expose this as a file so that that user-space tools don't need to read
>> from /sys/firmware/dmi/tables/DMI
>
> sysfs is an ABI and needs to be documented, I don't see that in this patch,
> pls add.

Thanks for taking a look. The only mention of the dmi/id I can find is
in Kconfig:

config DMIID
    bool "Export DMI identification via sysfs to userspace"
    depends on DMI
    default y
help
  Say Y here if you want to query SMBIOS/DMI system identification
  information from userspace through /sys/class/dmi/id/ or if you want
  DMI-based module auto-loading.


Are you suggesting that I create a list of the things in the /id node,
or something else?

Regards,
Simon

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] firmware: dmi: Add access to the SKU ID string
  2018-04-25 21:17   ` Simon Glass
@ 2018-04-26  9:33     ` Vinod Koul
  2018-04-26 11:01       ` Jean Delvare
  0 siblings, 1 reply; 7+ messages in thread
From: Vinod Koul @ 2018-04-26  9:33 UTC (permalink / raw)
  To: Simon Glass
  Cc: LKML, C Shapiro, Aaron Durbin, Mika Westerberg, Jonathan Corbet,
	Philippe Ombredanne, Andy Shevchenko, Alex Hung, Dmitry Torokhov,
	Greg Kroah-Hartman, Jean Delvare, sayli karnik, Sagar Dharia

On Wed, Apr 25, 2018 at 03:17:37PM -0600, Simon Glass wrote:
> Hi Vinod,
> 
> On 24 April 2018 at 20:51, Vinod Koul <vinod.koul@intel.com> wrote:
> > On Tue, Apr 24, 2018 at 03:11:11PM -0600, Simon Glass wrote:
> >> This is used in some systems from user space for determining the identity
> >> of the device.
> >>
> >> Expose this as a file so that that user-space tools don't need to read
> >> from /sys/firmware/dmi/tables/DMI
> >
> > sysfs is an ABI and needs to be documented, I don't see that in this patch,
> > pls add.
> 
> Thanks for taking a look. The only mention of the dmi/id I can find is
> in Kconfig:

Sorry I should have been explicit. All sysfs entries are ABI to userspace.
So they are documented in kernel and the meaning of files should not
typically get modfied over time.
Please read Documentation/ABI/README

For DMI, quick grep told me you should add to
Documentation/ABI/testing/sysfs-firmware-dmi-tables

HTH
-- 
~Vinod

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] firmware: dmi: Add access to the SKU ID string
  2018-04-26  9:33     ` Vinod Koul
@ 2018-04-26 11:01       ` Jean Delvare
  0 siblings, 0 replies; 7+ messages in thread
From: Jean Delvare @ 2018-04-26 11:01 UTC (permalink / raw)
  To: Vinod Koul, Simon Glass
  Cc: LKML, C Shapiro, Aaron Durbin, Mika Westerberg, Jonathan Corbet,
	Philippe Ombredanne, Andy Shevchenko, Alex Hung, Dmitry Torokhov,
	Greg Kroah-Hartman, sayli karnik, Sagar Dharia

On jeu., 2018-04-26 at 15:03 +0530, Vinod Koul wrote:
> On Wed, Apr 25, 2018 at 03:17:37PM -0600, Simon Glass wrote:
> > 
> > Hi Vinod,
> > 
> > On 24 April 2018 at 20:51, Vinod Koul <vinod.koul@intel.com> wrote:
> > > 
> > > On Tue, Apr 24, 2018 at 03:11:11PM -0600, Simon Glass wrote:
> > > > 
> > > > This is used in some systems from user space for determining the identity
> > > > of the device.
> > > > 
> > > > Expose this as a file so that that user-space tools don't need to read
> > > > from /sys/firmware/dmi/tables/DMI
> > > 
> > > sysfs is an ABI and needs to be documented, I don't see that in this patch,
> > > pls add.
> > 
> > Thanks for taking a look. The only mention of the dmi/id I can find is
> > in Kconfig:
> 
> Sorry I should have been explicit. All sysfs entries are ABI to userspace.
> So they are documented in kernel and the meaning of files should not
> typically get modfied over time.
> Please read Documentation/ABI/README
> 
> For DMI, quick grep told me you should add to
> Documentation/ABI/testing/sysfs-firmware-dmi-tables

No. This is a different interface to user-space (binary tables, instead
of already decoded, selected attributes.)

There is currently no formal documentation of the
/sys/devices/virtual/dmi/id contents, so there's no file Simon can
modify to mention product_sku. Instead, documentation of the whole
directory should be added in a separate patch.

-- 
Jean Delvare
SUSE L3 Support

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] firmware: dmi: Add access to the SKU ID string
  2018-04-24 21:11 [PATCH] firmware: dmi: Add access to the SKU ID string Simon Glass
  2018-04-25  2:51 ` Vinod Koul
@ 2018-04-27  7:58 ` Jean Delvare
  2018-04-27 19:12   ` Simon Glass
  1 sibling, 1 reply; 7+ messages in thread
From: Jean Delvare @ 2018-04-27  7:58 UTC (permalink / raw)
  To: Simon Glass
  Cc: LKML, C Shapiro, Aaron Durbin, Mika Westerberg, Jonathan Corbet,
	Philippe Ombredanne, Andy Shevchenko, Alex Hung, Dmitry Torokhov,
	Greg Kroah-Hartman, sayli karnik, Vinod Koul, Sagar Dharia

Hi Simon,

On Tue, 24 Apr 2018 15:11:11 -0600, Simon Glass wrote:
> This is used in some systems from user space for determining the identity
> of the device.
> 
> Expose this as a file so that that user-space tools don't need to read
> from /sys/firmware/dmi/tables/DMI
> 
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
> 
>  drivers/firmware/dmi-id.c       | 2 ++
>  drivers/firmware/dmi_scan.c     | 1 +
>  include/linux/mod_devicetable.h | 1 +
>  3 files changed, 4 insertions(+)
> (...)

Looks good to me. Applied, thanks. For consistency I have moved product
SKU before product family in all files, same order as in the DMI entry
itself.

-- 
Jean Delvare
SUSE L3 Support

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] firmware: dmi: Add access to the SKU ID string
  2018-04-27  7:58 ` Jean Delvare
@ 2018-04-27 19:12   ` Simon Glass
  0 siblings, 0 replies; 7+ messages in thread
From: Simon Glass @ 2018-04-27 19:12 UTC (permalink / raw)
  To: Jean Delvare
  Cc: LKML, C Shapiro, Aaron Durbin, Mika Westerberg, Jonathan Corbet,
	Philippe Ombredanne, Andy Shevchenko, Alex Hung, Dmitry Torokhov,
	Greg Kroah-Hartman, sayli karnik, Vinod Koul, Sagar Dharia

Hi Jean,

On 27 April 2018 at 01:58, Jean Delvare <jdelvare@suse.de> wrote:
> Hi Simon,
>
> On Tue, 24 Apr 2018 15:11:11 -0600, Simon Glass wrote:
>> This is used in some systems from user space for determining the identity
>> of the device.
>>
>> Expose this as a file so that that user-space tools don't need to read
>> from /sys/firmware/dmi/tables/DMI
>>
>> Signed-off-by: Simon Glass <sjg@chromium.org>
>> ---
>>
>>  drivers/firmware/dmi-id.c       | 2 ++
>>  drivers/firmware/dmi_scan.c     | 1 +
>>  include/linux/mod_devicetable.h | 1 +
>>  3 files changed, 4 insertions(+)
>> (...)
>
> Looks good to me. Applied, thanks. For consistency I have moved product
> SKU before product family in all files, same order as in the DMI entry
> itself.

Sounds good, thanks.

- Simon

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2018-04-27 19:12 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-24 21:11 [PATCH] firmware: dmi: Add access to the SKU ID string Simon Glass
2018-04-25  2:51 ` Vinod Koul
2018-04-25 21:17   ` Simon Glass
2018-04-26  9:33     ` Vinod Koul
2018-04-26 11:01       ` Jean Delvare
2018-04-27  7:58 ` Jean Delvare
2018-04-27 19:12   ` Simon Glass

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).