From nobody Sat Apr 20 09:26:16 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 153116873723937.20155968249969; Mon, 9 Jul 2018 13:38:57 -0700 (PDT) Received: from localhost ([::1]:44269 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fccvg-0001lQ-HQ for importer@patchew.org; Mon, 09 Jul 2018 16:38:40 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50242) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fccum-0001RM-QN for qemu-devel@nongnu.org; Mon, 09 Jul 2018 16:37:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fccuj-0006v5-Ks for qemu-devel@nongnu.org; Mon, 09 Jul 2018 16:37:44 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52222) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fccuj-0006ud-CR for qemu-devel@nongnu.org; Mon, 09 Jul 2018 16:37:41 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4BE493084033; Mon, 9 Jul 2018 20:37:40 +0000 (UTC) Received: from localhost (ovpn-116-12.gru2.redhat.com [10.97.116.12]) by smtp.corp.redhat.com (Postfix) with ESMTP id C74B85D6B4; Mon, 9 Jul 2018 20:37:32 +0000 (UTC) From: Eduardo Habkost To: qemu-devel@nongnu.org, "Michael S. Tsirkin" Date: Mon, 9 Jul 2018 17:37:31 -0300 Message-Id: <20180709203731.19865-1-ehabkost@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Mon, 09 Jul 2018 20:37:40 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-3.0] pc: Use "3.0+" constant as default SMBIOS version X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Wei Huang , Peter Maydell , Andrew Jones , Eduardo Habkost , Igor Mammedov Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Every time we create new PC machine-types in QEMU, the defaults for SMBIOS fields change unnecessarily because the version field defaults to MachineClass::name. This can cause unexpected side-effects, like triggering license reactivation on guest software, or changing the VM memory layout because of BIOS table size changes. Change the SMBIOS version string for pc-*-3.0 to "3.0+" to avoid doing this on every QEMU release, and keep compatible version strings on older machine-types using a new MachineClass::smbios_version field. Signed-off-by: Eduardo Habkost --- I just noticed that we started using mc->name on arm/virt since commit dfadc3bfb458efefb72e13a57b62f138c464a577. Should arm/virt start using "3.0+" too? --- include/hw/i386/pc.h | 3 +++ hw/i386/pc.c | 1 + hw/i386/pc_piix.c | 5 +++-- hw/i386/pc_q35.c | 3 ++- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index 4d99d69681..aea0fcaadb 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -134,6 +134,9 @@ struct PCMachineClass { =20 /* use DMA capable linuxboot option rom */ bool linuxboot_dma_enabled; + + /* Version field for SMBIOS Type 1, Type 2, Type 3, and Type 4 structs= */ + const char *smbios_version; }; =20 #define TYPE_PC_MACHINE "generic-pc-machine" diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 50d5553991..47877e7071 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -2379,6 +2379,7 @@ static void pc_machine_class_init(ObjectClass *oc, vo= id *data) pcmc->acpi_data_size =3D 0x20000 + 0x8000; pcmc->save_tsc_khz =3D true; pcmc->linuxboot_dma_enabled =3D true; + pcmc->smbios_version =3D "3.0+"; assert(!mc->get_hotplug_handler); mc->get_hotplug_handler =3D pc_get_hotpug_handler; mc->cpu_index_to_instance_props =3D pc_cpu_index_to_props; diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index dc09466b3e..f19c8b82d0 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -168,10 +168,9 @@ static void pc_init1(MachineState *machine, pc_guest_info_init(pcms); =20 if (pcmc->smbios_defaults) { - MachineClass *mc =3D MACHINE_GET_CLASS(machine); /* These values are guest ABI, do not change */ smbios_set_defaults("QEMU", "Standard PC (i440FX + PIIX, 1996)", - mc->name, pcmc->smbios_legacy_mode, + pcmc->smbios_version, pcmc->smbios_legacy_mode, pcmc->smbios_uuid_encoded, SMBIOS_ENTRY_POINT_21); } @@ -440,9 +439,11 @@ DEFINE_I440FX_MACHINE(v3_0, "pc-i440fx-3.0", NULL, =20 static void pc_i440fx_2_12_machine_options(MachineClass *m) { + PCMachineClass *pcmc =3D PC_MACHINE_CLASS(m); pc_i440fx_3_0_machine_options(m); m->is_default =3D 0; m->alias =3D NULL; + pcmc->smbios_version =3D m->name; SET_MACHINE_COMPAT(m, PC_COMPAT_2_12); } =20 diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c index 532241e3f8..d6551ed8e9 100644 --- a/hw/i386/pc_q35.c +++ b/hw/i386/pc_q35.c @@ -146,7 +146,7 @@ static void pc_q35_init(MachineState *machine) if (pcmc->smbios_defaults) { /* These values are guest ABI, do not change */ smbios_set_defaults("QEMU", "Standard PC (Q35 + ICH9, 2009)", - mc->name, pcmc->smbios_legacy_mode, + pcmc->smbios_version, pcmc->smbios_legacy_mode, pcmc->smbios_uuid_encoded, SMBIOS_ENTRY_POINT_21); } @@ -336,6 +336,7 @@ static void pc_q35_2_11_machine_options(MachineClass *m) =20 pc_q35_2_12_machine_options(m); pcmc->default_nic_model =3D "e1000"; + pcmc->smbios_version =3D m->name; SET_MACHINE_COMPAT(m, PC_COMPAT_2_11); } =20 --=20 2.18.0.rc1.1.g3f1ff2140