Skip to contentSkip to conversation

efi: dmi: List SMBIOS3 table before SMBIOS table

PATCH In review Jean Delvare 3 participants 8 messages Apr 30, 2015 – May 27, 2015 6 messages not in the archive EFI

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 efi: dmi: List SMBIOS3 table before SMBIOS table

The SMBIOS3 table should appear before the SMBIOS table in /sys/firmware/efi/systab. This allows user-space utilities which support both to pick the SMBIOS3 table with a single pass on systems where both are implemented. The SMBIOS3 entry point is more capable than the SMBIOS entry point so it should be preferred.

This follows the same logic as the ACPI20 table being listed before the ACPI table.

Cc Ard Biesheuvel <[email protected]>
Cc Leif Lindholm <[email protected]>
Cc Matt Fleming <[email protected]>

---
Changes since v1:
* Added a comment explaining why SMBIOS3 must be listed before SMBIOS, so that it doesn't get accidentally broken in the future.

 drivers/firmware/efi/efi.c |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/firmware/efi/efi.c +7 -2
@@ -85,10 +85,15 @@ static ssize_t systab_show(struct kobjec
 		str += sprintf(str, "ACPI20=0x%lx\n", efi.acpi20);
 	if (efi.acpi != EFI_INVALID_TABLE_ADDR)
 		str += sprintf(str, "ACPI=0x%lx\n", efi.acpi);
-	if (efi.smbios != EFI_INVALID_TABLE_ADDR)
-		str += sprintf(str, "SMBIOS=0x%lx\n", efi.smbios);
+	/*
+	 * If both SMBIOS and SMBIOS3 entry points are implemented, the
+	 * SMBIOS3 entry point shall be preferred, so we list it first to
+	 * let applications stop parsing after the first match.
+	 */
 	if (efi.smbios3 != EFI_INVALID_TABLE_ADDR)
 		str += sprintf(str, "SMBIOS3=0x%lx\n", efi.smbios3);
+	if (efi.smbios != EFI_INVALID_TABLE_ADDR)
+		str += sprintf(str, "SMBIOS=0x%lx\n", efi.smbios);
 	if (efi.hcdp != EFI_INVALID_TABLE_ADDR)
 		str += sprintf(str, "HCDP=0x%lx\n", efi.hcdp);
 	if (efi.boot_info != EFI_INVALID_TABLE_ADDR)
Signature · 2 lines
Jean Delvare
SUSE L3 Support
#2 lore raw
In reply to a message not in the archive
Quoted 13 lines · Jean Delvare

The SMBIOS3 table should appear before the SMBIOS table in /sys/firmware/efi/systab. This allows user-space utilities which support both to pick the SMBIOS3 table with a single pass on systems where both are implemented. The SMBIOS3 entry point is more capable than the SMBIOS entry point so it should be preferred.

This follows the same logic as the ACPI20 table being listed before the ACPI table.

Cc Ard Biesheuvel <[email protected]>
Cc Leif Lindholm <[email protected]>
Cc Matt Fleming <[email protected]>
Quoted 7 lines

---
Changes since v1:
* Added a comment explaining why SMBIOS3 must be listed before SMBIOS, so that it doesn't get accidentally broken in the future.

 drivers/firmware/efi/efi.c |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

Thanks Jean. This looks OK to me but I'd really like to see some ACKs from Leif, Ard or Ivan.

Signature · 1 line
Matt Fleming, Intel Open Source Technology Center
#4 lore raw
In reply to a message not in the archive
Quoted 19 lines · Matt Fleming
Quoted 18 lines · Jean Delvare

The SMBIOS3 table should appear before the SMBIOS table in /sys/firmware/efi/systab. This allows user-space utilities which support both to pick the SMBIOS3 table with a single pass on systems where both are implemented. The SMBIOS3 entry point is more capable than the SMBIOS entry point so it should be preferred.

This follows the same logic as the ACPI20 table being listed before the ACPI table.

Cc Ard Biesheuvel <[email protected]>
Cc Leif Lindholm <[email protected]>
Cc Matt Fleming <[email protected]>

---
Changes since v1:
* Added a comment explaining why SMBIOS3 must be listed before SMBIOS, so that it doesn't get accidentally broken in the future.

Quoted 6 lines
Quoted 2 lines
 drivers/firmware/efi/efi.c |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

Thanks Jean. This looks OK to me but I'd really like to see some ACKs from Leif, Ard or Ivan.

I don't have any objections to this patch per se, but I am not crazy about the fact that the way the output is ordered is kernel<->userland ABI now
But since there appears to be a precedent with ACPI20 before ACPI, that was already the case, apparently.
So,

#6 lore raw
In reply to a message not in the archive
Quoted 9 lines · Ard Biesheuvel

I don't have any objections to this patch per se, but I am not crazy about the fact that the way the output is ordered is kernel<->userland ABI now
But since there appears to be a precedent with ACPI20 before ACPI, that was already the case, apparently.
So,

Thanks Ard.

I've thought about this for a long while and we always kinda treat the results of sysfs files as ABI anyway. If SMBIOS 3 wasn't so new I wouldn't entertain doing this, but I think it's OK in this situation.

Signature · 1 line
Matt Fleming, Intel Open Source Technology Center
#8 lore raw
In reply to a message not in the archive
Quoted 9 lines · Matt Fleming
Quoted 8 lines · Ard Biesheuvel

I don't have any objections to this patch per se, but I am not crazy about the fact that the way the output is ordered is kernel<->userland ABI now
But since there appears to be a precedent with ACPI20 before ACPI, that was already the case, apparently.
So,

Quoted 8 lines
Quoted 1 line

Thanks Ard.

I've thought about this for a long while and we always kinda treat the results of sysfs files as ABI anyway. If SMBIOS 3 wasn't so new I wouldn't entertain doing this, but I think it's OK in this situation.

OK. Then I guess we should at least document in Documentation/ABI/stable/sysfs-firmware-efi-systab that the order in which the entries are enumerated is part of the ABI.

Regards,
Ard.

#10 lore raw
In reply to a message not in the archive
Quoted 4 lines · Ard Biesheuvel

OK. Then I guess we should at least document in Documentation/ABI/stable/sysfs-firmware-efi-systab that the order in which the entries are enumerated is part of the ABI.

Makes perfect sense to me. How about this?

---

Quoted 1 line

From ccb5f08bb71ae4199c75668c6beacd6b47fa186c Mon Sep 17 00:00:00 2001

From: Matt Fleming <[email protected]>
Date: Wed, 27 May 2015 14:14:22 +0100
Subject: [PATCH] efi: Add 'systab' information to Documentation/ABI

It's not clear right now that the order in which entries are displayed in /sys/firmware/efi/systab actually forms an ABI that userspace tools rely upon.

Document the ABI along with the userspace tool that cares.

Cc Jean Delvare <[email protected]>
Cc Leif Lindholm <[email protected]>
Cc Ivan Khoronzhuk <ivan.khoronzhuk-hExfYMNmJl/[email protected]>
---
 Documentation/ABI/testing/sysfs-firmware-efi | 10 ++++++++++
 1 file changed, 10 insertions(+)
Documentation/ABI/testing/sysfs-firmware-efi +10 -0
index 05874da7ce80..e794eac32a90 100644
@@ -18,3 +18,13 @@ Contact:	Dave Young <[email protected]>
 Description:	It shows the physical address of config table entry in the EFI
 		system table.
 Users:		Kexec
+
+What:		/sys/firmware/efi/systab
+Date:		April 2005
+Contact:	[email protected]
+Description:	Displays the physical addresses of all EFI Configuration
+		Tables found via the EFI System Table. The order in
+		which the tables are printed forms an ABI and newer
+		versions are always printed first, i.e. ACPI20 comes
+		before ACPI.
+Users:		dmidecode
Signature · 4 lines
2.1.0

-- 
Matt Fleming, Intel Open Source Technology Center
#12 lore raw
In reply to a message not in the archive
Quoted 19 lines · Matt Fleming
Quoted 4 lines · Ard Biesheuvel

OK. Then I guess we should at least document in Documentation/ABI/stable/sysfs-firmware-efi-systab that the order in which the entries are enumerated is part of the ABI.

Makes perfect sense to me. How about this?

---

From ccb5f08bb71ae4199c75668c6beacd6b47fa186c Mon Sep 17 00:00:00 2001
From: Matt Fleming <[email protected]>
Date: Wed, 27 May 2015 14:14:22 +0100
Subject: [PATCH] efi: Add 'systab' information to Documentation/ABI

It's not clear right now that the order in which entries are displayed in /sys/firmware/efi/systab actually forms an ABI that userspace tools rely upon.

Quoted 7 lines

Document the ABI along with the userspace tool that cares.

Cc Jean Delvare <[email protected]>
Cc Leif Lindholm <[email protected]>
Cc Ivan Khoronzhuk <ivan.khoronzhuk-hExfYMNmJl/[email protected]>

Still not crazy about it but here it goes :-)

Quoted 27 lines
---
 Documentation/ABI/testing/sysfs-firmware-efi | 10 ++++++++++
 1 file changed, 10 insertions(+)
Documentation/ABI/testing/sysfs-firmware-efi +10 -1
index 05874da7ce80..e794eac32a90 100644
@@ -18,3 +18,13 @@ Contact:     Dave Young <[email protected]>
 Description:   It shows the physical address of config table entry in the EFI
                system table.
 Users:         Kexec
+
+What:          /sys/firmware/efi/systab
+Date:          April 2005
+Contact:       [email protected]
+Description:   Displays the physical addresses of all EFI Configuration
+               Tables found via the EFI System Table. The order in
+               which the tables are printed forms an ABI and newer
+               versions are always printed first, i.e. ACPI20 comes
+               before ACPI.
+Users:         dmidecode
--

2.1.0

--
Matt Fleming, Intel Open Source Technology Center

author Reviewed-by
#13 lore raw
In reply to a message not in the archive
Quoted 38 lines · Matt Fleming
Quoted 4 lines · Ard Biesheuvel

OK. Then I guess we should at least document in Documentation/ABI/stable/sysfs-firmware-efi-systab that the order in which the entries are enumerated is part of the ABI.

Makes perfect sense to me. How about this?

---

From ccb5f08bb71ae4199c75668c6beacd6b47fa186c Mon Sep 17 00:00:00 2001
From: Matt Fleming <[email protected]>
Date: Wed, 27 May 2015 14:14:22 +0100
Subject: [PATCH] efi: Add 'systab' information to Documentation/ABI

It's not clear right now that the order in which entries are displayed in /sys/firmware/efi/systab actually forms an ABI that userspace tools rely upon.

Document the ABI along with the userspace tool that cares.

Cc Jean Delvare <[email protected]>
Cc Leif Lindholm <[email protected]>
Cc Ivan Khoronzhuk <ivan.khoronzhuk-hExfYMNmJl/[email protected]>
---
 Documentation/ABI/testing/sysfs-firmware-efi | 10 ++++++++++
 1 file changed, 10 insertions(+)
Documentation/ABI/testing/sysfs-firmware-efi +0 -0
index 05874da7ce80..e794eac32a90 100644
@@ -18,3 +18,13 @@ Contact:	Dave Young <[email protected]>
 Description:	It shows the physical address of config table entry in the EFI
 		system table.
 Users:		Kexec

Documentation/ABI/testing/sysfs-firmware-efi Contact: Dave Young <[email protected]> · line 30

Quoted 10 lines
Documentation/ABI/testing/sysfs-firmware-efi +10 -0
+
+What:		/sys/firmware/efi/systab
+Date:		April 2005
+Contact:	[email protected]
+Description:	Displays the physical addresses of all EFI Configuration
+		Tables found via the EFI System Table. The order in
+		which the tables are printed forms an ABI and newer
+		versions are always printed first, i.e. ACPI20 comes
+		before ACPI.
+Users:		dmidecode

Thank you,

Signature · 2 lines
Jean Delvare
SUSE L3 Support