Skip to contentSkip to conversation

x86: efi_loader: Ensure the SMBIOS tables are sent via EFI

PATCH Superseded Simon Glass 4 participants 7 messages Apr 5, 2025 – Apr 30, 2025 x86

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86: efi_loader: Ensure the SMBIOS tables are sent via EFI

The EFI-loader code has not been fully converted to use bloblist, so relies on the SMBIOS-table address being set in global_data.

Set this up in write_tables() so that the SMBIOS tables are actually available.

Enable the command for x86 QEMU so that the SMBIOS tests actually run.

Fixes 83ce35d6ebb ("emulation: Use bloblist to hold tables")

---

 arch/x86/lib/tables.c            | 2 ++
 board/emulation/qemu-x86/Kconfig | 1 +
 lib/efi_loader/efi_smbios.c      | 1 +
 3 files changed, 4 insertions(+)
arch/x86/lib/tables.c +2 -0
index ec52992209f..d7f183f95dc 100644
@@ -126,6 +126,8 @@ int write_tables(void)
 			use_high = true;
 			if (!gd->arch.table_start_high)
 				gd->arch.table_start_high = rom_addr;
+			if (table->tag == BLOBLISTT_SMBIOS_TABLES)
+				gd_set_smbios_start(rom_addr);
 		}
 		rom_table_end = table->write(rom_addr);
 		if (!rom_table_end) {
board/emulation/qemu-x86/Kconfig +1 -0
index b2a4e0891a4..c1564fba7cd 100644
@@ -23,5 +23,6 @@ config BOARD_SPECIFIC_OPTIONS # dummy
 	imply VIRTIO_PCI
 	imply VIRTIO_NET
 	imply VIRTIO_BLK
+	imply CMD_SMBIOS
 
 endif
lib/efi_loader/efi_smbios.c +1 -0
index 8d2ef6deb51..5275e966dfe 100644
@@ -35,6 +35,7 @@ efi_status_t efi_smbios_register(void)
 	void *buf;
 
 	addr = gd_smbios_start();
+	printf("register %lx\n", addr);
 	if (!addr) {
 		log_err("No SMBIOS tables to install\n");
 		return EFI_NOT_FOUND;
Signature · 1 line
2.43.0
#1 lore raw

Hi Simon

Quoted 3 lines · Simon Glass

The EFI-loader code has not been fully converted to use bloblist, so relies on the SMBIOS-table address being set in global_data.

Can you explain a bit more what this means? The SMBIOS tables for EFI are supposed to be on EFI allocated memory

Quoted 45 lines

Set this up in write_tables() so that the SMBIOS tables are actually available.

Enable the command for x86 QEMU so that the SMBIOS tests actually run.

Fixes 83ce35d6ebb ("emulation: Use bloblist to hold tables")

---

 arch/x86/lib/tables.c            | 2 ++
 board/emulation/qemu-x86/Kconfig | 1 +
 lib/efi_loader/efi_smbios.c      | 1 +
 3 files changed, 4 insertions(+)
arch/x86/lib/tables.c +2 -0
index ec52992209f..d7f183f95dc 100644
@@ -126,6 +126,8 @@ int write_tables(void)
                        use_high = true;
                        if (!gd->arch.table_start_high)
                                gd->arch.table_start_high = rom_addr;
+                       if (table->tag == BLOBLISTT_SMBIOS_TABLES)
+                               gd_set_smbios_start(rom_addr);
                }
                rom_table_end = table->write(rom_addr);
                if (!rom_table_end) {
board/emulation/qemu-x86/Kconfig +1 -0
index b2a4e0891a4..c1564fba7cd 100644
@@ -23,5 +23,6 @@ config BOARD_SPECIFIC_OPTIONS # dummy
        imply VIRTIO_PCI
        imply VIRTIO_NET
        imply VIRTIO_BLK
+       imply CMD_SMBIOS
 
 endif
lib/efi_loader/efi_smbios.c +0 -0
index 8d2ef6deb51..5275e966dfe 100644

lib/efi_loader/efi_smbios.c efi_status_t efi_smbios_register(void) · line 38

Quoted 4 lines
lib/efi_loader/efi_smbios.c +1 -0
@@ -35,6 +35,7 @@ efi_status_t efi_smbios_register(void)
        void *buf;
 
        addr = gd_smbios_start();
+       printf("register %lx\n", addr);

I don't think this print is useful at all, why isn't the log_err() right below enough?

Quoted 6 lines
lib/efi_loader/efi_smbios.c +0 -1
        if (!addr) {
                log_err("No SMBIOS tables to install\n");
                return EFI_NOT_FOUND;
--

2.43.0

Thanks
/Ilias

#2 lore raw
Quoted 57 lines · Ilias Apalodimas

Hi Simon

Quoted 3 lines · Simon Glass

The EFI-loader code has not been fully converted to use bloblist, so relies on the SMBIOS-table address being set in global_data.

Can you explain a bit more what this means? The SMBIOS tables for EFI are supposed to be on EFI allocated memory

Quoted 47 lines

Set this up in write_tables() so that the SMBIOS tables are actually available.

Enable the command for x86 QEMU so that the SMBIOS tests actually run.

Fixes 83ce35d6ebb ("emulation: Use bloblist to hold tables")

---

  arch/x86/lib/tables.c            | 2 ++
  board/emulation/qemu-x86/Kconfig | 1 +
  lib/efi_loader/efi_smbios.c      | 1 +
  3 files changed, 4 insertions(+)
arch/x86/lib/tables.c +2 -0
index ec52992209f..d7f183f95dc 100644
@@ -126,6 +126,8 @@ int write_tables(void)
                         use_high = true;
                         if (!gd->arch.table_start_high)
                                 gd->arch.table_start_high = rom_addr;
+                       if (table->tag == BLOBLISTT_SMBIOS_TABLES)
+                               gd_set_smbios_start(rom_addr);
                 }
                 rom_table_end = table->write(rom_addr);
                 if (!rom_table_end) {
board/emulation/qemu-x86/Kconfig +1 -0
index b2a4e0891a4..c1564fba7cd 100644
@@ -23,5 +23,6 @@ config BOARD_SPECIFIC_OPTIONS # dummy
         imply VIRTIO_PCI
         imply VIRTIO_NET
         imply VIRTIO_BLK
+       imply CMD_SMBIOS
 
  endif
lib/efi_loader/efi_smbios.c +0 -0
index 8d2ef6deb51..5275e966dfe 100644
@@ -35,6 +35,7 @@ efi_status_t efi_smbios_register(void)
         void *buf;
 
Quoted 2 lines

lib/efi_loader/efi_smbios.c efi_status_t efi_smbios_register(void) · line 38

Quoted 2 lines
lib/efi_loader/efi_smbios.c +1 -0
         addr = gd_smbios_start();
+       printf("register %lx\n", addr);

User will not know what "register" relates to.

log_debug() with a meaningful message in the else branch of the if statement below would be acceptable.

Best regards

Heinrich

Quoted 13 lines

I don't think this print is useful at all, why isn't the log_err() right below enough?

Quoted 6 lines
lib/efi_loader/efi_smbios.c +0 -1
         if (!addr) {
                 log_err("No SMBIOS tables to install\n");
                 return EFI_NOT_FOUND;
--

2.43.0

Thanks
/Ilias

#3 lore raw
In reply to Ilias Apalodimas

Hi Ilias,

Quoted 9 lines · Ilias Apalodimas

Hi Simon

Quoted 3 lines · Simon Glass

The EFI-loader code has not been fully converted to use bloblist, so relies on the SMBIOS-table address being set in global_data.

Can you explain a bit more what this means?

It means that the EFI-loader code is still using gd->arch.smbios_start to find the SMBIOS table. At some point we should move it to use bloblist_get_blob().

Quoted 2 lines

The SMBIOS tables for EFI
are supposed to be on EFI allocated memory

Not allocated by EFI, just added to the EFI memory map. See efi_smbios_register(). We still want to support SMBIOS tables if not booting with EFI.

Quoted 48 lines
Quoted 48 lines

Set this up in write_tables() so that the SMBIOS tables are actually available.

Enable the command for x86 QEMU so that the SMBIOS tests actually run.

Fixes 83ce35d6ebb ("emulation: Use bloblist to hold tables")

---

 arch/x86/lib/tables.c            | 2 ++
 board/emulation/qemu-x86/Kconfig | 1 +
 lib/efi_loader/efi_smbios.c      | 1 +
 3 files changed, 4 insertions(+)
arch/x86/lib/tables.c +2 -0
index ec52992209f..d7f183f95dc 100644
@@ -126,6 +126,8 @@ int write_tables(void)
                        use_high = true;
                        if (!gd->arch.table_start_high)
                                gd->arch.table_start_high = rom_addr;
+                       if (table->tag == BLOBLISTT_SMBIOS_TABLES)
+                               gd_set_smbios_start(rom_addr);
                }
                rom_table_end = table->write(rom_addr);
                if (!rom_table_end) {
board/emulation/qemu-x86/Kconfig +1 -0
index b2a4e0891a4..c1564fba7cd 100644
@@ -23,5 +23,6 @@ config BOARD_SPECIFIC_OPTIONS # dummy
        imply VIRTIO_PCI
        imply VIRTIO_NET
        imply VIRTIO_BLK
+       imply CMD_SMBIOS
 
 endif
lib/efi_loader/efi_smbios.c +0 -0
index 8d2ef6deb51..5275e966dfe 100644
@@ -35,6 +35,7 @@ efi_status_t efi_smbios_register(void)
        void *buf;
 
Quoted 5 lines

lib/efi_loader/efi_smbios.c efi_status_t efi_smbios_register(void) · line 38

Quoted 2 lines
lib/efi_loader/efi_smbios.c +1 -0
        addr = gd_smbios_start();
+       printf("register %lx\n", addr);

I don't think this print is useful at all, why isn't the log_err() right below enough?

This was left in inadvertently and should be removed.

Quoted 8 lines
Quoted 7 lines
lib/efi_loader/efi_smbios.c +0 -1
        if (!addr) {
                log_err("No SMBIOS tables to install\n");
                return EFI_NOT_FOUND;
--

2.43.0

Regards,
Simon

#4 lore raw
In reply to Simon Glass

Hi Simon,

this solves my problem, thanks!

Since SMBIOS is broken again in v2025.07-rc1 (and disabling bloblist doesn't work anymore), I applied this patch and it worked. I probably should have tried this sooner.

Greetings,
Niklas

Quoted 54 lines · Simon Glass

The EFI-loader code has not been fully converted to use bloblist, so relies on the SMBIOS-table address being set in global_data.

Set this up in write_tables() so that the SMBIOS tables are actually available.

Enable the command for x86 QEMU so that the SMBIOS tests actually run.

Fixes 83ce35d6ebb ("emulation: Use bloblist to hold tables")

---

  arch/x86/lib/tables.c            | 2 ++
  board/emulation/qemu-x86/Kconfig | 1 +
  lib/efi_loader/efi_smbios.c      | 1 +
  3 files changed, 4 insertions(+)
arch/x86/lib/tables.c +2 -0
index ec52992209f..d7f183f95dc 100644
@@ -126,6 +126,8 @@ int write_tables(void)
  			use_high = true;
  			if (!gd->arch.table_start_high)
  				gd->arch.table_start_high = rom_addr;
+			if (table->tag == BLOBLISTT_SMBIOS_TABLES)
+				gd_set_smbios_start(rom_addr);
  		}
  		rom_table_end = table->write(rom_addr);
  		if (!rom_table_end) {
board/emulation/qemu-x86/Kconfig +1 -0
index b2a4e0891a4..c1564fba7cd 100644
@@ -23,5 +23,6 @@ config BOARD_SPECIFIC_OPTIONS # dummy
  	imply VIRTIO_PCI
  	imply VIRTIO_NET
  	imply VIRTIO_BLK
+	imply CMD_SMBIOS
 
  endif
lib/efi_loader/efi_smbios.c +1 -0
index 8d2ef6deb51..5275e966dfe 100644
@@ -35,6 +35,7 @@ efi_status_t efi_smbios_register(void)
  	void *buf;
 
  	addr = gd_smbios_start();
+	printf("register %lx\n", addr);
  	if (!addr) {
  		log_err("No SMBIOS tables to install\n");
  		return EFI_NOT_FOUND;
#5 lore raw

Hi Niklas,

Quoted 8 lines · Niklas Sombert

Hi Simon,

this solves my problem, thanks!

Since SMBIOS is broken again in v2025.07-rc1 (and disabling bloblist doesn't work anymore), I applied this patch and it worked. I probably should have tried this sooner.

Thanks for testing this. Can you please reply with a 'Tested-by' tag?

Regards,
Simon

Quoted 60 lines

Greetings,
Niklas

Quoted 54 lines · Simon Glass

The EFI-loader code has not been fully converted to use bloblist, so relies on the SMBIOS-table address being set in global_data.

Set this up in write_tables() so that the SMBIOS tables are actually available.

Enable the command for x86 QEMU so that the SMBIOS tests actually run.

Fixes 83ce35d6ebb ("emulation: Use bloblist to hold tables")

---

  arch/x86/lib/tables.c            | 2 ++
  board/emulation/qemu-x86/Kconfig | 1 +
  lib/efi_loader/efi_smbios.c      | 1 +
  3 files changed, 4 insertions(+)
arch/x86/lib/tables.c +2 -0
index ec52992209f..d7f183f95dc 100644
@@ -126,6 +126,8 @@ int write_tables(void)
                      use_high = true;
                      if (!gd->arch.table_start_high)
                              gd->arch.table_start_high = rom_addr;
+                     if (table->tag == BLOBLISTT_SMBIOS_TABLES)
+                             gd_set_smbios_start(rom_addr);
              }
              rom_table_end = table->write(rom_addr);
              if (!rom_table_end) {
board/emulation/qemu-x86/Kconfig +1 -0
index b2a4e0891a4..c1564fba7cd 100644
@@ -23,5 +23,6 @@ config BOARD_SPECIFIC_OPTIONS # dummy
      imply VIRTIO_PCI
      imply VIRTIO_NET
      imply VIRTIO_BLK
+     imply CMD_SMBIOS
 
  endif
lib/efi_loader/efi_smbios.c +1 -0
index 8d2ef6deb51..5275e966dfe 100644
@@ -35,6 +35,7 @@ efi_status_t efi_smbios_register(void)
      void *buf;
 
      addr = gd_smbios_start();
+     printf("register %lx\n", addr);
      if (!addr) {
              log_err("No SMBIOS tables to install\n");
              return EFI_NOT_FOUND;