Skip to contentSkip to conversation

Parse SMBIOS additional entries

PATCH Superseded Mario Limonciello (AMD) 3 participants 14 messages Dec 14, 2025 – Dec 15, 2025

Subsystems (3)

v1 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

cover Parse SMBIOS additional entries

The SMBIOS additional entries on AMD Zen4+ systems running an AGESA based BIOS contain information about the AGESA version which can be useful for matching the software stack when debugging an issue.

Add support for parsing this from SMBIOS tables and output it into the logs at bootup. Additionally export the information to debugfs in case users are interested in any other strings.

Mario Limonciello (AMD) (5):
firmware: dmi: Correct an indexing error in dmi.h
firmware: dmi: Adjust dmi_decode() to use enums
firmware: dmi: Read additional information when decoding DMI table
firmware: dmi: Add debugfs for additional information entries x86/amd_node: Output the AGESA version to the logs

 arch/x86/kernel/amd_node.c  |   8 +++
 drivers/firmware/dmi_scan.c | 100 ++++++++++++++++++++++++++++++++----
 include/linux/dmi.h         |   8 +++
 3 files changed, 105 insertions(+), 11 deletions(-)
Signature · 1 line
2.43.0
#1 lore raw

PATCH 1/5 firmware: dmi: Correct an indexing error in dmi.h

The entries later in enum dmi_entry_type don't match the SMBIOS specification. The entry for type 33: 64-Bit Memory Error Information is not present and thus the index for all later entries is incorrect.

Add the missing type 33 entry.

Fixes 93c890dbe5287 ("firmware: Add DMI entry types to the headers")
---
 include/linux/dmi.h | 1 +
 1 file changed, 1 insertion(+)
include/linux/dmi.h +1 -0
index 927f8a8b7a1dd..a809b5095c259 100644
@@ -60,6 +60,7 @@ enum dmi_entry_type {
 	DMI_ENTRY_OOB_REMOTE_ACCESS,
 	DMI_ENTRY_BIS_ENTRY,
 	DMI_ENTRY_SYSTEM_BOOT,
+	DMI_ENTRY_MEMORY_INFO,
 	DMI_ENTRY_MGMT_DEV,
 	DMI_ENTRY_MGMT_DEV_COMPONENT,
 	DMI_ENTRY_MGMT_DEV_THRES,
Signature · 1 line
2.43.0
maintainer Reviewed-by on v1 1/5
#2 lore raw

Re: [PATCH 1/5] firmware: dmi: Correct an indexing error in dmi.h

Quoted 5 lines · Mario Limonciello (AMD)

The entries later in enum dmi_entry_type don't match the SMBIOS specification. The entry for type 33: 64-Bit Memory Error Information is not present and thus the index for all later entries is incorrect.

Add the missing type 33 entry.

Types 43, 44, 45, and 46 are missing also. Should those be added as well?

Probably not needed right now, but would be good to add them in a future patch. I think there's precedent for keeping definitions up to date with the spec even if they're not immediately used. ACPI does this, I think.

Quoted 4 lines
Fixes 93c890dbe5287 ("firmware: Add DMI entry types to the headers")

Thanks,
Yazen

#3 lore raw

Re: [PATCH 1/5] firmware: dmi: Correct an indexing error in dmi.h

Quoted 7 lines · Yazen Ghannam
Quoted 5 lines · Mario Limonciello (AMD)

The entries later in enum dmi_entry_type don't match the SMBIOS specification. The entry for type 33: 64-Bit Memory Error Information is not present and thus the index for all later entries is incorrect.

Add the missing type 33 entry.

Quoted 7 lines

Types 43, 44, 45, and 46 are missing also. Should those be added as well?

Probably not needed right now, but would be good to add them in a future patch. I think there's precedent for keeping definitions up to date with the spec even if they're not immediately used. ACPI does this, I think.

OK, thanks. I'll tail another patch to the next spin of the series to add those too.

Quoted 10 lines
Quoted 5 lines
Fixes 93c890dbe5287 ("firmware: Add DMI entry types to the headers")

Thanks,
Yazen

#4 lore raw

PATCH 2/5 firmware: dmi: Adjust dmi_decode() to use enums

In reply to Mario Limonciello (AMD)

dmi_decode() has hardcoded values with comments for each DMI entry type. The same information is already in dmi.h though, so drop the comments and use the definitions instead.

---
 drivers/firmware/dmi_scan.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)
drivers/firmware/dmi_scan.c +9 -9
index 70d39adf50dca..80aded4c778bc 100644
@@ -484,14 +484,14 @@ static void __init dmi_memdev_walk(void)
 static void __init dmi_decode(const struct dmi_header *dm, void *dummy)
 {
 	switch (dm->type) {
-	case 0:		/* BIOS Information */
+	case DMI_ENTRY_BIOS:
 		dmi_save_ident(dm, DMI_BIOS_VENDOR, 4);
 		dmi_save_ident(dm, DMI_BIOS_VERSION, 5);
 		dmi_save_ident(dm, DMI_BIOS_DATE, 8);
 		dmi_save_release(dm, DMI_BIOS_RELEASE, 21);
 		dmi_save_release(dm, DMI_EC_FIRMWARE_RELEASE, 23);
 		break;
-	case 1:		/* System Information */
+	case DMI_ENTRY_SYSTEM:
 		dmi_save_ident(dm, DMI_SYS_VENDOR, 4);
 		dmi_save_ident(dm, DMI_PRODUCT_NAME, 5);
 		dmi_save_ident(dm, DMI_PRODUCT_VERSION, 6);
@@ -500,33 +500,33 @@ static void __init dmi_decode(const struct dmi_header *dm, void *dummy)
 		dmi_save_ident(dm, DMI_PRODUCT_SKU, 25);
 		dmi_save_ident(dm, DMI_PRODUCT_FAMILY, 26);
 		break;
-	case 2:		/* Base Board Information */
+	case DMI_ENTRY_BASEBOARD:
 		dmi_save_ident(dm, DMI_BOARD_VENDOR, 4);
 		dmi_save_ident(dm, DMI_BOARD_NAME, 5);
 		dmi_save_ident(dm, DMI_BOARD_VERSION, 6);
 		dmi_save_ident(dm, DMI_BOARD_SERIAL, 7);
 		dmi_save_ident(dm, DMI_BOARD_ASSET_TAG, 8);
 		break;
-	case 3:		/* Chassis Information */
+	case DMI_ENTRY_CHASSIS:
 		dmi_save_ident(dm, DMI_CHASSIS_VENDOR, 4);
 		dmi_save_type(dm, DMI_CHASSIS_TYPE, 5);
 		dmi_save_ident(dm, DMI_CHASSIS_VERSION, 6);
 		dmi_save_ident(dm, DMI_CHASSIS_SERIAL, 7);
 		dmi_save_ident(dm, DMI_CHASSIS_ASSET_TAG, 8);
 		break;
-	case 9:		/* System Slots */
+	case DMI_ENTRY_SYSTEM_SLOT:
 		dmi_save_system_slot(dm);
 		break;
-	case 10:	/* Onboard Devices Information */
+	case DMI_ENTRY_ONBOARD_DEVICE:
 		dmi_save_devices(dm);
 		break;
-	case 11:	/* OEM Strings */
+	case DMI_ENTRY_OEMSTRINGS:
 		dmi_save_oem_strings_devices(dm);
 		break;
-	case 38:	/* IPMI Device Information */
+	case DMI_ENTRY_IPMI_DEV:
 		dmi_save_ipmi_device(dm);
 		break;
-	case 41:	/* Onboard Devices Extended Information */
+	case DMI_ENTRY_ONBOARD_DEV_EXT:
 		dmi_save_extended_devices(dm);
 	}
 }
Signature · 1 line
2.43.0
#6 lore raw

PATCH 3/5 firmware: dmi: Read additional information when decoding DMI table

In reply to Mario Limonciello (AMD)

Type 40 entries (Additional information) are summarized in section 7.41 as part of the SMBIOS specification. Save these entries when decoding the DMI tables.

---
 drivers/firmware/dmi_scan.c | 46 +++++++++++++++++++++++++++++++++++++
 include/linux/dmi.h         |  7 ++++++
 2 files changed, 53 insertions(+)
drivers/firmware/dmi_scan.c +46 -0
index 80aded4c778bc..f7b7ed1d872e8 100644
@@ -393,6 +393,48 @@ static void __init dmi_save_dev_pciaddr(int instance, int segment, int bus,
 	list_add(&dev->dev.list, &dmi_devices);
 }
 
+static void __init dmi_save_additional(const struct dmi_additional_info *info)
+{
+	const char *strings;
+	const u8 *data;
+	int count = 0;
+	int i;
+
+	if (!info || info->header.length < 5 + info->count * 5)
+		return;
+
+	data = info->entries;
+	strings = (const char *)(data + info->count * 5);
+
+	for (i = 0; i < info->count; i++) {
+		u8 entry_length = data[i * 5];
+		u8 string_num = data[i * 5 + 4];
+		const char *string_ptr;
+		char *value;
+		int len;
+
+		if (entry_length < 5 || string_num == 0)
+			continue;
+
+		string_ptr = dmi_string_nosave(&info->header, string_num);
+		if (!string_ptr || !*string_ptr)
+			continue;
+
+		len = strlen(string_ptr);
+		if (len == 0)
+			continue;
+
+		value = dmi_alloc(len + 1);
+		if (!value)
+			continue;
+
+		strscpy(value, string_ptr, len + 1);
+
+		dmi_save_one_device(DMI_DEV_TYPE_ADDITIONAL, value);
+		count++;
+	}
+}
+
 static void __init dmi_save_extended_devices(const struct dmi_header *dm)
 {
 	const char *name;
@@ -526,8 +568,12 @@ static void __init dmi_decode(const struct dmi_header *dm, void *dummy)
 	case DMI_ENTRY_IPMI_DEV:
 		dmi_save_ipmi_device(dm);
 		break;
+	case DMI_ENTRY_ADDITIONAL:
+		dmi_save_additional((const struct dmi_additional_info *)dm);
+		break;
 	case DMI_ENTRY_ONBOARD_DEV_EXT:
 		dmi_save_extended_devices(dm);
+		break;
 	}
 }
 
include/linux/dmi.h +7 -0
index a809b5095c259..3fc3d334b321d 100644
@@ -24,6 +24,7 @@ enum dmi_device_type {
 	DMI_DEV_TYPE_OEM_STRING = -2,
 	DMI_DEV_TYPE_DEV_ONBOARD = -3,
 	DMI_DEV_TYPE_DEV_SLOT = -4,
+	DMI_DEV_TYPE_ADDITIONAL = -5,
 };
 
 enum dmi_entry_type {
@@ -87,6 +88,12 @@ struct dmi_device {
 	void *device_data;	/* Type specific data */
 };
 
+struct dmi_additional_info {
+	struct dmi_header header;
+	u8 count;
+	u8 entries[];
+} __packed;
+
 #ifdef CONFIG_DMI
 
 struct dmi_dev_onboard {
Signature · 1 line
2.43.0
#7 lore raw

Re: [PATCH 3/5] firmware: dmi: Read additional information when decoding DMI table

kernel test robot noticed the following build warnings:

Hi Mario,

kernel test robot noticed the following build warnings:

[auto build test WARNING on tip/master]
[also build test WARNING on linus/master tip/auto-latest v6.19-rc1 next-20251215] [cannot apply to tip/x86/core]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Mario-Limonciello-AMD/firmware-dmi-Correct-an-indexing-error-in-dmi-h/20251215-025606
base:   tip/master
patch link:    https://lore.kernel.org/r/20251214185309.152614-4-superm1%40kernel.org
patch subject: [PATCH 3/5] firmware: dmi: Read additional information when decoding DMI table
config: i386-allnoconfig (https://download.01.org/0day-ci/archive/20251215/[email protected]/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251215/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

drivers/firmware/dmi_scan.c: In function 'dmi_save_additional':

>> drivers/firmware/dmi_scan.c:398:21: warning: variable 'strings' set but not used [-Wunused-but-set-variable]
     398 |         const char *strings;
         |                     ^~~~~~~

vim +/strings +398 drivers/firmware/dmi_scan.c

395
396 static void __init dmi_save_additional(const struct dmi_additional_info *info)
397 {

 > 398		const char *strings;

399 const u8 *data;
400 int count = 0;
401 int i;
402
403 if (!info || info->header.length < 5 + info->count * 5)
404 return;
405
406 data = info->entries;
407 strings = (const char *)(data + info->count * 5);
408
409 for (i = 0; i < info->count; i++) {
410 u8 entry_length = data[i * 5];
411 u8 string_num = data[i * 5 + 4];
412 const char *string_ptr;
413 char *value;
414 int len;
415
416 if (entry_length < 5 || string_num == 0)
417 continue;
418
419 string_ptr = dmi_string_nosave(&info->header, string_num);
420 if (!string_ptr || !*string_ptr)
421 continue;
422
423 len = strlen(string_ptr);
424 if (len == 0)
425 continue;
426
427 value = dmi_alloc(len + 1);
428 if (!value)
429 continue;
430
431 strscpy(value, string_ptr, len + 1);
432
433 dmi_save_one_device(DMI_DEV_TYPE_ADDITIONAL, value);
434 count++;
435 }
436 }
437

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
#8 lore raw

Re: [PATCH 3/5] firmware: dmi: Read additional information when decoding DMI table

In reply to Mario Limonciello (AMD)
kernel test robot noticed the following build warnings:

Hi Mario,

kernel test robot noticed the following build warnings:

[auto build test WARNING on tip/master]
[also build test WARNING on linus/master tip/auto-latest v6.19-rc1 next-20251215] [cannot apply to tip/x86/core]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Mario-Limonciello-AMD/firmware-dmi-Correct-an-indexing-error-in-dmi-h/20251215-025606
base:   tip/master
patch link:    https://lore.kernel.org/r/20251214185309.152614-4-superm1%40kernel.org
patch subject: [PATCH 3/5] firmware: dmi: Read additional information when decoding DMI table
config: x86_64-allnoconfig (https://download.01.org/0day-ci/archive/20251215/[email protected]/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251215/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

drivers/firmware/dmi_scan.c:398:14: warning: variable 'strings' set but not used [-Wunused-but-set-variable]

     398 |         const char *strings;
         |                     ^
>> drivers/firmware/dmi_scan.c:400:6: warning: variable 'count' set but not used [-Wunused-but-set-variable]
     400 |         int count = 0;
         |             ^

2 warnings generated.

vim +/count +400 drivers/firmware/dmi_scan.c

395
396 static void __init dmi_save_additional(const struct dmi_additional_info *info)
397 {
398 const char *strings;
399 const u8 *data;

 > 400		int count = 0;

401 int i;
402
403 if (!info || info->header.length < 5 + info->count * 5)
404 return;
405
406 data = info->entries;
407 strings = (const char *)(data + info->count * 5);
408
409 for (i = 0; i < info->count; i++) {
410 u8 entry_length = data[i * 5];
411 u8 string_num = data[i * 5 + 4];
412 const char *string_ptr;
413 char *value;
414 int len;
415
416 if (entry_length < 5 || string_num == 0)
417 continue;
418
419 string_ptr = dmi_string_nosave(&info->header, string_num);
420 if (!string_ptr || !*string_ptr)
421 continue;
422
423 len = strlen(string_ptr);
424 if (len == 0)
425 continue;
426
427 value = dmi_alloc(len + 1);
428 if (!value)
429 continue;
430
431 strscpy(value, string_ptr, len + 1);
432
433 dmi_save_one_device(DMI_DEV_TYPE_ADDITIONAL, value);
434 count++;
435 }
436 }
437

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
#9 lore raw

Re: [PATCH 3/5] firmware: dmi: Read additional information when decoding DMI table

In reply to Mario Limonciello (AMD)
kernel test robot noticed the following build warnings:

Hi Mario,

kernel test robot noticed the following build warnings:

[auto build test WARNING on tip/master]
[also build test WARNING on linus/master tip/auto-latest v6.19-rc1 next-20251215] [cannot apply to tip/x86/core]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Mario-Limonciello-AMD/firmware-dmi-Correct-an-indexing-error-in-dmi-h/20251215-025606
base:   tip/master
patch link:    https://lore.kernel.org/r/20251214185309.152614-4-superm1%40kernel.org
patch subject: [PATCH 3/5] firmware: dmi: Read additional information when decoding DMI table
config: x86_64-kexec (https://download.01.org/0day-ci/archive/20251215/[email protected]/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251215/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

>> drivers/firmware/dmi_scan.c:398:14: warning: variable 'strings' set but not used [-Wunused-but-set-variable]
     398 |         const char *strings;
         |                     ^
>> drivers/firmware/dmi_scan.c:400:6: warning: variable 'count' set but not used [-Wunused-but-set-variable]
     400 |         int count = 0;
         |             ^

2 warnings generated.

vim +/strings +398 drivers/firmware/dmi_scan.c

395
396 static void __init dmi_save_additional(const struct dmi_additional_info *info)
397 {

 > 398		const char *strings;
   399		const u8 *data;
 > 400		int count = 0;

401 int i;
402
403 if (!info || info->header.length < 5 + info->count * 5)
404 return;
405
406 data = info->entries;
407 strings = (const char *)(data + info->count * 5);
408
409 for (i = 0; i < info->count; i++) {
410 u8 entry_length = data[i * 5];
411 u8 string_num = data[i * 5 + 4];
412 const char *string_ptr;
413 char *value;
414 int len;
415
416 if (entry_length < 5 || string_num == 0)
417 continue;
418
419 string_ptr = dmi_string_nosave(&info->header, string_num);
420 if (!string_ptr || !*string_ptr)
421 continue;
422
423 len = strlen(string_ptr);
424 if (len == 0)
425 continue;
426
427 value = dmi_alloc(len + 1);
428 if (!value)
429 continue;
430
431 strscpy(value, string_ptr, len + 1);
432
433 dmi_save_one_device(DMI_DEV_TYPE_ADDITIONAL, value);
434 count++;
435 }
436 }
437

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
#10 lore raw

PATCH 4/5 firmware: dmi: Add debugfs for additional information entries

In reply to Mario Limonciello (AMD)

Additional information entries are not exposed through standardized information from sysfs, but can still contain valuable information.

For example on AMD systems this encodes the AGESA version. Introduce a debugfs file that will export this information.

---
 drivers/firmware/dmi_scan.c | 36 ++++++++++++++++++++++++++++++++++--
 1 file changed, 34 insertions(+), 2 deletions(-)
drivers/firmware/dmi_scan.c +34 -2
index f7b7ed1d872e8..52ed2a6b1c1d4 100644
@@ -4,6 +4,7 @@
 #include <linux/init.h>
 #include <linux/module.h>
 #include <linux/ctype.h>
+#include <linux/debugfs.h>
 #include <linux/dmi.h>
 #include <linux/efi.h>
 #include <linux/memblock.h>
@@ -30,6 +31,7 @@ static u32 dmi_len;
 static u16 dmi_num;
 static u8 smbios_entry_point[32];
 static int smbios_entry_point_size;
+static struct dentry *debugfs_dir;
 
 /* DMI system identification string used during boot */
 static char dmi_ids_string[128] __initdata;
@@ -180,6 +182,17 @@ static LIST_HEAD(dmi_devices);
 int dmi_available;
 EXPORT_SYMBOL_GPL(dmi_available);
 
+static int additional_show(struct seq_file *m, void *v)
+{
+	const struct dmi_device *dev = NULL;
+
+	while ((dev = dmi_find_device(DMI_DEV_TYPE_ADDITIONAL, NULL, dev)))
+		seq_printf(m, "%s\n", dev->name);
+
+	return 0;
+}
+DEFINE_SHOW_ATTRIBUTE(additional);
+
 /*
  *	Save a DMI string
  */
@@ -810,6 +823,20 @@ static void __init dmi_scan_machine(void)
 static __ro_after_init BIN_ATTR_SIMPLE_ADMIN_RO(smbios_entry_point);
 static __ro_after_init BIN_ATTR_SIMPLE_ADMIN_RO(DMI);
 
+static void __init dmi_create_debugfs(void)
+{
+	if (!arch_debugfs_dir)
+		return;
+	debugfs_dir = debugfs_create_dir("dmi", arch_debugfs_dir);
+	if (!debugfs_dir)
+		return;
+	if (!dmi_find_device(DMI_DEV_TYPE_ADDITIONAL, NULL, NULL))
+		return;
+	debugfs_create_file("additional", 0444,
+			    debugfs_dir, NULL,
+			    &additional_fops);
+}
+
 static int __init dmi_init(void)
 {
 	struct kobject *tables_kobj;
@@ -845,9 +872,14 @@ static int __init dmi_init(void)
 	bin_attr_DMI.size = dmi_len;
 	bin_attr_DMI.private = dmi_table;
 	ret = sysfs_create_bin_file(tables_kobj, &bin_attr_DMI);
-	if (!ret)
-		return 0;
+	if (ret)
+		goto err_sysfs;
+
+	dmi_create_debugfs();
+
+	return 0;
 
+ err_sysfs:
 	sysfs_remove_bin_file(tables_kobj,
 			      &bin_attr_smbios_entry_point);
  err_unmap:
Signature · 1 line
2.43.0
#11 lore raw

PATCH 5/5 x86/amd_node: Output the AGESA version to the logs

In reply to Mario Limonciello (AMD)

On AMD Zen platforms that are running AGESA, there is sometimes DMI additional string for the AGESA version that can be helpful when debugging an issue. If this string is found output to kernel logs.

---
This is not strictly AMD node related; it was a proxy for a good location for the message late enough on boot and only run on AMD Zen machines. I'm open to other suggestions.

 arch/x86/Kconfig           | 1 +
 arch/x86/kernel/amd_node.c | 8 ++++++++
 2 files changed, 9 insertions(+)
arch/x86/Kconfig +1 -0
index 80527299f859a..eae139a91fb84 100644
@@ -3116,6 +3116,7 @@ config AMD_NB
 config AMD_NODE
 	def_bool y
 	depends on CPU_SUP_AMD && PCI
+	select DMI
 
 endmenu
 
arch/x86/kernel/amd_node.c +8 -0
index 3d0a4768d603c..575d727c5827e 100644
@@ -9,6 +9,7 @@
  */
 
 #include <linux/debugfs.h>
+#include <linux/dmi.h>
 #include <asm/amd/node.h>
 
 /*
@@ -247,6 +248,7 @@ __setup("amd_smn_debugfs_enable", amd_smn_enable_dfs);
 static int __init amd_smn_init(void)
 {
 	u16 count, num_roots, roots_per_node, node, num_nodes;
+	const struct dmi_device *dev = NULL;
 	struct pci_dev *root;
 
 	if (!cpu_feature_enabled(X86_FEATURE_ZEN))
@@ -310,6 +312,12 @@ static int __init amd_smn_init(void)
 
 	smn_exclusive = true;
 
+	while ((dev = dmi_find_device(DMI_DEV_TYPE_ADDITIONAL, NULL, dev)))
+		if (!strncmp(dev->name, "AGESA", 5)) {
+			pr_info("%s\n", dev->name);
+			break;
+		}
+
 	return 0;
 }
 
Signature · 1 line
2.43.0
maintainer
#12 lore raw

Re: [PATCH 5/5] x86/amd_node: Output the AGESA version to the logs

Quoted 9 lines · Mario Limonciello (AMD)

On AMD Zen platforms that are running AGESA, there is sometimes DMI additional string for the AGESA version that can be helpful when debugging an issue. If this string is found output to kernel logs.

---
This is not strictly AMD node related; it was a proxy for a good location for the message late enough on boot and only run on AMD Zen machines. I'm open to other suggestions.

Maybe do like print_s5_reset_status_mmio() with a late_initcall()?

We could have an amd_zen_late_initcall() function in arch/x86/kernel/cpu/amd.c that collects appropriate functions.

We have two now:
- print_s5_reset_status_mmio()
- print_agesa_dmi_info()

Thanks,
Yazen

Quoted 52 lines
 arch/x86/Kconfig           | 1 +
 arch/x86/kernel/amd_node.c | 8 ++++++++
 2 files changed, 9 insertions(+)
arch/x86/Kconfig +1 -0
index 80527299f859a..eae139a91fb84 100644
@@ -3116,6 +3116,7 @@ config AMD_NB
 config AMD_NODE
 	def_bool y
 	depends on CPU_SUP_AMD && PCI
+	select DMI
 
 endmenu
 
arch/x86/kernel/amd_node.c +8 -0
index 3d0a4768d603c..575d727c5827e 100644
@@ -9,6 +9,7 @@
  */
 
 #include <linux/debugfs.h>
+#include <linux/dmi.h>
 #include <asm/amd/node.h>
 
 /*
@@ -247,6 +248,7 @@ __setup("amd_smn_debugfs_enable", amd_smn_enable_dfs);
 static int __init amd_smn_init(void)
 {
 	u16 count, num_roots, roots_per_node, node, num_nodes;
+	const struct dmi_device *dev = NULL;
 	struct pci_dev *root;
 
 	if (!cpu_feature_enabled(X86_FEATURE_ZEN))
@@ -310,6 +312,12 @@ static int __init amd_smn_init(void)
 
 	smn_exclusive = true;
 
+	while ((dev = dmi_find_device(DMI_DEV_TYPE_ADDITIONAL, NULL, dev)))
+		if (!strncmp(dev->name, "AGESA", 5)) {
+			pr_info("%s\n", dev->name);
+			break;
+		}
+
 	return 0;
 }
 
Signature · 1 line
2.43.0
#13 lore raw

Re: [PATCH 5/5] x86/amd_node: Output the AGESA version to the logs

Quoted 11 lines · Yazen Ghannam
Quoted 9 lines · Mario Limonciello (AMD)

On AMD Zen platforms that are running AGESA, there is sometimes DMI additional string for the AGESA version that can be helpful when debugging an issue. If this string is found output to kernel logs.

---
This is not strictly AMD node related; it was a proxy for a good location for the message late enough on boot and only run on AMD Zen machines. I'm open to other suggestions.

Quoted 8 lines

Maybe do like print_s5_reset_status_mmio() with a late_initcall()?

We could have an amd_zen_late_initcall() function in arch/x86/kernel/cpu/amd.c that collects appropriate functions.

We have two now:
- print_s5_reset_status_mmio()
- print_agesa_dmi_info()

Good idea, that is a more logical location. Lemme try it out.

Quoted 56 lines

Thanks,
Yazen

Quoted 52 lines
  arch/x86/Kconfig           | 1 +
  arch/x86/kernel/amd_node.c | 8 ++++++++
  2 files changed, 9 insertions(+)
arch/x86/Kconfig +1 -0
index 80527299f859a..eae139a91fb84 100644
@@ -3116,6 +3116,7 @@ config AMD_NB
  config AMD_NODE
  	def_bool y
  	depends on CPU_SUP_AMD && PCI
+	select DMI
 
  endmenu
 
arch/x86/kernel/amd_node.c +8 -0
index 3d0a4768d603c..575d727c5827e 100644
@@ -9,6 +9,7 @@
   */
 
  #include <linux/debugfs.h>
+#include <linux/dmi.h>
  #include <asm/amd/node.h>
 
  /*
@@ -247,6 +248,7 @@ __setup("amd_smn_debugfs_enable", amd_smn_enable_dfs);
  static int __init amd_smn_init(void)
  {
  	u16 count, num_roots, roots_per_node, node, num_nodes;
+	const struct dmi_device *dev = NULL;
  	struct pci_dev *root;
 
  	if (!cpu_feature_enabled(X86_FEATURE_ZEN))
@@ -310,6 +312,12 @@ static int __init amd_smn_init(void)
 
  	smn_exclusive = true;
 
+	while ((dev = dmi_find_device(DMI_DEV_TYPE_ADDITIONAL, NULL, dev)))
+		if (!strncmp(dev->name, "AGESA", 5)) {
+			pr_info("%s\n", dev->name);
+			break;
+		}
+
  	return 0;
  }
 
Signature · 1 line
2.43.0