public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Mario Limonciello (AMD)" <superm1@kernel.org>
To: Yazen Ghannam <yazen.ghannam@amd.com>,
	x86@kernel.org (maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)),
	Jean Delvare <jdelvare@suse.com>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	"H . Peter Anvin" <hpa@zytor.com>,
	linux-kernel@vger.kernel.org,
	"Mario Limonciello (AMD)" <superm1@kernel.org>
Subject: [PATCH 4/5] firmware: dmi: Add debugfs for additional information entries
Date: Sun, 14 Dec 2025 12:53:08 -0600	[thread overview]
Message-ID: <20251214185309.152614-5-superm1@kernel.org> (raw)
In-Reply-To: <20251214185309.152614-1-superm1@kernel.org>

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.

Signed-off-by: Mario Limonciello (AMD) <superm1@kernel.org>
---
 drivers/firmware/dmi_scan.c | 36 ++++++++++++++++++++++++++++++++++--
 1 file changed, 34 insertions(+), 2 deletions(-)

diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c
index f7b7ed1d872e8..52ed2a6b1c1d4 100644
--- a/drivers/firmware/dmi_scan.c
+++ b/drivers/firmware/dmi_scan.c
@@ -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:
-- 
2.43.0


  parent reply	other threads:[~2025-12-14 18:53 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-14 18:53 [PATCH 0/5] Parse SMBIOS additional entries Mario Limonciello (AMD)
2025-12-14 18:53 ` [PATCH 1/5] firmware: dmi: Correct an indexing error in dmi.h Mario Limonciello (AMD)
2025-12-15 21:11   ` Yazen Ghannam
2025-12-15 21:24     ` Mario Limonciello
2025-12-14 18:53 ` [PATCH 2/5] firmware: dmi: Adjust dmi_decode() to use enums Mario Limonciello (AMD)
2025-12-15 21:12   ` Yazen Ghannam
2025-12-14 18:53 ` [PATCH 3/5] firmware: dmi: Read additional information when decoding DMI table Mario Limonciello (AMD)
2025-12-15  4:31   ` kernel test robot
2025-12-15  5:06   ` kernel test robot
2025-12-15 12:47   ` kernel test robot
2025-12-14 18:53 ` Mario Limonciello (AMD) [this message]
2025-12-14 18:53 ` [PATCH 5/5] x86/amd_node: Output the AGESA version to the logs Mario Limonciello (AMD)
2025-12-15 21:23   ` Yazen Ghannam
2025-12-15 21:25     ` Mario Limonciello

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251214185309.152614-5-superm1@kernel.org \
    --to=superm1@kernel.org \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=jdelvare@suse.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    --cc=yazen.ghannam@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox