[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] pc: reduce duplication in compat machine types
From: |
Andreas Färber |
Subject: |
Re: [Qemu-devel] [PATCH] pc: reduce duplication in compat machine types |
Date: |
Mon, 26 Mar 2012 15:12:37 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:10.0.2) Gecko/20120215 Thunderbird/10.0.2 |
Am 26.03.2012 11:40, schrieb Michael S. Tsirkin:
> Make it easier to add compat properties, by
> adding macros for properties duplicated across
> machine types.
>
> Note: there could be bugs in compat properties,
> this patch does not attempt to address them,
> the code is bug for bug identical to the original.
>
> Tested by: generated a preprocessed file, sorted and
> compared to sorted original.
> Lightly tested on x86_64.
>
> Signed-off-by: Michael S. Tsirkin <address@hidden>
> ---
>
> I've put the above on my branch as it's needed for
> fixing balloon pci class. Let me know if there are
> any objections.
Better reusing code is certainly a good idea. I wonder though if we
might ever get into a situation where things change back and forth. I'd
hope that properties are processed top to bottom so that, e.g.,
PC_COMPAT_1_0, { ... } can overwrite 0_15 compat properties inherited
through 1_0.
Andreas
>
> hw/pc_piix.c | 288
> +++++++++++++++-------------------------------------------
> 1 files changed, 73 insertions(+), 215 deletions(-)
>
> diff --git a/hw/pc_piix.c b/hw/pc_piix.c
> index 3f99f9a..e39ef69 100644
> --- a/hw/pc_piix.c
> +++ b/hw/pc_piix.c
> @@ -372,50 +372,69 @@ static QEMUMachine pc_machine_v1_1 = {
> .is_default = 1,
> };
>
> +#define PC_COMPAT_1_0 \
> + {\
> + .driver = "pc-sysfw",\
> + .property = "rom_only",\
> + .value = stringify(1),\
> + }, {\
> + .driver = "isa-fdc",\
> + .property = "check_media_rate",\
> + .value = "off",\
> + }
> +
> static QEMUMachine pc_machine_v1_0 = {
> .name = "pc-1.0",
> .desc = "Standard PC",
> .init = pc_init_pci,
> .max_cpus = 255,
> .compat_props = (GlobalProperty[]) {
> - {
> - .driver = "pc-sysfw",
> - .property = "rom_only",
> - .value = stringify(1),
> - }, {
> - .driver = "isa-fdc",
> - .property = "check_media_rate",
> - .value = "off",
> - },
> + PC_COMPAT_1_0,
> { /* end of list */ }
> },
> };
[snip]
--
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg