smbios: cleanup smbios_get_tables() from legacy handling
authorIgor Mammedov <imammedo@redhat.com>
Thu, 14 Mar 2024 15:22:45 +0000 (16:22 +0100)
committerMichael S. Tsirkin <mst@redhat.com>
Mon, 18 Mar 2024 12:42:45 +0000 (08:42 -0400)
smbios_get_tables() bails out right away if leagacy mode is enabled
and won't generate any SMBIOS tables. At the same time x86 specific
fw_cfg_build_smbios() will genarate legacy tables and then proceed
to preparing temporary mem_array for useless call to
smbios_get_tables() and then discard it.

Drop legacy related check in smbios_get_tables() and return from
fw_cfg_build_smbios() early if legacy tables where built without
proceeding to non legacy part of the function.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Ani Sinha <anisinha@redhat.com>
Tested-by: Fiona Ebner <f.ebner@proxmox.com>
Message-Id: <20240314152302.2324164-5-imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
hw/i386/fw_cfg.c
hw/smbios/smbios.c

index 98a478c276de28468ea61c998f98cefaa4699a63..a635234e6838683d707b5daa4b813dfd4d05d219 100644 (file)
@@ -74,6 +74,7 @@ void fw_cfg_build_smbios(PCMachineState *pcms, FWCfgState *fw_cfg)
     if (smbios_tables) {
         fw_cfg_add_bytes(fw_cfg, FW_CFG_SMBIOS_ENTRIES,
                          smbios_tables, smbios_tables_len);
+        return;
     }
 
     /* build the array of physical mem area from e820 table */
index 949c2d74a18c08d265a4c8e2d39c77b9019d265a..a1741a64a66f2288ad2fe8c4f167cd657d13f6a9 100644 (file)
@@ -1229,12 +1229,6 @@ void smbios_get_tables(MachineState *ms,
 {
     unsigned i, dimm_cnt, offset;
 
-    if (smbios_legacy) {
-        *tables = *anchor = NULL;
-        *tables_len = *anchor_len = 0;
-        return;
-    }
-
     if (!smbios_immutable) {
         smbios_build_type_0_table();
         smbios_build_type_1_table();