From: Igor Mammedov <imammedo@redhat.com>
To: "Marc-André Lureau" <marcandre.lureau@redhat.com>
Cc: qemu-devel@nongnu.org, ehabkost@redhat.com
Subject: Re: [Qemu-devel] [PATCH v7 19/28] compat: replace PC_COMPAT_2_1 & HW_COMPAT_2_1 macros
Date: Thu, 27 Dec 2018 07:54:54 +0100 [thread overview]
Message-ID: <20181227075454.2ad4e77d@Igors-MacBook-Pro.local> (raw)
In-Reply-To: <20181221090410.27250-20-marcandre.lureau@redhat.com>
On Fri, 21 Dec 2018 13:04:01 +0400
Marc-André Lureau <marcandre.lureau@redhat.com> wrote:
> Use static arrays instead. I decided to rename the conflicting
> pc_compat_2_1() function with pc_compat_2_1_fn().
>
> Suggested-by: Eduardo Habkost <ehabkost@redhat.com>
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
> ---
> include/hw/boards.h | 3 +++
> include/hw/compat.h | 31 -------------------------------
> include/hw/i386/pc.h | 17 +++--------------
> hw/core/machine.c | 33 +++++++++++++++++++++++++++++++++
> hw/i386/pc.c | 15 +++++++++++++++
> hw/i386/pc_piix.c | 12 +++++-------
> hw/ppc/spapr.c | 6 +-----
> 7 files changed, 60 insertions(+), 57 deletions(-)
>
> diff --git a/include/hw/boards.h b/include/hw/boards.h
> index 0b0a1f4079..d4aca54968 100644
> --- a/include/hw/boards.h
> +++ b/include/hw/boards.h
> @@ -326,4 +326,7 @@ extern const size_t hw_compat_2_3_len;
> extern GlobalProperty hw_compat_2_2[];
> extern const size_t hw_compat_2_2_len;
>
> +extern GlobalProperty hw_compat_2_1[];
> +extern const size_t hw_compat_2_1_len;
> +
> #endif
> diff --git a/include/hw/compat.h b/include/hw/compat.h
> index 3bd91908e4..b2d0bdd599 100644
> --- a/include/hw/compat.h
> +++ b/include/hw/compat.h
> @@ -1,35 +1,4 @@
> #ifndef HW_COMPAT_H
> #define HW_COMPAT_H
>
> -#define HW_COMPAT_2_1 \
> - {\
> - .driver = "intel-hda",\
> - .property = "old_msi_addr",\
> - .value = "on",\
> - },{\
> - .driver = "VGA",\
> - .property = "qemu-extended-regs",\
> - .value = "off",\
> - },{\
> - .driver = "secondary-vga",\
> - .property = "qemu-extended-regs",\
> - .value = "off",\
> - },{\
> - .driver = "virtio-scsi-pci",\
> - .property = "any_layout",\
> - .value = "off",\
> - },{\
> - .driver = "usb-mouse",\
> - .property = "usb_version",\
> - .value = stringify(1),\
> - },{\
> - .driver = "usb-kbd",\
> - .property = "usb_version",\
> - .value = stringify(1),\
> - },{\
> - .driver = "virtio-pci",\
> - .property = "virtio-pci-bus-master-bug-migration",\
> - .value = "on",\
> - },
> -
> #endif /* HW_COMPAT_H */
> diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
> index 49b45bb79d..784ea7a92c 100644
> --- a/include/hw/i386/pc.h
> +++ b/include/hw/i386/pc.h
> @@ -333,6 +333,9 @@ extern const size_t pc_compat_2_3_len;
> extern GlobalProperty pc_compat_2_2[];
> extern const size_t pc_compat_2_2_len;
>
> +extern GlobalProperty pc_compat_2_1[];
> +extern const size_t pc_compat_2_1_len;
> +
> /* Helper for setting model-id for CPU models that changed model-id
> * depending on QEMU versions up to QEMU 2.4.
> */
> @@ -353,20 +356,6 @@ extern const size_t pc_compat_2_2_len;
> .value = "QEMU Virtual CPU version " v,\
> },
>
> -#define PC_COMPAT_2_1 \
> - HW_COMPAT_2_1 \
> - PC_CPU_MODEL_IDS("2.1.0") \
> - {\
> - .driver = "coreduo" "-" TYPE_X86_CPU,\
> - .property = "vmx",\
> - .value = "on",\
> - },\
> - {\
> - .driver = "core2duo" "-" TYPE_X86_CPU,\
> - .property = "vmx",\
> - .value = "on",\
> - },
> -
> #define PC_COMPAT_2_0 \
> PC_CPU_MODEL_IDS("2.0.0") \
> {\
> diff --git a/hw/core/machine.c b/hw/core/machine.c
> index 8f387e9063..7570408caa 100644
> --- a/hw/core/machine.c
> +++ b/hw/core/machine.c
> @@ -299,6 +299,39 @@ const size_t hw_compat_2_3_len = G_N_ELEMENTS(hw_compat_2_3);
> GlobalProperty hw_compat_2_2[] = {};
> const size_t hw_compat_2_2_len = G_N_ELEMENTS(hw_compat_2_2);
>
> +GlobalProperty hw_compat_2_1[] = {
> + {
> + .driver = "intel-hda",
> + .property = "old_msi_addr",
> + .value = "on",
> + },{
> + .driver = "VGA",
> + .property = "qemu-extended-regs",
> + .value = "off",
> + },{
> + .driver = "secondary-vga",
> + .property = "qemu-extended-regs",
> + .value = "off",
> + },{
> + .driver = "virtio-scsi-pci",
> + .property = "any_layout",
> + .value = "off",
> + },{
> + .driver = "usb-mouse",
> + .property = "usb_version",
> + .value = stringify(1),
> + },{
> + .driver = "usb-kbd",
> + .property = "usb_version",
> + .value = stringify(1),
> + },{
> + .driver = "virtio-pci",
> + .property = "virtio-pci-bus-master-bug-migration",
> + .value = "on",
> + },
> +};
> +const size_t hw_compat_2_1_len = G_N_ELEMENTS(hw_compat_2_1);
> +
> 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 aeba5a770e..f0c8f54aaf 100644
> --- a/hw/i386/pc.c
> +++ b/hw/i386/pc.c
> @@ -530,6 +530,21 @@ GlobalProperty pc_compat_2_2[] = {
> };
> const size_t pc_compat_2_2_len = G_N_ELEMENTS(pc_compat_2_2);
>
> +GlobalProperty pc_compat_2_1[] = {
> + PC_CPU_MODEL_IDS("2.1.0")
> + {
> + .driver = "coreduo" "-" TYPE_X86_CPU,
> + .property = "vmx",
> + .value = "on",
> + },
> + {
> + .driver = "core2duo" "-" TYPE_X86_CPU,
> + .property = "vmx",
> + .value = "on",
> + },
> +};
> +const size_t pc_compat_2_1_len = G_N_ELEMENTS(pc_compat_2_1);
> +
> 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 6c250e64fc..c7b5e0a3ad 100644
> --- a/hw/i386/pc_piix.c
> +++ b/hw/i386/pc_piix.c
> @@ -323,7 +323,7 @@ static void pc_compat_2_2_fn(MachineState *machine)
> pc_compat_2_3_fn(machine);
> }
>
> -static void pc_compat_2_1(MachineState *machine)
> +static void pc_compat_2_1_fn(MachineState *machine)
> {
> pc_compat_2_2_fn(machine);
> x86_cpu_change_kvm_default("svm", NULL);
> @@ -331,7 +331,7 @@ static void pc_compat_2_1(MachineState *machine)
>
> static void pc_compat_2_0(MachineState *machine)
> {
> - pc_compat_2_1(machine);
> + pc_compat_2_1_fn(machine);
> }
>
> static void pc_compat_1_7(MachineState *machine)
> @@ -593,19 +593,17 @@ DEFINE_I440FX_MACHINE(v2_2, "pc-i440fx-2.2", pc_compat_2_2_fn,
> static void pc_i440fx_2_1_machine_options(MachineClass *m)
> {
> PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
> - static GlobalProperty compat[] = {
> - PC_COMPAT_2_1
> - };
>
> pc_i440fx_2_2_machine_options(m);
> m->hw_version = "2.1.0";
> m->default_display = NULL;
> - compat_props_add(m->compat_props, compat, G_N_ELEMENTS(compat));
> + compat_props_add(m->compat_props, hw_compat_2_1, hw_compat_2_1_len);
> + compat_props_add(m->compat_props, pc_compat_2_1, pc_compat_2_1_len);
> pcmc->smbios_uuid_encoded = false;
> pcmc->enforce_aligned_dimm = false;
> }
>
> -DEFINE_I440FX_MACHINE(v2_1, "pc-i440fx-2.1", pc_compat_2_1,
> +DEFINE_I440FX_MACHINE(v2_1, "pc-i440fx-2.1", pc_compat_2_1_fn,
> pc_i440fx_2_1_machine_options);
>
> static void pc_i440fx_2_0_machine_options(MachineClass *m)
> diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
> index 2e71eb08e9..1c5b0e40b1 100644
> --- a/hw/ppc/spapr.c
> +++ b/hw/ppc/spapr.c
> @@ -4302,12 +4302,8 @@ DEFINE_SPAPR_MACHINE(2_2, "2.2", false);
>
> static void spapr_machine_2_1_class_options(MachineClass *mc)
> {
> - static GlobalProperty compat[] = {
> - HW_COMPAT_2_1
> - };
> -
> spapr_machine_2_2_class_options(mc);
> - compat_props_add(mc->compat_props, compat, G_N_ELEMENTS(compat));
> + compat_props_add(mc->compat_props, hw_compat_2_1, hw_compat_2_1_len);
> }
> DEFINE_SPAPR_MACHINE(2_1, "2.1", false);
>
next prev parent reply other threads:[~2018-12-27 6:55 UTC|newest]
Thread overview: 80+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-21 9:03 [Qemu-devel] [PATCH v7 00/28] Generalize machine compatibility properties Marc-André Lureau
2018-12-21 9:03 ` [Qemu-devel] [PATCH v7 01/28] hw: apply accel compat properties without touching globals Marc-André Lureau
2018-12-21 11:58 ` Cornelia Huck
2018-12-21 9:03 ` [Qemu-devel] [PATCH v7 02/28] machines: replace COMPAT define with a static array Marc-André Lureau
2018-12-21 12:33 ` Cornelia Huck
2018-12-21 14:17 ` Igor Mammedov
2018-12-21 9:03 ` [Qemu-devel] [PATCH v7 03/28] hw: apply machine compat properties without touching globals Marc-André Lureau
2018-12-21 12:38 ` Cornelia Huck
2018-12-21 14:20 ` Igor Mammedov
2018-12-21 9:03 ` [Qemu-devel] [PATCH v7 04/28] machine: move compat properties out of globals Marc-André Lureau
2018-12-21 12:44 ` Cornelia Huck
2018-12-21 14:21 ` Igor Mammedov
2018-12-21 9:03 ` [Qemu-devel] [PATCH v7 05/28] hw: remove SET_MACHINE_COMPAT Marc-André Lureau
2018-12-21 12:44 ` Cornelia Huck
2018-12-21 14:22 ` Igor Mammedov
2018-12-21 9:03 ` [Qemu-devel] [PATCH v7 06/28] compat: replace PC_COMPAT_3_1 & HW_COMPAT_3_1 macros Marc-André Lureau
2018-12-21 12:47 ` Cornelia Huck
2018-12-27 6:35 ` Igor Mammedov
2018-12-21 9:03 ` [Qemu-devel] [PATCH v7 07/28] compat: replace PC_COMPAT_3_0 & HW_COMPAT_3_0 macros Marc-André Lureau
2018-12-21 12:50 ` Cornelia Huck
2018-12-27 6:37 ` Igor Mammedov
2018-12-21 9:03 ` [Qemu-devel] [PATCH v7 08/28] compat: replace PC_COMPAT_2_12 & HW_COMPAT_2_12 macros Marc-André Lureau
2018-12-21 12:52 ` Cornelia Huck
2018-12-27 6:39 ` Igor Mammedov
2018-12-21 9:03 ` [Qemu-devel] [PATCH v7 09/28] compat: replace PC_COMPAT_2_11 & HW_COMPAT_2_11 macros Marc-André Lureau
2018-12-21 12:53 ` Cornelia Huck
2018-12-27 6:40 ` Igor Mammedov
2018-12-21 9:03 ` [Qemu-devel] [PATCH v7 10/28] compat: replace PC_COMPAT_2_10 & HW_COMPAT_2_10 macros Marc-André Lureau
2018-12-21 12:55 ` Cornelia Huck
2018-12-27 6:41 ` Igor Mammedov
2018-12-21 9:03 ` [Qemu-devel] [PATCH v7 11/28] compat: replace PC_COMPAT_2_9 & HW_COMPAT_2_9 macros Marc-André Lureau
2018-12-21 12:56 ` Cornelia Huck
2018-12-27 6:44 ` Igor Mammedov
2018-12-21 9:03 ` [Qemu-devel] [PATCH v7 12/28] compat: replace PC_COMPAT_2_8 & HW_COMPAT_2_8 macros Marc-André Lureau
2018-12-21 12:58 ` Cornelia Huck
2018-12-27 6:45 ` Igor Mammedov
2018-12-21 9:03 ` [Qemu-devel] [PATCH v7 13/28] compat: replace PC_COMPAT_2_7 & HW_COMPAT_2_7 macros Marc-André Lureau
2018-12-21 13:00 ` Cornelia Huck
2018-12-27 6:47 ` Igor Mammedov
2018-12-21 9:03 ` [Qemu-devel] [PATCH v7 14/28] compat: replace PC_COMPAT_2_6 & HW_COMPAT_2_6 macros Marc-André Lureau
2018-12-21 13:03 ` Cornelia Huck
2018-12-27 6:48 ` Igor Mammedov
2018-12-21 9:03 ` [Qemu-devel] [PATCH v7 15/28] compat: replace PC_COMPAT_2_5 & HW_COMPAT_2_5 macros Marc-André Lureau
2018-12-21 13:04 ` Cornelia Huck
2018-12-27 6:50 ` Igor Mammedov
2018-12-21 9:03 ` [Qemu-devel] [PATCH v7 16/28] compat: replace PC_COMPAT_2_4 & HW_COMPAT_2_4 macros Marc-André Lureau
2018-12-21 13:05 ` Cornelia Huck
2018-12-27 6:51 ` Igor Mammedov
2018-12-21 9:03 ` [Qemu-devel] [PATCH v7 17/28] compat: replace PC_COMPAT_2_3 & HW_COMPAT_2_3 macros Marc-André Lureau
2018-12-21 13:07 ` Cornelia Huck
2018-12-27 6:52 ` Igor Mammedov
2018-12-21 9:04 ` [Qemu-devel] [PATCH v7 18/28] compat: replace PC_COMPAT_2_2 & HW_COMPAT_2_2 macros Marc-André Lureau
2018-12-21 13:08 ` Cornelia Huck
2018-12-27 6:53 ` Igor Mammedov
2018-12-21 9:04 ` [Qemu-devel] [PATCH v7 19/28] compat: replace PC_COMPAT_2_1 & HW_COMPAT_2_1 macros Marc-André Lureau
2018-12-21 13:09 ` Cornelia Huck
2018-12-27 6:54 ` Igor Mammedov [this message]
2018-12-21 9:04 ` [Qemu-devel] [PATCH v7 20/28] include: remove compat.h Marc-André Lureau
2018-12-21 13:10 ` Cornelia Huck
2018-12-27 6:56 ` Igor Mammedov
2018-12-21 9:04 ` [Qemu-devel] [PATCH v7 21/28] compat: remove remaining PC_COMPAT macros Marc-André Lureau
2018-12-21 13:12 ` Cornelia Huck
2018-12-27 6:58 ` Igor Mammedov
2018-12-21 9:04 ` [Qemu-devel] [PATCH v7 22/28] qdev: make a separate helper function to apply compat properties Marc-André Lureau
2018-12-21 14:38 ` Igor Mammedov
2018-12-21 15:25 ` Cornelia Huck
2018-12-21 9:04 ` [Qemu-devel] [PATCH v7 23/28] qdev: all globals are now user-provided Marc-André Lureau
2018-12-21 15:26 ` Cornelia Huck
2018-12-21 9:04 ` [Qemu-devel] [PATCH v7 24/28] qdev-props: convert global_props to GPtrArray Marc-André Lureau
2018-12-21 15:28 ` Cornelia Huck
2018-12-21 9:04 ` [Qemu-devel] [PATCH v7 25/28] qdev-props: remove errp from GlobalProperty Marc-André Lureau
2018-12-21 15:34 ` Cornelia Huck
2019-01-04 10:57 ` Marc-André Lureau
2019-01-04 11:04 ` Cornelia Huck
2018-12-21 9:04 ` [Qemu-devel] [PATCH v7 26/28] qdev-props: call object_apply_global_props() Marc-André Lureau
2018-12-21 15:35 ` Cornelia Huck
2018-12-21 9:04 ` [Qemu-devel] [PATCH v7 27/28] arm: replace instance_post_init() Marc-André Lureau
2018-12-21 9:04 ` [Qemu-devel] [PATCH v7 28/28] hostmem: use object id for memory region name with >= 4.0 Marc-André Lureau
2019-01-04 11:42 ` [Qemu-devel] [PATCH v7 00/28] Generalize machine compatibility properties Marc-André Lureau
2019-01-04 16:16 ` Eduardo Habkost
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181227075454.2ad4e77d@Igors-MacBook-Pro.local \
--to=imammedo@redhat.com \
--cc=ehabkost@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).