From d6a415e7a62ca1bc21f1833f4251f512b2072a93 Mon Sep 17 00:00:00 2001 From: Shaoqin Huang Date: Wed, 22 May 2024 03:23:28 -0400 Subject: hw/arm/virt: Fix Manufacturer and Product Name in emulated SMBIOS mode Status: RHEL-only In vm, when run 'dmidecode -t system', it outputs different Manufacturer and Product Name on x86_64 and aarch64 system. For example: For aarch64 vm: Manufacturer: QEMU Product Name: KVM Virtual Machine For x86_64 vm: Manufacturer: Red Hat Product Name: KVM Fixing this issue by changing Manufacturer to 'Red Hat' and Product Name to 'KVM' on aarch64 platform. Thus the output is aligned on both x86_64 and aarch64 platform. To keep the compatability, this only apply for the RHEL9.6 machine type. For RHEL9.4 machine type, it still keep the old Manufacturer and Product Name. Signed-off-by: Shaoqin Huang --- hw/arm/virt.c | 14 ++++++++++++-- include/hw/arm/virt.h | 1 + 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/hw/arm/virt.c b/hw/arm/virt.c index bf05499a12..c50bff2a6c 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -1711,14 +1711,21 @@ static void virt_build_smbios(VirtMachineState *vms) uint8_t *smbios_tables, *smbios_anchor; size_t smbios_tables_len, smbios_anchor_len; struct smbios_phys_mem_area mem_array; + const char *manufacturer = "QEMU"; const char *product = "QEMU Virtual Machine"; + const char *version = vmc->smbios_old_sys_ver ? "1.0" : mc->name; if (kvm_enabled()) { product = "KVM Virtual Machine"; } - smbios_set_defaults("QEMU", product, - vmc->smbios_old_sys_ver ? "1.0" : mc->name, + if (!vmc->manufacturer_product_compat) { + manufacturer = "Red Hat"; + product = "KVM"; + version = mc->desc; + } + + smbios_set_defaults(manufacturer, product, version, NULL, NULL); /* build the array of physical mem area from base_memmap */ @@ -3587,10 +3594,13 @@ DEFINE_VIRT_MACHINE_AS_LATEST(9, 6, 0) static void virt_rhel_machine_9_4_0_options(MachineClass *mc) { + VirtMachineClass *vmc = VIRT_MACHINE_CLASS(OBJECT_CLASS(mc)); + virt_rhel_machine_9_6_0_options(mc); /* From virt_machine_9_0_options() */ mc->smbios_memory_device_size = 16 * GiB; + vmc->manufacturer_product_compat = true; compat_props_add(mc->compat_props, hw_compat_rhel_9_6, hw_compat_rhel_9_6_len); compat_props_add(mc->compat_props, hw_compat_rhel_9_5, hw_compat_rhel_9_5_len); diff --git a/include/hw/arm/virt.h b/include/hw/arm/virt.h index a4d937ed45..2fc30a7626 100644 --- a/include/hw/arm/virt.h +++ b/include/hw/arm/virt.h @@ -134,6 +134,7 @@ struct VirtMachineClass { bool no_cpu_topology; bool no_tcg_lpa2; bool no_ns_el2_virt_timer_irq; + bool manufacturer_product_compat; }; struct VirtMachineState { -- 2.39.3