From patchwork Fri Dec 21 09:03:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Patchwork-Id: 1017414 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43LjV62FCSz9sDN for ; Fri, 21 Dec 2018 20:08:46 +1100 (AEDT) Received: from localhost ([::1]:44358 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gaGnT-0005pg-4q for incoming@patchwork.ozlabs.org; Fri, 21 Dec 2018 04:08:43 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37976) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gaGjb-0002yL-PR for qemu-devel@nongnu.org; Fri, 21 Dec 2018 04:04:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gaGjV-0000Ys-Ib for qemu-devel@nongnu.org; Fri, 21 Dec 2018 04:04:41 -0500 Received: from mx1.redhat.com ([209.132.183.28]:59586) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gaGjT-0000Rt-Jm for qemu-devel@nongnu.org; Fri, 21 Dec 2018 04:04:36 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 35F20AB416 for ; Fri, 21 Dec 2018 09:04:27 +0000 (UTC) Received: from localhost (ovpn-112-51.ams2.redhat.com [10.36.112.51]) by smtp.corp.redhat.com (Postfix) with ESMTP id CC28B17130; Fri, 21 Dec 2018 09:04:23 +0000 (UTC) From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= To: qemu-devel@nongnu.org Date: Fri, 21 Dec 2018 13:03:44 +0400 Message-Id: <20181221090410.27250-3-marcandre.lureau@redhat.com> In-Reply-To: <20181221090410.27250-1-marcandre.lureau@redhat.com> References: <20181221090410.27250-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Fri, 21 Dec 2018 09:04:27 +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 v7 02/28] machines: replace COMPAT define with a static array 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: imammedo@redhat.com, ehabkost@redhat.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Marc-André Lureau Reviewed-by: Cornelia Huck Reviewed-by: Igor Mammedov --- include/hw/boards.h | 10 +- hw/arm/virt.c | 45 +-- hw/i386/pc_piix.c | 563 +++++++++++++++++++++---------------- hw/i386/pc_q35.c | 66 ++++- hw/ppc/spapr.c | 201 ++++++------- hw/s390x/s390-virtio-ccw.c | 219 ++++++++------- 6 files changed, 622 insertions(+), 482 deletions(-) diff --git a/include/hw/boards.h b/include/hw/boards.h index f82f28468b..92aa43a40e 100644 --- a/include/hw/boards.h +++ b/include/hw/boards.h @@ -288,18 +288,14 @@ struct MachineState { } \ type_init(machine_initfn##_register_types) -#define SET_MACHINE_COMPAT(m, COMPAT) \ +#define SET_MACHINE_COMPAT(m, compat) \ do { \ int i; \ - static GlobalProperty props[] = { \ - COMPAT \ - { /* end of list */ } \ - }; \ if (!m->compat_props) { \ m->compat_props = g_array_new(false, false, sizeof(void *)); \ } \ - for (i = 0; props[i].driver != NULL; i++) { \ - GlobalProperty *prop = &props[i]; \ + for (i = 0; i < G_N_ELEMENTS(compat); i++) { \ + GlobalProperty *prop = &compat[i]; \ g_array_append_val(m->compat_props, prop); \ } \ } while (0) diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 5b678237b7..f3155efa07 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -1872,84 +1872,91 @@ static void virt_machine_4_0_options(MachineClass *mc) } DEFINE_VIRT_MACHINE_AS_LATEST(4, 0) -#define VIRT_COMPAT_3_1 \ +static GlobalProperty virt_compat_3_1[] = { HW_COMPAT_3_1 +}; static void virt_machine_3_1_options(MachineClass *mc) { virt_machine_4_0_options(mc); - SET_MACHINE_COMPAT(mc, VIRT_COMPAT_3_1); + SET_MACHINE_COMPAT(mc, virt_compat_3_1); } DEFINE_VIRT_MACHINE(3, 1) -#define VIRT_COMPAT_3_0 \ +static GlobalProperty virt_compat_3_0[] = { HW_COMPAT_3_0 +}; static void virt_machine_3_0_options(MachineClass *mc) { virt_machine_3_1_options(mc); - SET_MACHINE_COMPAT(mc, VIRT_COMPAT_3_0); + SET_MACHINE_COMPAT(mc, virt_compat_3_0); } DEFINE_VIRT_MACHINE(3, 0) -#define VIRT_COMPAT_2_12 \ +static GlobalProperty virt_compat_2_12[] = { HW_COMPAT_2_12 +}; static void virt_machine_2_12_options(MachineClass *mc) { VirtMachineClass *vmc = VIRT_MACHINE_CLASS(OBJECT_CLASS(mc)); virt_machine_3_0_options(mc); - SET_MACHINE_COMPAT(mc, VIRT_COMPAT_2_12); + SET_MACHINE_COMPAT(mc, virt_compat_2_12); vmc->no_highmem_ecam = true; mc->max_cpus = 255; } DEFINE_VIRT_MACHINE(2, 12) -#define VIRT_COMPAT_2_11 \ +static GlobalProperty virt_compat_2_11[] = { HW_COMPAT_2_11 +}; static void virt_machine_2_11_options(MachineClass *mc) { VirtMachineClass *vmc = VIRT_MACHINE_CLASS(OBJECT_CLASS(mc)); virt_machine_2_12_options(mc); - SET_MACHINE_COMPAT(mc, VIRT_COMPAT_2_11); + SET_MACHINE_COMPAT(mc, virt_compat_2_11); vmc->smbios_old_sys_ver = true; } DEFINE_VIRT_MACHINE(2, 11) -#define VIRT_COMPAT_2_10 \ +static GlobalProperty virt_compat_2_10[] = { HW_COMPAT_2_10 +}; static void virt_machine_2_10_options(MachineClass *mc) { virt_machine_2_11_options(mc); - SET_MACHINE_COMPAT(mc, VIRT_COMPAT_2_10); + SET_MACHINE_COMPAT(mc, virt_compat_2_10); /* before 2.11 we never faulted accesses to bad addresses */ mc->ignore_memory_transaction_failures = true; } DEFINE_VIRT_MACHINE(2, 10) -#define VIRT_COMPAT_2_9 \ +static GlobalProperty virt_compat_2_9[] = { HW_COMPAT_2_9 +}; static void virt_machine_2_9_options(MachineClass *mc) { virt_machine_2_10_options(mc); - SET_MACHINE_COMPAT(mc, VIRT_COMPAT_2_9); + SET_MACHINE_COMPAT(mc, virt_compat_2_9); } DEFINE_VIRT_MACHINE(2, 9) -#define VIRT_COMPAT_2_8 \ +static GlobalProperty virt_compat_2_8[] = { HW_COMPAT_2_8 +}; static void virt_machine_2_8_options(MachineClass *mc) { VirtMachineClass *vmc = VIRT_MACHINE_CLASS(OBJECT_CLASS(mc)); virt_machine_2_9_options(mc); - SET_MACHINE_COMPAT(mc, VIRT_COMPAT_2_8); + SET_MACHINE_COMPAT(mc, virt_compat_2_8); /* For 2.8 and earlier we falsely claimed in the DT that * our timers were edge-triggered, not level-triggered. */ @@ -1957,15 +1964,16 @@ static void virt_machine_2_8_options(MachineClass *mc) } DEFINE_VIRT_MACHINE(2, 8) -#define VIRT_COMPAT_2_7 \ +static GlobalProperty virt_compat_2_7[] = { HW_COMPAT_2_7 +}; static void virt_machine_2_7_options(MachineClass *mc) { VirtMachineClass *vmc = VIRT_MACHINE_CLASS(OBJECT_CLASS(mc)); virt_machine_2_8_options(mc); - SET_MACHINE_COMPAT(mc, VIRT_COMPAT_2_7); + SET_MACHINE_COMPAT(mc, virt_compat_2_7); /* ITS was introduced with 2.8 */ vmc->no_its = true; /* Stick with 1K pages for migration compatibility */ @@ -1973,15 +1981,16 @@ static void virt_machine_2_7_options(MachineClass *mc) } DEFINE_VIRT_MACHINE(2, 7) -#define VIRT_COMPAT_2_6 \ +static GlobalProperty virt_compat_2_6[] = { HW_COMPAT_2_6 +}; static void virt_machine_2_6_options(MachineClass *mc) { VirtMachineClass *vmc = VIRT_MACHINE_CLASS(OBJECT_CLASS(mc)); virt_machine_2_7_options(mc); - SET_MACHINE_COMPAT(mc, VIRT_COMPAT_2_6); + SET_MACHINE_COMPAT(mc, virt_compat_2_6); vmc->disallow_affinity_adjustment = true; /* Disable PMU for 2.6 as PMU support was first introduced in 2.7 */ vmc->no_pmu = true; diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index 6981cfa740..8ade7318e0 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -438,83 +438,117 @@ static void pc_i440fx_4_0_machine_options(MachineClass *m) DEFINE_I440FX_MACHINE(v4_0, "pc-i440fx-4.0", NULL, pc_i440fx_4_0_machine_options); +static GlobalProperty pc_compat_3_1[] = { + PC_COMPAT_3_1 +}; + static void pc_i440fx_3_1_machine_options(MachineClass *m) { pc_i440fx_4_0_machine_options(m); m->is_default = 0; m->alias = NULL; - SET_MACHINE_COMPAT(m, PC_COMPAT_3_1); + SET_MACHINE_COMPAT(m, pc_compat_3_1); } DEFINE_I440FX_MACHINE(v3_1, "pc-i440fx-3.1", NULL, pc_i440fx_3_1_machine_options); +static GlobalProperty pc_compat_3_0[] = { + PC_COMPAT_3_0 +}; + static void pc_i440fx_3_0_machine_options(MachineClass *m) { pc_i440fx_3_1_machine_options(m); - SET_MACHINE_COMPAT(m, PC_COMPAT_3_0); + SET_MACHINE_COMPAT(m, pc_compat_3_0); } DEFINE_I440FX_MACHINE(v3_0, "pc-i440fx-3.0", NULL, pc_i440fx_3_0_machine_options); +static GlobalProperty pc_compat_2_12[] = { + PC_COMPAT_2_12 +}; + static void pc_i440fx_2_12_machine_options(MachineClass *m) { pc_i440fx_3_0_machine_options(m); - SET_MACHINE_COMPAT(m, PC_COMPAT_2_12); + SET_MACHINE_COMPAT(m, pc_compat_2_12); } DEFINE_I440FX_MACHINE(v2_12, "pc-i440fx-2.12", NULL, pc_i440fx_2_12_machine_options); +static GlobalProperty pc_compat_2_11[] = { + PC_COMPAT_2_11 +}; + static void pc_i440fx_2_11_machine_options(MachineClass *m) { pc_i440fx_2_12_machine_options(m); - SET_MACHINE_COMPAT(m, PC_COMPAT_2_11); + SET_MACHINE_COMPAT(m, pc_compat_2_11); } DEFINE_I440FX_MACHINE(v2_11, "pc-i440fx-2.11", NULL, pc_i440fx_2_11_machine_options); +static GlobalProperty pc_compat_2_10[] = { + PC_COMPAT_2_10 +}; + static void pc_i440fx_2_10_machine_options(MachineClass *m) { pc_i440fx_2_11_machine_options(m); - SET_MACHINE_COMPAT(m, PC_COMPAT_2_10); + SET_MACHINE_COMPAT(m, pc_compat_2_10); m->auto_enable_numa_with_memhp = false; } DEFINE_I440FX_MACHINE(v2_10, "pc-i440fx-2.10", NULL, pc_i440fx_2_10_machine_options); +static GlobalProperty pc_compat_2_9[] = { + PC_COMPAT_2_9 +}; + static void pc_i440fx_2_9_machine_options(MachineClass *m) { pc_i440fx_2_10_machine_options(m); - SET_MACHINE_COMPAT(m, PC_COMPAT_2_9); + SET_MACHINE_COMPAT(m, pc_compat_2_9); m->numa_auto_assign_ram = numa_legacy_auto_assign_ram; } DEFINE_I440FX_MACHINE(v2_9, "pc-i440fx-2.9", NULL, pc_i440fx_2_9_machine_options); +static GlobalProperty pc_compat_2_8[] = { + PC_COMPAT_2_8 +}; + static void pc_i440fx_2_8_machine_options(MachineClass *m) { pc_i440fx_2_9_machine_options(m); - SET_MACHINE_COMPAT(m, PC_COMPAT_2_8); + SET_MACHINE_COMPAT(m, pc_compat_2_8); } DEFINE_I440FX_MACHINE(v2_8, "pc-i440fx-2.8", NULL, pc_i440fx_2_8_machine_options); +static GlobalProperty pc_compat_2_7[] = { + PC_COMPAT_2_7 +}; static void pc_i440fx_2_7_machine_options(MachineClass *m) { pc_i440fx_2_8_machine_options(m); - SET_MACHINE_COMPAT(m, PC_COMPAT_2_7); + SET_MACHINE_COMPAT(m, pc_compat_2_7); } DEFINE_I440FX_MACHINE(v2_7, "pc-i440fx-2.7", NULL, pc_i440fx_2_7_machine_options); +static GlobalProperty pc_compat_2_6[] = { + PC_COMPAT_2_6 +}; static void pc_i440fx_2_6_machine_options(MachineClass *m) { @@ -522,12 +556,15 @@ static void pc_i440fx_2_6_machine_options(MachineClass *m) pc_i440fx_2_7_machine_options(m); pcmc->legacy_cpu_hotplug = true; pcmc->linuxboot_dma_enabled = false; - SET_MACHINE_COMPAT(m, PC_COMPAT_2_6); + SET_MACHINE_COMPAT(m, pc_compat_2_6); } DEFINE_I440FX_MACHINE(v2_6, "pc-i440fx-2.6", NULL, pc_i440fx_2_6_machine_options); +static GlobalProperty pc_compat_2_5[] = { + PC_COMPAT_2_5 +}; static void pc_i440fx_2_5_machine_options(MachineClass *m) { @@ -535,12 +572,15 @@ static void pc_i440fx_2_5_machine_options(MachineClass *m) pc_i440fx_2_6_machine_options(m); pcmc->save_tsc_khz = false; m->legacy_fw_cfg_order = 1; - SET_MACHINE_COMPAT(m, PC_COMPAT_2_5); + SET_MACHINE_COMPAT(m, pc_compat_2_5); } DEFINE_I440FX_MACHINE(v2_5, "pc-i440fx-2.5", NULL, pc_i440fx_2_5_machine_options); +static GlobalProperty pc_compat_2_4[] = { + PC_COMPAT_2_4 +}; static void pc_i440fx_2_4_machine_options(MachineClass *m) { @@ -548,23 +588,29 @@ static void pc_i440fx_2_4_machine_options(MachineClass *m) pc_i440fx_2_5_machine_options(m); m->hw_version = "2.4.0"; pcmc->broken_reserved_end = true; - SET_MACHINE_COMPAT(m, PC_COMPAT_2_4); + SET_MACHINE_COMPAT(m, pc_compat_2_4); } DEFINE_I440FX_MACHINE(v2_4, "pc-i440fx-2.4", NULL, pc_i440fx_2_4_machine_options) +static GlobalProperty pc_compatp_2_3[] = { + PC_COMPAT_2_3 +}; static void pc_i440fx_2_3_machine_options(MachineClass *m) { pc_i440fx_2_4_machine_options(m); m->hw_version = "2.3.0"; - SET_MACHINE_COMPAT(m, PC_COMPAT_2_3); + SET_MACHINE_COMPAT(m, pc_compatp_2_3); } DEFINE_I440FX_MACHINE(v2_3, "pc-i440fx-2.3", pc_compat_2_3, pc_i440fx_2_3_machine_options); +static GlobalProperty pc_compatp_2_2[] = { + PC_COMPAT_2_2 +}; static void pc_i440fx_2_2_machine_options(MachineClass *m) { @@ -572,13 +618,16 @@ static void pc_i440fx_2_2_machine_options(MachineClass *m) pc_i440fx_2_3_machine_options(m); m->hw_version = "2.2.0"; m->default_machine_opts = "firmware=bios-256k.bin,suppress-vmdesc=on"; - SET_MACHINE_COMPAT(m, PC_COMPAT_2_2); + SET_MACHINE_COMPAT(m, pc_compatp_2_2); pcmc->rsdp_in_ram = false; } DEFINE_I440FX_MACHINE(v2_2, "pc-i440fx-2.2", pc_compat_2_2, pc_i440fx_2_2_machine_options); +static GlobalProperty pc_compatp_2_1[] = { + PC_COMPAT_2_1 +}; static void pc_i440fx_2_1_machine_options(MachineClass *m) { @@ -586,7 +635,7 @@ static void pc_i440fx_2_1_machine_options(MachineClass *m) pc_i440fx_2_2_machine_options(m); m->hw_version = "2.1.0"; m->default_display = NULL; - SET_MACHINE_COMPAT(m, PC_COMPAT_2_1); + SET_MACHINE_COMPAT(m, pc_compatp_2_1); pcmc->smbios_uuid_encoded = false; pcmc->enforce_aligned_dimm = false; } @@ -594,14 +643,16 @@ static void pc_i440fx_2_1_machine_options(MachineClass *m) DEFINE_I440FX_MACHINE(v2_1, "pc-i440fx-2.1", pc_compat_2_1, pc_i440fx_2_1_machine_options); - +static GlobalProperty pc_compatp_2_0[] = { + PC_COMPAT_2_0 +}; static void pc_i440fx_2_0_machine_options(MachineClass *m) { PCMachineClass *pcmc = PC_MACHINE_CLASS(m); pc_i440fx_2_1_machine_options(m); m->hw_version = "2.0.0"; - SET_MACHINE_COMPAT(m, PC_COMPAT_2_0); + SET_MACHINE_COMPAT(m, pc_compatp_2_0); pcmc->smbios_legacy_mode = true; pcmc->has_reserved_memory = false; /* This value depends on the actual DSDT and SSDT compiled into @@ -627,6 +678,9 @@ static void pc_i440fx_2_0_machine_options(MachineClass *m) DEFINE_I440FX_MACHINE(v2_0, "pc-i440fx-2.0", pc_compat_2_0, pc_i440fx_2_0_machine_options); +static GlobalProperty pc_compatp_1_7[] = { + PC_COMPAT_1_7 +}; static void pc_i440fx_1_7_machine_options(MachineClass *m) { @@ -635,7 +689,7 @@ static void pc_i440fx_1_7_machine_options(MachineClass *m) m->hw_version = "1.7.0"; m->default_machine_opts = NULL; m->option_rom_has_mr = true; - SET_MACHINE_COMPAT(m, PC_COMPAT_1_7); + SET_MACHINE_COMPAT(m, pc_compatp_1_7); pcmc->smbios_defaults = false; pcmc->gigabyte_align = false; pcmc->legacy_acpi_table_size = 6414; @@ -644,6 +698,9 @@ static void pc_i440fx_1_7_machine_options(MachineClass *m) DEFINE_I440FX_MACHINE(v1_7, "pc-i440fx-1.7", pc_compat_1_7, pc_i440fx_1_7_machine_options); +static GlobalProperty pc_compatp_1_6[] = { + PC_COMPAT_1_6 +}; static void pc_i440fx_1_6_machine_options(MachineClass *m) { @@ -651,368 +708,378 @@ static void pc_i440fx_1_6_machine_options(MachineClass *m) pc_i440fx_1_7_machine_options(m); m->hw_version = "1.6.0"; m->rom_file_has_mr = false; - SET_MACHINE_COMPAT(m, PC_COMPAT_1_6); + SET_MACHINE_COMPAT(m, pc_compatp_1_6); pcmc->has_acpi_build = false; } DEFINE_I440FX_MACHINE(v1_6, "pc-i440fx-1.6", pc_compat_1_6, pc_i440fx_1_6_machine_options); +static GlobalProperty pc_compatp_1_5[] = { + PC_COMPAT_1_5 +}; static void pc_i440fx_1_5_machine_options(MachineClass *m) { pc_i440fx_1_6_machine_options(m); m->hw_version = "1.5.0"; - SET_MACHINE_COMPAT(m, PC_COMPAT_1_5); + SET_MACHINE_COMPAT(m, pc_compatp_1_5); } DEFINE_I440FX_MACHINE(v1_5, "pc-i440fx-1.5", pc_compat_1_5, pc_i440fx_1_5_machine_options); +static GlobalProperty pc_compatp_1_4[] = { + PC_COMPAT_1_4 +}; static void pc_i440fx_1_4_machine_options(MachineClass *m) { pc_i440fx_1_5_machine_options(m); m->hw_version = "1.4.0"; m->hot_add_cpu = NULL; - SET_MACHINE_COMPAT(m, PC_COMPAT_1_4); + SET_MACHINE_COMPAT(m, pc_compatp_1_4); } DEFINE_I440FX_MACHINE(v1_4, "pc-i440fx-1.4", pc_compat_1_4, pc_i440fx_1_4_machine_options); - -#define PC_COMPAT_1_3 \ - PC_CPU_MODEL_IDS("1.3.0") \ - {\ - .driver = "usb-tablet",\ - .property = "usb_version",\ - .value = stringify(1),\ - },{\ - .driver = "virtio-net-pci",\ - .property = "ctrl_mac_addr",\ - .value = "off", \ - },{ \ - .driver = "virtio-net-pci", \ - .property = "mq", \ - .value = "off", \ - }, {\ - .driver = "e1000",\ - .property = "autonegotiation",\ - .value = "off",\ - }, - +static GlobalProperty pc_compatp_1_3[] = { + PC_CPU_MODEL_IDS("1.3.0") + { + .driver = "usb-tablet", + .property = "usb_version", + .value = stringify(1), + },{ + .driver = "virtio-net-pci", + .property = "ctrl_mac_addr", + .value = "off", + },{ + .driver = "virtio-net-pci", + .property = "mq", + .value = "off", + }, { + .driver = "e1000", + .property = "autonegotiation", + .value = "off", + }, +}; static void pc_i440fx_1_3_machine_options(MachineClass *m) { pc_i440fx_1_4_machine_options(m); m->hw_version = "1.3.0"; - SET_MACHINE_COMPAT(m, PC_COMPAT_1_3); + SET_MACHINE_COMPAT(m, pc_compatp_1_3); } DEFINE_I440FX_MACHINE(v1_3, "pc-1.3", pc_compat_1_3, pc_i440fx_1_3_machine_options); -#define PC_COMPAT_1_2 \ - PC_CPU_MODEL_IDS("1.2.0") \ - {\ - .driver = "nec-usb-xhci",\ - .property = "msi",\ - .value = "off",\ - },{\ - .driver = "nec-usb-xhci",\ - .property = "msix",\ - .value = "off",\ - },{\ - .driver = "ivshmem",\ - .property = "use64",\ - .value = "0",\ - },{\ - .driver = "qxl",\ - .property = "revision",\ - .value = stringify(3),\ - },{\ - .driver = "qxl-vga",\ - .property = "revision",\ - .value = stringify(3),\ - },{\ - .driver = "VGA",\ - .property = "mmio",\ - .value = "off",\ - }, +static GlobalProperty pc_compatp_1_2[] = { + PC_CPU_MODEL_IDS("1.2.0") + { + .driver = "nec-usb-xhci", + .property = "msi", + .value = "off", + },{ + .driver = "nec-usb-xhci", + .property = "msix", + .value = "off", + },{ + .driver = "ivshmem", + .property = "use64", + .value = "0", + },{ + .driver = "qxl", + .property = "revision", + .value = stringify(3), + },{ + .driver = "qxl-vga", + .property = "revision", + .value = stringify(3), + },{ + .driver = "VGA", + .property = "mmio", + .value = "off", + }, +}; static void pc_i440fx_1_2_machine_options(MachineClass *m) { pc_i440fx_1_3_machine_options(m); m->hw_version = "1.2.0"; - SET_MACHINE_COMPAT(m, PC_COMPAT_1_2); + SET_MACHINE_COMPAT(m, pc_compatp_1_2); } DEFINE_I440FX_MACHINE(v1_2, "pc-1.2", pc_compat_1_2, pc_i440fx_1_2_machine_options); -#define PC_COMPAT_1_1 \ - PC_CPU_MODEL_IDS("1.1.0") \ - {\ - .driver = "virtio-scsi-pci",\ - .property = "hotplug",\ - .value = "off",\ - },{\ - .driver = "virtio-scsi-pci",\ - .property = "param_change",\ - .value = "off",\ - },{\ - .driver = "VGA",\ - .property = "vgamem_mb",\ - .value = stringify(8),\ - },{\ - .driver = "vmware-svga",\ - .property = "vgamem_mb",\ - .value = stringify(8),\ - },{\ - .driver = "qxl-vga",\ - .property = "vgamem_mb",\ - .value = stringify(8),\ - },{\ - .driver = "qxl",\ - .property = "vgamem_mb",\ - .value = stringify(8),\ - },{\ - .driver = "virtio-blk-pci",\ - .property = "config-wce",\ - .value = "off",\ - }, +static GlobalProperty pc_compatp_1_1[] = { + PC_CPU_MODEL_IDS("1.1.0") + { + .driver = "virtio-scsi-pci", + .property = "hotplug", + .value = "off", + },{ + .driver = "virtio-scsi-pci", + .property = "param_change", + .value = "off", + },{ + .driver = "VGA", + .property = "vgamem_mb", + .value = stringify(8), + },{ + .driver = "vmware-svga", + .property = "vgamem_mb", + .value = stringify(8), + },{ + .driver = "qxl-vga", + .property = "vgamem_mb", + .value = stringify(8), + },{ + .driver = "qxl", + .property = "vgamem_mb", + .value = stringify(8), + },{ + .driver = "virtio-blk-pci", + .property = "config-wce", + .value = "off", + }, +}; static void pc_i440fx_1_1_machine_options(MachineClass *m) { pc_i440fx_1_2_machine_options(m); m->hw_version = "1.1.0"; - SET_MACHINE_COMPAT(m, PC_COMPAT_1_1); + SET_MACHINE_COMPAT(m, pc_compatp_1_1); } DEFINE_I440FX_MACHINE(v1_1, "pc-1.1", pc_compat_1_2, pc_i440fx_1_1_machine_options); - -#define PC_COMPAT_1_0 \ - PC_CPU_MODEL_IDS("1.0") \ - {\ - .driver = TYPE_ISA_FDC,\ - .property = "check_media_rate",\ - .value = "off",\ - }, {\ - .driver = "virtio-balloon-pci",\ - .property = "class",\ - .value = stringify(PCI_CLASS_MEMORY_RAM),\ - },{\ - .driver = "apic-common",\ - .property = "vapic",\ - .value = "off",\ - },{\ - .driver = TYPE_USB_DEVICE,\ - .property = "full-path",\ - .value = "no",\ - }, +static GlobalProperty pc_compatp_1_0[] = { + PC_CPU_MODEL_IDS("1.0") + { + .driver = TYPE_ISA_FDC, + .property = "check_media_rate", + .value = "off", + },{ + .driver = "virtio-balloon-pci", + .property = "class", + .value = stringify(PCI_CLASS_MEMORY_RAM), + },{ + .driver = "apic-common", + .property = "vapic", + .value = "off", + },{ + .driver = TYPE_USB_DEVICE, + .property = "full-path", + .value = "no", + }, +}; static void pc_i440fx_1_0_machine_options(MachineClass *m) { pc_i440fx_1_1_machine_options(m); m->hw_version = "1.0"; - SET_MACHINE_COMPAT(m, PC_COMPAT_1_0); + SET_MACHINE_COMPAT(m, pc_compatp_1_0); } DEFINE_I440FX_MACHINE(v1_0, "pc-1.0", pc_compat_1_2, pc_i440fx_1_0_machine_options); -#define PC_COMPAT_0_15 \ - PC_CPU_MODEL_IDS("0.15") +static GlobalProperty pc_compatp_0_15[] = { + PC_CPU_MODEL_IDS("0.15") +}; static void pc_i440fx_0_15_machine_options(MachineClass *m) { pc_i440fx_1_0_machine_options(m); m->hw_version = "0.15"; - SET_MACHINE_COMPAT(m, PC_COMPAT_0_15); + SET_MACHINE_COMPAT(m, pc_compatp_0_15); } DEFINE_I440FX_MACHINE(v0_15, "pc-0.15", pc_compat_1_2, pc_i440fx_0_15_machine_options); -#define PC_COMPAT_0_14 \ - PC_CPU_MODEL_IDS("0.14") \ - {\ - .driver = "virtio-blk-pci",\ - .property = "event_idx",\ - .value = "off",\ - },{\ - .driver = "virtio-serial-pci",\ - .property = "event_idx",\ - .value = "off",\ - },{\ - .driver = "virtio-net-pci",\ - .property = "event_idx",\ - .value = "off",\ - },{\ - .driver = "virtio-balloon-pci",\ - .property = "event_idx",\ - .value = "off",\ - },{\ - .driver = "qxl",\ - .property = "revision",\ - .value = stringify(2),\ - },{\ - .driver = "qxl-vga",\ - .property = "revision",\ - .value = stringify(2),\ - }, +static GlobalProperty pc_compatp_0_14[] = { + PC_CPU_MODEL_IDS("0.14") + { + .driver = "virtio-blk-pci", + .property = "event_idx", + .value = "off", + },{ + .driver = "virtio-serial-pci", + .property = "event_idx", + .value = "off", + },{ + .driver = "virtio-net-pci", + .property = "event_idx", + .value = "off", + },{ + .driver = "virtio-balloon-pci", + .property = "event_idx", + .value = "off", + },{ + .driver = "qxl", + .property = "revision", + .value = stringify(2), + },{ + .driver = "qxl-vga", + .property = "revision", + .value = stringify(2), + }, +}; static void pc_i440fx_0_14_machine_options(MachineClass *m) { pc_i440fx_0_15_machine_options(m); m->hw_version = "0.14"; - SET_MACHINE_COMPAT(m, PC_COMPAT_0_14); + SET_MACHINE_COMPAT(m, pc_compatp_0_14); } DEFINE_I440FX_MACHINE(v0_14, "pc-0.14", pc_compat_1_2, pc_i440fx_0_14_machine_options); - -#define PC_COMPAT_0_13 \ - PC_CPU_MODEL_IDS("0.13") \ - {\ - .driver = TYPE_PCI_DEVICE,\ - .property = "command_serr_enable",\ - .value = "off",\ - },{\ - .driver = "AC97",\ - .property = "use_broken_id",\ - .value = stringify(1),\ - },{\ - .driver = "virtio-9p-pci",\ - .property = "vectors",\ - .value = stringify(0),\ - },{\ - .driver = "VGA",\ - .property = "rombar",\ - .value = stringify(0),\ - },{\ - .driver = "vmware-svga",\ - .property = "rombar",\ - .value = stringify(0),\ - }, +static GlobalProperty pc_compatp_0_13[] = { + PC_CPU_MODEL_IDS("0.13") + { + .driver = TYPE_PCI_DEVICE, + .property = "command_serr_enable", + .value = "off", + },{ + .driver = "AC97", + .property = "use_broken_id", + .value = stringify(1), + },{ + .driver = "virtio-9p-pci", + .property = "vectors", + .value = stringify(0), + },{ + .driver = "VGA", + .property = "rombar", + .value = stringify(0), + },{ + .driver = "vmware-svga", + .property = "rombar", + .value = stringify(0), + }, +}; static void pc_i440fx_0_13_machine_options(MachineClass *m) { PCMachineClass *pcmc = PC_MACHINE_CLASS(m); pc_i440fx_0_14_machine_options(m); m->hw_version = "0.13"; - SET_MACHINE_COMPAT(m, PC_COMPAT_0_13); + SET_MACHINE_COMPAT(m, pc_compatp_0_13); pcmc->kvmclock_enabled = false; } DEFINE_I440FX_MACHINE(v0_13, "pc-0.13", pc_compat_0_13, pc_i440fx_0_13_machine_options); - -#define PC_COMPAT_0_12 \ - PC_CPU_MODEL_IDS("0.12") \ - {\ - .driver = "virtio-serial-pci",\ - .property = "max_ports",\ - .value = stringify(1),\ - },{\ - .driver = "virtio-serial-pci",\ - .property = "vectors",\ - .value = stringify(0),\ - },{\ - .driver = "usb-mouse",\ - .property = "serial",\ - .value = "1",\ - },{\ - .driver = "usb-tablet",\ - .property = "serial",\ - .value = "1",\ - },{\ - .driver = "usb-kbd",\ - .property = "serial",\ - .value = "1",\ - }, +static GlobalProperty pc_compat_0_12[] = { + PC_CPU_MODEL_IDS("0.12") + { + .driver = "virtio-serial-pci", + .property = "max_ports", + .value = stringify(1), + },{ + .driver = "virtio-serial-pci", + .property = "vectors", + .value = stringify(0), + },{ + .driver = "usb-mouse", + .property = "serial", + .value = "1", + },{ + .driver = "usb-tablet", + .property = "serial", + .value = "1", + },{ + .driver = "usb-kbd", + .property = "serial", + .value = "1", + }, +}; static void pc_i440fx_0_12_machine_options(MachineClass *m) { pc_i440fx_0_13_machine_options(m); m->hw_version = "0.12"; - SET_MACHINE_COMPAT(m, PC_COMPAT_0_12); + SET_MACHINE_COMPAT(m, pc_compat_0_12); } DEFINE_I440FX_MACHINE(v0_12, "pc-0.12", pc_compat_0_13, pc_i440fx_0_12_machine_options); -#define PC_COMPAT_0_11 \ - PC_CPU_MODEL_IDS("0.11") \ - {\ - .driver = "virtio-blk-pci",\ - .property = "vectors",\ - .value = stringify(0),\ - },{\ - .driver = TYPE_PCI_DEVICE,\ - .property = "rombar",\ - .value = stringify(0),\ - },{\ - .driver = "ide-drive",\ - .property = "ver",\ - .value = "0.11",\ - },{\ - .driver = "scsi-disk",\ - .property = "ver",\ - .value = "0.11",\ - }, +static GlobalProperty pc_compat_0_11[] = { + PC_CPU_MODEL_IDS("0.11") + { + .driver = "virtio-blk-pci", + .property = "vectors", + .value = stringify(0), + },{ + .driver = TYPE_PCI_DEVICE, + .property = "rombar", + .value = stringify(0), + },{ + .driver = "ide-drive", + .property = "ver", + .value = "0.11", + },{ + .driver = "scsi-disk", + .property = "ver", + .value = "0.11", + }, +}; static void pc_i440fx_0_11_machine_options(MachineClass *m) { pc_i440fx_0_12_machine_options(m); m->hw_version = "0.11"; m->deprecation_reason = "use a newer machine type instead"; - SET_MACHINE_COMPAT(m, PC_COMPAT_0_11); + SET_MACHINE_COMPAT(m, pc_compat_0_11); } DEFINE_I440FX_MACHINE(v0_11, "pc-0.11", pc_compat_0_13, pc_i440fx_0_11_machine_options); - -#define PC_COMPAT_0_10 \ - PC_CPU_MODEL_IDS("0.10") \ - {\ - .driver = "virtio-blk-pci",\ - .property = "class",\ - .value = stringify(PCI_CLASS_STORAGE_OTHER),\ - },{\ - .driver = "virtio-serial-pci",\ - .property = "class",\ - .value = stringify(PCI_CLASS_DISPLAY_OTHER),\ - },{\ - .driver = "virtio-net-pci",\ - .property = "vectors",\ - .value = stringify(0),\ - },{\ - .driver = "ide-drive",\ - .property = "ver",\ - .value = "0.10",\ - },{\ - .driver = "scsi-disk",\ - .property = "ver",\ - .value = "0.10",\ +static GlobalProperty pc_compat_0_10[] = { + PC_CPU_MODEL_IDS("0.10") + { + .driver = "virtio-blk-pci", + .property = "class", + .value = stringify(PCI_CLASS_STORAGE_OTHER), + },{ + .driver = "virtio-serial-pci", + .property = "class", + .value = stringify(PCI_CLASS_DISPLAY_OTHER), + },{ + .driver = "virtio-net-pci", + .property = "vectors", + .value = stringify(0), + },{ + .driver = "ide-drive", + .property = "ver", + .value = "0.10", + },{ + .driver = "scsi-disk", + .property = "ver", + .value = "0.10", }, +}; static void pc_i440fx_0_10_machine_options(MachineClass *m) { pc_i440fx_0_11_machine_options(m); m->hw_version = "0.10"; - SET_MACHINE_COMPAT(m, PC_COMPAT_0_10); + SET_MACHINE_COMPAT(m, pc_compat_0_10); } DEFINE_I440FX_MACHINE(v0_10, "pc-0.10", pc_compat_0_13, diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c index 58459bdab5..0c02a72e00 100644 --- a/hw/i386/pc_q35.c +++ b/hw/i386/pc_q35.c @@ -320,50 +320,70 @@ static void pc_q35_4_0_machine_options(MachineClass *m) DEFINE_Q35_MACHINE(v4_0, "pc-q35-4.0", NULL, pc_q35_4_0_machine_options); +static GlobalProperty pc_compat_3_1[] = { + PC_COMPAT_3_1 +}; + static void pc_q35_3_1_machine_options(MachineClass *m) { pc_q35_4_0_machine_options(m); m->alias = NULL; - SET_MACHINE_COMPAT(m, PC_COMPAT_3_1); + SET_MACHINE_COMPAT(m, pc_compat_3_1); } DEFINE_Q35_MACHINE(v3_1, "pc-q35-3.1", NULL, pc_q35_3_1_machine_options); +static GlobalProperty pc_compat_3_0[] = { + PC_COMPAT_3_0 +}; + static void pc_q35_3_0_machine_options(MachineClass *m) { pc_q35_3_1_machine_options(m); - SET_MACHINE_COMPAT(m, PC_COMPAT_3_0); + SET_MACHINE_COMPAT(m, pc_compat_3_0); } DEFINE_Q35_MACHINE(v3_0, "pc-q35-3.0", NULL, pc_q35_3_0_machine_options); +static GlobalProperty pc_compat_2_12[] = { + PC_COMPAT_2_12 +}; + static void pc_q35_2_12_machine_options(MachineClass *m) { pc_q35_3_0_machine_options(m); - SET_MACHINE_COMPAT(m, PC_COMPAT_2_12); + SET_MACHINE_COMPAT(m, pc_compat_2_12); } DEFINE_Q35_MACHINE(v2_12, "pc-q35-2.12", NULL, pc_q35_2_12_machine_options); +static GlobalProperty pc_compat_2_11[] = { + PC_COMPAT_2_11 +}; + static void pc_q35_2_11_machine_options(MachineClass *m) { PCMachineClass *pcmc = PC_MACHINE_CLASS(m); pc_q35_2_12_machine_options(m); pcmc->default_nic_model = "e1000"; - SET_MACHINE_COMPAT(m, PC_COMPAT_2_11); + SET_MACHINE_COMPAT(m, pc_compat_2_11); } DEFINE_Q35_MACHINE(v2_11, "pc-q35-2.11", NULL, pc_q35_2_11_machine_options); +static GlobalProperty pc_compat_2_10[] = { + PC_COMPAT_2_10 +}; + static void pc_q35_2_10_machine_options(MachineClass *m) { pc_q35_2_11_machine_options(m); - SET_MACHINE_COMPAT(m, PC_COMPAT_2_10); + SET_MACHINE_COMPAT(m, pc_compat_2_10); m->numa_auto_assign_ram = numa_legacy_auto_assign_ram; m->auto_enable_numa_with_memhp = false; } @@ -371,65 +391,89 @@ static void pc_q35_2_10_machine_options(MachineClass *m) DEFINE_Q35_MACHINE(v2_10, "pc-q35-2.10", NULL, pc_q35_2_10_machine_options); +static GlobalProperty pc_compat_2_9[] = { + PC_COMPAT_2_9 +}; + static void pc_q35_2_9_machine_options(MachineClass *m) { pc_q35_2_10_machine_options(m); - SET_MACHINE_COMPAT(m, PC_COMPAT_2_9); + SET_MACHINE_COMPAT(m, pc_compat_2_9); } DEFINE_Q35_MACHINE(v2_9, "pc-q35-2.9", NULL, pc_q35_2_9_machine_options); +static GlobalProperty pc_compat_2_8[] = { + PC_COMPAT_2_8 +}; + static void pc_q35_2_8_machine_options(MachineClass *m) { pc_q35_2_9_machine_options(m); - SET_MACHINE_COMPAT(m, PC_COMPAT_2_8); + SET_MACHINE_COMPAT(m, pc_compat_2_8); } DEFINE_Q35_MACHINE(v2_8, "pc-q35-2.8", NULL, pc_q35_2_8_machine_options); +static GlobalProperty pc_compat_2_7[] = { + PC_COMPAT_2_7 +}; + static void pc_q35_2_7_machine_options(MachineClass *m) { pc_q35_2_8_machine_options(m); m->max_cpus = 255; - SET_MACHINE_COMPAT(m, PC_COMPAT_2_7); + SET_MACHINE_COMPAT(m, pc_compat_2_7); } DEFINE_Q35_MACHINE(v2_7, "pc-q35-2.7", NULL, pc_q35_2_7_machine_options); +static GlobalProperty pc_compat_2_6[] = { + PC_COMPAT_2_6 +}; + static void pc_q35_2_6_machine_options(MachineClass *m) { PCMachineClass *pcmc = PC_MACHINE_CLASS(m); pc_q35_2_7_machine_options(m); pcmc->legacy_cpu_hotplug = true; pcmc->linuxboot_dma_enabled = false; - SET_MACHINE_COMPAT(m, PC_COMPAT_2_6); + SET_MACHINE_COMPAT(m, pc_compat_2_6); } DEFINE_Q35_MACHINE(v2_6, "pc-q35-2.6", NULL, pc_q35_2_6_machine_options); +static GlobalProperty pc_compat_2_5[] = { + PC_COMPAT_2_5 +}; + static void pc_q35_2_5_machine_options(MachineClass *m) { PCMachineClass *pcmc = PC_MACHINE_CLASS(m); pc_q35_2_6_machine_options(m); pcmc->save_tsc_khz = false; m->legacy_fw_cfg_order = 1; - SET_MACHINE_COMPAT(m, PC_COMPAT_2_5); + SET_MACHINE_COMPAT(m, pc_compat_2_5); } DEFINE_Q35_MACHINE(v2_5, "pc-q35-2.5", NULL, pc_q35_2_5_machine_options); +static GlobalProperty pc_compat_2_4[] = { + PC_COMPAT_2_4 +}; + static void pc_q35_2_4_machine_options(MachineClass *m) { PCMachineClass *pcmc = PC_MACHINE_CLASS(m); pc_q35_2_5_machine_options(m); m->hw_version = "2.4.0"; pcmc->broken_reserved_end = true; - SET_MACHINE_COMPAT(m, PC_COMPAT_2_4); + SET_MACHINE_COMPAT(m, pc_compat_2_4); } DEFINE_Q35_MACHINE(v2_4, "pc-q35-2.4", NULL, diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 55be0f56cb..6145a9909d 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -3963,13 +3963,14 @@ DEFINE_SPAPR_MACHINE(4_0, "4.0", true); /* * pseries-3.1 */ -#define SPAPR_COMPAT_3_1 \ +static GlobalProperty spapr_compat_3_1[] = { HW_COMPAT_3_1 +}; static void spapr_machine_3_1_class_options(MachineClass *mc) { spapr_machine_4_0_class_options(mc); - SET_MACHINE_COMPAT(mc, SPAPR_COMPAT_3_1); + SET_MACHINE_COMPAT(mc, spapr_compat_3_1); } DEFINE_SPAPR_MACHINE(3_1, "3.1", false); @@ -3977,15 +3978,16 @@ DEFINE_SPAPR_MACHINE(3_1, "3.1", false); /* * pseries-3.0 */ -#define SPAPR_COMPAT_3_0 \ +static GlobalProperty spapr_compat_3_0[] = { HW_COMPAT_3_0 +}; static void spapr_machine_3_0_class_options(MachineClass *mc) { sPAPRMachineClass *smc = SPAPR_MACHINE_CLASS(mc); spapr_machine_3_1_class_options(mc); - SET_MACHINE_COMPAT(mc, SPAPR_COMPAT_3_0); + SET_MACHINE_COMPAT(mc, spapr_compat_3_0); smc->legacy_irq_allocation = true; smc->irq = &spapr_irq_xics_legacy; @@ -3996,25 +3998,26 @@ DEFINE_SPAPR_MACHINE(3_0, "3.0", false); /* * pseries-2.12 */ -#define SPAPR_COMPAT_2_12 \ - HW_COMPAT_2_12 \ - { \ - .driver = TYPE_POWERPC_CPU, \ - .property = "pre-3.0-migration", \ - .value = "on", \ - }, \ - { \ - .driver = TYPE_SPAPR_CPU_CORE, \ - .property = "pre-3.0-migration", \ - .value = "on", \ +static GlobalProperty spapr_compat_2_12[] = { + HW_COMPAT_2_12 + { + .driver = TYPE_POWERPC_CPU, + .property = "pre-3.0-migration", + .value = "on", + }, + { + .driver = TYPE_SPAPR_CPU_CORE, + .property = "pre-3.0-migration", + .value = "on", }, +}; static void spapr_machine_2_12_class_options(MachineClass *mc) { sPAPRMachineClass *smc = SPAPR_MACHINE_CLASS(mc); spapr_machine_3_0_class_options(mc); - SET_MACHINE_COMPAT(mc, SPAPR_COMPAT_2_12); + SET_MACHINE_COMPAT(mc, spapr_compat_2_12); /* We depend on kvm_enabled() to choose a default value for the * hpt-max-page-size capability. Of course we can't do it here @@ -4041,8 +4044,9 @@ DEFINE_SPAPR_MACHINE(2_12_sxxm, "2.12-sxxm", false); /* * pseries-2.11 */ -#define SPAPR_COMPAT_2_11 \ +static GlobalProperty spapr_compat_2_11[] = { HW_COMPAT_2_11 +}; static void spapr_machine_2_11_class_options(MachineClass *mc) { @@ -4050,7 +4054,7 @@ static void spapr_machine_2_11_class_options(MachineClass *mc) spapr_machine_2_12_class_options(mc); smc->default_caps.caps[SPAPR_CAP_HTM] = SPAPR_CAP_ON; - SET_MACHINE_COMPAT(mc, SPAPR_COMPAT_2_11); + SET_MACHINE_COMPAT(mc, spapr_compat_2_11); } DEFINE_SPAPR_MACHINE(2_11, "2.11", false); @@ -4058,13 +4062,14 @@ DEFINE_SPAPR_MACHINE(2_11, "2.11", false); /* * pseries-2.10 */ -#define SPAPR_COMPAT_2_10 \ +static GlobalProperty spapr_compat_2_10[] = { HW_COMPAT_2_10 +}; static void spapr_machine_2_10_class_options(MachineClass *mc) { spapr_machine_2_11_class_options(mc); - SET_MACHINE_COMPAT(mc, SPAPR_COMPAT_2_10); + SET_MACHINE_COMPAT(mc, spapr_compat_2_10); } DEFINE_SPAPR_MACHINE(2_10, "2.10", false); @@ -4072,20 +4077,21 @@ DEFINE_SPAPR_MACHINE(2_10, "2.10", false); /* * pseries-2.9 */ -#define SPAPR_COMPAT_2_9 \ - HW_COMPAT_2_9 \ - { \ - .driver = TYPE_POWERPC_CPU, \ - .property = "pre-2.10-migration", \ - .value = "on", \ - }, \ +static GlobalProperty spapr_compat_2_9[] = { + HW_COMPAT_2_9 + { + .driver = TYPE_POWERPC_CPU, + .property = "pre-2.10-migration", + .value = "on", + }, +}; static void spapr_machine_2_9_class_options(MachineClass *mc) { sPAPRMachineClass *smc = SPAPR_MACHINE_CLASS(mc); spapr_machine_2_10_class_options(mc); - SET_MACHINE_COMPAT(mc, SPAPR_COMPAT_2_9); + SET_MACHINE_COMPAT(mc, spapr_compat_2_9); mc->numa_auto_assign_ram = numa_legacy_auto_assign_ram; smc->pre_2_10_has_unused_icps = true; smc->resize_hpt_default = SPAPR_RESIZE_HPT_DISABLED; @@ -4096,18 +4102,19 @@ DEFINE_SPAPR_MACHINE(2_9, "2.9", false); /* * pseries-2.8 */ -#define SPAPR_COMPAT_2_8 \ - HW_COMPAT_2_8 \ - { \ - .driver = TYPE_SPAPR_PCI_HOST_BRIDGE, \ - .property = "pcie-extended-configuration-space", \ - .value = "off", \ +static GlobalProperty spapr_compat_2_8[] = { + HW_COMPAT_2_8 + { + .driver = TYPE_SPAPR_PCI_HOST_BRIDGE, + .property = "pcie-extended-configuration-space", + .value = "off", }, +}; static void spapr_machine_2_8_class_options(MachineClass *mc) { spapr_machine_2_9_class_options(mc); - SET_MACHINE_COMPAT(mc, SPAPR_COMPAT_2_8); + SET_MACHINE_COMPAT(mc, spapr_compat_2_8); mc->numa_mem_align_shift = 23; } @@ -4116,28 +4123,29 @@ DEFINE_SPAPR_MACHINE(2_8, "2.8", false); /* * pseries-2.7 */ -#define SPAPR_COMPAT_2_7 \ - HW_COMPAT_2_7 \ - { \ - .driver = TYPE_SPAPR_PCI_HOST_BRIDGE, \ - .property = "mem_win_size", \ - .value = stringify(SPAPR_PCI_2_7_MMIO_WIN_SIZE),\ - }, \ - { \ - .driver = TYPE_SPAPR_PCI_HOST_BRIDGE, \ - .property = "mem64_win_size", \ - .value = "0", \ - }, \ - { \ - .driver = TYPE_POWERPC_CPU, \ - .property = "pre-2.8-migration", \ - .value = "on", \ - }, \ - { \ - .driver = TYPE_SPAPR_PCI_HOST_BRIDGE, \ - .property = "pre-2.8-migration", \ - .value = "on", \ +static GlobalProperty spapr_compat_2_7[] = { + HW_COMPAT_2_7 + { + .driver = TYPE_SPAPR_PCI_HOST_BRIDGE, + .property = "mem_win_size", + .value = stringify(SPAPR_PCI_2_7_MMIO_WIN_SIZE), + }, + { + .driver = TYPE_SPAPR_PCI_HOST_BRIDGE, + .property = "mem64_win_size", + .value = "0", + }, + { + .driver = TYPE_POWERPC_CPU, + .property = "pre-2.8-migration", + .value = "on", }, + { + .driver = TYPE_SPAPR_PCI_HOST_BRIDGE, + .property = "pre-2.8-migration", + .value = "on", + }, +}; static void phb_placement_2_7(sPAPRMachineState *spapr, uint32_t index, uint64_t *buid, hwaddr *pio, @@ -4195,7 +4203,7 @@ static void spapr_machine_2_7_class_options(MachineClass *mc) spapr_machine_2_8_class_options(mc); mc->default_cpu_type = POWERPC_CPU_TYPE_NAME("power7_v2.3"); mc->default_machine_opts = "modern-hotplug-events=off"; - SET_MACHINE_COMPAT(mc, SPAPR_COMPAT_2_7); + SET_MACHINE_COMPAT(mc, spapr_compat_2_7); smc->phb_placement = phb_placement_2_7; } @@ -4204,19 +4212,20 @@ DEFINE_SPAPR_MACHINE(2_7, "2.7", false); /* * pseries-2.6 */ -#define SPAPR_COMPAT_2_6 \ - HW_COMPAT_2_6 \ - { \ - .driver = TYPE_SPAPR_PCI_HOST_BRIDGE,\ - .property = "ddw",\ - .value = stringify(off),\ +static GlobalProperty spapr_compat_2_6[] = { + HW_COMPAT_2_6 + { + .driver = TYPE_SPAPR_PCI_HOST_BRIDGE, + .property = "ddw", + .value = stringify(off), }, +}; static void spapr_machine_2_6_class_options(MachineClass *mc) { spapr_machine_2_7_class_options(mc); mc->has_hotpluggable_cpus = false; - SET_MACHINE_COMPAT(mc, SPAPR_COMPAT_2_6); + SET_MACHINE_COMPAT(mc, spapr_compat_2_6); } DEFINE_SPAPR_MACHINE(2_6, "2.6", false); @@ -4224,13 +4233,14 @@ DEFINE_SPAPR_MACHINE(2_6, "2.6", false); /* * pseries-2.5 */ -#define SPAPR_COMPAT_2_5 \ - HW_COMPAT_2_5 \ - { \ - .driver = "spapr-vlan", \ - .property = "use-rx-buffer-pools", \ - .value = "off", \ +static GlobalProperty spapr_compat_2_5[] = { + HW_COMPAT_2_5 + { + .driver = "spapr-vlan", + .property = "use-rx-buffer-pools", + .value = "off", }, +}; static void spapr_machine_2_5_class_options(MachineClass *mc) { @@ -4238,7 +4248,7 @@ static void spapr_machine_2_5_class_options(MachineClass *mc) spapr_machine_2_6_class_options(mc); smc->use_ohci_by_default = true; - SET_MACHINE_COMPAT(mc, SPAPR_COMPAT_2_5); + SET_MACHINE_COMPAT(mc, spapr_compat_2_5); } DEFINE_SPAPR_MACHINE(2_5, "2.5", false); @@ -4246,8 +4256,9 @@ DEFINE_SPAPR_MACHINE(2_5, "2.5", false); /* * pseries-2.4 */ -#define SPAPR_COMPAT_2_4 \ - HW_COMPAT_2_4 +static GlobalProperty spapr_compat_2_4[] = { + HW_COMPAT_2_4 +}; static void spapr_machine_2_4_class_options(MachineClass *mc) { @@ -4255,7 +4266,7 @@ static void spapr_machine_2_4_class_options(MachineClass *mc) spapr_machine_2_5_class_options(mc); smc->dr_lmb_enabled = false; - SET_MACHINE_COMPAT(mc, SPAPR_COMPAT_2_4); + SET_MACHINE_COMPAT(mc, spapr_compat_2_4); } DEFINE_SPAPR_MACHINE(2_4, "2.4", false); @@ -4263,37 +4274,38 @@ DEFINE_SPAPR_MACHINE(2_4, "2.4", false); /* * pseries-2.3 */ -#define SPAPR_COMPAT_2_3 \ - HW_COMPAT_2_3 \ - {\ - .driver = "spapr-pci-host-bridge",\ - .property = "dynamic-reconfiguration",\ - .value = "off",\ - }, +static GlobalProperty spapr_compat_2_3[] = { + HW_COMPAT_2_3 + { + .driver = "spapr-pci-host-bridge", + .property = "dynamic-reconfiguration", + .value = "off", + }, +}; static void spapr_machine_2_3_class_options(MachineClass *mc) { spapr_machine_2_4_class_options(mc); - SET_MACHINE_COMPAT(mc, SPAPR_COMPAT_2_3); + SET_MACHINE_COMPAT(mc, spapr_compat_2_3); } DEFINE_SPAPR_MACHINE(2_3, "2.3", false); /* * pseries-2.2 */ - -#define SPAPR_COMPAT_2_2 \ - HW_COMPAT_2_2 \ - {\ - .driver = TYPE_SPAPR_PCI_HOST_BRIDGE,\ - .property = "mem_win_size",\ - .value = "0x20000000",\ - }, +static GlobalProperty spapr_compat_2_2[] = { + HW_COMPAT_2_2 + { + .driver = TYPE_SPAPR_PCI_HOST_BRIDGE, + .property = "mem_win_size", + .value = "0x20000000", + }, +}; static void spapr_machine_2_2_class_options(MachineClass *mc) { spapr_machine_2_3_class_options(mc); - SET_MACHINE_COMPAT(mc, SPAPR_COMPAT_2_2); + SET_MACHINE_COMPAT(mc, spapr_compat_2_2); mc->default_machine_opts = "modern-hotplug-events=off,suppress-vmdesc=on"; } DEFINE_SPAPR_MACHINE(2_2, "2.2", false); @@ -4301,13 +4313,14 @@ DEFINE_SPAPR_MACHINE(2_2, "2.2", false); /* * pseries-2.1 */ -#define SPAPR_COMPAT_2_1 \ - HW_COMPAT_2_1 +static GlobalProperty spapr_compat_2_1[] = { + HW_COMPAT_2_1 +}; static void spapr_machine_2_1_class_options(MachineClass *mc) { spapr_machine_2_2_class_options(mc); - SET_MACHINE_COMPAT(mc, SPAPR_COMPAT_2_1); + SET_MACHINE_COMPAT(mc, spapr_compat_2_1); } DEFINE_SPAPR_MACHINE(2_1, "2.1", false); diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c index fd9d0b0542..882a9796cf 100644 --- a/hw/s390x/s390-virtio-ccw.c +++ b/hw/s390x/s390-virtio-ccw.c @@ -651,99 +651,110 @@ bool css_migration_enabled(void) } \ type_init(ccw_machine_register_##suffix) -#define CCW_COMPAT_3_1 \ - HW_COMPAT_3_1 - -#define CCW_COMPAT_3_0 \ - HW_COMPAT_3_0 - -#define CCW_COMPAT_2_12 \ - HW_COMPAT_2_12 - -#define CCW_COMPAT_2_11 \ - HW_COMPAT_2_11 \ - {\ - .driver = TYPE_SCLP_EVENT_FACILITY,\ - .property = "allow_all_mask_sizes",\ - .value = "off",\ - }, - -#define CCW_COMPAT_2_10 \ - HW_COMPAT_2_10 - -#define CCW_COMPAT_2_9 \ - HW_COMPAT_2_9 \ - {\ - .driver = TYPE_S390_STATTRIB,\ - .property = "migration-enabled",\ - .value = "off",\ - }, - -#define CCW_COMPAT_2_8 \ - HW_COMPAT_2_8 \ - {\ - .driver = TYPE_S390_FLIC_COMMON,\ - .property = "adapter_routes_max_batch",\ - .value = "64",\ - }, - -#define CCW_COMPAT_2_7 \ - HW_COMPAT_2_7 - -#define CCW_COMPAT_2_6 \ - HW_COMPAT_2_6 \ - {\ - .driver = TYPE_S390_IPL,\ - .property = "iplbext_migration",\ - .value = "off",\ - }, {\ - .driver = TYPE_VIRTUAL_CSS_BRIDGE,\ - .property = "css_dev_path",\ - .value = "off",\ - }, - -#define CCW_COMPAT_2_5 \ - HW_COMPAT_2_5 - -#define CCW_COMPAT_2_4 \ - HW_COMPAT_2_4 \ - {\ - .driver = TYPE_S390_SKEYS,\ - .property = "migration-enabled",\ - .value = "off",\ - },{\ - .driver = "virtio-blk-ccw",\ - .property = "max_revision",\ - .value = "0",\ - },{\ - .driver = "virtio-balloon-ccw",\ - .property = "max_revision",\ - .value = "0",\ - },{\ - .driver = "virtio-serial-ccw",\ - .property = "max_revision",\ - .value = "0",\ - },{\ - .driver = "virtio-9p-ccw",\ - .property = "max_revision",\ - .value = "0",\ - },{\ - .driver = "virtio-rng-ccw",\ - .property = "max_revision",\ - .value = "0",\ - },{\ - .driver = "virtio-net-ccw",\ - .property = "max_revision",\ - .value = "0",\ - },{\ - .driver = "virtio-scsi-ccw",\ - .property = "max_revision",\ - .value = "0",\ - },{\ - .driver = "vhost-scsi-ccw",\ - .property = "max_revision",\ - .value = "0",\ - }, +static GlobalProperty ccw_compat_3_1[] = { + HW_COMPAT_3_1 +}; + +static GlobalProperty ccw_compat_3_0[] = { + HW_COMPAT_3_0 +}; + +static GlobalProperty ccw_compat_2_12[] = { + HW_COMPAT_2_12 +}; + +static GlobalProperty ccw_compat_2_11[] = { + HW_COMPAT_2_11 + { + .driver = TYPE_SCLP_EVENT_FACILITY, + .property = "allow_all_mask_sizes", + .value = "off", + }, +}; + +static GlobalProperty ccw_compat_2_10[] = { + HW_COMPAT_2_10 +}; + +static GlobalProperty ccw_compat_2_9[] = { + HW_COMPAT_2_9 + { + .driver = TYPE_S390_STATTRIB, + .property = "migration-enabled", + .value = "off", + }, +}; + +static GlobalProperty ccw_compat_2_8[] = { + HW_COMPAT_2_8 + { + .driver = TYPE_S390_FLIC_COMMON, + .property = "adapter_routes_max_batch", + .value = "64", + }, +}; + +static GlobalProperty ccw_compat_2_7[] = { + HW_COMPAT_2_7 +}; + +static GlobalProperty ccw_compat_2_6[] = { + HW_COMPAT_2_6 + { + .driver = TYPE_S390_IPL, + .property = "iplbext_migration", + .value = "off", + }, { + .driver = TYPE_VIRTUAL_CSS_BRIDGE, + .property = "css_dev_path", + .value = "off", + }, +}; + +static GlobalProperty ccw_compat_2_5[] = { + HW_COMPAT_2_5 +}; + +static GlobalProperty ccw_compat_2_4[] = { + HW_COMPAT_2_4 + { + .driver = TYPE_S390_SKEYS, + .property = "migration-enabled", + .value = "off", + },{ + .driver = "virtio-blk-ccw", + .property = "max_revision", + .value = "0", + },{ + .driver = "virtio-balloon-ccw", + .property = "max_revision", + .value = "0", + },{ + .driver = "virtio-serial-ccw", + .property = "max_revision", + .value = "0", + },{ + .driver = "virtio-9p-ccw", + .property = "max_revision", + .value = "0", + },{ + .driver = "virtio-rng-ccw", + .property = "max_revision", + .value = "0", + },{ + .driver = "virtio-net-ccw", + .property = "max_revision", + .value = "0", + },{ + .driver = "virtio-scsi-ccw", + .property = "max_revision", + .value = "0", + },{ + .driver = "vhost-scsi-ccw", + .property = "max_revision", + .value = "0", + }, +}; static void ccw_machine_4_0_instance_options(MachineState *machine) { @@ -762,7 +773,7 @@ static void ccw_machine_3_1_instance_options(MachineState *machine) static void ccw_machine_3_1_class_options(MachineClass *mc) { ccw_machine_4_0_class_options(mc); - SET_MACHINE_COMPAT(mc, CCW_COMPAT_3_1); + SET_MACHINE_COMPAT(mc, ccw_compat_3_1); } DEFINE_CCW_MACHINE(3_1, "3.1", false); @@ -777,7 +788,7 @@ static void ccw_machine_3_0_class_options(MachineClass *mc) s390mc->hpage_1m_allowed = false; ccw_machine_3_1_class_options(mc); - SET_MACHINE_COMPAT(mc, CCW_COMPAT_3_0); + SET_MACHINE_COMPAT(mc, ccw_compat_3_0); } DEFINE_CCW_MACHINE(3_0, "3.0", false); @@ -791,7 +802,7 @@ static void ccw_machine_2_12_instance_options(MachineState *machine) static void ccw_machine_2_12_class_options(MachineClass *mc) { ccw_machine_3_0_class_options(mc); - SET_MACHINE_COMPAT(mc, CCW_COMPAT_2_12); + SET_MACHINE_COMPAT(mc, ccw_compat_2_12); } DEFINE_CCW_MACHINE(2_12, "2.12", false); @@ -807,7 +818,7 @@ static void ccw_machine_2_11_instance_options(MachineState *machine) static void ccw_machine_2_11_class_options(MachineClass *mc) { ccw_machine_2_12_class_options(mc); - SET_MACHINE_COMPAT(mc, CCW_COMPAT_2_11); + SET_MACHINE_COMPAT(mc, ccw_compat_2_11); } DEFINE_CCW_MACHINE(2_11, "2.11", false); @@ -819,7 +830,7 @@ static void ccw_machine_2_10_instance_options(MachineState *machine) static void ccw_machine_2_10_class_options(MachineClass *mc) { ccw_machine_2_11_class_options(mc); - SET_MACHINE_COMPAT(mc, CCW_COMPAT_2_10); + SET_MACHINE_COMPAT(mc, ccw_compat_2_10); } DEFINE_CCW_MACHINE(2_10, "2.10", false); @@ -838,7 +849,7 @@ static void ccw_machine_2_9_class_options(MachineClass *mc) S390CcwMachineClass *s390mc = S390_MACHINE_CLASS(mc); ccw_machine_2_10_class_options(mc); - SET_MACHINE_COMPAT(mc, CCW_COMPAT_2_9); + SET_MACHINE_COMPAT(mc, ccw_compat_2_9); s390mc->css_migration_enabled = false; } DEFINE_CCW_MACHINE(2_9, "2.9", false); @@ -851,7 +862,7 @@ static void ccw_machine_2_8_instance_options(MachineState *machine) static void ccw_machine_2_8_class_options(MachineClass *mc) { ccw_machine_2_9_class_options(mc); - SET_MACHINE_COMPAT(mc, CCW_COMPAT_2_8); + SET_MACHINE_COMPAT(mc, ccw_compat_2_8); } DEFINE_CCW_MACHINE(2_8, "2.8", false); @@ -866,7 +877,7 @@ static void ccw_machine_2_7_class_options(MachineClass *mc) s390mc->cpu_model_allowed = false; ccw_machine_2_8_class_options(mc); - SET_MACHINE_COMPAT(mc, CCW_COMPAT_2_7); + SET_MACHINE_COMPAT(mc, ccw_compat_2_7); } DEFINE_CCW_MACHINE(2_7, "2.7", false); @@ -881,7 +892,7 @@ static void ccw_machine_2_6_class_options(MachineClass *mc) s390mc->ri_allowed = false; ccw_machine_2_7_class_options(mc); - SET_MACHINE_COMPAT(mc, CCW_COMPAT_2_6); + SET_MACHINE_COMPAT(mc, ccw_compat_2_6); } DEFINE_CCW_MACHINE(2_6, "2.6", false); @@ -893,7 +904,7 @@ static void ccw_machine_2_5_instance_options(MachineState *machine) static void ccw_machine_2_5_class_options(MachineClass *mc) { ccw_machine_2_6_class_options(mc); - SET_MACHINE_COMPAT(mc, CCW_COMPAT_2_5); + SET_MACHINE_COMPAT(mc, ccw_compat_2_5); } DEFINE_CCW_MACHINE(2_5, "2.5", false); @@ -905,7 +916,7 @@ static void ccw_machine_2_4_instance_options(MachineState *machine) static void ccw_machine_2_4_class_options(MachineClass *mc) { ccw_machine_2_5_class_options(mc); - SET_MACHINE_COMPAT(mc, CCW_COMPAT_2_4); + SET_MACHINE_COMPAT(mc, ccw_compat_2_4); } DEFINE_CCW_MACHINE(2_4, "2.4", false);