From patchwork Fri Dec 21 09:03:55 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: 1017433 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 43Ljpw3Zmbz9sDN for ; Fri, 21 Dec 2018 20:23:20 +1100 (AEDT) Received: from localhost ([::1]:44445 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gaH1a-0001CC-7D for incoming@patchwork.ozlabs.org; Fri, 21 Dec 2018 04:23:18 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38232) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gaGkO-0003ii-9a for qemu-devel@nongnu.org; Fri, 21 Dec 2018 04:05:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gaGkL-0001Rj-66 for qemu-devel@nongnu.org; Fri, 21 Dec 2018 04:05:32 -0500 Received: from mx1.redhat.com ([209.132.183.28]:47706) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gaGkK-0001OI-H4 for qemu-devel@nongnu.org; Fri, 21 Dec 2018 04:05:29 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E074483F3C for ; Fri, 21 Dec 2018 09:05: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 6BF045F7C2; Fri, 21 Dec 2018 09:05:26 +0000 (UTC) From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= To: qemu-devel@nongnu.org Date: Fri, 21 Dec 2018 13:03:55 +0400 Message-Id: <20181221090410.27250-14-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.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Fri, 21 Dec 2018 09:05: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 13/28] compat: replace PC_COMPAT_2_7 & HW_COMPAT_2_7 macros 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" Use static arrays instead. Suggested-by: Eduardo Habkost Signed-off-by: Marc-André Lureau Reviewed-by: Cornelia Huck Reviewed-by: Igor Mammedov --- include/hw/boards.h | 3 +++ include/hw/compat.h | 23 ----------------------- include/hw/i386/pc.h | 34 ++-------------------------------- hw/arm/virt.c | 5 +---- hw/core/machine.c | 25 +++++++++++++++++++++++++ hw/i386/pc.c | 34 ++++++++++++++++++++++++++++++++++ hw/i386/pc_piix.c | 7 ++----- hw/i386/pc_q35.c | 7 ++----- hw/ppc/spapr.c | 2 +- hw/s390x/s390-virtio-ccw.c | 5 +---- 10 files changed, 71 insertions(+), 74 deletions(-) diff --git a/include/hw/boards.h b/include/hw/boards.h index f8aa034d0e..611b34b26a 100644 --- a/include/hw/boards.h +++ b/include/hw/boards.h @@ -308,4 +308,7 @@ extern const size_t hw_compat_2_9_len; extern GlobalProperty hw_compat_2_8[]; extern const size_t hw_compat_2_8_len; +extern GlobalProperty hw_compat_2_7[]; +extern const size_t hw_compat_2_7_len; + #endif diff --git a/include/hw/compat.h b/include/hw/compat.h index 65d6748054..7ceab17401 100644 --- a/include/hw/compat.h +++ b/include/hw/compat.h @@ -1,29 +1,6 @@ #ifndef HW_COMPAT_H #define HW_COMPAT_H -#define HW_COMPAT_2_7 \ - {\ - .driver = "virtio-pci",\ - .property = "page-per-vq",\ - .value = "on",\ - },{\ - .driver = "virtio-serial-device",\ - .property = "emergency-write",\ - .value = "off",\ - },{\ - .driver = "ioapic",\ - .property = "version",\ - .value = "0x11",\ - },{\ - .driver = "intel-iommu",\ - .property = "x-buggy-eim",\ - .value = "true",\ - },{\ - .driver = "virtio-pci",\ - .property = "x-ignore-backend-features",\ - .value = "on",\ - }, - #define HW_COMPAT_2_6 \ {\ .driver = "virtio-mmio",\ diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index 12c47d2506..504fbc79a9 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -315,38 +315,8 @@ extern const size_t pc_compat_2_9_len; extern GlobalProperty pc_compat_2_8[]; extern const size_t pc_compat_2_8_len; -#define PC_COMPAT_2_7 \ - HW_COMPAT_2_7 \ - {\ - .driver = TYPE_X86_CPU,\ - .property = "l3-cache",\ - .value = "off",\ - },\ - {\ - .driver = TYPE_X86_CPU,\ - .property = "full-cpuid-auto-level",\ - .value = "off",\ - },\ - {\ - .driver = "Opteron_G3" "-" TYPE_X86_CPU,\ - .property = "family",\ - .value = "15",\ - },\ - {\ - .driver = "Opteron_G3" "-" TYPE_X86_CPU,\ - .property = "model",\ - .value = "6",\ - },\ - {\ - .driver = "Opteron_G3" "-" TYPE_X86_CPU,\ - .property = "stepping",\ - .value = "1",\ - },\ - {\ - .driver = "isa-pcspk",\ - .property = "migrate",\ - .value = "off",\ - }, +extern GlobalProperty pc_compat_2_7[]; +extern const size_t pc_compat_2_7_len; #define PC_COMPAT_2_6 \ HW_COMPAT_2_6 \ diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 850a02cf43..e01d19e5e1 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -1939,12 +1939,9 @@ DEFINE_VIRT_MACHINE(2, 8) static void virt_machine_2_7_options(MachineClass *mc) { VirtMachineClass *vmc = VIRT_MACHINE_CLASS(OBJECT_CLASS(mc)); - static GlobalProperty compat[] = { - HW_COMPAT_2_7 - }; virt_machine_2_8_options(mc); - compat_props_add(mc->compat_props, compat, G_N_ELEMENTS(compat)); + compat_props_add(mc->compat_props, hw_compat_2_7, hw_compat_2_7_len); /* ITS was introduced with 2.8 */ vmc->no_its = true; /* Stick with 1K pages for migration compatibility */ diff --git a/hw/core/machine.c b/hw/core/machine.c index b3ea5bd777..92f4c71354 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -158,6 +158,31 @@ GlobalProperty hw_compat_2_8[] = { }; const size_t hw_compat_2_8_len = G_N_ELEMENTS(hw_compat_2_8); +GlobalProperty hw_compat_2_7[] = { + { + .driver = "virtio-pci", + .property = "page-per-vq", + .value = "on", + },{ + .driver = "virtio-serial-device", + .property = "emergency-write", + .value = "off", + },{ + .driver = "ioapic", + .property = "version", + .value = "0x11", + },{ + .driver = "intel-iommu", + .property = "x-buggy-eim", + .value = "true", + },{ + .driver = "virtio-pci", + .property = "x-ignore-backend-features", + .value = "on", + }, +}; +const size_t hw_compat_2_7_len = G_N_ELEMENTS(hw_compat_2_7); + static char *machine_get_accel(Object *obj, Error **errp) { MachineState *ms = MACHINE(obj); diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 517ead567c..96c64ccc4f 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -218,6 +218,40 @@ GlobalProperty pc_compat_2_8[] = { }; const size_t pc_compat_2_8_len = G_N_ELEMENTS(pc_compat_2_8); +GlobalProperty pc_compat_2_7[] = { + { + .driver = TYPE_X86_CPU, + .property = "l3-cache", + .value = "off", + }, + { + .driver = TYPE_X86_CPU, + .property = "full-cpuid-auto-level", + .value = "off", + }, + { + .driver = "Opteron_G3" "-" TYPE_X86_CPU, + .property = "family", + .value = "15", + }, + { + .driver = "Opteron_G3" "-" TYPE_X86_CPU, + .property = "model", + .value = "6", + }, + { + .driver = "Opteron_G3" "-" TYPE_X86_CPU, + .property = "stepping", + .value = "1", + }, + { + .driver = "isa-pcspk", + .property = "migrate", + .value = "off", + }, +}; +const size_t pc_compat_2_7_len = G_N_ELEMENTS(pc_compat_2_7); + void gsi_handler(void *opaque, int n, int level) { GSIState *s = opaque; diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index deb5500624..b956b4abe0 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -514,12 +514,9 @@ DEFINE_I440FX_MACHINE(v2_8, "pc-i440fx-2.8", NULL, static void pc_i440fx_2_7_machine_options(MachineClass *m) { - static GlobalProperty compat[] = { - PC_COMPAT_2_7 - }; - pc_i440fx_2_8_machine_options(m); - compat_props_add(m->compat_props, compat, G_N_ELEMENTS(compat)); + compat_props_add(m->compat_props, hw_compat_2_7, hw_compat_2_7_len); + compat_props_add(m->compat_props, pc_compat_2_7, pc_compat_2_7_len); } DEFINE_I440FX_MACHINE(v2_7, "pc-i440fx-2.7", NULL, diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c index 57b46e1ecb..e321f14cb5 100644 --- a/hw/i386/pc_q35.c +++ b/hw/i386/pc_q35.c @@ -398,13 +398,10 @@ DEFINE_Q35_MACHINE(v2_8, "pc-q35-2.8", NULL, static void pc_q35_2_7_machine_options(MachineClass *m) { - static GlobalProperty compat[] = { - PC_COMPAT_2_7 - }; - pc_q35_2_8_machine_options(m); m->max_cpus = 255; - compat_props_add(m->compat_props, compat, G_N_ELEMENTS(compat)); + compat_props_add(m->compat_props, hw_compat_2_7, hw_compat_2_7_len); + compat_props_add(m->compat_props, pc_compat_2_7, pc_compat_2_7_len); } DEFINE_Q35_MACHINE(v2_7, "pc-q35-2.7", NULL, diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index d2e46362fb..445996c0b4 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -4164,7 +4164,6 @@ static void spapr_machine_2_7_class_options(MachineClass *mc) { sPAPRMachineClass *smc = SPAPR_MACHINE_CLASS(mc); static GlobalProperty compat[] = { - HW_COMPAT_2_7 { .driver = TYPE_SPAPR_PCI_HOST_BRIDGE, .property = "mem_win_size", @@ -4190,6 +4189,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"; + compat_props_add(mc->compat_props, hw_compat_2_7, hw_compat_2_7_len); compat_props_add(mc->compat_props, compat, G_N_ELEMENTS(compat)); smc->phb_placement = phb_placement_2_7; } diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c index 22e96ab353..f28feedd4b 100644 --- a/hw/s390x/s390-virtio-ccw.c +++ b/hw/s390x/s390-virtio-ccw.c @@ -795,13 +795,10 @@ static void ccw_machine_2_7_instance_options(MachineState *machine) static void ccw_machine_2_7_class_options(MachineClass *mc) { S390CcwMachineClass *s390mc = S390_MACHINE_CLASS(mc); - static GlobalProperty compat[] = { - HW_COMPAT_2_7 - }; s390mc->cpu_model_allowed = false; ccw_machine_2_8_class_options(mc); - compat_props_add(mc->compat_props, compat, G_N_ELEMENTS(compat)); + compat_props_add(mc->compat_props, hw_compat_2_7, hw_compat_2_7_len); } DEFINE_CCW_MACHINE(2_7, "2.7", false);