* [PATCH 1/1] DMI: Scan for DMI tbale from DTS info
@ 2025-09-26 15:56 adriana
2025-09-27 14:33 ` kernel test robot
2025-10-21 16:54 ` Adriana Nicolae
0 siblings, 2 replies; 3+ messages in thread
From: adriana @ 2025-09-26 15:56 UTC (permalink / raw)
To: jdelvare, linux-kernel; +Cc: Adriana Nicolae
Allow DMI decoding to use custom addresses stored in Device Tree
Some bootloaders like U-boot, particularly for the ARM architecture,
provide SMBIOS/DMI tables at a specific memory address. However, these
systems often do not boot using a full UEFI environment, which means the
kernel's standard EFI DMI scanner cannot find these tables.
The bootloader can specify the physical addresses of the SMBIOS and
SMBIOS3 tables in the /chosen node using the "linux,smbios-table" and
linux,smbios3-table properties. This patch hooks into the DMI
initialization process to read these properties, map the tables,
and parse the DMI information.
This extra scan is performed after the standard EFI check fails but
before the fallback memory scan, not to alter the order of DMI scanning
for current implementation.
Signed-off-by: Adriana Nicolae <adriana@arista.com>
diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c
index 70d39adf50dc..ea3ed40d0370 100644
--- a/drivers/firmware/dmi_scan.c
+++ b/drivers/firmware/dmi_scan.c
@@ -10,6 +10,9 @@
#include <linux/random.h>
#include <asm/dmi.h>
#include <linux/unaligned.h>
+#if IS_ENABLED(CONFIG_OF)
+#include <linux/of.h>
+#endif
#ifndef SMBIOS_ENTRY_POINT_SCAN_START
#define SMBIOS_ENTRY_POINT_SCAN_START 0xF0000
@@ -670,6 +673,70 @@ static int __init dmi_smbios3_present(const u8 *buf)
return 1;
}
+#if IS_ENABLED(CONFIG_OF)
+/**
+ * dmi_scan_from_dt - Find and parse DMI/SMBIOS tables from the Device Tree
+ *
+ * Checks if the bootloader has passed SMBIOS table addresses via the /chosen
+ * node in the Device Tree. This follows the standard kernel DT bindings and
+ * assumes a fixed 32-byte mapping for the entry point.
+ * Returns true if a valid table is found and successfully parsed.
+ */
+static bool __init dmi_scan_from_dt(void)
+{
+ struct device_node *chosen;
+ const __be64 *prop;
+ char buf[32];
+ void __iomem *p;
+ bool dmi_available = false;
+ u64 addr;
+ int len;
+
+ chosen = of_find_node_by_path("/chosen");
+ if (!chosen)
+ return false;
+
+ /* SMBIOSv3 (64-bit entry point) has priority */
+ prop = of_get_property(chosen, "linux,smbios3-table", &len);
+ if (prop && len >= sizeof(u64)) {
+ addr = be64_to_cpup(prop);
+
+ p = dmi_early_remap(addr, 32);
+ if (p == NULL)
+ goto out;
+
+ memcpy_fromio(buf, p, sizeof(buf));
+ dmi_early_unmap(p, 32);
+
+ if (!dmi_smbios3_present(buf)) {
+ dmi_available = true;
+ goto out;
+ }
+ }
+
+ prop = of_get_property(chosen, "linux,smbios-table", &len);
+ if (prop && len >= sizeof(u64)) {
+ addr = be64_to_cpup(prop);
+
+ p = dmi_early_remap(addr, 32);
+ if (p == NULL)
+ goto out;
+
+ memcpy_fromio(buf, p, sizeof(buf));
+ dmi_early_unmap(p, 32);
+
+ if (!dmi_present(buf))
+ dmi_available = true;
+ }
+
+out:
+ of_node_put(chosen);
+ return dmi_available;
+}
+#else
+static bool __init dmi_scan_from_dt(void) { return false; }
+#endif /* IS_ENABLED(CONFIG_OF) */
+
static void __init dmi_scan_machine(void)
{
char __iomem *p, *q;
@@ -718,6 +785,13 @@ static void __init dmi_scan_machine(void)
dmi_available = 1;
return;
}
+ } else if (IS_ENABLED(CONFIG_OF) && dmi_scan_from_dt()) {
+ /*
+ * If EFI is not present or failed, try getting SMBIOS
+ * tables from the Device Tree.
+ */
+ dmi_available = 1;
+ return;
} else if (IS_ENABLED(CONFIG_DMI_SCAN_MACHINE_NON_EFI_FALLBACK)) {
p = dmi_early_remap(SMBIOS_ENTRY_POINT_SCAN_START, 0x10000);
if (p == NULL)
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/1] DMI: Scan for DMI tbale from DTS info
2025-09-26 15:56 [PATCH 1/1] DMI: Scan for DMI tbale from DTS info adriana
@ 2025-09-27 14:33 ` kernel test robot
2025-10-21 16:54 ` Adriana Nicolae
1 sibling, 0 replies; 3+ messages in thread
From: kernel test robot @ 2025-09-27 14:33 UTC (permalink / raw)
To: adriana, jdelvare, linux-kernel; +Cc: oe-kbuild-all, Adriana Nicolae
Hi adriana,
kernel test robot noticed the following build warnings:
[auto build test WARNING on v6.17-rc7]
[also build test WARNING on linus/master next-20250926]
[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/adriana/DMI-Scan-for-DMI-tbale-from-DTS-info/20250926-235813
base: v6.17-rc7
patch link: https://lore.kernel.org/r/20250926155612.2737443-1-adriana%40arista.com
patch subject: [PATCH 1/1] DMI: Scan for DMI tbale from DTS info
config: i386-randconfig-061-20250927 (https://download.01.org/0day-ci/archive/20250927/202509272216.c9WBgv6U-lkp@intel.com/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/20250927/202509272216.c9WBgv6U-lkp@intel.com/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 <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202509272216.c9WBgv6U-lkp@intel.com/
sparse warnings: (new ones prefixed by >>)
>> drivers/firmware/dmi_scan.c:704:19: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected void [noderef] __iomem *p @@ got void * @@
drivers/firmware/dmi_scan.c:704:19: sparse: expected void [noderef] __iomem *p
drivers/firmware/dmi_scan.c:704:19: sparse: got void *
>> drivers/firmware/dmi_scan.c:709:33: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *addr @@ got void [noderef] __iomem *p @@
drivers/firmware/dmi_scan.c:709:33: sparse: expected void *addr
drivers/firmware/dmi_scan.c:709:33: sparse: got void [noderef] __iomem *p
drivers/firmware/dmi_scan.c:721:19: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected void [noderef] __iomem *p @@ got void * @@
drivers/firmware/dmi_scan.c:721:19: sparse: expected void [noderef] __iomem *p
drivers/firmware/dmi_scan.c:721:19: sparse: got void *
drivers/firmware/dmi_scan.c:726:33: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *addr @@ got void [noderef] __iomem *p @@
drivers/firmware/dmi_scan.c:726:33: sparse: expected void *addr
drivers/firmware/dmi_scan.c:726:33: sparse: got void [noderef] __iomem *p
drivers/firmware/dmi_scan.c:760:27: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected char [noderef] __iomem *p @@ got void * @@
drivers/firmware/dmi_scan.c:760:27: sparse: expected char [noderef] __iomem *p
drivers/firmware/dmi_scan.c:760:27: sparse: got void *
drivers/firmware/dmi_scan.c:764:41: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *addr @@ got char [noderef] __iomem *p @@
drivers/firmware/dmi_scan.c:764:41: sparse: expected void *addr
drivers/firmware/dmi_scan.c:764:41: sparse: got char [noderef] __iomem *p
drivers/firmware/dmi_scan.c:778:19: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected char [noderef] __iomem *p @@ got void * @@
drivers/firmware/dmi_scan.c:778:19: sparse: expected char [noderef] __iomem *p
drivers/firmware/dmi_scan.c:778:19: sparse: got void *
drivers/firmware/dmi_scan.c:782:33: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *addr @@ got char [noderef] __iomem *p @@
drivers/firmware/dmi_scan.c:782:33: sparse: expected void *addr
drivers/firmware/dmi_scan.c:782:33: sparse: got char [noderef] __iomem *p
drivers/firmware/dmi_scan.c:796:19: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected char [noderef] __iomem *p @@ got void * @@
drivers/firmware/dmi_scan.c:796:19: sparse: expected char [noderef] __iomem *p
drivers/firmware/dmi_scan.c:796:19: sparse: got void *
drivers/firmware/dmi_scan.c:809:49: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *addr @@ got char [noderef] __iomem *p @@
drivers/firmware/dmi_scan.c:809:49: sparse: expected void *addr
drivers/firmware/dmi_scan.c:809:49: sparse: got char [noderef] __iomem *p
drivers/firmware/dmi_scan.c:827:49: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *addr @@ got char [noderef] __iomem *p @@
drivers/firmware/dmi_scan.c:827:49: sparse: expected void *addr
drivers/firmware/dmi_scan.c:827:49: sparse: got char [noderef] __iomem *p
drivers/firmware/dmi_scan.c:832:33: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *addr @@ got char [noderef] __iomem *p @@
drivers/firmware/dmi_scan.c:832:33: sparse: expected void *addr
drivers/firmware/dmi_scan.c:832:33: sparse: got char [noderef] __iomem *p
vim +704 drivers/firmware/dmi_scan.c
675
676 #if IS_ENABLED(CONFIG_OF)
677 /**
678 * dmi_scan_from_dt - Find and parse DMI/SMBIOS tables from the Device Tree
679 *
680 * Checks if the bootloader has passed SMBIOS table addresses via the /chosen
681 * node in the Device Tree. This follows the standard kernel DT bindings and
682 * assumes a fixed 32-byte mapping for the entry point.
683 * Returns true if a valid table is found and successfully parsed.
684 */
685 static bool __init dmi_scan_from_dt(void)
686 {
687 struct device_node *chosen;
688 const __be64 *prop;
689 char buf[32];
690 void __iomem *p;
691 bool dmi_available = false;
692 u64 addr;
693 int len;
694
695 chosen = of_find_node_by_path("/chosen");
696 if (!chosen)
697 return false;
698
699 /* SMBIOSv3 (64-bit entry point) has priority */
700 prop = of_get_property(chosen, "linux,smbios3-table", &len);
701 if (prop && len >= sizeof(u64)) {
702 addr = be64_to_cpup(prop);
703
> 704 p = dmi_early_remap(addr, 32);
705 if (p == NULL)
706 goto out;
707
708 memcpy_fromio(buf, p, sizeof(buf));
> 709 dmi_early_unmap(p, 32);
710
711 if (!dmi_smbios3_present(buf)) {
712 dmi_available = true;
713 goto out;
714 }
715 }
716
717 prop = of_get_property(chosen, "linux,smbios-table", &len);
718 if (prop && len >= sizeof(u64)) {
719 addr = be64_to_cpup(prop);
720
721 p = dmi_early_remap(addr, 32);
722 if (p == NULL)
723 goto out;
724
725 memcpy_fromio(buf, p, sizeof(buf));
726 dmi_early_unmap(p, 32);
727
728 if (!dmi_present(buf))
729 dmi_available = true;
730 }
731
732 out:
733 of_node_put(chosen);
734 return dmi_available;
735 }
736 #else
737 static bool __init dmi_scan_from_dt(void) { return false; }
738 #endif /* IS_ENABLED(CONFIG_OF) */
739
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 1/1] DMI: Scan for DMI tbale from DTS info
2025-09-26 15:56 [PATCH 1/1] DMI: Scan for DMI tbale from DTS info adriana
2025-09-27 14:33 ` kernel test robot
@ 2025-10-21 16:54 ` Adriana Nicolae
1 sibling, 0 replies; 3+ messages in thread
From: Adriana Nicolae @ 2025-10-21 16:54 UTC (permalink / raw)
To: jdelvare, linux-kernel; +Cc: Vasiliy Khoruzhick
Hello maintainers,
Following up on this patch, I was wondering if there have been any
prior discussions or similar requests?
I would also appreciate your feedback on the proposed changes.
Thank you,
Adriana
On Fri, Sep 26, 2025 at 6:56 PM adriana <adriana@arista.com> wrote:
>
> Allow DMI decoding to use custom addresses stored in Device Tree
>
> Some bootloaders like U-boot, particularly for the ARM architecture,
> provide SMBIOS/DMI tables at a specific memory address. However, these
> systems often do not boot using a full UEFI environment, which means the
> kernel's standard EFI DMI scanner cannot find these tables.
>
> The bootloader can specify the physical addresses of the SMBIOS and
> SMBIOS3 tables in the /chosen node using the "linux,smbios-table" and
> linux,smbios3-table properties. This patch hooks into the DMI
> initialization process to read these properties, map the tables,
> and parse the DMI information.
>
> This extra scan is performed after the standard EFI check fails but
> before the fallback memory scan, not to alter the order of DMI scanning
> for current implementation.
>
> Signed-off-by: Adriana Nicolae <adriana@arista.com>
>
> diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c
> index 70d39adf50dc..ea3ed40d0370 100644
> --- a/drivers/firmware/dmi_scan.c
> +++ b/drivers/firmware/dmi_scan.c
> @@ -10,6 +10,9 @@
> #include <linux/random.h>
> #include <asm/dmi.h>
> #include <linux/unaligned.h>
> +#if IS_ENABLED(CONFIG_OF)
> +#include <linux/of.h>
> +#endif
>
> #ifndef SMBIOS_ENTRY_POINT_SCAN_START
> #define SMBIOS_ENTRY_POINT_SCAN_START 0xF0000
> @@ -670,6 +673,70 @@ static int __init dmi_smbios3_present(const u8 *buf)
> return 1;
> }
>
> +#if IS_ENABLED(CONFIG_OF)
> +/**
> + * dmi_scan_from_dt - Find and parse DMI/SMBIOS tables from the Device Tree
> + *
> + * Checks if the bootloader has passed SMBIOS table addresses via the /chosen
> + * node in the Device Tree. This follows the standard kernel DT bindings and
> + * assumes a fixed 32-byte mapping for the entry point.
> + * Returns true if a valid table is found and successfully parsed.
> + */
> +static bool __init dmi_scan_from_dt(void)
> +{
> + struct device_node *chosen;
> + const __be64 *prop;
> + char buf[32];
> + void __iomem *p;
> + bool dmi_available = false;
> + u64 addr;
> + int len;
> +
> + chosen = of_find_node_by_path("/chosen");
> + if (!chosen)
> + return false;
> +
> + /* SMBIOSv3 (64-bit entry point) has priority */
> + prop = of_get_property(chosen, "linux,smbios3-table", &len);
> + if (prop && len >= sizeof(u64)) {
> + addr = be64_to_cpup(prop);
> +
> + p = dmi_early_remap(addr, 32);
> + if (p == NULL)
> + goto out;
> +
> + memcpy_fromio(buf, p, sizeof(buf));
> + dmi_early_unmap(p, 32);
> +
> + if (!dmi_smbios3_present(buf)) {
> + dmi_available = true;
> + goto out;
> + }
> + }
> +
> + prop = of_get_property(chosen, "linux,smbios-table", &len);
> + if (prop && len >= sizeof(u64)) {
> + addr = be64_to_cpup(prop);
> +
> + p = dmi_early_remap(addr, 32);
> + if (p == NULL)
> + goto out;
> +
> + memcpy_fromio(buf, p, sizeof(buf));
> + dmi_early_unmap(p, 32);
> +
> + if (!dmi_present(buf))
> + dmi_available = true;
> + }
> +
> +out:
> + of_node_put(chosen);
> + return dmi_available;
> +}
> +#else
> +static bool __init dmi_scan_from_dt(void) { return false; }
> +#endif /* IS_ENABLED(CONFIG_OF) */
> +
> static void __init dmi_scan_machine(void)
> {
> char __iomem *p, *q;
> @@ -718,6 +785,13 @@ static void __init dmi_scan_machine(void)
> dmi_available = 1;
> return;
> }
> + } else if (IS_ENABLED(CONFIG_OF) && dmi_scan_from_dt()) {
> + /*
> + * If EFI is not present or failed, try getting SMBIOS
> + * tables from the Device Tree.
> + */
> + dmi_available = 1;
> + return;
> } else if (IS_ENABLED(CONFIG_DMI_SCAN_MACHINE_NON_EFI_FALLBACK)) {
> p = dmi_early_remap(SMBIOS_ENTRY_POINT_SCAN_START, 0x10000);
> if (p == NULL)
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-10-21 16:54 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-26 15:56 [PATCH 1/1] DMI: Scan for DMI tbale from DTS info adriana
2025-09-27 14:33 ` kernel test robot
2025-10-21 16:54 ` Adriana Nicolae
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox