diff options
author | Igor Mammedov <imammedo@redhat.com> | 2016-01-28 11:58:08 +0100 |
---|---|---|
committer | Eduardo Habkost <ehabkost@redhat.com> | 2016-05-20 14:28:54 -0300 |
commit | bacc344c548ce165a0001276ece56ee4b0bddae3 (patch) | |
tree | df773e89863c26316b09afaf5cb214543108194d /include/hw/boards.h | |
parent | 16714b16806979d7f9f245b2b4c13966e4fa1c2e (diff) | |
download | qemu-bacc344c548ce165a0001276ece56ee4b0bddae3.zip qemu-bacc344c548ce165a0001276ece56ee4b0bddae3.tar.gz qemu-bacc344c548ce165a0001276ece56ee4b0bddae3.tar.bz2 |
machine: add properties to compat_props incrementaly
Switch to adding compat properties incrementaly instead of
completly overwriting compat_props per machine type.
That removes data duplication which we have due to nested
[PC|SPAPR]_COMPAT_* macros.
It also allows to set default device properties from
default foo_machine_options() hook, which will be used
in following patch for putting VMGENID device as
a function if ISA bridge on pc/q35 machines.
Suggested-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
[ehabkost: Fixed CCW_COMPAT_* and PC_COMPAT_0_* defines]
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Diffstat (limited to 'include/hw/boards.h')
-rw-r--r-- | include/hw/boards.h | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/include/hw/boards.h b/include/hw/boards.h index f968a25..d268bd0 100644 --- a/include/hw/boards.h +++ b/include/hw/boards.h @@ -114,7 +114,7 @@ struct MachineClass { const char *default_machine_opts; const char *default_boot_order; const char *default_display; - GlobalProperty *compat_props; + GArray *compat_props; const char *hw_version; ram_addr_t default_ram_size; bool option_rom_has_mr; @@ -186,11 +186,18 @@ struct MachineState { #define SET_MACHINE_COMPAT(m, COMPAT) \ do { \ + int i; \ static GlobalProperty props[] = { \ COMPAT \ { /* end of list */ } \ }; \ - (m)->compat_props = props; \ + 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]; \ + g_array_append_val(m->compat_props, prop); \ + } \ } while (0) #endif |