Skip to contentSkip to conversation

SMBIOS Support for ARM

RFC PATCH In review Wei Huang 3 participants 11 messages Jul 14, 2015 – Jul 16, 2015

lore
Share & tools
lore

Wei Huang

author
#0 lore raw

cover SMBIOS Support for ARM

SMBIOS tables present userful system hardware info to management applications, such as DMI tools. Even though SMBIOS was originally developed for Intel x86, it has been extended to both Itanium and ARM (32bit & 64bit). More and more ARM server releases, such as RHEL Server for ARM, start to integrate support for SMBIOS.

This patchset is intendted to provid SMBIOS tables for ARM mach-virt machine. The SMBIOS tables are created and stored in fw_cfg, awaiting OVMF (AAVMF) to parse/present SMBIOS entry.

NOTE: This is RFC and the patches haven't been fully tested yet. Laszlo is kind enough to offer help on fixing AAVMF to enable support for SMBIOS. Any comments are welcomed for next release.

Thanks,
-Wei

Wei Huang (5):
smbios: extract x86 smbios building code into a function
smbios: remove dependency on x86 e820 tables
smbios: pass ram size as a parameter to build smbios tables
smbios: move smbios code into a common folder
smbios: implement smbios support for mach-virt

 arch_init.c                        |    2 +-
 default-configs/arm-softmmu.mak    |    1 +
 default-configs/i386-softmmu.mak   |    1 +
 default-configs/x86_64-softmmu.mak |    1 +
 hw/Makefile.objs                   |    1 +
 hw/arm/virt.c                      |   24 +
 hw/i386/Makefile.objs              |    2 +-
 hw/i386/pc.c                       |   56 +-
 hw/i386/pc_piix.c                  |    2 +-
 hw/i386/pc_q35.c                   |    2 +-
 hw/i386/smbios.c                   | 1102 ------------------------------------
 hw/smbios/Makefile.objs            |    1 +
 hw/smbios/smbios.c                 | 1102 ++++++++++++++++++++++++++++++++++++
 include/hw/arm/virt-acpi-build.h   |    1 +
 include/hw/i386/smbios.h           |  227 --------
 include/hw/smbios/smbios.h         |  237 ++++++++
 tests/bios-tables-test.c           |    2 +-
 vl.c                               |    2 +-
 18 files changed, 1414 insertions(+), 1352 deletions(-)
 delete mode 100644 hw/i386/smbios.c
 create mode 100644 hw/smbios/Makefile.objs
 create mode 100644 hw/smbios/smbios.c
 delete mode 100644 include/hw/i386/smbios.h
 create mode 100644 include/hw/smbios/smbios.h
Signature · 1 line
1.8.3.1
author
#2 lore raw

RFC PATCH 2/5 smbios: remove dependency on x86 e820 tables

Current smbios builds type 19 table from e820, which is x86 specific. This patch removes smbios' dependency on e820 by passing an array of memory area to smbios_get_tables().

---
 hw/i386/pc.c             | 18 +++++++++++++++++-
 hw/i386/smbios.c         | 14 +++++++-------
 include/hw/i386/smbios.h | 10 +++++++++-
 3 files changed, 33 insertions(+), 9 deletions(-)
hw/i386/pc.c +17 -1
index 00e45f3..34e9133 100644
@@ -722,6 +722,8 @@ static void pc_build_smbios(FWCfgState *fw_cfg)
 {
     uint8_t *smbios_tables, *smbios_anchor;
     size_t smbios_tables_len, smbios_anchor_len;
+    struct smbios_phys_mem_area *mem_array;
+    unsigned i, array_count;
 
     smbios_tables = smbios_get_table_legacy(&smbios_tables_len);
     if (smbios_tables) {
@@ -729,8 +731,22 @@ static void pc_build_smbios(FWCfgState *fw_cfg)
                          smbios_tables, smbios_tables_len);
     }
 
-    smbios_get_tables(&smbios_tables, &smbios_tables_len,
+    /* build the array of physical mem area from e820 table */
+    mem_array = g_malloc0(sizeof(*mem_array) * e820_get_num_entries());
+    for (i = 0, array_count = 0; i < e820_get_num_entries(); i++) {
+        uint64_t addr, len;
+
+        if (e820_get_entry(i, E820_RAM, &addr, &len)) {
+            mem_array[array_count].address = addr;
+            mem_array[array_count].length = len;
+            array_count++;
+        }
+    }
+    smbios_get_tables(mem_array, array_count,
+                      &smbios_tables, &smbios_tables_len,
                       &smbios_anchor, &smbios_anchor_len);
+    g_free(mem_array);
+
     if (smbios_anchor) {
         fw_cfg_add_file(fw_cfg, "etc/smbios/smbios-tables",
                         smbios_tables, smbios_tables_len);
hw/i386/smbios.c +7 -7
index 1341e02..6f715c6 100644
@@ -831,10 +831,12 @@ static void smbios_entry_point_setup(void)
     ep.structure_table_address = cpu_to_le32(0);
 }
 
-void smbios_get_tables(uint8_t **tables, size_t *tables_len,
+void smbios_get_tables(const struct smbios_phys_mem_area *mem_array,
+                       const unsigned int mem_array_size,
+                       uint8_t **tables, size_t *tables_len,
                        uint8_t **anchor, size_t *anchor_len)
 {
-    unsigned i, dimm_cnt, instance;
+    unsigned i, dimm_cnt;
 
     if (smbios_legacy) {
         *tables = *anchor = NULL;
@@ -867,11 +869,9 @@ void smbios_get_tables(uint8_t **tables, size_t *tables_len,
             smbios_build_type_17_table(i, GET_DIMM_SZ);
         }
 
-        for (i = 0, instance = 0; i < e820_get_num_entries(); i++) {
-            uint64_t address, length;
-            if (e820_get_entry(i, E820_RAM, &address, &length)) {
-                smbios_build_type_19_table(instance++, address, length);
-            }
+        for (i = 0; i < mem_array_size; i++) {
+            smbios_build_type_19_table(i, mem_array[i].address,
+                                       mem_array[i].length);
         }
 
         smbios_build_type_32_table();
include/hw/i386/smbios.h +9 -1
index d2850be..4269aab 100644
@@ -17,13 +17,21 @@
 
 #define SMBIOS_MAX_TYPE 127
 
+/* memory area description, used by type 19 table */
+struct smbios_phys_mem_area {
+    uint64_t address;
+    uint64_t length;
+};
+
 void smbios_entry_add(QemuOpts *opts);
 void smbios_set_cpuid(uint32_t version, uint32_t features);
 void smbios_set_defaults(const char *manufacturer, const char *product,
                          const char *version, bool legacy_mode,
                          bool uuid_encoded);
 uint8_t *smbios_get_table_legacy(size_t *length);
-void smbios_get_tables(uint8_t **tables, size_t *tables_len,
+void smbios_get_tables(const struct smbios_phys_mem_area *mem_array,
+                       const unsigned int mem_array_size,
+                       uint8_t **tables, size_t *tables_len,
                        uint8_t **anchor, size_t *anchor_len);
 
 /*
Signature · 1 line
1.8.3.1
author
#3 lore raw

RFC PATCH 3/5 smbios: pass ram size as a parameter to build smbios tables

In reply to Wei Huang

This patch adds a new parameter, mem_size, to smbios_get_tables() function. This step is required to make smbios code architect-independent.

---
 hw/i386/pc.c             | 2 +-
 hw/i386/smbios.c         | 8 ++++----
 include/hw/i386/smbios.h | 2 ++
 3 files changed, 7 insertions(+), 5 deletions(-)
hw/i386/pc.c +1 -1
index 34e9133..944d5b1 100644
@@ -742,7 +742,7 @@ static void pc_build_smbios(FWCfgState *fw_cfg)
             array_count++;
         }
     }
-    smbios_get_tables(mem_array, array_count,
+    smbios_get_tables(mem_array, array_count, ram_size,
                       &smbios_tables, &smbios_tables_len,
                       &smbios_anchor, &smbios_anchor_len);
     g_free(mem_array);
hw/i386/smbios.c +4 -4
index 6f715c6..12aee90 100644
@@ -19,10 +19,9 @@
 #include "qemu/error-report.h"
 #include "sysemu/sysemu.h"
 #include "sysemu/cpus.h"
-#include "hw/i386/pc.h"
 #include "hw/i386/smbios.h"
 #include "hw/loader.h"
-
+#include "exec/cpu-common.h"
 
 /* legacy structures and constants for <= 2.0 machines */
 struct smbios_header {
@@ -649,7 +648,7 @@ static void smbios_build_type_4_table(unsigned instance)
 
 #define MAX_T16_STD_SZ 0x80000000 /* 2T in Kilobytes */
 
-static void smbios_build_type_16_table(unsigned dimm_cnt)
+static void smbios_build_type_16_table(unsigned dimm_cnt, ram_addr_t ram_size)
 {
     uint64_t size_kb;
 
@@ -833,6 +832,7 @@ static void smbios_entry_point_setup(void)
 
 void smbios_get_tables(const struct smbios_phys_mem_area *mem_array,
                        const unsigned int mem_array_size,
+                       const ram_addr_t ram_size,
                        uint8_t **tables, size_t *tables_len,
                        uint8_t **anchor, size_t *anchor_len)
 {
@@ -863,7 +863,7 @@ void smbios_get_tables(const struct smbios_phys_mem_area *mem_array,
 
         dimm_cnt = QEMU_ALIGN_UP(ram_size, MAX_DIMM_SZ) / MAX_DIMM_SZ;
 
-        smbios_build_type_16_table(dimm_cnt);
+        smbios_build_type_16_table(dimm_cnt, ram_size);
 
         for (i = 0; i < dimm_cnt; i++) {
             smbios_build_type_17_table(i, GET_DIMM_SZ);
include/hw/i386/smbios.h +2 -0
index 4269aab..e727233 100644
@@ -14,6 +14,7 @@
  */
 
 #include "qemu/option.h"
+#include "exec/cpu-common.h"
 
 #define SMBIOS_MAX_TYPE 127
 
@@ -31,6 +32,7 @@ void smbios_set_defaults(const char *manufacturer, const char *product,
 uint8_t *smbios_get_table_legacy(size_t *length);
 void smbios_get_tables(const struct smbios_phys_mem_area *mem_array,
                        const unsigned int mem_array_size,
+                       const ram_addr_t ram_size,
                        uint8_t **tables, size_t *tables_len,
                        uint8_t **anchor, size_t *anchor_len);
 
Signature · 1 line
1.8.3.1
author
#1 lore raw

RFC PATCH 1/5 smbios: extract x86 smbios building code into a function

In reply to Wei Huang

This patch extracts out the procedure of buidling x86 SMBIOS tables into a dedicated function.

---
 hw/i386/pc.c | 38 ++++++++++++++++++++++----------------
 1 file changed, 22 insertions(+), 16 deletions(-)
hw/i386/pc.c +22 -16
index 7661ea9..00e45f3 100644
@@ -718,11 +718,30 @@ static unsigned int pc_apic_id_limit(unsigned int max_cpus)
     return x86_cpu_apic_id_from_index(max_cpus - 1) + 1;
 }
 
-static FWCfgState *bochs_bios_init(void)
+static void pc_build_smbios(FWCfgState *fw_cfg)
 {
-    FWCfgState *fw_cfg;
     uint8_t *smbios_tables, *smbios_anchor;
     size_t smbios_tables_len, smbios_anchor_len;
+
+    smbios_tables = smbios_get_table_legacy(&smbios_tables_len);
+    if (smbios_tables) {
+        fw_cfg_add_bytes(fw_cfg, FW_CFG_SMBIOS_ENTRIES,
+                         smbios_tables, smbios_tables_len);
+    }
+
+    smbios_get_tables(&smbios_tables, &smbios_tables_len,
+                      &smbios_anchor, &smbios_anchor_len);
+    if (smbios_anchor) {
+        fw_cfg_add_file(fw_cfg, "etc/smbios/smbios-tables",
+                        smbios_tables, smbios_tables_len);
+        fw_cfg_add_file(fw_cfg, "etc/smbios/smbios-anchor",
+                        smbios_anchor, smbios_anchor_len);
+    }
+}
+
+static FWCfgState *bochs_bios_init(void)
+{
+    FWCfgState *fw_cfg;
     uint64_t *numa_fw_cfg;
     int i, j;
     unsigned int apic_id_limit = pc_apic_id_limit(max_cpus);
@@ -748,20 +767,7 @@ static FWCfgState *bochs_bios_init(void)
                      acpi_tables, acpi_tables_len);
     fw_cfg_add_i32(fw_cfg, FW_CFG_IRQ0_OVERRIDE, kvm_allows_irq0_override());
 
-    smbios_tables = smbios_get_table_legacy(&smbios_tables_len);
-    if (smbios_tables) {
-        fw_cfg_add_bytes(fw_cfg, FW_CFG_SMBIOS_ENTRIES,
-                         smbios_tables, smbios_tables_len);
-    }
-
-    smbios_get_tables(&smbios_tables, &smbios_tables_len,
-                      &smbios_anchor, &smbios_anchor_len);
-    if (smbios_anchor) {
-        fw_cfg_add_file(fw_cfg, "etc/smbios/smbios-tables",
-                        smbios_tables, smbios_tables_len);
-        fw_cfg_add_file(fw_cfg, "etc/smbios/smbios-anchor",
-                        smbios_anchor, smbios_anchor_len);
-    }
+    pc_build_smbios(fw_cfg);
 
     fw_cfg_add_bytes(fw_cfg, FW_CFG_E820_TABLE,
                      &e820_reserve, sizeof(e820_reserve));
Signature · 1 line
1.8.3.1
author
#7 lore raw

RFC PATCH 5/5 smbios: implement smbios support for mach-virt

In reply to Wei Huang

This patch generates smbios tables for ARM mach-virt. Also add CONFIG_SMBIOS=y for ARM default config.

---
 default-configs/arm-softmmu.mak  |  1 +
 hw/arm/virt.c                    | 24 ++++++++++++++++++++++++
 include/hw/arm/virt-acpi-build.h |  1 +
 3 files changed, 26 insertions(+)
default-configs/arm-softmmu.mak +1 -0
index 74f1db3..99b41e9 100644
@@ -102,3 +102,4 @@ CONFIG_XIO3130=y
 CONFIG_IOH3420=y
 CONFIG_I82801B11=y
 CONFIG_ACPI=y
+CONFIG_SMBIOS=y
hw/arm/virt.c +24 -0
index 4846892..09c800b 100644
@@ -48,6 +48,7 @@
 #include "hw/arm/sysbus-fdt.h"
 #include "hw/platform-bus.h"
 #include "hw/arm/fdt.h"
+#include "hw/smbios/smbios.h"
 
 /* Number of external interrupt lines to configure the GIC with */
 #define NUM_IRQS 256
@@ -780,12 +781,34 @@ static void *machvirt_dtb(const struct arm_boot_info *binfo, int *fdt_size)
     return board->fdt;
 }
 
+static void virt_build_smbios(VirtGuestInfo *guest_info)
+{
+    FWCfgState *fw_cfg = guest_info->fw_cfg;
+    uint8_t *smbios_tables, *smbios_anchor;
+    size_t smbios_tables_len, smbios_anchor_len;
+
+    smbios_set_defaults("QEMU", "QEMU Virtual Machine",
+                        "1.0", false, false);
+
+    smbios_get_tables(NULL, 0, guest_info->ram_size,
+                      &smbios_tables, &smbios_tables_len,
+                      &smbios_anchor, &smbios_anchor_len);
+
+    if (smbios_anchor) {
+        fw_cfg_add_file(fw_cfg, "etc/smbios/smbios-tables",
+                        smbios_tables, smbios_tables_len);
+        fw_cfg_add_file(fw_cfg, "etc/smbios/smbios-anchor",
+                        smbios_anchor, smbios_anchor_len);
+    }
+}
+
 static
 void virt_guest_info_machine_done(Notifier *notifier, void *data)
 {
     VirtGuestInfoState *guest_info_state = container_of(notifier,
                                               VirtGuestInfoState, machine_done);
     virt_acpi_setup(&guest_info_state->info);
+    virt_build_smbios(&guest_info_state->info);
 }
 
 static void machvirt_init(MachineState *machine)
@@ -894,6 +917,7 @@ static void machvirt_init(MachineState *machine)
 
     guest_info->smp_cpus = smp_cpus;
     guest_info->fw_cfg = fw_cfg_find();
+    guest_info->ram_size = machine->ram_size;
     guest_info->memmap = vbi->memmap;
     guest_info->irqmap = vbi->irqmap;
     guest_info_state->machine_done.notify = virt_guest_info_machine_done;
include/hw/arm/virt-acpi-build.h +1 -0
index 04f174d..ef274c6 100644
@@ -29,6 +29,7 @@
 typedef struct VirtGuestInfo {
     int smp_cpus;
     FWCfgState *fw_cfg;
+    ram_addr_t ram_size;
     const MemMapEntry *memmap;
     const int *irqmap;
 } VirtGuestInfo;
Signature · 1 line
1.8.3.1
author
#4 lore raw

RFC PATCH 4/5 smbios: move smbios code into a common folder

In reply to Wei Huang

To share smbios among different architectures, this patch moves SMBIOS code (smbios.c and smbios.h) from x86 specific folders into new hw/smbios directories. As a result, CONFIG_SMBIOS=y is defined in x86 default config files.

---
 arch_init.c                        |    2 +-
 default-configs/i386-softmmu.mak   |    1 +
 default-configs/x86_64-softmmu.mak |    1 +
 hw/Makefile.objs                   |    1 +
 hw/i386/Makefile.objs              |    2 +-
 hw/i386/pc.c                       |    2 +-
 hw/i386/pc_piix.c                  |    2 +-
 hw/i386/pc_q35.c                   |    2 +-
 hw/i386/smbios.c                   | 1102 ------------------------------------
 hw/smbios/Makefile.objs            |    1 +
 hw/smbios/smbios.c                 | 1102 ++++++++++++++++++++++++++++++++++++
 include/hw/i386/smbios.h           |  237 --------
 include/hw/smbios/smbios.h         |  237 ++++++++
 tests/bios-tables-test.c           |    2 +-
 vl.c                               |    2 +-
 15 files changed, 1350 insertions(+), 1346 deletions(-)
 delete mode 100644 hw/i386/smbios.c
 create mode 100644 hw/smbios/Makefile.objs
 create mode 100644 hw/smbios/smbios.c
 delete mode 100644 include/hw/i386/smbios.h
 create mode 100644 include/hw/smbios/smbios.h
arch_init.c +1 -1
index 725c638..38f5fb9 100644
@@ -26,7 +26,7 @@
 #include "sysemu/arch_init.h"
 #include "hw/pci/pci.h"
 #include "hw/audio/audio.h"
-#include "hw/i386/smbios.h"
+#include "hw/smbios/smbios.h"
 #include "qemu/config-file.h"
 #include "qemu/error-report.h"
 #include "qmp-commands.h"
default-configs/i386-softmmu.mak +1 -0
index 48b5762..5eaafa1 100644
@@ -49,3 +49,4 @@ CONFIG_MEM_HOTPLUG=y
 CONFIG_XIO3130=y
 CONFIG_IOH3420=y
 CONFIG_I82801B11=y
+CONFIG_SMBIOS=y
default-configs/x86_64-softmmu.mak +1 -0
index 4962ed7..28e2099 100644
@@ -50,3 +50,4 @@ CONFIG_MEM_HOTPLUG=y
 CONFIG_XIO3130=y
 CONFIG_IOH3420=y
 CONFIG_I82801B11=y
+CONFIG_SMBIOS=y
hw/Makefile.objs +1 -0
index 73afa41..7e7c241 100644
@@ -31,6 +31,7 @@ devices-dirs-$(CONFIG_VIRTIO) += virtio/
 devices-dirs-$(CONFIG_SOFTMMU) += watchdog/
 devices-dirs-$(CONFIG_SOFTMMU) += xen/
 devices-dirs-$(CONFIG_MEM_HOTPLUG) += mem/
+devices-dirs-$(CONFIG_SMBIOS) += smbios/
 devices-dirs-y += core/
 common-obj-y += $(devices-dirs-y)
 obj-y += $(devices-dirs-y)
hw/i386/Makefile.objs +1 -1
index bd4f147..723a4d8 100644
@@ -1,5 +1,5 @@
 obj-$(CONFIG_KVM) += kvm/
-obj-y += multiboot.o smbios.o
+obj-y += multiboot.o
 obj-y += pc.o pc_piix.o pc_q35.o
 obj-y += pc_sysfw.o
 obj-y += intel_iommu.o
hw/i386/pc.c +1 -1
index 944d5b1..80291fe 100644
@@ -33,7 +33,7 @@
 #include "hw/pci/pci_bus.h"
 #include "hw/nvram/fw_cfg.h"
 #include "hw/timer/hpet.h"
-#include "hw/i386/smbios.h"
+#include "hw/smbios/smbios.h"
 #include "hw/loader.h"
 #include "elf.h"
 #include "multiboot.h"
hw/i386/pc_piix.c +1 -1
index 8167b12..4ee4c28 100644
@@ -28,7 +28,7 @@
 #include "hw/loader.h"
 #include "hw/i386/pc.h"
 #include "hw/i386/apic.h"
-#include "hw/i386/smbios.h"
+#include "hw/smbios/smbios.h"
 #include "hw/pci/pci.h"
 #include "hw/pci/pci_ids.h"
 #include "hw/usb.h"
hw/i386/pc_q35.c +1 -1
index 974aead..d83df14 100644
@@ -39,7 +39,7 @@
 #include "hw/pci-host/q35.h"
 #include "exec/address-spaces.h"
 #include "hw/i386/ich9.h"
-#include "hw/i386/smbios.h"
+#include "hw/smbios/smbios.h"
 #include "hw/ide/pci.h"
 #include "hw/ide/ahci.h"
 #include "hw/usb.h"
hw/i386/smbios.c deleted +0 -1102

1,102 lines not on this page · raw message

hw/smbios/Makefile.objs new file +1 -0
new file mode 100644
index 0000000..f69a92f
@@ -0,0 +1 @@
+common-obj-$(CONFIG_SMBIOS) += smbios.o
hw/smbios/smbios.c new file +1102 -0

1,102 lines not on this page · raw message

include/hw/i386/smbios.h deleted +0 -237

237 lines not on this page · raw message

include/hw/smbios/smbios.h new file +237 -0

237 lines not on this page · raw message

tests/bios-tables-test.c +1 -1
index 0de1742..613867a 100644
@@ -18,7 +18,7 @@
 #include "libqtest.h"
 #include "qemu/compiler.h"
 #include "hw/acpi/acpi-defs.h"
-#include "hw/i386/smbios.h"
+#include "hw/smbios/smbios.h"
 #include "qemu/bitmap.h"
 
 #define MACHINE_PC "pc"
vl.c +1 -1
index 3f269dc..be59bfb 100644
@@ -68,7 +68,7 @@ int main(int argc, char **argv)
 #include "hw/isa/isa.h"
 #include "hw/bt.h"
 #include "sysemu/watchdog.h"
-#include "hw/i386/smbios.h"
+#include "hw/smbios/smbios.h"
 #include "hw/xen/xen.h"
 #include "hw/qdev.h"
 #include "hw/loader.h"
Signature · 1 line
1.8.3.1
#8 lore raw
In reply to Wei Huang

Cc'ing Ard.

Quoted 6 lines · Wei Huang

SMBIOS tables present userful system hardware info to management applications, such as DMI tools. Even though SMBIOS was originally developed for Intel x86, it has been extended to both Itanium and ARM (32bit & 64bit). More and more ARM server releases, such as RHEL Server for ARM, start to integrate support for SMBIOS.

Quoted 7 lines

This patchset is intendted to provid SMBIOS tables for ARM mach-virt machine. The SMBIOS tables are created and stored in fw_cfg, awaiting OVMF (AAVMF) to parse/present SMBIOS entry.

NOTE: This is RFC and the patches haven't been fully tested yet. Laszlo is kind enough to offer help on fixing AAVMF to enable support for SMBIOS.

I intend to start working on this tomorrow. (Well, not in ~50 minutes for sure, but you get the idea.)

Thanks!
Laszlo

Quoted 37 lines

Any comments are welcomed for next release.

Thanks,
-Wei

Wei Huang (5):
smbios: extract x86 smbios building code into a function
smbios: remove dependency on x86 e820 tables
smbios: pass ram size as a parameter to build smbios tables
smbios: move smbios code into a common folder
smbios: implement smbios support for mach-virt

 arch_init.c                        |    2 +-
 default-configs/arm-softmmu.mak    |    1 +
 default-configs/i386-softmmu.mak   |    1 +
 default-configs/x86_64-softmmu.mak |    1 +
 hw/Makefile.objs                   |    1 +
 hw/arm/virt.c                      |   24 +
 hw/i386/Makefile.objs              |    2 +-
 hw/i386/pc.c                       |   56 +-
 hw/i386/pc_piix.c                  |    2 +-
 hw/i386/pc_q35.c                   |    2 +-
 hw/i386/smbios.c                   | 1102 ------------------------------------
 hw/smbios/Makefile.objs            |    1 +
 hw/smbios/smbios.c                 | 1102 ++++++++++++++++++++++++++++++++++++
 include/hw/arm/virt-acpi-build.h   |    1 +
 include/hw/i386/smbios.h           |  227 --------
 include/hw/smbios/smbios.h         |  237 ++++++++
 tests/bios-tables-test.c           |    2 +-
 vl.c                               |    2 +-
 18 files changed, 1414 insertions(+), 1352 deletions(-)
 delete mode 100644 hw/i386/smbios.c
 create mode 100644 hw/smbios/Makefile.objs
 create mode 100644 hw/smbios/smbios.c
 delete mode 100644 include/hw/i386/smbios.h
 create mode 100644 include/hw/smbios/smbios.h
#5 lore raw

Re: [Qemu-devel] [ARM SMBIOS RFC PATCH 4/5] smbios: move smbios code into a common folder

In reply to Wei Huang
Quoted 20 lines · Wei Huang

To share smbios among different architectures, this patch moves SMBIOS code (smbios.c and smbios.h) from x86 specific folders into new hw/smbios directories. As a result, CONFIG_SMBIOS=y is defined in x86 default config files.

---
 arch_init.c                        |    2 +-
 default-configs/i386-softmmu.mak   |    1 +
 default-configs/x86_64-softmmu.mak |    1 +
 hw/Makefile.objs                   |    1 +
 hw/i386/Makefile.objs              |    2 +-
 hw/i386/pc.c                       |    2 +-
 hw/i386/pc_piix.c                  |    2 +-
 hw/i386/pc_q35.c                   |    2 +-
 hw/i386/smbios.c                   | 1102 ------------------------------------
 hw/smbios/Makefile.objs            |    1 +
 hw/smbios/smbios.c                 | 1102 ++++++++++++++++++++++++++++++++++++
 include/hw/i386/smbios.h           |  237 --------
 include/hw/smbios/smbios.h         |  237 ++++++++
Quoted 8 lines
 tests/bios-tables-test.c           |    2 +-
 vl.c                               |    2 +-
 15 files changed, 1350 insertions(+), 1346 deletions(-)
 delete mode 100644 hw/i386/smbios.c
 create mode 100644 hw/smbios/Makefile.objs
 create mode 100644 hw/smbios/smbios.c
 delete mode 100644 include/hw/i386/smbios.h
 create mode 100644 include/hw/smbios/smbios.h

Can you please send the next version of this series (I assume there's going to be one) with rename detection enabled? At least "hw/i386/smbios.c" --> "hw/smbios/smbios.c" appears a rename. A few lines may have changed, but without enabling rename detection, it's really hard to tell.

Thanks
Laszlo

author
#6 lore raw

Re: [Qemu-devel] [ARM SMBIOS RFC PATCH 4/5] smbios: move smbios code into a common folder

Quoted 30 lines · Laszlo Ersek
Quoted 20 lines · Wei Huang

To share smbios among different architectures, this patch moves SMBIOS code (smbios.c and smbios.h) from x86 specific folders into new hw/smbios directories. As a result, CONFIG_SMBIOS=y is defined in x86 default config files.

---
 arch_init.c                        |    2 +-
 default-configs/i386-softmmu.mak   |    1 +
 default-configs/x86_64-softmmu.mak |    1 +
 hw/Makefile.objs                   |    1 +
 hw/i386/Makefile.objs              |    2 +-
 hw/i386/pc.c                       |    2 +-
 hw/i386/pc_piix.c                  |    2 +-
 hw/i386/pc_q35.c                   |    2 +-
 hw/i386/smbios.c                   | 1102 ------------------------------------
 hw/smbios/Makefile.objs            |    1 +
 hw/smbios/smbios.c                 | 1102 ++++++++++++++++++++++++++++++++++++
 include/hw/i386/smbios.h           |  237 --------
 include/hw/smbios/smbios.h         |  237 ++++++++
Quoted 8 lines
 tests/bios-tables-test.c           |    2 +-
 vl.c                               |    2 +-
 15 files changed, 1350 insertions(+), 1346 deletions(-)
 delete mode 100644 hw/i386/smbios.c
 create mode 100644 hw/smbios/Makefile.objs
 create mode 100644 hw/smbios/smbios.c
 delete mode 100644 include/hw/i386/smbios.h
 create mode 100644 include/hw/smbios/smbios.h
Quoted 5 lines

Can you please send the next version of this series (I assume there's going to be one) with rename detection enabled? At least "hw/i386/smbios.c" --> "hw/smbios/smbios.c" appears a rename. A few lines may have changed, but without enabling rename detection, it's really hard to tell.

Good point. I will do it in next version.

Quoted 4 lines

Thanks
Laszlo

#9 lore raw
In reply to Wei Huang
Quoted 6 lines · Wei Huang

SMBIOS tables present userful system hardware info to management applications, such as DMI tools. Even though SMBIOS was originally developed for Intel x86, it has been extended to both Itanium and ARM (32bit & 64bit). More and more ARM server releases, such as RHEL Server for ARM, start to integrate support for SMBIOS.

Quoted 7 lines

This patchset is intendted to provid SMBIOS tables for ARM mach-virt machine. The SMBIOS tables are created and stored in fw_cfg, awaiting OVMF (AAVMF) to parse/present SMBIOS entry.

NOTE: This is RFC and the patches haven't been fully tested yet. Laszlo is kind enough to offer help on fixing AAVMF to enable support for SMBIOS. Any comments are welcomed for next release.

Your series is functional; I posted a matching patch set for edk2 (with example dmidecode output in the blurb):

http://thread.gmane.org/gmane.comp.bios.tianocore.devel/17470

I'll let others review your patches, especially concerning the concrete SMBIOS contents.

Thanks!
Laszlo

Quoted 36 lines

Thanks,
-Wei

Wei Huang (5):
smbios: extract x86 smbios building code into a function
smbios: remove dependency on x86 e820 tables
smbios: pass ram size as a parameter to build smbios tables
smbios: move smbios code into a common folder
smbios: implement smbios support for mach-virt

 arch_init.c                        |    2 +-
 default-configs/arm-softmmu.mak    |    1 +
 default-configs/i386-softmmu.mak   |    1 +
 default-configs/x86_64-softmmu.mak |    1 +
 hw/Makefile.objs                   |    1 +
 hw/arm/virt.c                      |   24 +
 hw/i386/Makefile.objs              |    2 +-
 hw/i386/pc.c                       |   56 +-
 hw/i386/pc_piix.c                  |    2 +-
 hw/i386/pc_q35.c                   |    2 +-
 hw/i386/smbios.c                   | 1102 ------------------------------------
 hw/smbios/Makefile.objs            |    1 +
 hw/smbios/smbios.c                 | 1102 ++++++++++++++++++++++++++++++++++++
 include/hw/arm/virt-acpi-build.h   |    1 +
 include/hw/i386/smbios.h           |  227 --------
 include/hw/smbios/smbios.h         |  237 ++++++++
 tests/bios-tables-test.c           |    2 +-
 vl.c                               |    2 +-
 18 files changed, 1414 insertions(+), 1352 deletions(-)
 delete mode 100644 hw/i386/smbios.c
 create mode 100644 hw/smbios/Makefile.objs
 create mode 100644 hw/smbios/smbios.c
 delete mode 100644 include/hw/i386/smbios.h
 create mode 100644 include/hw/smbios/smbios.h
Acked-by on the v1 series
#10 lore raw
In reply to Wei Huang
Quoted 7 lines · On Tue, 14 Jul 2015 Wei Huang <[email protected]> wrote:

SMBIOS tables present userful system hardware info to management applications, such as DMI tools. Even though SMBIOS was originally developed for Intel x86, it has been extended to both Itanium and ARM (32bit & 64bit). More and more ARM server releases, such as RHEL Server for ARM, start to integrate support for SMBIOS.

Quoted 7 lines

This patchset is intendted to provid SMBIOS tables for ARM mach-virt machine. The SMBIOS tables are created and stored in fw_cfg, awaiting OVMF (AAVMF) to parse/present SMBIOS entry.

NOTE: This is RFC and the patches haven't been fully tested yet. Laszlo is kind enough to offer help on fixing AAVMF to enable support for SMBIOS. Any comments are welcomed for next release.

Since I was the last person to tinker with smbios in a significant way, here goes:

Patch 3/5: in the commit blurb,

           s/architect-independent/architecture-independent/
                                            ^^^

Whole series:

I built and ran it (on pc/q35) and saw no regressions. If you will:

Cheers,
--Gabriel