Generalize machine compatibility properties
v7 cover Generalize machine compatibility properties
Hi,
During "[PATCH v2 05/10] qom/globals: generalize object_property_set_globals()" review, Eduardo suggested to rework the GlobalProperty handling, so that -global is limited to QDev only and we avoid mixing the machine compats and the user-provided -global properties (instead of generalizing -global to various object kinds, like I proposed in v2).
"qdev: do not mix compat props with global props" patch decouples a bit user-provided -global from machine compat properties. This allows to get rid of "user_provided" and "errp" fields in following patches.
A new compat property "x-use-canonical-path-for-ramblock-id" is added to hostmem for legacy canonical path names, set to true for -file and -memfd with qemu < 4.0.
(this series was initially titled "[PATCH v2 00/10] hostmem: use object "id" for memory region name with >= 3.1", but its focus is more in refactoring the global and compatilibity properties handling now)
v7:
- rebased (s390 conflicts)
- rename self/backend in last patch
- add some r-b tags
v6:
- split "hw: apply machine compat properties without touching globals"
- replace PC_COMPAT_* and HW_COMPAT_* defines with static arrays
- add ARMCPUInfo *info in ARMCPUClass for "arm: replace instance_post_init()" patch
- rebased, commit message updates, add some r-b tags
v5:
- replace the SET_COMPAT macros, use normal function instead (suggested by Eduardo)
- replace the TYPE_COMPAT_PROPS interface approach for explicit object_apply_compat_props(), solving post-init ordering issues.
- get back to coupling compat properties with machine, in qdev (although there is still some discussion how to improve this, it can be changed later)
- mark the "arm: replace instance_post_init()" as RFC, since it is not longer required for this series
- change machines version from 3.2 to 4.0
- add some r-b tags
v4:
- fix accel/machine compat props apply order inversion
- split "qdev: do not mix compat props with global props": replace using current_machine by new compat_props global, introduce SET_COMPAT() macro, use GPtrArray.
- add a comment about "qdev-props: call object_apply_global_props()" error reporting
- add "arm: replace instance_post_init()", to solve the post-init ordering issue
- add "hw/arm/virt: add virt-3.2 machine type" for completeness
- commit message improvements
- rebased, add r-b tags
v3:
- GlobalProperties improvements/cleanups
- drop generalizing the -global idea
- "replace" the set_globals flag with a TYPE_COMPAT_PROPS interface
- update hw/i386 machine version to 3.2
- add "qom: make interface types abstract" interface cleanup
v2:
- replace "qom/user-creatable: add a few helper macros" patch for a more optimized "qom: make user_creatable_complete() specific to UserCreatable"
- rename register_global_list() to register_global_properties()
- call object_property_set_globals() after post-init
- add and use a ObjectClass.set_globals flag, instead of dynamically check object class in object_property_set_globals()
- use object "id" in >= 3.1 instead of canonical path, add compat property "x-use-canonical-path-for-ramblock-id" in base hostmem class.
Marc-André Lureau (28):
hw: apply accel compat properties without touching globals
machines: replace COMPAT define with a static array
hw: apply machine compat properties without touching globals
machine: move compat properties out of globals
hw: remove SET_MACHINE_COMPAT
compat: replace PC_COMPAT_3_1 & HW_COMPAT_3_1 macros
compat: replace PC_COMPAT_3_0 & HW_COMPAT_3_0 macros
compat: replace PC_COMPAT_2_12 & HW_COMPAT_2_12 macros
compat: replace PC_COMPAT_2_11 & HW_COMPAT_2_11 macros
compat: replace PC_COMPAT_2_10 & HW_COMPAT_2_10 macros
compat: replace PC_COMPAT_2_9 & HW_COMPAT_2_9 macros
compat: replace PC_COMPAT_2_8 & HW_COMPAT_2_8 macros
compat: replace PC_COMPAT_2_7 & HW_COMPAT_2_7 macros
compat: replace PC_COMPAT_2_6 & HW_COMPAT_2_6 macros
compat: replace PC_COMPAT_2_5 & HW_COMPAT_2_5 macros
compat: replace PC_COMPAT_2_4 & HW_COMPAT_2_4 macros
compat: replace PC_COMPAT_2_3 & HW_COMPAT_2_3 macros
compat: replace PC_COMPAT_2_2 & HW_COMPAT_2_2 macros
compat: replace PC_COMPAT_2_1 & HW_COMPAT_2_1 macros
include: remove compat.h
compat: remove remaining PC_COMPAT macros
qdev: make a separate helper function to apply compat properties
qdev: all globals are now user-provided
qdev-props: convert global_props to GPtrArray
qdev-props: remove errp from GlobalProperty
qdev-props: call object_apply_global_props()
arm: replace instance_post_init()
hostmem: use object id for memory region name with >= 4.0
include/hw/boards.h | 59 ++- include/hw/compat.h | 291 -------------- include/hw/i386/pc.h | 684 +++------------------------------ include/hw/qdev-core.h | 21 +- include/qom/object.h | 3 + include/sysemu/accel.h | 4 +- include/sysemu/hostmem.h | 3 +- target/arm/cpu-qom.h | 3 + target/arm/cpu.h | 2 + accel/accel.c | 12 - backends/hostmem-file.c | 8 +- backends/hostmem-memfd.c | 2 +- backends/hostmem-ram.c | 9 +- backends/hostmem.c | 36 ++ hw/arm/virt.c | 46 +-- hw/core/machine.c | 339 +++++++++++++++- hw/core/qdev-properties.c | 49 +-- hw/core/qdev.c | 15 + hw/i386/pc.c | 668 ++++++++++++++++++++++++++++++++ hw/i386/pc_piix.c | 603 +++++++++++++++-------------- hw/i386/pc_q35.c | 36 +- hw/ppc/spapr.c | 207 +++++----- hw/s390x/s390-virtio-ccw.c | 196 +++++----- hw/xen/xen-common.c | 41 +- qom/cpu.c | 1 - qom/object.c | 35 ++ target/arm/cpu.c | 30 +- target/arm/cpu64.c | 24 +- target/i386/cpu.c | 1 - target/sparc/cpu.c | 1 - tests/test-qdev-global-props.c | 57 +-- vl.c | 4 - 32 files changed, 1818 insertions(+), 1672 deletions(-) delete mode 100644 include/hw/compat.h
Signature · 1 line
2.20.1.2.gb21ebb671b
PATCH v7 1/28 hw: apply accel compat properties without touching globals
Instead of registering compat properties as globals, let's keep them in their own array, to avoid mixing with user globals.
Introduce object_apply_global_props() function, to apply compatibility properties from a GPtrArray.
--- include/hw/qdev-core.h | 10 ++++++++++ include/qom/object.h | 3 +++ include/sysemu/accel.h | 4 +--- accel/accel.c | 12 ------------ hw/core/qdev.c | 9 +++++++++ hw/xen/xen-common.c | 9 ++++++--- qom/object.c | 25 +++++++++++++++++++++++++ vl.c | 1 - 8 files changed, 54 insertions(+), 19 deletions(-)
include/hw/qdev-core.h +10 -0
@@ -267,6 +267,16 @@ typedef struct GlobalProperty {Error **errp; } GlobalProperty; +static inline void +compat_props_add (GPtrArray *arr, +GlobalProperty props[],size_t nelem) +{ +int i; +for (i =0 ; i < nelem; i++) { +g_ptr_array_add (arr, (void *)&props[i]); + } +} +/*** Board API. This should go away once we have a machine config file. ***/ DeviceState *qdev_create (BusState *bus,const char *name);
include/qom/object.h +3 -0
@@ -675,6 +675,9 @@ Object *object_new_with_propv(const char *typename,Error **errp, va_list vargs); +void object_apply_global_props (Object *obj,const GPtrArray *props, +Error **errp); +/** * object_set_props: * @obj: the object instance to set properties on
include/sysemu/accel.h +1 -3
@@ -49,7 +49,7 @@ typedef struct AccelClass {* global properties may be overridden by machine-type * compat_props or user-provided global properties. */ -GlobalProperty *global_props; +GPtrArray *compat_props; } AccelClass;#define TYPE_ACCEL "accel"
@@ -67,8 +67,6 @@ typedef struct AccelClass {extern unsigned long tcg_tb_size;void configure_accelerator (MachineState *ms); -/* Register accelerator specific global properties */ -void accel_register_compat_props (AccelState *accel);/* Called just before os_setup_post (ie just before drop OS privs) */ void accel_setup_post (MachineState *ms);
accel/accel.c +0 -12
@@ -119,18 +119,6 @@ void configure_accelerator(MachineState *ms) } } -void accel_register_compat_props (AccelState *accel) -{ -AccelClass *class =ACCEL_GET_CLASS (accel); -GlobalProperty *prop = class->global_props; - -for (; prop && prop->driver; prop++) { -/* Any compat_props must never cause error */ - prop->errp = &error_abort; -qdev_prop_register_global (prop); - } -} -void accel_setup_post (MachineState *ms) {AccelState *accel = ms->accelerator;
hw/core/qdev.c +9 -0
@@ -972,6 +972,15 @@ static void device_initfn(Object *obj)static void device_post_init (Object *obj) { +if (object_dynamic_cast (qdev_get_machine (),TYPE_MACHINE )) { +MachineState *m =MACHINE (qdev_get_machine ()); +AccelClass *ac =ACCEL_GET_CLASS (m->accelerator); + +if (ac->compat_props) { +object_apply_global_props (obj, ac->compat_props, &error_abort); + } + } +qdev_prop_set_globals (DEVICE (obj)); }
hw/xen/xen-common.c +6 -3
@@ -174,18 +174,21 @@ static GlobalProperty xen_compat_props[] = { .driver = "migration", .property = "send-section-footer", .value = "off", - }, - { /* end of list */ }, + } };static void xen_accel_class_init (ObjectClass *oc,void *data) {AccelClass *ac =ACCEL_CLASS (oc); + ac->name ="Xen" ; ac->init_machine = xen_init; ac->setup_post = xen_setup_post; ac->allowed = &xen_allowed; - ac->global_props = xen_compat_props; + ac->compat_props =g_ptr_array_new (); + +compat_props_add (ac->compat_props, + xen_compat_props,G_N_ELEMENTS (xen_compat_props)); }#define TYPE_XEN_ACCEL ACCEL_CLASS_NAME("xen")
qom/object.c +25 -0
@@ -370,6 +370,31 @@ static void object_post_init_with_type(Object *obj, TypeImpl *ti) } } +void object_apply_global_props (Object *obj,const GPtrArray *props,Error **errp) +{ +Error *err =NULL ; +int i; + +if (!props) { +return ; + } + +for (i =0 ; i < props->len; i++) { +GlobalProperty *p =g_ptr_array_index (props, i); + +if (object_dynamic_cast (obj, p->driver) ==NULL ) { +continue ; + } + p->used = true; +object_property_parse (obj, p->value, p->property, &err); +if (err !=NULL ) { +error_prepend (&err,"can't apply global %s.%s=%s: " , + p->driver, p->property, p->value); +error_propagate (errp, err); + } + } +} +static void object_initialize_with_type (void *data,size_t size,TypeImpl *type) {Object *obj = data;
vl.c +0 -1
@@ -2984,7 +2984,6 @@ static void user_register_global_props(void)*/ static void register_global_properties (MachineState *ms) { -accel_register_compat_props (ms->accelerator);machine_register_compat_props (ms);user_register_global_props (); }
Signature · 1 line
2.20.1.2.gb21ebb671b
Re: [Qemu-devel] [PATCH v7 01/28] hw: apply accel compat properties without touching globals
Quoted 8 lines · On Fri, 21 Dec 2018 13:03:43 +0400 Marc-André Lureau…
Instead of registering compat properties as globals, let's keep them in their own array, to avoid mixing with user globals.
Introduce
object_apply_global_props()function, to apply compatibility properties from a GPtrArray.Signed-off-by Marc-André Lureau <[email protected]>Reviewed-by Igor Mammedov <[email protected]>
Quoted 10 lines
--- include/hw/qdev-core.h | 10 ++++++++++ include/qom/object.h | 3 +++ include/sysemu/accel.h | 4 +--- accel/accel.c | 12 ------------ hw/core/qdev.c | 9 +++++++++ hw/xen/xen-common.c | 9 ++++++--- qom/object.c | 25 +++++++++++++++++++++++++ vl.c | 1 - 8 files changed, 54 insertions(+), 19 deletions(-)
PATCH v7 2/28 machines: replace COMPAT define with a static array
In reply to Marc-André Lureau--- 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(-)
include/hw/boards.h +3 -7
@@ -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 )
hw/arm/virt.c +27 -18
141 lines not on this page · raw message
hw/i386/pc_piix.c +315 -248
866 lines not on this page · raw message
hw/i386/pc_q35.c +55 -11
170 lines not on this page · raw message
hw/ppc/spapr.c +107 -94
365 lines not on this page · raw message
hw/s390x/s390-virtio-ccw.c +115 -104
291 lines not on this page · raw message
Signature · 1 line
2.20.1.2.gb21ebb671b
Re: [Qemu-devel] [PATCH v7 02/28] machines: replace COMPAT define with a static array
Quoted 10 lines · On Fri, 21 Dec 2018 13:03:44 +0400 Marc-André Lureau…
Signed-off-by Marc-André Lureau <[email protected]>--- 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(-)
Re: [Qemu-devel] [PATCH v7 02/28] machines: replace COMPAT define with a static array
In reply to Marc-André LureauQuoted 9 lines · On Fri, 21 Dec 2018 13:03:44 +0400 Marc-André Lureau…
Signed-off-by Marc-André Lureau <[email protected]>--- 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(-)
[...]
PATCH v7 3/28 hw: apply machine compat properties without touching globals
In reply to Marc-André LureauSimilarly to accel properties, move compat properties out of globals registration, and apply the machine compat properties during device_post_init().
--- include/hw/boards.h | 3 +- hw/arm/virt.c | 27 ++++++++---- hw/core/machine.c | 19 +-------- hw/core/qdev.c | 2 + hw/i386/pc_piix.c | 87 +++++++++++++++++++++++++------------- hw/i386/pc_q35.c | 33 ++++++++++----- hw/ppc/spapr.c | 42 ++++++++++++------ hw/s390x/s390-virtio-ccw.c | 33 ++++++++++----- vl.c | 1 - 9 files changed, 152 insertions(+), 95 deletions(-)
include/hw/boards.h +1 -2
@@ -69,7 +69,6 @@ int machine_kvm_shadow_mem(MachineState *machine);int machine_phandle_start (MachineState *machine);bool machine_dump_guest_core (MachineState *machine);bool machine_mem_merge (MachineState *machine); -void machine_register_compat_props (MachineState *machine);HotpluggableCPUList *machine_query_hotpluggable_cpus (MachineState *machine); void machine_set_cpu_numa_node(MachineState *machine, const CpuInstanceProperties *props,
@@ -191,7 +190,7 @@ struct MachineClass {const char *default_machine_opts;const char *default_boot_order;const char *default_display; -GArray *compat_props; +GPtrArray *compat_props;const char *hw_version;ram_addr_t default_ram_size;const char *default_cpu_type;
hw/arm/virt.c +18 -9
@@ -1879,7 +1879,8 @@ static GlobalProperty virt_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); +compat_props_add (mc->compat_props, + virt_compat_3_1,G_N_ELEMENTS (virt_compat_3_1)); }DEFINE_VIRT_MACHINE (3 ,1 )
@@ -1890,7 +1891,8 @@ static GlobalProperty virt_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); +compat_props_add (mc->compat_props, + virt_compat_3_0,G_N_ELEMENTS (virt_compat_3_0)); }DEFINE_VIRT_MACHINE (3 ,0 )
@@ -1903,7 +1905,8 @@ 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); +compat_props_add (mc->compat_props, + virt_compat_2_12,G_N_ELEMENTS (virt_compat_2_12)); vmc->no_highmem_ecam = true; mc->max_cpus =255 ; }
@@ -1918,7 +1921,8 @@ 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); +compat_props_add (mc->compat_props, + virt_compat_2_11,G_N_ELEMENTS (virt_compat_2_11)); vmc->smbios_old_sys_ver = true; }DEFINE_VIRT_MACHINE (2 ,11 )
@@ -1930,7 +1934,8 @@ static GlobalProperty virt_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); +compat_props_add (mc->compat_props, + virt_compat_2_10,G_N_ELEMENTS (virt_compat_2_10));/* before 2.11 we never faulted accesses to bad addresses */ mc->ignore_memory_transaction_failures = true; }
@@ -1943,7 +1948,8 @@ static GlobalProperty virt_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); +compat_props_add (mc->compat_props, + virt_compat_2_9,G_N_ELEMENTS (virt_compat_2_9)); }DEFINE_VIRT_MACHINE (2 ,9 )
@@ -1956,7 +1962,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); +compat_props_add (mc->compat_props, + virt_compat_2_8,G_N_ELEMENTS (virt_compat_2_8));/* For 2.8 and earlier we falsely claimed in the DT that * our timers were edge-triggered, not level-triggered. */
@@ -1973,7 +1980,8 @@ 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); +compat_props_add (mc->compat_props, + virt_compat_2_7,G_N_ELEMENTS (virt_compat_2_7));/* ITS was introduced with 2.8 */ vmc->no_its = true;/* Stick with 1K pages for migration compatibility */
@@ -1990,7 +1998,8 @@ 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); +compat_props_add (mc->compat_props, + virt_compat_2_6,G_N_ELEMENTS (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;
hw/core/machine.c +1 -18
@@ -647,6 +647,7 @@ static void machine_class_base_init(ObjectClass *oc, void *data)assert (g_str_has_suffix (cname,TYPE_MACHINE_SUFFIX )); mc->name =g_strndup (cname,strlen (cname) -strlen (TYPE_MACHINE_SUFFIX )); + mc->compat_props =g_ptr_array_new (); } }
@@ -834,24 +835,6 @@ void machine_run_board_init(MachineState *machine) machine_class->init (machine); } -void machine_register_compat_props (MachineState *machine) -{ -MachineClass *mc =MACHINE_GET_CLASS (machine); -int i; -GlobalProperty *p; - -if (!mc->compat_props) { -return ; - } - -for (i =0 ; i < mc->compat_props->len; i++) { - p = g_array_index(mc->compat_props, GlobalProperty *, i); -/* Machine compat_props must never cause errors: */ - p->errp = &error_abort; -qdev_prop_register_global (p); - } -} -static const TypeInfo machine_info = { .name =TYPE_MACHINE , .parent =TYPE_OBJECT ,
hw/core/qdev.c +2 -0
@@ -974,11 +974,13 @@ static void device_post_init(Object *obj) {if (object_dynamic_cast (qdev_get_machine (),TYPE_MACHINE )) {MachineState *m =MACHINE (qdev_get_machine ()); +MachineClass *mc =MACHINE_GET_CLASS (m);AccelClass *ac =ACCEL_GET_CLASS (m->accelerator);if (ac->compat_props) {object_apply_global_props (obj, ac->compat_props, &error_abort); } +object_apply_global_props (obj, mc->compat_props, &error_abort); }qdev_prop_set_globals (DEVICE (obj));
hw/i386/pc_piix.c +58 -29
261 lines not on this page · raw message
hw/i386/pc_q35.c +22 -11
@@ -328,7 +328,8 @@ 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); +compat_props_add (m->compat_props, + pc_compat_3_1,G_N_ELEMENTS (pc_compat_3_1)); } DEFINE_Q35_MACHINE(v3_1, "pc-q35-3.1", NULL,
@@ -341,7 +342,8 @@ static GlobalProperty 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); +compat_props_add (m->compat_props, + pc_compat_3_0,G_N_ELEMENTS (pc_compat_3_0)); } DEFINE_Q35_MACHINE(v3_0, "pc-q35-3.0", NULL,
@@ -354,7 +356,8 @@ static GlobalProperty 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); +compat_props_add (m->compat_props, + pc_compat_2_12,G_N_ELEMENTS (pc_compat_2_12)); } DEFINE_Q35_MACHINE(v2_12, "pc-q35-2.12", NULL,
@@ -370,7 +373,8 @@ static void pc_q35_2_11_machine_options(MachineClass *m)pc_q35_2_12_machine_options (m); pcmc->default_nic_model ="e1000" ; -SET_MACHINE_COMPAT (m, pc_compat_2_11); +compat_props_add (m->compat_props, + pc_compat_2_11,G_N_ELEMENTS (pc_compat_2_11)); } DEFINE_Q35_MACHINE(v2_11, "pc-q35-2.11", NULL,
@@ -383,7 +387,8 @@ static GlobalProperty 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); +compat_props_add (m->compat_props, + pc_compat_2_10,G_N_ELEMENTS (pc_compat_2_10)); m->numa_auto_assign_ram = numa_legacy_auto_assign_ram; m->auto_enable_numa_with_memhp = false; }
@@ -398,7 +403,8 @@ static GlobalProperty 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); +compat_props_add (m->compat_props, + pc_compat_2_9,G_N_ELEMENTS (pc_compat_2_9)); } DEFINE_Q35_MACHINE(v2_9, "pc-q35-2.9", NULL,
@@ -411,7 +417,8 @@ static GlobalProperty 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); +compat_props_add (m->compat_props, + pc_compat_2_8,G_N_ELEMENTS (pc_compat_2_8)); } DEFINE_Q35_MACHINE(v2_8, "pc-q35-2.8", NULL,
@@ -425,7 +432,8 @@ 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); +compat_props_add (m->compat_props, + pc_compat_2_7,G_N_ELEMENTS (pc_compat_2_7)); } DEFINE_Q35_MACHINE(v2_7, "pc-q35-2.7", NULL,
@@ -441,7 +449,8 @@ static void pc_q35_2_6_machine_options(MachineClass *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); +compat_props_add (m->compat_props, + pc_compat_2_6,G_N_ELEMENTS (pc_compat_2_6)); } DEFINE_Q35_MACHINE(v2_6, "pc-q35-2.6", NULL,
@@ -457,7 +466,8 @@ static void pc_q35_2_5_machine_options(MachineClass *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); +compat_props_add (m->compat_props, + pc_compat_2_5,G_N_ELEMENTS (pc_compat_2_5)); } DEFINE_Q35_MACHINE(v2_5, "pc-q35-2.5", NULL,
@@ -473,7 +483,8 @@ static void pc_q35_2_4_machine_options(MachineClass *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); +compat_props_add (m->compat_props, + pc_compat_2_4,G_N_ELEMENTS (pc_compat_2_4)); } DEFINE_Q35_MACHINE(v2_4, "pc-q35-2.4", NULL,
hw/ppc/spapr.c +28 -14
126 lines not on this page · raw message
hw/s390x/s390-virtio-ccw.c +22 -11
@@ -773,7 +773,8 @@ 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); +compat_props_add (mc->compat_props, + ccw_compat_3_1,G_N_ELEMENTS (ccw_compat_3_1)); } DEFINE_CCW_MACHINE(3_1, "3.1", false);
@@ -788,7 +789,8 @@ 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); +compat_props_add (mc->compat_props, + ccw_compat_3_0,G_N_ELEMENTS (ccw_compat_3_0)); } DEFINE_CCW_MACHINE(3_0, "3.0", false);
@@ -802,7 +804,8 @@ 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); +compat_props_add (mc->compat_props, + ccw_compat_2_12,G_N_ELEMENTS (ccw_compat_2_12)); } DEFINE_CCW_MACHINE(2_12, "2.12", false);
@@ -818,7 +821,8 @@ 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); +compat_props_add (mc->compat_props, + ccw_compat_2_11,G_N_ELEMENTS (ccw_compat_2_11)); } DEFINE_CCW_MACHINE(2_11, "2.11", false);
@@ -830,7 +834,8 @@ 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); +compat_props_add (mc->compat_props, + ccw_compat_2_10,G_N_ELEMENTS (ccw_compat_2_10)); } DEFINE_CCW_MACHINE(2_10, "2.10", false);
@@ -849,7 +854,8 @@ 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); +compat_props_add (mc->compat_props, + ccw_compat_2_9,G_N_ELEMENTS (ccw_compat_2_9)); s390mc->css_migration_enabled = false; } DEFINE_CCW_MACHINE(2_9, "2.9", false);
@@ -862,7 +868,8 @@ 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); +compat_props_add (mc->compat_props, + ccw_compat_2_8,G_N_ELEMENTS (ccw_compat_2_8)); } DEFINE_CCW_MACHINE(2_8, "2.8", false);
@@ -877,7 +884,8 @@ 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); +compat_props_add (mc->compat_props, + ccw_compat_2_7,G_N_ELEMENTS (ccw_compat_2_7)); } DEFINE_CCW_MACHINE(2_7, "2.7", false);
@@ -892,7 +900,8 @@ 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); +compat_props_add (mc->compat_props, + ccw_compat_2_6,G_N_ELEMENTS (ccw_compat_2_6)); } DEFINE_CCW_MACHINE(2_6, "2.6", false);
@@ -904,7 +913,8 @@ 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); +compat_props_add (mc->compat_props, + ccw_compat_2_5,G_N_ELEMENTS (ccw_compat_2_5)); } DEFINE_CCW_MACHINE(2_5, "2.5", false);
@@ -916,7 +926,8 @@ 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); +compat_props_add (mc->compat_props, + ccw_compat_2_4,G_N_ELEMENTS (ccw_compat_2_4)); } DEFINE_CCW_MACHINE(2_4, "2.4", false);
vl.c +0 -1
@@ -2984,7 +2984,6 @@ static void user_register_global_props(void)*/ static void register_global_properties (MachineState *ms) { -machine_register_compat_props (ms);user_register_global_props (); }
Signature · 1 line
2.20.1.2.gb21ebb671b
Re: [Qemu-devel] [PATCH v7 03/28] hw: apply machine compat properties without touching globals
Quoted 5 lines · On Fri, 21 Dec 2018 13:03:45 +0400 Marc-André Lureau…
Similarly to accel properties, move compat properties out of globals registration, and apply the machine compat properties during
device_post_init().Signed-off-by Marc-André Lureau <[email protected]>
Quoted 11 lines
--- include/hw/boards.h | 3 +- hw/arm/virt.c | 27 ++++++++---- hw/core/machine.c | 19 +-------- hw/core/qdev.c | 2 + hw/i386/pc_piix.c | 87 +++++++++++++++++++++++++------------- hw/i386/pc_q35.c | 33 ++++++++++----- hw/ppc/spapr.c | 42 ++++++++++++------ hw/s390x/s390-virtio-ccw.c | 33 ++++++++++----- vl.c | 1 - 9 files changed, 152 insertions(+), 95 deletions(-)
Re: [Qemu-devel] [PATCH v7 03/28] hw: apply machine compat properties without touching globals
In reply to Marc-André LureauQuoted 5 lines · On Fri, 21 Dec 2018 13:03:45 +0400 Marc-André Lureau…
Similarly to accel properties, move compat properties out of globals registration, and apply the machine compat properties during
device_post_init().Signed-off-by Marc-André Lureau <[email protected]>
Quoted 11 lines
--- include/hw/boards.h | 3 +- hw/arm/virt.c | 27 ++++++++---- hw/core/machine.c | 19 +-------- hw/core/qdev.c | 2 + hw/i386/pc_piix.c | 87 +++++++++++++++++++++++++------------- hw/i386/pc_q35.c | 33 ++++++++++----- hw/ppc/spapr.c | 42 ++++++++++++------ hw/s390x/s390-virtio-ccw.c | 33 ++++++++++----- vl.c | 1 - 9 files changed, 152 insertions(+), 95 deletions(-)
[...]
PATCH v7 4/28 machine: move compat properties out of globals
In reply to Marc-André LureauMove the compat arrays inside functions that use them.
--- hw/arm/virt.c | 94 +++-- hw/i386/pc_piix.c | 705 ++++++++++++++++++------------------- hw/i386/pc_q35.c | 121 +++---- hw/ppc/spapr.c | 254 +++++++------ hw/s390x/s390-virtio-ccw.c | 239 ++++++------- hw/xen/xen-common.c | 38 +- 6 files changed, 685 insertions(+), 766 deletions(-)
hw/arm/virt.c +40 -54
@@ -1872,98 +1872,88 @@ static void virt_machine_4_0_options(MachineClass *mc) } DEFINE_VIRT_MACHINE_AS_LATEST(4, 0) -static GlobalProperty virt_compat_3_1[] = { -HW_COMPAT_3_1 -}; -static void virt_machine_3_1_options (MachineClass *mc) { +static GlobalProperty compat[] = { +HW_COMPAT_3_1 + }; +virt_machine_4_0_options (mc); -compat_props_add (mc->compat_props, - virt_compat_3_1,G_N_ELEMENTS (virt_compat_3_1)); +compat_props_add (mc->compat_props, compat,G_N_ELEMENTS (compat)); } DEFINE_VIRT_MACHINE(3, 1) -static GlobalProperty virt_compat_3_0[] = { -HW_COMPAT_3_0 -}; -static void virt_machine_3_0_options (MachineClass *mc) { +static GlobalProperty compat[] = { +HW_COMPAT_3_0 + }; +virt_machine_3_1_options (mc); -compat_props_add (mc->compat_props, - virt_compat_3_0,G_N_ELEMENTS (virt_compat_3_0)); +compat_props_add (mc->compat_props, compat,G_N_ELEMENTS (compat)); } DEFINE_VIRT_MACHINE(3, 0) -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)); +static GlobalProperty compat[] = { +HW_COMPAT_2_12 + };virt_machine_3_0_options (mc); -compat_props_add (mc->compat_props, - virt_compat_2_12,G_N_ELEMENTS (virt_compat_2_12)); +compat_props_add (mc->compat_props, compat,G_N_ELEMENTS (compat)); vmc->no_highmem_ecam = true; mc->max_cpus =255 ; } DEFINE_VIRT_MACHINE(2, 12) -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)); +static GlobalProperty compat[] = { +HW_COMPAT_2_11 + };virt_machine_2_12_options (mc); -compat_props_add (mc->compat_props, - virt_compat_2_11,G_N_ELEMENTS (virt_compat_2_11)); +compat_props_add (mc->compat_props, compat,G_N_ELEMENTS (compat)); vmc->smbios_old_sys_ver = true; } DEFINE_VIRT_MACHINE(2, 11) -static GlobalProperty virt_compat_2_10[] = { -HW_COMPAT_2_10 -}; -static void virt_machine_2_10_options (MachineClass *mc) { +static GlobalProperty compat[] = { +HW_COMPAT_2_10 + }; +virt_machine_2_11_options (mc); -compat_props_add (mc->compat_props, - virt_compat_2_10,G_N_ELEMENTS (virt_compat_2_10)); +compat_props_add (mc->compat_props, compat,G_N_ELEMENTS (compat));/* before 2.11 we never faulted accesses to bad addresses */ mc->ignore_memory_transaction_failures = true; } DEFINE_VIRT_MACHINE(2, 10) -static GlobalProperty virt_compat_2_9[] = { -HW_COMPAT_2_9 -}; -static void virt_machine_2_9_options (MachineClass *mc) { +static GlobalProperty compat[] = { +HW_COMPAT_2_9 + }; +virt_machine_2_10_options (mc); -compat_props_add (mc->compat_props, - virt_compat_2_9,G_N_ELEMENTS (virt_compat_2_9)); +compat_props_add (mc->compat_props, compat,G_N_ELEMENTS (compat)); } DEFINE_VIRT_MACHINE(2, 9) -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)); +static GlobalProperty compat[] = { +HW_COMPAT_2_8 + };virt_machine_2_9_options (mc); -compat_props_add (mc->compat_props, - virt_compat_2_8,G_N_ELEMENTS (virt_compat_2_8)); +compat_props_add (mc->compat_props, compat,G_N_ELEMENTS (compat));/* For 2.8 and earlier we falsely claimed in the DT that * our timers were edge-triggered, not level-triggered. */
@@ -1971,17 +1961,15 @@ static void virt_machine_2_8_options(MachineClass *mc) } DEFINE_VIRT_MACHINE(2, 8) -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)); +static GlobalProperty compat[] = { +HW_COMPAT_2_7 + };virt_machine_2_8_options (mc); -compat_props_add (mc->compat_props, - virt_compat_2_7,G_N_ELEMENTS (virt_compat_2_7)); +compat_props_add (mc->compat_props, compat,G_N_ELEMENTS (compat));/* ITS was introduced with 2.8 */ vmc->no_its = true;/* Stick with 1K pages for migration compatibility */
@@ -1989,17 +1977,15 @@ static void virt_machine_2_7_options(MachineClass *mc) } DEFINE_VIRT_MACHINE(2, 7) -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)); +static GlobalProperty compat[] = { +HW_COMPAT_2_6 + };virt_machine_2_7_options (mc); -compat_props_add (mc->compat_props, - virt_compat_2_6,G_N_ELEMENTS (virt_compat_2_6)); +compat_props_add (mc->compat_props, compat,G_N_ELEMENTS (compat)); vmc->disallow_affinity_adjustment = true;/* Disable PMU for 2.6 as PMU support was first introduced in 2.7 */ vmc->no_pmu = true;
hw/i386/pc_piix.c +338 -367
993 lines not on this page · raw message
hw/i386/pc_q35.c +55 -66
225 lines not on this page · raw message
hw/ppc/spapr.c +122 -132
414 lines not on this page · raw message
hw/s390x/s390-virtio-ccw.c +112 -127
329 lines not on this page · raw message
hw/xen/xen-common.c +18 -20
@@ -159,27 +159,26 @@ static int xen_init(MachineState *ms)return 0 ; } -static GlobalProperty xen_compat_props[] = { - { - .driver ="migration" , - .property ="store-global-state" , - .value ="off" , - }, - { - .driver ="migration" , - .property ="send-configuration" , - .value ="off" , - }, - { - .driver ="migration" , - .property ="send-section-footer" , - .value ="off" , - } -}; -static void xen_accel_class_init (ObjectClass *oc,void *data) {AccelClass *ac =ACCEL_CLASS (oc); +static GlobalProperty compat[] = { + { + .driver ="migration" , + .property ="store-global-state" , + .value ="off" , + }, + { + .driver ="migration" , + .property ="send-configuration" , + .value ="off" , + }, + { + .driver ="migration" , + .property ="send-section-footer" , + .value ="off" , + } + }; ac->name ="Xen" ; ac->init_machine = xen_init;
@@ -187,8 +186,7 @@ static void xen_accel_class_init(ObjectClass *oc, void *data) ac->allowed = &xen_allowed; ac->compat_props =g_ptr_array_new (); -compat_props_add (ac->compat_props, - xen_compat_props,G_N_ELEMENTS (xen_compat_props)); +compat_props_add (ac->compat_props, compat,G_N_ELEMENTS (compat)); }#define TYPE_XEN_ACCEL ACCEL_CLASS_NAME("xen")
Signature · 1 line
2.20.1.2.gb21ebb671b
Re: [Qemu-devel] [PATCH v7 04/28] machine: move compat properties out of globals
Quoted 12 lines · On Fri, 21 Dec 2018 13:03:46 +0400 Marc-André Lureau…
Move the compat arrays inside functions that use them.
Signed-off-by Marc-André Lureau <[email protected]>--- hw/arm/virt.c | 94 +++-- hw/i386/pc_piix.c | 705 ++++++++++++++++++------------------- hw/i386/pc_q35.c | 121 +++---- hw/ppc/spapr.c | 254 +++++++------ hw/s390x/s390-virtio-ccw.c | 239 ++++++------- hw/xen/xen-common.c | 38 +- 6 files changed, 685 insertions(+), 766 deletions(-)
Re: [Qemu-devel] [PATCH v7 04/28] machine: move compat properties out of globals
In reply to Marc-André LureauQuoted 11 lines · On Fri, 21 Dec 2018 13:03:46 +0400 Marc-André Lureau…
Move the compat arrays inside functions that use them.
Signed-off-by Marc-André Lureau <[email protected]>--- hw/arm/virt.c | 94 +++-- hw/i386/pc_piix.c | 705 ++++++++++++++++++------------------- hw/i386/pc_q35.c | 121 +++---- hw/ppc/spapr.c | 254 +++++++------ hw/s390x/s390-virtio-ccw.c | 239 ++++++------- hw/xen/xen-common.c | 38 +- 6 files changed, 685 insertions(+), 766 deletions(-)
PATCH v7 5/28 hw: remove SET_MACHINE_COMPAT
In reply to Marc-André LureauNo longer needed.
--- include/hw/boards.h | 12 ------------ 1 file changed, 12 deletions(-)
include/hw/boards.h +0 -12
@@ -287,16 +287,4 @@ struct MachineState { } \ type_init(machine_initfn##_register_types) -#define SET_MACHINE_COMPAT (m, compat) \ - do { \ - int i; \ - if (!m->compat_props) { \ - m->compat_props = g_array_new(false, false, sizeof(void *)); \ - } \ - for (i = 0; i < G_N_ELEMENTS(compat); i++) { \ - GlobalProperty *prop = &compat[i]; \ - g_array_append_val(m->compat_props, prop); \ - } \ - } while (0) -#endif
Signature · 1 line
2.20.1.2.gb21ebb671b
Re: [Qemu-devel] [PATCH v7 05/28] hw: remove SET_MACHINE_COMPAT
Quoted 6 lines · On Fri, 21 Dec 2018 13:03:47 +0400 Marc-André Lureau…
No longer needed.
Signed-off-by Marc-André Lureau <[email protected]>--- include/hw/boards.h | 12 ------------ 1 file changed, 12 deletions(-)
Re: [Qemu-devel] [PATCH v7 05/28] hw: remove SET_MACHINE_COMPAT
In reply to Marc-André LureauQuoted 3 lines · On Fri, 21 Dec 2018 13:03:47 +0400 Marc-André Lureau…
No longer needed.
Signed-off-by Marc-André Lureau <[email protected]>
Quoted 25 lines
--- include/hw/boards.h | 12 ------------ 1 file changed, 12 deletions(-)include/hw/boards.h +0
-12@@ -287,16 +287,4 @@ struct MachineState { } \ type_init(machine_initfn##_register_types) -#define SET_MACHINE_COMPAT (m, compat) \ - do { \ - int i; \ - if (!m->compat_props) { \ - m->compat_props = g_array_new(false, false, sizeof(void *)); \ - } \ - for (i = 0; i < G_N_ELEMENTS(compat); i++) { \ - GlobalProperty *prop = &compat[i]; \ - g_array_append_val(m->compat_props, prop); \ - } \ - } while (0) -#endif
PATCH v7 6/28 compat: replace PC_COMPAT_3_1 & HW_COMPAT_3_1 macros
In reply to Marc-André LureauUse static arrays instead.
--- include/hw/boards.h | 3 +++ include/hw/compat.h | 3 --- include/hw/i386/pc.h | 4 ++-- hw/arm/virt.c | 6 +----- hw/core/machine.c | 3 +++ hw/i386/pc.c | 3 +++ hw/i386/pc_piix.c | 7 ++----- hw/i386/pc_q35.c | 7 ++----- hw/ppc/spapr.c | 6 +----- hw/s390x/s390-virtio-ccw.c | 6 +----- 10 files changed, 18 insertions(+), 30 deletions(-)
include/hw/boards.h +3 -0
@@ -287,4 +287,7 @@ struct MachineState { } \ type_init(machine_initfn##_register_types) +extern GlobalProperty hw_compat_3_1[]; +extern const size_t hw_compat_3_1_len; +#endif
include/hw/compat.h +0 -3
@@ -1,9 +1,6 @@#ifndef HW_COMPAT_H #define HW_COMPAT_H -#define HW_COMPAT_3_1 \ -/* empty */ -#define HW_COMPAT_3_0 \/* empty */
include/hw/i386/pc.h +2 -2
@@ -294,8 +294,8 @@ int e820_add_entry(uint64_t, uint64_t, uint32_t);int e820_get_num_entries (void );bool e820_get_entry (int ,uint32_t ,uint64_t *,uint64_t *); -#define PC_COMPAT_3_1 \ - HW_COMPAT_3_1 \ +extern GlobalProperty pc_compat_3_1[]; +extern const size_t pc_compat_3_1_len;#define PC_COMPAT_3_0 \ HW_COMPAT_3_0 \
hw/arm/virt.c +1 -5
@@ -1874,12 +1874,8 @@ DEFINE_VIRT_MACHINE_AS_LATEST(4, 0)static void virt_machine_3_1_options (MachineClass *mc) { -static GlobalProperty compat[] = { -HW_COMPAT_3_1 - }; -virt_machine_4_0_options (mc); -compat_props_add (mc->compat_props, compat,G_N_ELEMENTS (compat)); +compat_props_add (mc->compat_props, hw_compat_3_1, hw_compat_3_1_len); }DEFINE_VIRT_MACHINE (3 ,1 )
hw/core/machine.c +3 -0
@@ -22,6 +22,9 @@#include "qemu/error-report.h" #include "sysemu/qtest.h" +GlobalProperty hw_compat_3_1[] = {}; +const size_t hw_compat_3_1_len =G_N_ELEMENTS (hw_compat_3_1); +static char *machine_get_accel (Object *obj,Error **errp) {MachineState *ms =MACHINE (obj);
hw/i386/pc.c +3 -0
@@ -109,6 +109,9 @@ static struct e820_entry *e820_table;static unsigned e820_entries;struct hpet_fw_config hpet_cfg = {.count =UINT8_MAX }; +GlobalProperty pc_compat_3_1[] = {}; +const size_t pc_compat_3_1_len =G_N_ELEMENTS (pc_compat_3_1); +void gsi_handler (void *opaque,int n,int level) {GSIState *s = opaque;
hw/i386/pc_piix.c +2 -5
@@ -440,14 +440,11 @@ DEFINE_I440FX_MACHINE(v4_0, "pc-i440fx-4.0", NULL,static void pc_i440fx_3_1_machine_options (MachineClass *m) { -static GlobalProperty compat[] = { -PC_COMPAT_3_1 - }; -pc_i440fx_4_0_machine_options (m); m->is_default =0 ; m->alias =NULL ; -compat_props_add (m->compat_props, compat,G_N_ELEMENTS (compat)); +compat_props_add (m->compat_props, hw_compat_3_1, hw_compat_3_1_len); +compat_props_add (m->compat_props, pc_compat_3_1, pc_compat_3_1_len); } DEFINE_I440FX_MACHINE(v3_1, "pc-i440fx-3.1", NULL,
hw/i386/pc_q35.c +2 -5
@@ -322,13 +322,10 @@ DEFINE_Q35_MACHINE(v4_0, "pc-q35-4.0", NULL,static void pc_q35_3_1_machine_options (MachineClass *m) { -static GlobalProperty compat[] = { -PC_COMPAT_3_1 - }; -pc_q35_4_0_machine_options (m); m->alias =NULL ; -compat_props_add (m->compat_props, compat,G_N_ELEMENTS (compat)); +compat_props_add (m->compat_props, hw_compat_3_1, hw_compat_3_1_len); +compat_props_add (m->compat_props, pc_compat_3_1, pc_compat_3_1_len); } DEFINE_Q35_MACHINE(v3_1, "pc-q35-3.1", NULL,
hw/ppc/spapr.c +1 -5
@@ -3965,12 +3965,8 @@ DEFINE_SPAPR_MACHINE(4_0, "4.0", true);*/ static void spapr_machine_3_1_class_options (MachineClass *mc) { -static GlobalProperty compat[] = { -HW_COMPAT_3_1 - }; -spapr_machine_4_0_class_options (mc); -compat_props_add (mc->compat_props, compat,G_N_ELEMENTS (compat)); +compat_props_add (mc->compat_props, hw_compat_3_1, hw_compat_3_1_len); } DEFINE_SPAPR_MACHINE(3_1, "3.1", false);
hw/s390x/s390-virtio-ccw.c +1 -5
@@ -667,12 +667,8 @@ static void ccw_machine_3_1_instance_options(MachineState *machine)static void ccw_machine_3_1_class_options (MachineClass *mc) { -static GlobalProperty compat[] = { -HW_COMPAT_3_1 - }; -ccw_machine_4_0_class_options (mc); -compat_props_add (mc->compat_props, compat,G_N_ELEMENTS (compat)); +compat_props_add (mc->compat_props, hw_compat_3_1, hw_compat_3_1_len); } DEFINE_CCW_MACHINE(3_1, "3.1", false);
Signature · 1 line
2.20.1.2.gb21ebb671b
Re: [Qemu-devel] [PATCH v7 06/28] compat: replace PC_COMPAT_3_1 & HW_COMPAT_3_1 macros
Quoted 4 lines · On Fri, 21 Dec 2018 13:03:48 +0400 Marc-André Lureau…
Use static arrays instead.
Suggested-by Eduardo Habkost <[email protected]>Signed-off-by Marc-André Lureau <[email protected]>
Quoted 12 lines
--- include/hw/boards.h | 3 +++ include/hw/compat.h | 3 --- include/hw/i386/pc.h | 4 ++-- hw/arm/virt.c | 6 +----- hw/core/machine.c | 3 +++ hw/i386/pc.c | 3 +++ hw/i386/pc_piix.c | 7 ++----- hw/i386/pc_q35.c | 7 ++----- hw/ppc/spapr.c | 6 +----- hw/s390x/s390-virtio-ccw.c | 6 +----- 10 files changed, 18 insertions(+), 30 deletions(-)
Re: [Qemu-devel] [PATCH v7 06/28] compat: replace PC_COMPAT_3_1 & HW_COMPAT_3_1 macros
In reply to Marc-André LureauQuoted 4 lines · On Fri, 21 Dec 2018 13:03:48 +0400 Marc-André Lureau…
Use static arrays instead.
Suggested-by Eduardo Habkost <[email protected]>Signed-off-by Marc-André Lureau <[email protected]>
Quoted 177 lines
--- include/hw/boards.h | 3 +++ include/hw/compat.h | 3 --- include/hw/i386/pc.h | 4 ++-- hw/arm/virt.c | 6 +----- hw/core/machine.c | 3 +++ hw/i386/pc.c | 3 +++ hw/i386/pc_piix.c | 7 ++----- hw/i386/pc_q35.c | 7 ++----- hw/ppc/spapr.c | 6 +----- hw/s390x/s390-virtio-ccw.c | 6 +----- 10 files changed, 18 insertions(+), 30 deletions(-)include/hw/boards.h +3
-0@@ -287,4 +287,7 @@ struct MachineState { } \ type_init(machine_initfn##_register_types) +extern GlobalProperty hw_compat_3_1[]; +extern const size_t hw_compat_3_1_len; +#endif include/hw/compat.h +0
-3@@ -1,9 +1,6 @@#ifndef HW_COMPAT_H #define HW_COMPAT_H -#define HW_COMPAT_3_1 \ -/* empty */ -#define HW_COMPAT_3_0 \/* empty */ include/hw/i386/pc.h +2
-2@@ -294,8 +294,8 @@ int e820_add_entry(uint64_t, uint64_t, uint32_t);int e820_get_num_entries (void );bool e820_get_entry (int ,uint32_t ,uint64_t *,uint64_t *); -#define PC_COMPAT_3_1 \ - HW_COMPAT_3_1 \ +extern GlobalProperty pc_compat_3_1[]; +extern const size_t pc_compat_3_1_len;#define PC_COMPAT_3_0 \ HW_COMPAT_3_0 \hw/arm/virt.c +1
-5@@ -1874,12 +1874,8 @@ DEFINE_VIRT_MACHINE_AS_LATEST(4, 0)static void virt_machine_3_1_options (MachineClass *mc) { -static GlobalProperty compat[] = { -HW_COMPAT_3_1 - }; -virt_machine_4_0_options (mc); -compat_props_add (mc->compat_props, compat,G_N_ELEMENTS (compat)); +compat_props_add (mc->compat_props, hw_compat_3_1, hw_compat_3_1_len); }DEFINE_VIRT_MACHINE (3 ,1 )hw/core/machine.c +3
-0@@ -22,6 +22,9 @@#include "qemu/error-report.h" #include "sysemu/qtest.h" +GlobalProperty hw_compat_3_1[] = {}; +const size_t hw_compat_3_1_len =G_N_ELEMENTS (hw_compat_3_1); +static char *machine_get_accel (Object *obj,Error **errp) {MachineState *ms =MACHINE (obj);hw/i386/pc.c +3
-0@@ -109,6 +109,9 @@ static struct e820_entry *e820_table;static unsigned e820_entries;struct hpet_fw_config hpet_cfg = {.count =UINT8_MAX }; +GlobalProperty pc_compat_3_1[] = {}; +const size_t pc_compat_3_1_len =G_N_ELEMENTS (pc_compat_3_1); +void gsi_handler (void *opaque,int n,int level) {GSIState *s = opaque;hw/i386/pc_piix.c +2
-5@@ -440,14 +440,11 @@ DEFINE_I440FX_MACHINE(v4_0, "pc-i440fx-4.0", NULL,static void pc_i440fx_3_1_machine_options (MachineClass *m) { -static GlobalProperty compat[] = { -PC_COMPAT_3_1 - }; -pc_i440fx_4_0_machine_options (m); m->is_default =0 ; m->alias =NULL ; -compat_props_add (m->compat_props, compat,G_N_ELEMENTS (compat)); +compat_props_add (m->compat_props, hw_compat_3_1, hw_compat_3_1_len); +compat_props_add (m->compat_props, pc_compat_3_1, pc_compat_3_1_len); } DEFINE_I440FX_MACHINE(v3_1, "pc-i440fx-3.1", NULL,hw/i386/pc_q35.c +2
-5@@ -322,13 +322,10 @@ DEFINE_Q35_MACHINE(v4_0, "pc-q35-4.0", NULL,static void pc_q35_3_1_machine_options (MachineClass *m) { -static GlobalProperty compat[] = { -PC_COMPAT_3_1 - }; -pc_q35_4_0_machine_options (m); m->alias =NULL ; -compat_props_add (m->compat_props, compat,G_N_ELEMENTS (compat)); +compat_props_add (m->compat_props, hw_compat_3_1, hw_compat_3_1_len); +compat_props_add (m->compat_props, pc_compat_3_1, pc_compat_3_1_len); } DEFINE_Q35_MACHINE(v3_1, "pc-q35-3.1", NULL,hw/ppc/spapr.c +1
-5@@ -3965,12 +3965,8 @@ DEFINE_SPAPR_MACHINE(4_0, "4.0", true);*/ static void spapr_machine_3_1_class_options (MachineClass *mc) { -static GlobalProperty compat[] = { -HW_COMPAT_3_1 - }; -spapr_machine_4_0_class_options (mc); -compat_props_add (mc->compat_props, compat,G_N_ELEMENTS (compat)); +compat_props_add (mc->compat_props, hw_compat_3_1, hw_compat_3_1_len); } DEFINE_SPAPR_MACHINE(3_1, "3.1", false);hw/s390x/s390-virtio-ccw.c +1
-5@@ -667,12 +667,8 @@ static void ccw_machine_3_1_instance_options(MachineState *machine)static void ccw_machine_3_1_class_options (MachineClass *mc) { -static GlobalProperty compat[] = { -HW_COMPAT_3_1 - }; -ccw_machine_4_0_class_options (mc); -compat_props_add (mc->compat_props, compat,G_N_ELEMENTS (compat)); +compat_props_add (mc->compat_props, hw_compat_3_1, hw_compat_3_1_len); } DEFINE_CCW_MACHINE(3_1, "3.1", false);
PATCH v7 7/28 compat: replace PC_COMPAT_3_0 & HW_COMPAT_3_0 macros
In reply to Marc-André LureauUse static arrays instead.
--- include/hw/boards.h | 3 +++ include/hw/compat.h | 3 --- include/hw/i386/pc.h | 17 ++--------------- hw/arm/virt.c | 6 +----- hw/core/machine.c | 3 +++ hw/i386/pc.c | 17 +++++++++++++++++ hw/i386/pc_piix.c | 7 ++----- hw/i386/pc_q35.c | 7 ++----- hw/ppc/spapr.c | 5 +---- hw/s390x/s390-virtio-ccw.c | 5 +---- 10 files changed, 32 insertions(+), 41 deletions(-)
include/hw/boards.h +3 -0
@@ -290,4 +290,7 @@ struct MachineState {extern GlobalProperty hw_compat_3_1[];extern const size_t hw_compat_3_1_len; +extern GlobalProperty hw_compat_3_0[]; +extern const size_t hw_compat_3_0_len; +#endif
include/hw/compat.h +0 -3
@@ -1,9 +1,6 @@#ifndef HW_COMPAT_H #define HW_COMPAT_H -#define HW_COMPAT_3_0 \ -/* empty */ -#define HW_COMPAT_2_12 \ {\ .driver = "migration",\
include/hw/i386/pc.h +2 -15
@@ -297,21 +297,8 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *);extern GlobalProperty pc_compat_3_1[];extern const size_t pc_compat_3_1_len; -#define PC_COMPAT_3_0 \ - HW_COMPAT_3_0 \ - {\ - .driver = TYPE_X86_CPU,\ - .property = "x-hv-synic-kvm-only",\ - .value = "on",\ - },{\ - .driver = "Skylake-Server" "-" TYPE_X86_CPU,\ - .property = "pku",\ - .value = "off",\ - },{\ - .driver = "Skylake-Server-IBRS" "-" TYPE_X86_CPU,\ - .property = "pku",\ - .value = "off",\ - }, +extern GlobalProperty pc_compat_3_0[]; +extern const size_t pc_compat_3_0_len;#define PC_COMPAT_2_12 \ HW_COMPAT_2_12 \
hw/arm/virt.c +1 -5
@@ -1881,12 +1881,8 @@ DEFINE_VIRT_MACHINE(3, 1)static void virt_machine_3_0_options (MachineClass *mc) { -static GlobalProperty compat[] = { -HW_COMPAT_3_0 - }; -virt_machine_3_1_options (mc); -compat_props_add (mc->compat_props, compat,G_N_ELEMENTS (compat)); +compat_props_add (mc->compat_props, hw_compat_3_0, hw_compat_3_0_len); }DEFINE_VIRT_MACHINE (3 ,0 )
hw/core/machine.c +3 -0
@@ -25,6 +25,9 @@GlobalProperty hw_compat_3_1[] = {};const size_t hw_compat_3_1_len =G_N_ELEMENTS (hw_compat_3_1); +GlobalProperty hw_compat_3_0[] = {}; +const size_t hw_compat_3_0_len =G_N_ELEMENTS (hw_compat_3_0); +static char *machine_get_accel (Object *obj,Error **errp) {MachineState *ms =MACHINE (obj);
hw/i386/pc.c +17 -0
@@ -112,6 +112,23 @@ struct hpet_fw_config hpet_cfg = {.count = UINT8_MAX};GlobalProperty pc_compat_3_1[] = {};const size_t pc_compat_3_1_len =G_N_ELEMENTS (pc_compat_3_1); +GlobalProperty pc_compat_3_0[] = { + { + .driver =TYPE_X86_CPU , + .property ="x-hv-synic-kvm-only" , + .value ="on" , + },{ + .driver ="Skylake-Server" "-" TYPE_X86_CPU , + .property ="pku" , + .value ="off" , + },{ + .driver ="Skylake-Server-IBRS" "-" TYPE_X86_CPU , + .property ="pku" , + .value ="off" , + }, +}; +const size_t pc_compat_3_0_len =G_N_ELEMENTS (pc_compat_3_0); +void gsi_handler (void *opaque,int n,int level) {GSIState *s = opaque;
hw/i386/pc_piix.c +2 -5
@@ -452,12 +452,9 @@ DEFINE_I440FX_MACHINE(v3_1, "pc-i440fx-3.1", NULL,static void pc_i440fx_3_0_machine_options (MachineClass *m) { -static GlobalProperty compat[] = { -PC_COMPAT_3_0 - }; -pc_i440fx_3_1_machine_options (m); -compat_props_add (m->compat_props, compat,G_N_ELEMENTS (compat)); +compat_props_add (m->compat_props, hw_compat_3_0, hw_compat_3_0_len); +compat_props_add (m->compat_props, pc_compat_3_0, pc_compat_3_0_len); } DEFINE_I440FX_MACHINE(v3_0, "pc-i440fx-3.0", NULL,
hw/i386/pc_q35.c +2 -5
@@ -333,12 +333,9 @@ DEFINE_Q35_MACHINE(v3_1, "pc-q35-3.1", NULL,static void pc_q35_3_0_machine_options (MachineClass *m) { -static GlobalProperty compat[] = { -PC_COMPAT_3_0 - }; -pc_q35_3_1_machine_options (m); -compat_props_add (m->compat_props, compat,G_N_ELEMENTS (compat)); +compat_props_add (m->compat_props, hw_compat_3_0, hw_compat_3_0_len); +compat_props_add (m->compat_props, pc_compat_3_0, pc_compat_3_0_len); } DEFINE_Q35_MACHINE(v3_0, "pc-q35-3.0", NULL,
hw/ppc/spapr.c +1 -4
@@ -3978,12 +3978,9 @@ DEFINE_SPAPR_MACHINE(3_1, "3.1", false);static void spapr_machine_3_0_class_options (MachineClass *mc) {sPAPRMachineClass *smc =SPAPR_MACHINE_CLASS (mc); -static GlobalProperty compat[] = { -HW_COMPAT_3_0 - };spapr_machine_3_1_class_options (mc); -compat_props_add (mc->compat_props, compat,G_N_ELEMENTS (compat)); +compat_props_add (mc->compat_props, hw_compat_3_0, hw_compat_3_0_len); smc->legacy_irq_allocation = true; smc->irq = &spapr_irq_xics_legacy;
hw/s390x/s390-virtio-ccw.c +1 -4
@@ -680,13 +680,10 @@ static void ccw_machine_3_0_instance_options(MachineState *machine)static void ccw_machine_3_0_class_options (MachineClass *mc) {S390CcwMachineClass *s390mc =S390_MACHINE_CLASS (mc); -static GlobalProperty compat[] = { -HW_COMPAT_3_0 - }; s390mc->hpage_1m_allowed = false;ccw_machine_3_1_class_options (mc); -compat_props_add (mc->compat_props, compat,G_N_ELEMENTS (compat)); +compat_props_add (mc->compat_props, hw_compat_3_0, hw_compat_3_0_len); } DEFINE_CCW_MACHINE(3_0, "3.0", false);
Signature · 1 line
2.20.1.2.gb21ebb671b
Re: [Qemu-devel] [PATCH v7 07/28] compat: replace PC_COMPAT_3_0 & HW_COMPAT_3_0 macros
Quoted 4 lines · On Fri, 21 Dec 2018 13:03:49 +0400 Marc-André Lureau…
Use static arrays instead.
Suggested-by Eduardo Habkost <[email protected]>Signed-off-by Marc-André Lureau <[email protected]>
Quoted 12 lines
--- include/hw/boards.h | 3 +++ include/hw/compat.h | 3 --- include/hw/i386/pc.h | 17 ++--------------- hw/arm/virt.c | 6 +----- hw/core/machine.c | 3 +++ hw/i386/pc.c | 17 +++++++++++++++++ hw/i386/pc_piix.c | 7 ++----- hw/i386/pc_q35.c | 7 ++----- hw/ppc/spapr.c | 5 +---- hw/s390x/s390-virtio-ccw.c | 5 +---- 10 files changed, 32 insertions(+), 41 deletions(-)
Re: [Qemu-devel] [PATCH v7 07/28] compat: replace PC_COMPAT_3_0 & HW_COMPAT_3_0 macros
In reply to Marc-André LureauQuoted 4 lines · On Fri, 21 Dec 2018 13:03:49 +0400 Marc-André Lureau…
Use static arrays instead.
Suggested-by Eduardo Habkost <[email protected]>Signed-off-by Marc-André Lureau <[email protected]>
Quoted 202 lines
--- include/hw/boards.h | 3 +++ include/hw/compat.h | 3 --- include/hw/i386/pc.h | 17 ++--------------- hw/arm/virt.c | 6 +----- hw/core/machine.c | 3 +++ hw/i386/pc.c | 17 +++++++++++++++++ hw/i386/pc_piix.c | 7 ++----- hw/i386/pc_q35.c | 7 ++----- hw/ppc/spapr.c | 5 +---- hw/s390x/s390-virtio-ccw.c | 5 +---- 10 files changed, 32 insertions(+), 41 deletions(-)include/hw/boards.h +3
-0@@ -290,4 +290,7 @@ struct MachineState {extern GlobalProperty hw_compat_3_1[];extern const size_t hw_compat_3_1_len; +extern GlobalProperty hw_compat_3_0[]; +extern const size_t hw_compat_3_0_len; +#endif include/hw/compat.h +0
-3@@ -1,9 +1,6 @@#ifndef HW_COMPAT_H #define HW_COMPAT_H -#define HW_COMPAT_3_0 \ -/* empty */ -#define HW_COMPAT_2_12 \ {\ .driver = "migration",\include/hw/i386/pc.h +2
-15@@ -297,21 +297,8 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *);extern GlobalProperty pc_compat_3_1[];extern const size_t pc_compat_3_1_len; -#define PC_COMPAT_3_0 \ - HW_COMPAT_3_0 \ - {\ - .driver = TYPE_X86_CPU,\ - .property = "x-hv-synic-kvm-only",\ - .value = "on",\ - },{\ - .driver = "Skylake-Server" "-" TYPE_X86_CPU,\ - .property = "pku",\ - .value = "off",\ - },{\ - .driver = "Skylake-Server-IBRS" "-" TYPE_X86_CPU,\ - .property = "pku",\ - .value = "off",\ - }, +extern GlobalProperty pc_compat_3_0[]; +extern const size_t pc_compat_3_0_len;#define PC_COMPAT_2_12 \ HW_COMPAT_2_12 \hw/arm/virt.c +1
-5@@ -1881,12 +1881,8 @@ DEFINE_VIRT_MACHINE(3, 1)static void virt_machine_3_0_options (MachineClass *mc) { -static GlobalProperty compat[] = { -HW_COMPAT_3_0 - }; -virt_machine_3_1_options (mc); -compat_props_add (mc->compat_props, compat,G_N_ELEMENTS (compat)); +compat_props_add (mc->compat_props, hw_compat_3_0, hw_compat_3_0_len); }DEFINE_VIRT_MACHINE (3 ,0 )hw/core/machine.c +3
-0@@ -25,6 +25,9 @@GlobalProperty hw_compat_3_1[] = {};const size_t hw_compat_3_1_len =G_N_ELEMENTS (hw_compat_3_1); +GlobalProperty hw_compat_3_0[] = {}; +const size_t hw_compat_3_0_len =G_N_ELEMENTS (hw_compat_3_0); +static char *machine_get_accel (Object *obj,Error **errp) {MachineState *ms =MACHINE (obj);hw/i386/pc.c +17
-0@@ -112,6 +112,23 @@ struct hpet_fw_config hpet_cfg = {.count = UINT8_MAX};GlobalProperty pc_compat_3_1[] = {};const size_t pc_compat_3_1_len =G_N_ELEMENTS (pc_compat_3_1); +GlobalProperty pc_compat_3_0[] = { + { + .driver =TYPE_X86_CPU , + .property ="x-hv-synic-kvm-only" , + .value ="on" , + },{ + .driver ="Skylake-Server" "-" TYPE_X86_CPU , + .property ="pku" , + .value ="off" , + },{ + .driver ="Skylake-Server-IBRS" "-" TYPE_X86_CPU , + .property ="pku" , + .value ="off" , + }, +}; +const size_t pc_compat_3_0_len =G_N_ELEMENTS (pc_compat_3_0); +void gsi_handler (void *opaque,int n,int level) {GSIState *s = opaque;hw/i386/pc_piix.c +2
-5@@ -452,12 +452,9 @@ DEFINE_I440FX_MACHINE(v3_1, "pc-i440fx-3.1", NULL,static void pc_i440fx_3_0_machine_options (MachineClass *m) { -static GlobalProperty compat[] = { -PC_COMPAT_3_0 - }; -pc_i440fx_3_1_machine_options (m); -compat_props_add (m->compat_props, compat,G_N_ELEMENTS (compat)); +compat_props_add (m->compat_props, hw_compat_3_0, hw_compat_3_0_len); +compat_props_add (m->compat_props, pc_compat_3_0, pc_compat_3_0_len); } DEFINE_I440FX_MACHINE(v3_0, "pc-i440fx-3.0", NULL,hw/i386/pc_q35.c +2
-5@@ -333,12 +333,9 @@ DEFINE_Q35_MACHINE(v3_1, "pc-q35-3.1", NULL,static void pc_q35_3_0_machine_options (MachineClass *m) { -static GlobalProperty compat[] = { -PC_COMPAT_3_0 - }; -pc_q35_3_1_machine_options (m); -compat_props_add (m->compat_props, compat,G_N_ELEMENTS (compat)); +compat_props_add (m->compat_props, hw_compat_3_0, hw_compat_3_0_len); +compat_props_add (m->compat_props, pc_compat_3_0, pc_compat_3_0_len); } DEFINE_Q35_MACHINE(v3_0, "pc-q35-3.0", NULL,hw/ppc/spapr.c +1
-4@@ -3978,12 +3978,9 @@ DEFINE_SPAPR_MACHINE(3_1, "3.1", false);static void spapr_machine_3_0_class_options (MachineClass *mc) {sPAPRMachineClass *smc =SPAPR_MACHINE_CLASS (mc); -static GlobalProperty compat[] = { -HW_COMPAT_3_0 - };spapr_machine_3_1_class_options (mc); -compat_props_add (mc->compat_props, compat,G_N_ELEMENTS (compat)); +compat_props_add (mc->compat_props, hw_compat_3_0, hw_compat_3_0_len); smc->legacy_irq_allocation = true; smc->irq = &spapr_irq_xics_legacy;hw/s390x/s390-virtio-ccw.c +1
-4@@ -680,13 +680,10 @@ static void ccw_machine_3_0_instance_options(MachineState *machine)static void ccw_machine_3_0_class_options (MachineClass *mc) {S390CcwMachineClass *s390mc =S390_MACHINE_CLASS (mc); -static GlobalProperty compat[] = { -HW_COMPAT_3_0 - }; s390mc->hpage_1m_allowed = false;ccw_machine_3_1_class_options (mc); -compat_props_add (mc->compat_props, compat,G_N_ELEMENTS (compat)); +compat_props_add (mc->compat_props, hw_compat_3_0, hw_compat_3_0_len); } DEFINE_CCW_MACHINE(3_0, "3.0", false);
PATCH v7 8/28 compat: replace PC_COMPAT_2_12 & HW_COMPAT_2_12 macros
In reply to Marc-André LureauUse static arrays instead.
--- include/hw/boards.h | 3 +++ include/hw/compat.h | 27 --------------------------- include/hw/i386/pc.h | 21 ++------------------- hw/arm/virt.c | 5 +---- hw/core/machine.c | 29 +++++++++++++++++++++++++++++ hw/i386/pc.c | 21 +++++++++++++++++++++ hw/i386/pc_piix.c | 7 ++----- hw/i386/pc_q35.c | 7 ++----- hw/ppc/spapr.c | 2 +- hw/s390x/s390-virtio-ccw.c | 6 +----- 10 files changed, 62 insertions(+), 66 deletions(-)
include/hw/boards.h +3 -0
@@ -293,4 +293,7 @@ extern const size_t hw_compat_3_1_len;extern GlobalProperty hw_compat_3_0[];extern const size_t hw_compat_3_0_len; +extern GlobalProperty hw_compat_2_12[]; +extern const size_t hw_compat_2_12_len; +#endif
include/hw/compat.h +0 -27
@@ -1,33 +1,6 @@#ifndef HW_COMPAT_H #define HW_COMPAT_H -#define HW_COMPAT_2_12 \ - {\ - .driver = "migration",\ - .property = "decompress-error-check",\ - .value = "off",\ - },{\ - .driver = "hda-audio",\ - .property = "use-timer",\ - .value = "false",\ - },{\ - .driver = "cirrus-vga",\ - .property = "global-vmstate",\ - .value = "true",\ - },{\ - .driver = "VGA",\ - .property = "global-vmstate",\ - .value = "true",\ - },{\ - .driver = "vmware-svga",\ - .property = "global-vmstate",\ - .value = "true",\ - },{\ - .driver = "qxl-vga",\ - .property = "global-vmstate",\ - .value = "true",\ - }, -#define HW_COMPAT_2_11 \ {\ .driver = "hpet",\
include/hw/i386/pc.h +2 -19
@@ -300,25 +300,8 @@ extern const size_t pc_compat_3_1_len;extern GlobalProperty pc_compat_3_0[];extern const size_t pc_compat_3_0_len; -#define PC_COMPAT_2_12 \ - HW_COMPAT_2_12 \ - {\ - .driver = TYPE_X86_CPU,\ - .property = "legacy-cache",\ - .value = "on",\ - },{\ - .driver = TYPE_X86_CPU,\ - .property = "topoext",\ - .value = "off",\ - },{\ - .driver = "EPYC-" TYPE_X86_CPU,\ - .property = "xlevel",\ - .value = stringify(0x8000000a),\ - },{\ - .driver = "EPYC-IBPB-" TYPE_X86_CPU,\ - .property = "xlevel",\ - .value = stringify(0x8000000a),\ - }, +extern GlobalProperty pc_compat_2_12[]; +extern const size_t pc_compat_2_12_len;#define PC_COMPAT_2_11 \ HW_COMPAT_2_11 \
hw/arm/virt.c +1 -4
@@ -1889,12 +1889,9 @@ DEFINE_VIRT_MACHINE(3, 0)static void virt_machine_2_12_options (MachineClass *mc) {VirtMachineClass *vmc =VIRT_MACHINE_CLASS (OBJECT_CLASS (mc)); -static GlobalProperty compat[] = { -HW_COMPAT_2_12 - };virt_machine_3_0_options (mc); -compat_props_add (mc->compat_props, compat,G_N_ELEMENTS (compat)); +compat_props_add (mc->compat_props, hw_compat_2_12, hw_compat_2_12_len); vmc->no_highmem_ecam = true; mc->max_cpus =255 ; }
hw/core/machine.c +29 -0
@@ -28,6 +28,35 @@ const size_t hw_compat_3_1_len = G_N_ELEMENTS(hw_compat_3_1);GlobalProperty hw_compat_3_0[] = {};const size_t hw_compat_3_0_len =G_N_ELEMENTS (hw_compat_3_0); +GlobalProperty hw_compat_2_12[] = { + { + .driver ="migration" , + .property ="decompress-error-check" , + .value ="off" , + },{ + .driver ="hda-audio" , + .property ="use-timer" , + .value ="false" , + },{ + .driver ="cirrus-vga" , + .property ="global-vmstate" , + .value ="true" , + },{ + .driver ="VGA" , + .property ="global-vmstate" , + .value ="true" , + },{ + .driver ="vmware-svga" , + .property ="global-vmstate" , + .value ="true" , + },{ + .driver ="qxl-vga" , + .property ="global-vmstate" , + .value ="true" , + }, +}; +const size_t hw_compat_2_12_len =G_N_ELEMENTS (hw_compat_2_12); +static char *machine_get_accel (Object *obj,Error **errp) {MachineState *ms =MACHINE (obj);
hw/i386/pc.c +21 -0
@@ -129,6 +129,27 @@ GlobalProperty pc_compat_3_0[] = { };const size_t pc_compat_3_0_len =G_N_ELEMENTS (pc_compat_3_0); +GlobalProperty pc_compat_2_12[] = { + { + .driver =TYPE_X86_CPU , + .property ="legacy-cache" , + .value ="on" , + },{ + .driver =TYPE_X86_CPU , + .property ="topoext" , + .value ="off" , + },{ + .driver ="EPYC-" TYPE_X86_CPU , + .property ="xlevel" , + .value =stringify (0x8000000a ), + },{ + .driver ="EPYC-IBPB-" TYPE_X86_CPU , + .property ="xlevel" , + .value =stringify (0x8000000a ), + }, +}; +const size_t pc_compat_2_12_len =G_N_ELEMENTS (pc_compat_2_12); +void gsi_handler (void *opaque,int n,int level) {GSIState *s = opaque;
hw/i386/pc_piix.c +2 -5
@@ -462,12 +462,9 @@ DEFINE_I440FX_MACHINE(v3_0, "pc-i440fx-3.0", NULL,static void pc_i440fx_2_12_machine_options (MachineClass *m) { -static GlobalProperty compat[] = { -PC_COMPAT_2_12 - }; -pc_i440fx_3_0_machine_options (m); -compat_props_add (m->compat_props, compat,G_N_ELEMENTS (compat)); +compat_props_add (m->compat_props, hw_compat_2_12, hw_compat_2_12_len); +compat_props_add (m->compat_props, pc_compat_2_12, pc_compat_2_12_len); } DEFINE_I440FX_MACHINE(v2_12, "pc-i440fx-2.12", NULL,
hw/i386/pc_q35.c +2 -5
@@ -343,12 +343,9 @@ DEFINE_Q35_MACHINE(v3_0, "pc-q35-3.0", NULL,static void pc_q35_2_12_machine_options (MachineClass *m) { -static GlobalProperty compat[] = { -PC_COMPAT_2_12 - }; -pc_q35_3_0_machine_options (m); -compat_props_add (m->compat_props, compat,G_N_ELEMENTS (compat)); +compat_props_add (m->compat_props, hw_compat_2_12, hw_compat_2_12_len); +compat_props_add (m->compat_props, pc_compat_2_12, pc_compat_2_12_len); } DEFINE_Q35_MACHINE(v2_12, "pc-q35-2.12", NULL,
hw/ppc/spapr.c +1 -1
@@ -3995,7 +3995,6 @@ static void spapr_machine_2_12_class_options(MachineClass *mc) {sPAPRMachineClass *smc =SPAPR_MACHINE_CLASS (mc);static GlobalProperty compat[] = { -HW_COMPAT_2_12 { .driver =TYPE_POWERPC_CPU , .property ="pre-3.0-migration" ,
@@ -4009,6 +4008,7 @@ static void spapr_machine_2_12_class_options(MachineClass *mc) };spapr_machine_3_0_class_options (mc); +compat_props_add (mc->compat_props, hw_compat_2_12, hw_compat_2_12_len);compat_props_add (mc->compat_props, compat,G_N_ELEMENTS (compat));/* We depend on kvm_enabled() to choose a default value for the
hw/s390x/s390-virtio-ccw.c +1 -5
@@ -696,12 +696,8 @@ static void ccw_machine_2_12_instance_options(MachineState *machine)static void ccw_machine_2_12_class_options (MachineClass *mc) { -static GlobalProperty compat[] = { -HW_COMPAT_2_12 - }; -ccw_machine_3_0_class_options (mc); -compat_props_add (mc->compat_props, compat,G_N_ELEMENTS (compat)); +compat_props_add (mc->compat_props, hw_compat_2_12, hw_compat_2_12_len); } DEFINE_CCW_MACHINE(2_12, "2.12", false);
Signature · 1 line
2.20.1.2.gb21ebb671b
Re: [Qemu-devel] [PATCH v7 08/28] compat: replace PC_COMPAT_2_12 & HW_COMPAT_2_12 macros
Quoted 4 lines · On Fri, 21 Dec 2018 13:03:50 +0400 Marc-André Lureau…
Use static arrays instead.
Suggested-by Eduardo Habkost <[email protected]>Signed-off-by Marc-André Lureau <[email protected]>
Quoted 12 lines
--- include/hw/boards.h | 3 +++ include/hw/compat.h | 27 --------------------------- include/hw/i386/pc.h | 21 ++------------------- hw/arm/virt.c | 5 +---- hw/core/machine.c | 29 +++++++++++++++++++++++++++++ hw/i386/pc.c | 21 +++++++++++++++++++++ hw/i386/pc_piix.c | 7 ++----- hw/i386/pc_q35.c | 7 ++----- hw/ppc/spapr.c | 2 +- hw/s390x/s390-virtio-ccw.c | 6 +----- 10 files changed, 62 insertions(+), 66 deletions(-)
Re: [Qemu-devel] [PATCH v7 08/28] compat: replace PC_COMPAT_2_12 & HW_COMPAT_2_12 macros
In reply to Marc-André LureauQuoted 4 lines · On Fri, 21 Dec 2018 13:03:50 +0400 Marc-André Lureau…
Use static arrays instead.
Suggested-by Eduardo Habkost <[email protected]>Signed-off-by Marc-André Lureau <[email protected]>
Quoted 261 lines
--- include/hw/boards.h | 3 +++ include/hw/compat.h | 27 --------------------------- include/hw/i386/pc.h | 21 ++------------------- hw/arm/virt.c | 5 +---- hw/core/machine.c | 29 +++++++++++++++++++++++++++++ hw/i386/pc.c | 21 +++++++++++++++++++++ hw/i386/pc_piix.c | 7 ++----- hw/i386/pc_q35.c | 7 ++----- hw/ppc/spapr.c | 2 +- hw/s390x/s390-virtio-ccw.c | 6 +----- 10 files changed, 62 insertions(+), 66 deletions(-)include/hw/boards.h +3
-0@@ -293,4 +293,7 @@ extern const size_t hw_compat_3_1_len;extern GlobalProperty hw_compat_3_0[];extern const size_t hw_compat_3_0_len; +extern GlobalProperty hw_compat_2_12[]; +extern const size_t hw_compat_2_12_len; +#endif include/hw/compat.h +0
-27@@ -1,33 +1,6 @@#ifndef HW_COMPAT_H #define HW_COMPAT_H -#define HW_COMPAT_2_12 \ - {\ - .driver = "migration",\ - .property = "decompress-error-check",\ - .value = "off",\ - },{\ - .driver = "hda-audio",\ - .property = "use-timer",\ - .value = "false",\ - },{\ - .driver = "cirrus-vga",\ - .property = "global-vmstate",\ - .value = "true",\ - },{\ - .driver = "VGA",\ - .property = "global-vmstate",\ - .value = "true",\ - },{\ - .driver = "vmware-svga",\ - .property = "global-vmstate",\ - .value = "true",\ - },{\ - .driver = "qxl-vga",\ - .property = "global-vmstate",\ - .value = "true",\ - }, -#define HW_COMPAT_2_11 \ {\ .driver = "hpet",\include/hw/i386/pc.h +2
-19@@ -300,25 +300,8 @@ extern const size_t pc_compat_3_1_len;extern GlobalProperty pc_compat_3_0[];extern const size_t pc_compat_3_0_len; -#define PC_COMPAT_2_12 \ - HW_COMPAT_2_12 \ - {\ - .driver = TYPE_X86_CPU,\ - .property = "legacy-cache",\ - .value = "on",\ - },{\ - .driver = TYPE_X86_CPU,\ - .property = "topoext",\ - .value = "off",\ - },{\ - .driver = "EPYC-" TYPE_X86_CPU,\ - .property = "xlevel",\ - .value = stringify(0x8000000a),\ - },{\ - .driver = "EPYC-IBPB-" TYPE_X86_CPU,\ - .property = "xlevel",\ - .value = stringify(0x8000000a),\ - }, +extern GlobalProperty pc_compat_2_12[]; +extern const size_t pc_compat_2_12_len;#define PC_COMPAT_2_11 \ HW_COMPAT_2_11 \hw/arm/virt.c +1
-4@@ -1889,12 +1889,9 @@ DEFINE_VIRT_MACHINE(3, 0)static void virt_machine_2_12_options (MachineClass *mc) {VirtMachineClass *vmc =VIRT_MACHINE_CLASS (OBJECT_CLASS (mc)); -static GlobalProperty compat[] = { -HW_COMPAT_2_12 - };virt_machine_3_0_options (mc); -compat_props_add (mc->compat_props, compat,G_N_ELEMENTS (compat)); +compat_props_add (mc->compat_props, hw_compat_2_12, hw_compat_2_12_len); vmc->no_highmem_ecam = true; mc->max_cpus =255 ; }hw/core/machine.c +29
-0@@ -28,6 +28,35 @@ const size_t hw_compat_3_1_len = G_N_ELEMENTS(hw_compat_3_1);GlobalProperty hw_compat_3_0[] = {};const size_t hw_compat_3_0_len =G_N_ELEMENTS (hw_compat_3_0); +GlobalProperty hw_compat_2_12[] = { + { + .driver ="migration" , + .property ="decompress-error-check" , + .value ="off" , + },{ + .driver ="hda-audio" , + .property ="use-timer" , + .value ="false" , + },{ + .driver ="cirrus-vga" , + .property ="global-vmstate" , + .value ="true" , + },{ + .driver ="VGA" , + .property ="global-vmstate" , + .value ="true" , + },{ + .driver ="vmware-svga" , + .property ="global-vmstate" , + .value ="true" , + },{ + .driver ="qxl-vga" , + .property ="global-vmstate" , + .value ="true" , + }, +}; +const size_t hw_compat_2_12_len =G_N_ELEMENTS (hw_compat_2_12); +static char *machine_get_accel (Object *obj,Error **errp) {MachineState *ms =MACHINE (obj);hw/i386/pc.c +21
-0@@ -129,6 +129,27 @@ GlobalProperty pc_compat_3_0[] = { };const size_t pc_compat_3_0_len =G_N_ELEMENTS (pc_compat_3_0); +GlobalProperty pc_compat_2_12[] = { + { + .driver =TYPE_X86_CPU , + .property ="legacy-cache" , + .value ="on" , + },{ + .driver =TYPE_X86_CPU , + .property ="topoext" , + .value ="off" , + },{ + .driver ="EPYC-" TYPE_X86_CPU , + .property ="xlevel" , + .value =stringify (0x8000000a ), + },{ + .driver ="EPYC-IBPB-" TYPE_X86_CPU , + .property ="xlevel" , + .value =stringify (0x8000000a ), + }, +}; +const size_t pc_compat_2_12_len =G_N_ELEMENTS (pc_compat_2_12); +void gsi_handler (void *opaque,int n,int level) {GSIState *s = opaque;hw/i386/pc_piix.c +2
-5@@ -462,12 +462,9 @@ DEFINE_I440FX_MACHINE(v3_0, "pc-i440fx-3.0", NULL,static void pc_i440fx_2_12_machine_options (MachineClass *m) { -static GlobalProperty compat[] = { -PC_COMPAT_2_12 - }; -pc_i440fx_3_0_machine_options (m); -compat_props_add (m->compat_props, compat,G_N_ELEMENTS (compat)); +compat_props_add (m->compat_props, hw_compat_2_12, hw_compat_2_12_len); +compat_props_add (m->compat_props, pc_compat_2_12, pc_compat_2_12_len); } DEFINE_I440FX_MACHINE(v2_12, "pc-i440fx-2.12", NULL,hw/i386/pc_q35.c +2
-5@@ -343,12 +343,9 @@ DEFINE_Q35_MACHINE(v3_0, "pc-q35-3.0", NULL,static void pc_q35_2_12_machine_options (MachineClass *m) { -static GlobalProperty compat[] = { -PC_COMPAT_2_12 - }; -pc_q35_3_0_machine_options (m); -compat_props_add (m->compat_props, compat,G_N_ELEMENTS (compat)); +compat_props_add (m->compat_props, hw_compat_2_12, hw_compat_2_12_len); +compat_props_add (m->compat_props, pc_compat_2_12, pc_compat_2_12_len); } DEFINE_Q35_MACHINE(v2_12, "pc-q35-2.12", NULL,hw/ppc/spapr.c +1
-1@@ -3995,7 +3995,6 @@ static void spapr_machine_2_12_class_options(MachineClass *mc) {sPAPRMachineClass *smc =SPAPR_MACHINE_CLASS (mc);static GlobalProperty compat[] = { -HW_COMPAT_2_12 { .driver =TYPE_POWERPC_CPU , .property ="pre-3.0-migration" ,@@ -4009,6 +4008,7 @@ static void spapr_machine_2_12_class_options(MachineClass *mc) };spapr_machine_3_0_class_options (mc); +compat_props_add (mc->compat_props, hw_compat_2_12, hw_compat_2_12_len);compat_props_add (mc->compat_props, compat,G_N_ELEMENTS (compat));/* We depend on kvm_enabled() to choose a default value for the hw/s390x/s390-virtio-ccw.c +1
-5@@ -696,12 +696,8 @@ static void ccw_machine_2_12_instance_options(MachineState *machine)static void ccw_machine_2_12_class_options (MachineClass *mc) { -static GlobalProperty compat[] = { -HW_COMPAT_2_12 - }; -ccw_machine_3_0_class_options (mc); -compat_props_add (mc->compat_props, compat,G_N_ELEMENTS (compat)); +compat_props_add (mc->compat_props, hw_compat_2_12, hw_compat_2_12_len); } DEFINE_CCW_MACHINE(2_12, "2.12", false);
PATCH v7 9/28 compat: replace PC_COMPAT_2_11 & HW_COMPAT_2_11 macros
In reply to Marc-André LureauUse static arrays instead.
--- include/hw/boards.h | 3 +++ include/hw/compat.h | 19 ------------------- include/hw/i386/pc.h | 13 ++----------- hw/arm/virt.c | 5 +---- hw/core/machine.c | 21 +++++++++++++++++++++ hw/i386/pc.c | 13 +++++++++++++ hw/i386/pc_piix.c | 7 ++----- hw/i386/pc_q35.c | 7 ++----- hw/ppc/spapr.c | 5 +---- hw/s390x/s390-virtio-ccw.c | 2 +- 10 files changed, 46 insertions(+), 49 deletions(-)
include/hw/boards.h +3 -0
@@ -296,4 +296,7 @@ extern const size_t hw_compat_3_0_len;extern GlobalProperty hw_compat_2_12[];extern const size_t hw_compat_2_12_len; +extern GlobalProperty hw_compat_2_11[]; +extern const size_t hw_compat_2_11_len; +#endif
include/hw/compat.h +0 -19
@@ -1,25 +1,6 @@#ifndef HW_COMPAT_H #define HW_COMPAT_H -#define HW_COMPAT_2_11 \ - {\ - .driver = "hpet",\ - .property = "hpet-offset-saved",\ - .value = "false",\ - },{\ - .driver = "virtio-blk-pci",\ - .property = "vectors",\ - .value = "2",\ - },{\ - .driver = "vhost-user-blk-pci",\ - .property = "vectors",\ - .value = "2",\ - },{\ - .driver = "e1000",\ - .property = "migrate_tso_props",\ - .value = "off",\ - }, -#define HW_COMPAT_2_10 \ {\ .driver = "virtio-mouse-device",\
include/hw/i386/pc.h +2 -11
@@ -303,17 +303,8 @@ extern const size_t pc_compat_3_0_len;extern GlobalProperty pc_compat_2_12[];extern const size_t pc_compat_2_12_len; -#define PC_COMPAT_2_11 \ - HW_COMPAT_2_11 \ - {\ - .driver = TYPE_X86_CPU,\ - .property = "x-migrate-smi-count",\ - .value = "off",\ - },{\ - .driver = "Skylake-Server" "-" TYPE_X86_CPU,\ - .property = "clflushopt",\ - .value = "off",\ - }, +extern GlobalProperty pc_compat_2_11[]; +extern const size_t pc_compat_2_11_len;#define PC_COMPAT_2_10 \ HW_COMPAT_2_10 \
hw/arm/virt.c +1 -4
@@ -1900,12 +1900,9 @@ DEFINE_VIRT_MACHINE(2, 12)static void virt_machine_2_11_options (MachineClass *mc) {VirtMachineClass *vmc =VIRT_MACHINE_CLASS (OBJECT_CLASS (mc)); -static GlobalProperty compat[] = { -HW_COMPAT_2_11 - };virt_machine_2_12_options (mc); -compat_props_add (mc->compat_props, compat,G_N_ELEMENTS (compat)); +compat_props_add (mc->compat_props, hw_compat_2_11, hw_compat_2_11_len); vmc->smbios_old_sys_ver = true; }DEFINE_VIRT_MACHINE (2 ,11 )
hw/core/machine.c +21 -0
@@ -57,6 +57,27 @@ GlobalProperty hw_compat_2_12[] = { };const size_t hw_compat_2_12_len =G_N_ELEMENTS (hw_compat_2_12); +GlobalProperty hw_compat_2_11[] = { + { + .driver ="hpet" , + .property ="hpet-offset-saved" , + .value ="false" , + },{ + .driver ="virtio-blk-pci" , + .property ="vectors" , + .value ="2" , + },{ + .driver ="vhost-user-blk-pci" , + .property ="vectors" , + .value ="2" , + },{ + .driver ="e1000" , + .property ="migrate_tso_props" , + .value ="off" , + }, +}; +const size_t hw_compat_2_11_len =G_N_ELEMENTS (hw_compat_2_11); +static char *machine_get_accel (Object *obj,Error **errp) {MachineState *ms =MACHINE (obj);
hw/i386/pc.c +13 -0
@@ -150,6 +150,19 @@ GlobalProperty pc_compat_2_12[] = { };const size_t pc_compat_2_12_len =G_N_ELEMENTS (pc_compat_2_12); +GlobalProperty pc_compat_2_11[] = { + { + .driver =TYPE_X86_CPU , + .property ="x-migrate-smi-count" , + .value ="off" , + },{ + .driver ="Skylake-Server" "-" TYPE_X86_CPU , + .property ="clflushopt" , + .value ="off" , + }, +}; +const size_t pc_compat_2_11_len =G_N_ELEMENTS (pc_compat_2_11); +void gsi_handler (void *opaque,int n,int level) {GSIState *s = opaque;
hw/i386/pc_piix.c +2 -5
@@ -472,12 +472,9 @@ DEFINE_I440FX_MACHINE(v2_12, "pc-i440fx-2.12", NULL,static void pc_i440fx_2_11_machine_options (MachineClass *m) { -static GlobalProperty compat[] = { -PC_COMPAT_2_11 - }; -pc_i440fx_2_12_machine_options (m); -compat_props_add (m->compat_props, compat,G_N_ELEMENTS (compat)); +compat_props_add (m->compat_props, hw_compat_2_11, hw_compat_2_11_len); +compat_props_add (m->compat_props, pc_compat_2_11, pc_compat_2_11_len); } DEFINE_I440FX_MACHINE(v2_11, "pc-i440fx-2.11", NULL,
hw/i386/pc_q35.c +2 -5
@@ -354,14 +354,11 @@ DEFINE_Q35_MACHINE(v2_12, "pc-q35-2.12", NULL,static void pc_q35_2_11_machine_options (MachineClass *m) {PCMachineClass *pcmc =PC_MACHINE_CLASS (m); -static GlobalProperty compat[] = { -PC_COMPAT_2_11 - }; -pc_q35_2_12_machine_options (m); pcmc->default_nic_model ="e1000" ; -compat_props_add (m->compat_props, compat,G_N_ELEMENTS (compat)); +compat_props_add (m->compat_props, hw_compat_2_11, hw_compat_2_11_len); +compat_props_add (m->compat_props, pc_compat_2_11, pc_compat_2_11_len); } DEFINE_Q35_MACHINE(v2_11, "pc-q35-2.11", NULL,
hw/ppc/spapr.c +1 -4
@@ -4040,13 +4040,10 @@ DEFINE_SPAPR_MACHINE(2_12_sxxm, "2.12-sxxm", false);static void spapr_machine_2_11_class_options (MachineClass *mc) {sPAPRMachineClass *smc =SPAPR_MACHINE_CLASS (mc); -static GlobalProperty compat[] = { -HW_COMPAT_2_11 - };spapr_machine_2_12_class_options (mc); smc->default_caps.caps[SPAPR_CAP_HTM ] =SPAPR_CAP_ON ; -compat_props_add (mc->compat_props, compat,G_N_ELEMENTS (compat)); +compat_props_add (mc->compat_props, hw_compat_2_11, hw_compat_2_11_len); } DEFINE_SPAPR_MACHINE(2_11, "2.11", false);
hw/s390x/s390-virtio-ccw.c +1 -1
@@ -713,7 +713,6 @@ static void ccw_machine_2_11_instance_options(MachineState *machine)static void ccw_machine_2_11_class_options (MachineClass *mc) {static GlobalProperty compat[] = { -HW_COMPAT_2_11 { .driver =TYPE_SCLP_EVENT_FACILITY , .property ="allow_all_mask_sizes" ,
@@ -722,6 +721,7 @@ static void ccw_machine_2_11_class_options(MachineClass *mc) };ccw_machine_2_12_class_options (mc); +compat_props_add (mc->compat_props, hw_compat_2_11, hw_compat_2_11_len);compat_props_add (mc->compat_props, compat,G_N_ELEMENTS (compat)); } DEFINE_CCW_MACHINE(2_11, "2.11", false);
Signature · 1 line
2.20.1.2.gb21ebb671b
Re: [Qemu-devel] [PATCH v7 09/28] compat: replace PC_COMPAT_2_11 & HW_COMPAT_2_11 macros
Quoted 4 lines · On Fri, 21 Dec 2018 13:03:51 +0400 Marc-André Lureau…
Use static arrays instead.
Suggested-by Eduardo Habkost <[email protected]>Signed-off-by Marc-André Lureau <[email protected]>
Quoted 12 lines
--- include/hw/boards.h | 3 +++ include/hw/compat.h | 19 ------------------- include/hw/i386/pc.h | 13 ++----------- hw/arm/virt.c | 5 +---- hw/core/machine.c | 21 +++++++++++++++++++++ hw/i386/pc.c | 13 +++++++++++++ hw/i386/pc_piix.c | 7 ++----- hw/i386/pc_q35.c | 7 ++----- hw/ppc/spapr.c | 5 +---- hw/s390x/s390-virtio-ccw.c | 2 +- 10 files changed, 46 insertions(+), 49 deletions(-)
Re: [Qemu-devel] [PATCH v7 09/28] compat: replace PC_COMPAT_2_11 & HW_COMPAT_2_11 macros
In reply to Marc-André LureauQuoted 4 lines · On Fri, 21 Dec 2018 13:03:51 +0400 Marc-André Lureau…
Use static arrays instead.
Suggested-by Eduardo Habkost <[email protected]>Signed-off-by Marc-André Lureau <[email protected]>
Quoted 232 lines
--- include/hw/boards.h | 3 +++ include/hw/compat.h | 19 ------------------- include/hw/i386/pc.h | 13 ++----------- hw/arm/virt.c | 5 +---- hw/core/machine.c | 21 +++++++++++++++++++++ hw/i386/pc.c | 13 +++++++++++++ hw/i386/pc_piix.c | 7 ++----- hw/i386/pc_q35.c | 7 ++----- hw/ppc/spapr.c | 5 +---- hw/s390x/s390-virtio-ccw.c | 2 +- 10 files changed, 46 insertions(+), 49 deletions(-)include/hw/boards.h +3
-0@@ -296,4 +296,7 @@ extern const size_t hw_compat_3_0_len;extern GlobalProperty hw_compat_2_12[];extern const size_t hw_compat_2_12_len; +extern GlobalProperty hw_compat_2_11[]; +extern const size_t hw_compat_2_11_len; +#endif include/hw/compat.h +0
-19@@ -1,25 +1,6 @@#ifndef HW_COMPAT_H #define HW_COMPAT_H -#define HW_COMPAT_2_11 \ - {\ - .driver = "hpet",\ - .property = "hpet-offset-saved",\ - .value = "false",\ - },{\ - .driver = "virtio-blk-pci",\ - .property = "vectors",\ - .value = "2",\ - },{\ - .driver = "vhost-user-blk-pci",\ - .property = "vectors",\ - .value = "2",\ - },{\ - .driver = "e1000",\ - .property = "migrate_tso_props",\ - .value = "off",\ - }, -#define HW_COMPAT_2_10 \ {\ .driver = "virtio-mouse-device",\include/hw/i386/pc.h +2
-11@@ -303,17 +303,8 @@ extern const size_t pc_compat_3_0_len;extern GlobalProperty pc_compat_2_12[];extern const size_t pc_compat_2_12_len; -#define PC_COMPAT_2_11 \ - HW_COMPAT_2_11 \ - {\ - .driver = TYPE_X86_CPU,\ - .property = "x-migrate-smi-count",\ - .value = "off",\ - },{\ - .driver = "Skylake-Server" "-" TYPE_X86_CPU,\ - .property = "clflushopt",\ - .value = "off",\ - }, +extern GlobalProperty pc_compat_2_11[]; +extern const size_t pc_compat_2_11_len;#define PC_COMPAT_2_10 \ HW_COMPAT_2_10 \hw/arm/virt.c +1
-4@@ -1900,12 +1900,9 @@ DEFINE_VIRT_MACHINE(2, 12)static void virt_machine_2_11_options (MachineClass *mc) {VirtMachineClass *vmc =VIRT_MACHINE_CLASS (OBJECT_CLASS (mc)); -static GlobalProperty compat[] = { -HW_COMPAT_2_11 - };virt_machine_2_12_options (mc); -compat_props_add (mc->compat_props, compat,G_N_ELEMENTS (compat)); +compat_props_add (mc->compat_props, hw_compat_2_11, hw_compat_2_11_len); vmc->smbios_old_sys_ver = true; }DEFINE_VIRT_MACHINE (2 ,11 )hw/core/machine.c +21
-0@@ -57,6 +57,27 @@ GlobalProperty hw_compat_2_12[] = { };const size_t hw_compat_2_12_len =G_N_ELEMENTS (hw_compat_2_12); +GlobalProperty hw_compat_2_11[] = { + { + .driver ="hpet" , + .property ="hpet-offset-saved" , + .value ="false" , + },{ + .driver ="virtio-blk-pci" , + .property ="vectors" , + .value ="2" , + },{ + .driver ="vhost-user-blk-pci" , + .property ="vectors" , + .value ="2" , + },{ + .driver ="e1000" , + .property ="migrate_tso_props" , + .value ="off" , + }, +}; +const size_t hw_compat_2_11_len =G_N_ELEMENTS (hw_compat_2_11); +static char *machine_get_accel (Object *obj,Error **errp) {MachineState *ms =MACHINE (obj);hw/i386/pc.c +13
-0@@ -150,6 +150,19 @@ GlobalProperty pc_compat_2_12[] = { };const size_t pc_compat_2_12_len =G_N_ELEMENTS (pc_compat_2_12); +GlobalProperty pc_compat_2_11[] = { + { + .driver =TYPE_X86_CPU , + .property ="x-migrate-smi-count" , + .value ="off" , + },{ + .driver ="Skylake-Server" "-" TYPE_X86_CPU , + .property ="clflushopt" , + .value ="off" , + }, +}; +const size_t pc_compat_2_11_len =G_N_ELEMENTS (pc_compat_2_11); +void gsi_handler (void *opaque,int n,int level) {GSIState *s = opaque;hw/i386/pc_piix.c +2
-5@@ -472,12 +472,9 @@ DEFINE_I440FX_MACHINE(v2_12, "pc-i440fx-2.12", NULL,static void pc_i440fx_2_11_machine_options (MachineClass *m) { -static GlobalProperty compat[] = { -PC_COMPAT_2_11 - }; -pc_i440fx_2_12_machine_options (m); -compat_props_add (m->compat_props, compat,G_N_ELEMENTS (compat)); +compat_props_add (m->compat_props, hw_compat_2_11, hw_compat_2_11_len); +compat_props_add (m->compat_props, pc_compat_2_11, pc_compat_2_11_len); } DEFINE_I440FX_MACHINE(v2_11, "pc-i440fx-2.11", NULL,hw/i386/pc_q35.c +2
-5@@ -354,14 +354,11 @@ DEFINE_Q35_MACHINE(v2_12, "pc-q35-2.12", NULL,static void pc_q35_2_11_machine_options (MachineClass *m) {PCMachineClass *pcmc =PC_MACHINE_CLASS (m); -static GlobalProperty compat[] = { -PC_COMPAT_2_11 - }; -pc_q35_2_12_machine_options (m); pcmc->default_nic_model ="e1000" ; -compat_props_add (m->compat_props, compat,G_N_ELEMENTS (compat)); +compat_props_add (m->compat_props, hw_compat_2_11, hw_compat_2_11_len); +compat_props_add (m->compat_props, pc_compat_2_11, pc_compat_2_11_len); } DEFINE_Q35_MACHINE(v2_11, "pc-q35-2.11", NULL,hw/ppc/spapr.c +1
-4@@ -4040,13 +4040,10 @@ DEFINE_SPAPR_MACHINE(2_12_sxxm, "2.12-sxxm", false);static void spapr_machine_2_11_class_options (MachineClass *mc) {sPAPRMachineClass *smc =SPAPR_MACHINE_CLASS (mc); -static GlobalProperty compat[] = { -HW_COMPAT_2_11 - };spapr_machine_2_12_class_options (mc); smc->default_caps.caps[SPAPR_CAP_HTM ] =SPAPR_CAP_ON ; -compat_props_add (mc->compat_props, compat,G_N_ELEMENTS (compat)); +compat_props_add (mc->compat_props, hw_compat_2_11, hw_compat_2_11_len); } DEFINE_SPAPR_MACHINE(2_11, "2.11", false);hw/s390x/s390-virtio-ccw.c +1
-1@@ -713,7 +713,6 @@ static void ccw_machine_2_11_instance_options(MachineState *machine)static void ccw_machine_2_11_class_options (MachineClass *mc) {static GlobalProperty compat[] = { -HW_COMPAT_2_11 { .driver =TYPE_SCLP_EVENT_FACILITY , .property ="allow_all_mask_sizes" ,@@ -722,6 +721,7 @@ static void ccw_machine_2_11_class_options(MachineClass *mc) };ccw_machine_2_12_class_options (mc); +compat_props_add (mc->compat_props, hw_compat_2_11, hw_compat_2_11_len);compat_props_add (mc->compat_props, compat,G_N_ELEMENTS (compat)); } DEFINE_CCW_MACHINE(2_11, "2.11", false);
PATCH v7 10/28 compat: replace PC_COMPAT_2_10 & HW_COMPAT_2_10 macros
In reply to Marc-André LureauUse static arrays instead.
--- include/hw/boards.h | 3 +++ include/hw/compat.h | 11 ----------- include/hw/i386/pc.h | 17 ++--------------- hw/arm/virt.c | 6 +----- hw/core/machine.c | 13 +++++++++++++ hw/i386/pc.c | 17 +++++++++++++++++ hw/i386/pc_piix.c | 7 ++----- hw/i386/pc_q35.c | 7 ++----- hw/ppc/spapr.c | 6 +----- hw/s390x/s390-virtio-ccw.c | 6 +----- 10 files changed, 42 insertions(+), 51 deletions(-)
include/hw/boards.h +3 -0
@@ -299,4 +299,7 @@ extern const size_t hw_compat_2_12_len;extern GlobalProperty hw_compat_2_11[];extern const size_t hw_compat_2_11_len; +extern GlobalProperty hw_compat_2_10[]; +extern const size_t hw_compat_2_10_len; +#endif
include/hw/compat.h +0 -11
@@ -1,17 +1,6 @@#ifndef HW_COMPAT_H #define HW_COMPAT_H -#define HW_COMPAT_2_10 \ - {\ - .driver = "virtio-mouse-device",\ - .property = "wheel-axis",\ - .value = "false",\ - },{\ - .driver = "virtio-tablet-device",\ - .property = "wheel-axis",\ - .value = "false",\ - }, -#define HW_COMPAT_2_9 \ {\ .driver = "pci-bridge",\
include/hw/i386/pc.h +2 -15
@@ -306,21 +306,8 @@ extern const size_t pc_compat_2_12_len;extern GlobalProperty pc_compat_2_11[];extern const size_t pc_compat_2_11_len; -#define PC_COMPAT_2_10 \ - HW_COMPAT_2_10 \ - {\ - .driver = TYPE_X86_CPU,\ - .property = "x-hv-max-vps",\ - .value = "0x40",\ - },{\ - .driver = "i440FX-pcihost",\ - .property = "x-pci-hole64-fix",\ - .value = "off",\ - },{\ - .driver = "q35-pcihost",\ - .property = "x-pci-hole64-fix",\ - .value = "off",\ - }, +extern GlobalProperty pc_compat_2_10[]; +extern const size_t pc_compat_2_10_len;#define PC_COMPAT_2_9 \ HW_COMPAT_2_9 \
hw/arm/virt.c +1 -5
@@ -1909,12 +1909,8 @@ DEFINE_VIRT_MACHINE(2, 11)static void virt_machine_2_10_options (MachineClass *mc) { -static GlobalProperty compat[] = { -HW_COMPAT_2_10 - }; -virt_machine_2_11_options (mc); -compat_props_add (mc->compat_props, compat,G_N_ELEMENTS (compat)); +compat_props_add (mc->compat_props, hw_compat_2_10, hw_compat_2_10_len);/* before 2.11 we never faulted accesses to bad addresses */ mc->ignore_memory_transaction_failures = true; }
hw/core/machine.c +13 -0
@@ -78,6 +78,19 @@ GlobalProperty hw_compat_2_11[] = { };const size_t hw_compat_2_11_len =G_N_ELEMENTS (hw_compat_2_11); +GlobalProperty hw_compat_2_10[] = { + { + .driver ="virtio-mouse-device" , + .property ="wheel-axis" , + .value ="false" , + },{ + .driver ="virtio-tablet-device" , + .property ="wheel-axis" , + .value ="false" , + }, +}; +const size_t hw_compat_2_10_len =G_N_ELEMENTS (hw_compat_2_10); +static char *machine_get_accel (Object *obj,Error **errp) {MachineState *ms =MACHINE (obj);
hw/i386/pc.c +17 -0
@@ -163,6 +163,23 @@ GlobalProperty pc_compat_2_11[] = { };const size_t pc_compat_2_11_len =G_N_ELEMENTS (pc_compat_2_11); +GlobalProperty pc_compat_2_10[] = { + { + .driver =TYPE_X86_CPU , + .property ="x-hv-max-vps" , + .value ="0x40" , + },{ + .driver ="i440FX-pcihost" , + .property ="x-pci-hole64-fix" , + .value ="off" , + },{ + .driver ="q35-pcihost" , + .property ="x-pci-hole64-fix" , + .value ="off" , + }, +}; +const size_t pc_compat_2_10_len =G_N_ELEMENTS (pc_compat_2_10); +void gsi_handler (void *opaque,int n,int level) {GSIState *s = opaque;
hw/i386/pc_piix.c +2 -5
@@ -482,12 +482,9 @@ DEFINE_I440FX_MACHINE(v2_11, "pc-i440fx-2.11", NULL,static void pc_i440fx_2_10_machine_options (MachineClass *m) { -static GlobalProperty compat[] = { -PC_COMPAT_2_10 - }; -pc_i440fx_2_11_machine_options (m); -compat_props_add (m->compat_props, compat,G_N_ELEMENTS (compat)); +compat_props_add (m->compat_props, hw_compat_2_10, hw_compat_2_10_len); +compat_props_add (m->compat_props, pc_compat_2_10, pc_compat_2_10_len); m->auto_enable_numa_with_memhp = false; }
hw/i386/pc_q35.c +2 -5
@@ -366,12 +366,9 @@ DEFINE_Q35_MACHINE(v2_11, "pc-q35-2.11", NULL,static void pc_q35_2_10_machine_options (MachineClass *m) { -static GlobalProperty compat[] = { -PC_COMPAT_2_10 - }; -pc_q35_2_11_machine_options (m); -compat_props_add (m->compat_props, compat,G_N_ELEMENTS (compat)); +compat_props_add (m->compat_props, hw_compat_2_10, hw_compat_2_10_len); +compat_props_add (m->compat_props, pc_compat_2_10, pc_compat_2_10_len); m->numa_auto_assign_ram = numa_legacy_auto_assign_ram; m->auto_enable_numa_with_memhp = false; }
hw/ppc/spapr.c +1 -5
@@ -4054,12 +4054,8 @@ DEFINE_SPAPR_MACHINE(2_11, "2.11", false);static void spapr_machine_2_10_class_options (MachineClass *mc) { -static GlobalProperty compat[] = { -HW_COMPAT_2_10 - }; -spapr_machine_2_11_class_options (mc); -compat_props_add (mc->compat_props, compat,G_N_ELEMENTS (compat)); +compat_props_add (mc->compat_props, hw_compat_2_10, hw_compat_2_10_len); } DEFINE_SPAPR_MACHINE(2_10, "2.10", false);
hw/s390x/s390-virtio-ccw.c +1 -5
@@ -733,12 +733,8 @@ static void ccw_machine_2_10_instance_options(MachineState *machine)static void ccw_machine_2_10_class_options (MachineClass *mc) { -static GlobalProperty compat[] = { -HW_COMPAT_2_10 - }; -ccw_machine_2_11_class_options (mc); -compat_props_add (mc->compat_props, compat,G_N_ELEMENTS (compat)); +compat_props_add (mc->compat_props, hw_compat_2_10, hw_compat_2_10_len); } DEFINE_CCW_MACHINE(2_10, "2.10", false);
Signature · 1 line
2.20.1.2.gb21ebb671b
Re: [Qemu-devel] [PATCH v7 10/28] compat: replace PC_COMPAT_2_10 & HW_COMPAT_2_10 macros
Quoted 4 lines · On Fri, 21 Dec 2018 13:03:52 +0400 Marc-André Lureau…
Use static arrays instead.
Suggested-by Eduardo Habkost <[email protected]>Signed-off-by Marc-André Lureau <[email protected]>
Quoted 12 lines
--- include/hw/boards.h | 3 +++ include/hw/compat.h | 11 ----------- include/hw/i386/pc.h | 17 ++--------------- hw/arm/virt.c | 6 +----- hw/core/machine.c | 13 +++++++++++++ hw/i386/pc.c | 17 +++++++++++++++++ hw/i386/pc_piix.c | 7 ++----- hw/i386/pc_q35.c | 7 ++----- hw/ppc/spapr.c | 6 +----- hw/s390x/s390-virtio-ccw.c | 6 +----- 10 files changed, 42 insertions(+), 51 deletions(-)
Re: [Qemu-devel] [PATCH v7 10/28] compat: replace PC_COMPAT_2_10 & HW_COMPAT_2_10 macros
In reply to Marc-André LureauQuoted 4 lines · On Fri, 21 Dec 2018 13:03:52 +0400 Marc-André Lureau…
Use static arrays instead.
Suggested-by Eduardo Habkost <[email protected]>Signed-off-by Marc-André Lureau <[email protected]>
Quoted 219 lines
--- include/hw/boards.h | 3 +++ include/hw/compat.h | 11 ----------- include/hw/i386/pc.h | 17 ++--------------- hw/arm/virt.c | 6 +----- hw/core/machine.c | 13 +++++++++++++ hw/i386/pc.c | 17 +++++++++++++++++ hw/i386/pc_piix.c | 7 ++----- hw/i386/pc_q35.c | 7 ++----- hw/ppc/spapr.c | 6 +----- hw/s390x/s390-virtio-ccw.c | 6 +----- 10 files changed, 42 insertions(+), 51 deletions(-)include/hw/boards.h +3
-0@@ -299,4 +299,7 @@ extern const size_t hw_compat_2_12_len;extern GlobalProperty hw_compat_2_11[];extern const size_t hw_compat_2_11_len; +extern GlobalProperty hw_compat_2_10[]; +extern const size_t hw_compat_2_10_len; +#endif include/hw/compat.h +0
-11@@ -1,17 +1,6 @@#ifndef HW_COMPAT_H #define HW_COMPAT_H -#define HW_COMPAT_2_10 \ - {\ - .driver = "virtio-mouse-device",\ - .property = "wheel-axis",\ - .value = "false",\ - },{\ - .driver = "virtio-tablet-device",\ - .property = "wheel-axis",\ - .value = "false",\ - }, -#define HW_COMPAT_2_9 \ {\ .driver = "pci-bridge",\include/hw/i386/pc.h +2
-15@@ -306,21 +306,8 @@ extern const size_t pc_compat_2_12_len;extern GlobalProperty pc_compat_2_11[];extern const size_t pc_compat_2_11_len; -#define PC_COMPAT_2_10 \ - HW_COMPAT_2_10 \ - {\ - .driver = TYPE_X86_CPU,\ - .property = "x-hv-max-vps",\ - .value = "0x40",\ - },{\ - .driver = "i440FX-pcihost",\ - .property = "x-pci-hole64-fix",\ - .value = "off",\ - },{\ - .driver = "q35-pcihost",\ - .property = "x-pci-hole64-fix",\ - .value = "off",\ - }, +extern GlobalProperty pc_compat_2_10[]; +extern const size_t pc_compat_2_10_len;#define PC_COMPAT_2_9 \ HW_COMPAT_2_9 \hw/arm/virt.c +1
-5@@ -1909,12 +1909,8 @@ DEFINE_VIRT_MACHINE(2, 11)static void virt_machine_2_10_options (MachineClass *mc) { -static GlobalProperty compat[] = { -HW_COMPAT_2_10 - }; -virt_machine_2_11_options (mc); -compat_props_add (mc->compat_props, compat,G_N_ELEMENTS (compat)); +compat_props_add (mc->compat_props, hw_compat_2_10, hw_compat_2_10_len);/* before 2.11 we never faulted accesses to bad addresses */ mc->ignore_memory_transaction_failures = true; }hw/core/machine.c +13
-0@@ -78,6 +78,19 @@ GlobalProperty hw_compat_2_11[] = { };const size_t hw_compat_2_11_len =G_N_ELEMENTS (hw_compat_2_11); +GlobalProperty hw_compat_2_10[] = { + { + .driver ="virtio-mouse-device" , + .property ="wheel-axis" , + .value ="false" , + },{ + .driver ="virtio-tablet-device" , + .property ="wheel-axis" , + .value ="false" , + }, +}; +const size_t hw_compat_2_10_len =G_N_ELEMENTS (hw_compat_2_10); +static char *machine_get_accel (Object *obj,Error **errp) {MachineState *ms =MACHINE (obj);hw/i386/pc.c +17
-0@@ -163,6 +163,23 @@ GlobalProperty pc_compat_2_11[] = { };const size_t pc_compat_2_11_len =G_N_ELEMENTS (pc_compat_2_11); +GlobalProperty pc_compat_2_10[] = { + { + .driver =TYPE_X86_CPU , + .property ="x-hv-max-vps" , + .value ="0x40" , + },{ + .driver ="i440FX-pcihost" , + .property ="x-pci-hole64-fix" , + .value ="off" , + },{ + .driver ="q35-pcihost" , + .property ="x-pci-hole64-fix" , + .value ="off" , + }, +}; +const size_t pc_compat_2_10_len =G_N_ELEMENTS (pc_compat_2_10); +void gsi_handler (void *opaque,int n,int level) {GSIState *s = opaque;hw/i386/pc_piix.c +2
-5@@ -482,12 +482,9 @@ DEFINE_I440FX_MACHINE(v2_11, "pc-i440fx-2.11", NULL,static void pc_i440fx_2_10_machine_options (MachineClass *m) { -static GlobalProperty compat[] = { -PC_COMPAT_2_10 - }; -pc_i440fx_2_11_machine_options (m); -compat_props_add (m->compat_props, compat,G_N_ELEMENTS (compat)); +compat_props_add (m->compat_props, hw_compat_2_10, hw_compat_2_10_len); +compat_props_add (m->compat_props, pc_compat_2_10, pc_compat_2_10_len); m->auto_enable_numa_with_memhp = false; }hw/i386/pc_q35.c +2
-5@@ -366,12 +366,9 @@ DEFINE_Q35_MACHINE(v2_11, "pc-q35-2.11", NULL,static void pc_q35_2_10_machine_options (MachineClass *m) { -static GlobalProperty compat[] = { -PC_COMPAT_2_10 - }; -pc_q35_2_11_machine_options (m); -compat_props_add (m->compat_props, compat,G_N_ELEMENTS (compat)); +compat_props_add (m->compat_props, hw_compat_2_10, hw_compat_2_10_len); +compat_props_add (m->compat_props, pc_compat_2_10, pc_compat_2_10_len); m->numa_auto_assign_ram = numa_legacy_auto_assign_ram; m->auto_enable_numa_with_memhp = false; }hw/ppc/spapr.c +1
-5@@ -4054,12 +4054,8 @@ DEFINE_SPAPR_MACHINE(2_11, "2.11", false);static void spapr_machine_2_10_class_options (MachineClass *mc) { -static GlobalProperty compat[] = { -HW_COMPAT_2_10 - }; -spapr_machine_2_11_class_options (mc); -compat_props_add (mc->compat_props, compat,G_N_ELEMENTS (compat)); +compat_props_add (mc->compat_props, hw_compat_2_10, hw_compat_2_10_len); } DEFINE_SPAPR_MACHINE(2_10, "2.10", false);hw/s390x/s390-virtio-ccw.c +1
-5@@ -733,12 +733,8 @@ static void ccw_machine_2_10_instance_options(MachineState *machine)static void ccw_machine_2_10_class_options (MachineClass *mc) { -static GlobalProperty compat[] = { -HW_COMPAT_2_10 - }; -ccw_machine_2_11_class_options (mc); -compat_props_add (mc->compat_props, compat,G_N_ELEMENTS (compat)); +compat_props_add (mc->compat_props, hw_compat_2_10, hw_compat_2_10_len); } DEFINE_CCW_MACHINE(2_10, "2.10", false);
PATCH v7 11/28 compat: replace PC_COMPAT_2_9 & HW_COMPAT_2_9 macros
In reply to Marc-André LureauUse static arrays instead.
--- include/hw/boards.h | 3 +++ include/hw/compat.h | 19 ------------------- include/hw/i386/pc.h | 9 ++------- hw/arm/virt.c | 6 +----- hw/core/machine.c | 21 +++++++++++++++++++++ hw/i386/pc.c | 9 +++++++++ hw/i386/pc_piix.c | 7 ++----- hw/i386/pc_q35.c | 7 ++----- hw/ppc/spapr.c | 2 +- hw/s390x/s390-virtio-ccw.c | 2 +- 10 files changed, 42 insertions(+), 43 deletions(-)
include/hw/boards.h +3 -0
@@ -302,4 +302,7 @@ extern const size_t hw_compat_2_11_len;extern GlobalProperty hw_compat_2_10[];extern const size_t hw_compat_2_10_len; +extern GlobalProperty hw_compat_2_9[]; +extern const size_t hw_compat_2_9_len; +#endif
include/hw/compat.h +0 -19
@@ -1,25 +1,6 @@#ifndef HW_COMPAT_H #define HW_COMPAT_H -#define HW_COMPAT_2_9 \ - {\ - .driver = "pci-bridge",\ - .property = "shpc",\ - .value = "off",\ - },{\ - .driver = "intel-iommu",\ - .property = "pt",\ - .value = "off",\ - },{\ - .driver = "virtio-net-device",\ - .property = "x-mtu-bypass-backend",\ - .value = "off",\ - },{\ - .driver = "pcie-root-port",\ - .property = "x-migrate-msix",\ - .value = "false",\ - }, -#define HW_COMPAT_2_8 \ {\ .driver = "fw_cfg_mem",\
include/hw/i386/pc.h +2 -7
@@ -309,13 +309,8 @@ extern const size_t pc_compat_2_11_len;extern GlobalProperty pc_compat_2_10[];extern const size_t pc_compat_2_10_len; -#define PC_COMPAT_2_9 \ - HW_COMPAT_2_9 \ - {\ - .driver = "mch",\ - .property = "extended-tseg-mbytes",\ - .value = stringify(0),\ - },\ +extern GlobalProperty pc_compat_2_9[]; +extern const size_t pc_compat_2_9_len;#define PC_COMPAT_2_8 \ HW_COMPAT_2_8 \
hw/arm/virt.c +1 -5
@@ -1918,12 +1918,8 @@ DEFINE_VIRT_MACHINE(2, 10)static void virt_machine_2_9_options (MachineClass *mc) { -static GlobalProperty compat[] = { -HW_COMPAT_2_9 - }; -virt_machine_2_10_options (mc); -compat_props_add (mc->compat_props, compat,G_N_ELEMENTS (compat)); +compat_props_add (mc->compat_props, hw_compat_2_9, hw_compat_2_9_len); }DEFINE_VIRT_MACHINE (2 ,9 )
hw/core/machine.c +21 -0
@@ -91,6 +91,27 @@ GlobalProperty hw_compat_2_10[] = { };const size_t hw_compat_2_10_len =G_N_ELEMENTS (hw_compat_2_10); +GlobalProperty hw_compat_2_9[] = { + { + .driver ="pci-bridge" , + .property ="shpc" , + .value ="off" , + },{ + .driver ="intel-iommu" , + .property ="pt" , + .value ="off" , + },{ + .driver ="virtio-net-device" , + .property ="x-mtu-bypass-backend" , + .value ="off" , + },{ + .driver ="pcie-root-port" , + .property ="x-migrate-msix" , + .value ="false" , + }, +}; +const size_t hw_compat_2_9_len =G_N_ELEMENTS (hw_compat_2_9); +static char *machine_get_accel (Object *obj,Error **errp) {MachineState *ms =MACHINE (obj);
hw/i386/pc.c +9 -0
@@ -180,6 +180,15 @@ GlobalProperty pc_compat_2_10[] = { };const size_t pc_compat_2_10_len =G_N_ELEMENTS (pc_compat_2_10); +GlobalProperty pc_compat_2_9[] = { + { + .driver ="mch" , + .property ="extended-tseg-mbytes" , + .value =stringify (0 ), + }, +}; +const size_t pc_compat_2_9_len =G_N_ELEMENTS (pc_compat_2_9); +void gsi_handler (void *opaque,int n,int level) {GSIState *s = opaque;
hw/i386/pc_piix.c +2 -5
@@ -493,12 +493,9 @@ DEFINE_I440FX_MACHINE(v2_10, "pc-i440fx-2.10", NULL,static void pc_i440fx_2_9_machine_options (MachineClass *m) { -static GlobalProperty compat[] = { -PC_COMPAT_2_9 - }; -pc_i440fx_2_10_machine_options (m); -compat_props_add (m->compat_props, compat,G_N_ELEMENTS (compat)); +compat_props_add (m->compat_props, hw_compat_2_9, hw_compat_2_9_len); +compat_props_add (m->compat_props, pc_compat_2_9, pc_compat_2_9_len); m->numa_auto_assign_ram = numa_legacy_auto_assign_ram; }
hw/i386/pc_q35.c +2 -5
@@ -378,12 +378,9 @@ DEFINE_Q35_MACHINE(v2_10, "pc-q35-2.10", NULL,static void pc_q35_2_9_machine_options (MachineClass *m) { -static GlobalProperty compat[] = { -PC_COMPAT_2_9 - }; -pc_q35_2_10_machine_options (m); -compat_props_add (m->compat_props, compat,G_N_ELEMENTS (compat)); +compat_props_add (m->compat_props, hw_compat_2_9, hw_compat_2_9_len); +compat_props_add (m->compat_props, pc_compat_2_9, pc_compat_2_9_len); } DEFINE_Q35_MACHINE(v2_9, "pc-q35-2.9", NULL,
hw/ppc/spapr.c +1 -1
@@ -4068,7 +4068,6 @@ static void spapr_machine_2_9_class_options(MachineClass *mc) {sPAPRMachineClass *smc =SPAPR_MACHINE_CLASS (mc);static GlobalProperty compat[] = { -HW_COMPAT_2_9 { .driver =TYPE_POWERPC_CPU , .property ="pre-2.10-migration" ,
@@ -4077,6 +4076,7 @@ static void spapr_machine_2_9_class_options(MachineClass *mc) };spapr_machine_2_10_class_options (mc); +compat_props_add (mc->compat_props, hw_compat_2_9, hw_compat_2_9_len);compat_props_add (mc->compat_props, compat,G_N_ELEMENTS (compat)); mc->numa_auto_assign_ram = numa_legacy_auto_assign_ram; smc->pre_2_10_has_unused_icps = true;
hw/s390x/s390-virtio-ccw.c +1 -1
@@ -752,7 +752,6 @@ static void ccw_machine_2_9_class_options(MachineClass *mc) {S390CcwMachineClass *s390mc =S390_MACHINE_CLASS (mc);static GlobalProperty compat[] = { -HW_COMPAT_2_9 { .driver =TYPE_S390_STATTRIB , .property ="migration-enabled" ,
@@ -761,6 +760,7 @@ static void ccw_machine_2_9_class_options(MachineClass *mc) };ccw_machine_2_10_class_options (mc); +compat_props_add (mc->compat_props, hw_compat_2_9, hw_compat_2_9_len);compat_props_add (mc->compat_props, compat,G_N_ELEMENTS (compat)); s390mc->css_migration_enabled = false; }
Signature · 1 line
2.20.1.2.gb21ebb671b
Re: [Qemu-devel] [PATCH v7 11/28] compat: replace PC_COMPAT_2_9 & HW_COMPAT_2_9 macros
Quoted 4 lines · On Fri, 21 Dec 2018 13:03:53 +0400 Marc-André Lureau…
Use static arrays instead.
Suggested-by Eduardo Habkost <[email protected]>Signed-off-by Marc-André Lureau <[email protected]>
Quoted 12 lines
--- include/hw/boards.h | 3 +++ include/hw/compat.h | 19 ------------------- include/hw/i386/pc.h | 9 ++------- hw/arm/virt.c | 6 +----- hw/core/machine.c | 21 +++++++++++++++++++++ hw/i386/pc.c | 9 +++++++++ hw/i386/pc_piix.c | 7 ++----- hw/i386/pc_q35.c | 7 ++----- hw/ppc/spapr.c | 2 +- hw/s390x/s390-virtio-ccw.c | 2 +- 10 files changed, 42 insertions(+), 43 deletions(-)
Re: [Qemu-devel] [PATCH v7 11/28] compat: replace PC_COMPAT_2_9 & HW_COMPAT_2_9 macros
In reply to Marc-André LureauQuoted 4 lines · On Fri, 21 Dec 2018 13:03:53 +0400 Marc-André Lureau…
Use static arrays instead.
Suggested-by Eduardo Habkost <[email protected]>Signed-off-by Marc-André Lureau <[email protected]>
Quoted 223 lines
--- include/hw/boards.h | 3 +++ include/hw/compat.h | 19 ------------------- include/hw/i386/pc.h | 9 ++------- hw/arm/virt.c | 6 +----- hw/core/machine.c | 21 +++++++++++++++++++++ hw/i386/pc.c | 9 +++++++++ hw/i386/pc_piix.c | 7 ++----- hw/i386/pc_q35.c | 7 ++----- hw/ppc/spapr.c | 2 +- hw/s390x/s390-virtio-ccw.c | 2 +- 10 files changed, 42 insertions(+), 43 deletions(-)include/hw/boards.h +3
-0@@ -302,4 +302,7 @@ extern const size_t hw_compat_2_11_len;extern GlobalProperty hw_compat_2_10[];extern const size_t hw_compat_2_10_len; +extern GlobalProperty hw_compat_2_9[]; +extern const size_t hw_compat_2_9_len; +#endif include/hw/compat.h +0
-19@@ -1,25 +1,6 @@#ifndef HW_COMPAT_H #define HW_COMPAT_H -#define HW_COMPAT_2_9 \ - {\ - .driver = "pci-bridge",\ - .property = "shpc",\ - .value = "off",\ - },{\ - .driver = "intel-iommu",\ - .property = "pt",\ - .value = "off",\ - },{\ - .driver = "virtio-net-device",\ - .property = "x-mtu-bypass-backend",\ - .value = "off",\ - },{\ - .driver = "pcie-root-port",\ - .property = "x-migrate-msix",\ - .value = "false",\ - }, -#define HW_COMPAT_2_8 \ {\ .driver = "fw_cfg_mem",\include/hw/i386/pc.h +2
-7@@ -309,13 +309,8 @@ extern const size_t pc_compat_2_11_len;extern GlobalProperty pc_compat_2_10[];extern const size_t pc_compat_2_10_len; -#define PC_COMPAT_2_9 \ - HW_COMPAT_2_9 \ - {\ - .driver = "mch",\ - .property = "extended-tseg-mbytes",\ - .value = stringify(0),\ - },\ +extern GlobalProperty pc_compat_2_9[]; +extern const size_t pc_compat_2_9_len;#define PC_COMPAT_2_8 \ HW_COMPAT_2_8 \hw/arm/virt.c +1
-5@@ -1918,12 +1918,8 @@ DEFINE_VIRT_MACHINE(2, 10)static void virt_machine_2_9_options (MachineClass *mc) { -static GlobalProperty compat[] = { -HW_COMPAT_2_9 - }; -virt_machine_2_10_options (mc); -compat_props_add (mc->compat_props, compat,G_N_ELEMENTS (compat)); +compat_props_add (mc->compat_props, hw_compat_2_9, hw_compat_2_9_len); }DEFINE_VIRT_MACHINE (2 ,9 )hw/core/machine.c +21
-0@@ -91,6 +91,27 @@ GlobalProperty hw_compat_2_10[] = { };const size_t hw_compat_2_10_len =G_N_ELEMENTS (hw_compat_2_10); +GlobalProperty hw_compat_2_9[] = { + { + .driver ="pci-bridge" , + .property ="shpc" , + .value ="off" , + },{ + .driver ="intel-iommu" , + .property ="pt" , + .value ="off" , + },{ + .driver ="virtio-net-device" , + .property ="x-mtu-bypass-backend" , + .value ="off" , + },{ + .driver ="pcie-root-port" , + .property ="x-migrate-msix" , + .value ="false" , + }, +}; +const size_t hw_compat_2_9_len =G_N_ELEMENTS (hw_compat_2_9); +static char *machine_get_accel (Object *obj,Error **errp) {MachineState *ms =MACHINE (obj);hw/i386/pc.c +9
-0@@ -180,6 +180,15 @@ GlobalProperty pc_compat_2_10[] = { };const size_t pc_compat_2_10_len =G_N_ELEMENTS (pc_compat_2_10); +GlobalProperty pc_compat_2_9[] = { + { + .driver ="mch" , + .property ="extended-tseg-mbytes" , + .value =stringify (0 ), + }, +}; +const size_t pc_compat_2_9_len =G_N_ELEMENTS (pc_compat_2_9); +void gsi_handler (void *opaque,int n,int level) {GSIState *s = opaque;hw/i386/pc_piix.c +2
-5@@ -493,12 +493,9 @@ DEFINE_I440FX_MACHINE(v2_10, "pc-i440fx-2.10", NULL,static void pc_i440fx_2_9_machine_options (MachineClass *m) { -static GlobalProperty compat[] = { -PC_COMPAT_2_9 - }; -pc_i440fx_2_10_machine_options (m); -compat_props_add (m->compat_props, compat,G_N_ELEMENTS (compat)); +compat_props_add (m->compat_props, hw_compat_2_9, hw_compat_2_9_len); +compat_props_add (m->compat_props, pc_compat_2_9, pc_compat_2_9_len); m->numa_auto_assign_ram = numa_legacy_auto_assign_ram; }hw/i386/pc_q35.c +2
-5@@ -378,12 +378,9 @@ DEFINE_Q35_MACHINE(v2_10, "pc-q35-2.10", NULL,static void pc_q35_2_9_machine_options (MachineClass *m) { -static GlobalProperty compat[] = { -PC_COMPAT_2_9 - }; -pc_q35_2_10_machine_options (m); -compat_props_add (m->compat_props, compat,G_N_ELEMENTS (compat)); +compat_props_add (m->compat_props, hw_compat_2_9, hw_compat_2_9_len); +compat_props_add (m->compat_props, pc_compat_2_9, pc_compat_2_9_len); } DEFINE_Q35_MACHINE(v2_9, "pc-q35-2.9", NULL,hw/ppc/spapr.c +1
-1@@ -4068,7 +4068,6 @@ static void spapr_machine_2_9_class_options(MachineClass *mc) {sPAPRMachineClass *smc =SPAPR_MACHINE_CLASS (mc);static GlobalProperty compat[] = { -HW_COMPAT_2_9 { .driver =TYPE_POWERPC_CPU , .property ="pre-2.10-migration" ,@@ -4077,6 +4076,7 @@ static void spapr_machine_2_9_class_options(MachineClass *mc) };spapr_machine_2_10_class_options (mc); +compat_props_add (mc->compat_props, hw_compat_2_9, hw_compat_2_9_len);compat_props_add (mc->compat_props, compat,G_N_ELEMENTS (compat)); mc->numa_auto_assign_ram = numa_legacy_auto_assign_ram; smc->pre_2_10_has_unused_icps = true;hw/s390x/s390-virtio-ccw.c +1
-1@@ -752,7 +752,6 @@ static void ccw_machine_2_9_class_options(MachineClass *mc) {S390CcwMachineClass *s390mc =S390_MACHINE_CLASS (mc);static GlobalProperty compat[] = { -HW_COMPAT_2_9 { .driver =TYPE_S390_STATTRIB , .property ="migration-enabled" ,@@ -761,6 +760,7 @@ static void ccw_machine_2_9_class_options(MachineClass *mc) };ccw_machine_2_10_class_options (mc); +compat_props_add (mc->compat_props, hw_compat_2_9, hw_compat_2_9_len);compat_props_add (mc->compat_props, compat,G_N_ELEMENTS (compat)); s390mc->css_migration_enabled = false; }
PATCH v7 12/28 compat: replace PC_COMPAT_2_8 & HW_COMPAT_2_8 macros
In reply to Marc-André LureauUse static arrays instead.
--- include/hw/boards.h | 3 +++ include/hw/compat.h | 43 ----------------------------------- include/hw/i386/pc.h | 29 ++---------------------- hw/arm/virt.c | 5 +---- hw/core/machine.c | 46 ++++++++++++++++++++++++++++++++++++++ hw/i386/pc.c | 29 ++++++++++++++++++++++++ hw/i386/pc_piix.c | 7 ++---- hw/i386/pc_q35.c | 7 ++---- hw/ppc/spapr.c | 2 +- hw/s390x/s390-virtio-ccw.c | 2 +- 10 files changed, 87 insertions(+), 86 deletions(-)
include/hw/boards.h +3 -0
@@ -305,4 +305,7 @@ extern const size_t hw_compat_2_10_len;extern GlobalProperty hw_compat_2_9[];extern const size_t hw_compat_2_9_len; +extern GlobalProperty hw_compat_2_8[]; +extern const size_t hw_compat_2_8_len; +#endif
include/hw/compat.h +0 -43
49 lines not on this page · raw message
include/hw/i386/pc.h +2 -27
@@ -312,33 +312,8 @@ extern const size_t pc_compat_2_10_len;extern GlobalProperty pc_compat_2_9[];extern const size_t pc_compat_2_9_len; -#define PC_COMPAT_2_8 \ - HW_COMPAT_2_8 \ - {\ - .driver = TYPE_X86_CPU,\ - .property = "tcg-cpuid",\ - .value = "off",\ - },\ - {\ - .driver = "kvmclock",\ - .property = "x-mach-use-reliable-get-clock",\ - .value = "off",\ - },\ - {\ - .driver = "ICH9-LPC",\ - .property = "x-smi-broadcast",\ - .value = "off",\ - },\ - {\ - .driver = TYPE_X86_CPU,\ - .property = "vmware-cpuid-freq",\ - .value = "off",\ - },\ - {\ - .driver = "Haswell-" TYPE_X86_CPU,\ - .property = "stepping",\ - .value = "1",\ - }, +extern GlobalProperty pc_compat_2_8[]; +extern const size_t pc_compat_2_8_len;#define PC_COMPAT_2_7 \ HW_COMPAT_2_7 \
hw/arm/virt.c +1 -4
@@ -1926,12 +1926,9 @@ DEFINE_VIRT_MACHINE(2, 9)static void virt_machine_2_8_options (MachineClass *mc) {VirtMachineClass *vmc =VIRT_MACHINE_CLASS (OBJECT_CLASS (mc)); -static GlobalProperty compat[] = { -HW_COMPAT_2_8 - };virt_machine_2_9_options (mc); -compat_props_add (mc->compat_props, compat,G_N_ELEMENTS (compat)); +compat_props_add (mc->compat_props, hw_compat_2_8, hw_compat_2_8_len);/* For 2.8 and earlier we falsely claimed in the DT that * our timers were edge-triggered, not level-triggered. */
hw/core/machine.c +46 -0
58 lines not on this page · raw message
hw/i386/pc.c +29 -0
@@ -189,6 +189,35 @@ GlobalProperty pc_compat_2_9[] = { };const size_t pc_compat_2_9_len =G_N_ELEMENTS (pc_compat_2_9); +GlobalProperty pc_compat_2_8[] = { + { + .driver =TYPE_X86_CPU , + .property ="tcg-cpuid" , + .value ="off" , + }, + { + .driver ="kvmclock" , + .property ="x-mach-use-reliable-get-clock" , + .value ="off" , + }, + { + .driver ="ICH9-LPC" , + .property ="x-smi-broadcast" , + .value ="off" , + }, + { + .driver =TYPE_X86_CPU , + .property ="vmware-cpuid-freq" , + .value ="off" , + }, + { + .driver ="Haswell-" TYPE_X86_CPU , + .property ="stepping" , + .value ="1" , + }, +}; +const size_t pc_compat_2_8_len =G_N_ELEMENTS (pc_compat_2_8); +void gsi_handler (void *opaque,int n,int level) {GSIState *s = opaque;
hw/i386/pc_piix.c +2 -5
@@ -504,12 +504,9 @@ DEFINE_I440FX_MACHINE(v2_9, "pc-i440fx-2.9", NULL,static void pc_i440fx_2_8_machine_options (MachineClass *m) { -static GlobalProperty compat[] = { -PC_COMPAT_2_8 - }; -pc_i440fx_2_9_machine_options (m); -compat_props_add (m->compat_props, compat,G_N_ELEMENTS (compat)); +compat_props_add (m->compat_props, hw_compat_2_8, hw_compat_2_8_len); +compat_props_add (m->compat_props, pc_compat_2_8, pc_compat_2_8_len); } DEFINE_I440FX_MACHINE(v2_8, "pc-i440fx-2.8", NULL,
hw/i386/pc_q35.c +2 -5
@@ -388,12 +388,9 @@ DEFINE_Q35_MACHINE(v2_9, "pc-q35-2.9", NULL,static void pc_q35_2_8_machine_options (MachineClass *m) { -static GlobalProperty compat[] = { -PC_COMPAT_2_8 - }; -pc_q35_2_9_machine_options (m); -compat_props_add (m->compat_props, compat,G_N_ELEMENTS (compat)); +compat_props_add (m->compat_props, hw_compat_2_8, hw_compat_2_8_len); +compat_props_add (m->compat_props, pc_compat_2_8, pc_compat_2_8_len); } DEFINE_Q35_MACHINE(v2_8, "pc-q35-2.8", NULL,
hw/ppc/spapr.c +1 -1
@@ -4092,7 +4092,6 @@ DEFINE_SPAPR_MACHINE(2_9, "2.9", false);static void spapr_machine_2_8_class_options (MachineClass *mc) {static GlobalProperty compat[] = { -HW_COMPAT_2_8 { .driver =TYPE_SPAPR_PCI_HOST_BRIDGE , .property ="pcie-extended-configuration-space" ,
@@ -4101,6 +4100,7 @@ static void spapr_machine_2_8_class_options(MachineClass *mc) };spapr_machine_2_9_class_options (mc); +compat_props_add (mc->compat_props, hw_compat_2_8, hw_compat_2_8_len);compat_props_add (mc->compat_props, compat,G_N_ELEMENTS (compat)); mc->numa_mem_align_shift =23 ; }
hw/s390x/s390-virtio-ccw.c +1 -1
@@ -774,7 +774,6 @@ static void ccw_machine_2_8_instance_options(MachineState *machine)static void ccw_machine_2_8_class_options (MachineClass *mc) {static GlobalProperty compat[] = { -HW_COMPAT_2_8 { .driver =TYPE_S390_FLIC_COMMON , .property ="adapter_routes_max_batch" ,
@@ -783,6 +782,7 @@ static void ccw_machine_2_8_class_options(MachineClass *mc) };ccw_machine_2_9_class_options (mc); +compat_props_add (mc->compat_props, hw_compat_2_8, hw_compat_2_8_len);compat_props_add (mc->compat_props, compat,G_N_ELEMENTS (compat)); } DEFINE_CCW_MACHINE(2_8, "2.8", false);
Signature · 1 line
2.20.1.2.gb21ebb671b
Re: [Qemu-devel] [PATCH v7 12/28] compat: replace PC_COMPAT_2_8 & HW_COMPAT_2_8 macros
Quoted 4 lines · On Fri, 21 Dec 2018 13:03:54 +0400 Marc-André Lureau…
Use static arrays instead.
Suggested-by Eduardo Habkost <[email protected]>Signed-off-by Marc-André Lureau <[email protected]>
Quoted 12 lines
--- include/hw/boards.h | 3 +++ include/hw/compat.h | 43 ----------------------------------- include/hw/i386/pc.h | 29 ++---------------------- hw/arm/virt.c | 5 +---- hw/core/machine.c | 46 ++++++++++++++++++++++++++++++++++++++ hw/i386/pc.c | 29 ++++++++++++++++++++++++ hw/i386/pc_piix.c | 7 ++---- hw/i386/pc_q35.c | 7 ++---- hw/ppc/spapr.c | 2 +- hw/s390x/s390-virtio-ccw.c | 2 +- 10 files changed, 87 insertions(+), 86 deletions(-)
Re: [Qemu-devel] [PATCH v7 12/28] compat: replace PC_COMPAT_2_8 & HW_COMPAT_2_8 macros
In reply to Marc-André LureauQuoted 4 lines · On Fri, 21 Dec 2018 13:03:54 +0400 Marc-André Lureau…
Use static arrays instead.
Suggested-by Eduardo Habkost <[email protected]>Signed-off-by Marc-André Lureau <[email protected]>
Quoted 319 lines
--- include/hw/boards.h | 3 +++ include/hw/compat.h | 43 ----------------------------------- include/hw/i386/pc.h | 29 ++---------------------- hw/arm/virt.c | 5 +---- hw/core/machine.c | 46 ++++++++++++++++++++++++++++++++++++++ hw/i386/pc.c | 29 ++++++++++++++++++++++++ hw/i386/pc_piix.c | 7 ++---- hw/i386/pc_q35.c | 7 ++---- hw/ppc/spapr.c | 2 +- hw/s390x/s390-virtio-ccw.c | 2 +- 10 files changed, 87 insertions(+), 86 deletions(-)include/hw/boards.h +3
-0@@ -305,4 +305,7 @@ extern const size_t hw_compat_2_10_len;extern GlobalProperty hw_compat_2_9[];extern const size_t hw_compat_2_9_len; +extern GlobalProperty hw_compat_2_8[]; +extern const size_t hw_compat_2_8_len; +#endif include/hw/compat.h +0
-43@@ -1,49 +1,6 @@#ifndef HW_COMPAT_H #define HW_COMPAT_H -#define HW_COMPAT_2_8 \ - {\ - .driver = "fw_cfg_mem",\ - .property = "x-file-slots",\ - .value = stringify(0x10),\ - },{\ - .driver = "fw_cfg_io",\ - .property = "x-file-slots",\ - .value = stringify(0x10),\ - },{\ - .driver = "pflash_cfi01",\ - .property = "old-multiple-chip-handling",\ - .value = "on",\ - },{\ - .driver = "pci-bridge",\ - .property = "shpc",\ - .value = "on",\ - },{\ - .driver = TYPE_PCI_DEVICE,\ - .property = "x-pcie-extcap-init",\ - .value = "off",\ - },{\ - .driver = "virtio-pci",\ - .property = "x-pcie-deverr-init",\ - .value = "off",\ - },{\ - .driver = "virtio-pci",\ - .property = "x-pcie-lnkctl-init",\ - .value = "off",\ - },{\ - .driver = "virtio-pci",\ - .property = "x-pcie-pm-init",\ - .value = "off",\ - },{\ - .driver = "cirrus-vga",\ - .property = "vgamem_mb",\ - .value = "8",\ - },{\ - .driver = "isa-cirrus-vga",\ - .property = "vgamem_mb",\ - .value = "8",\ - }, -#define HW_COMPAT_2_7 \ {\ .driver = "virtio-pci",\include/hw/i386/pc.h +2
-27@@ -312,33 +312,8 @@ extern const size_t pc_compat_2_10_len;extern GlobalProperty pc_compat_2_9[];extern const size_t pc_compat_2_9_len; -#define PC_COMPAT_2_8 \ - HW_COMPAT_2_8 \ - {\ - .driver = TYPE_X86_CPU,\ - .property = "tcg-cpuid",\ - .value = "off",\ - },\ - {\ - .driver = "kvmclock",\ - .property = "x-mach-use-reliable-get-clock",\ - .value = "off",\ - },\ - {\ - .driver = "ICH9-LPC",\ - .property = "x-smi-broadcast",\ - .value = "off",\ - },\ - {\ - .driver = TYPE_X86_CPU,\ - .property = "vmware-cpuid-freq",\ - .value = "off",\ - },\ - {\ - .driver = "Haswell-" TYPE_X86_CPU,\ - .property = "stepping",\ - .value = "1",\ - }, +extern GlobalProperty pc_compat_2_8[]; +extern const size_t pc_compat_2_8_len;#define PC_COMPAT_2_7 \ HW_COMPAT_2_7 \hw/arm/virt.c +1
-4@@ -1926,12 +1926,9 @@ DEFINE_VIRT_MACHINE(2, 9)static void virt_machine_2_8_options (MachineClass *mc) {VirtMachineClass *vmc =VIRT_MACHINE_CLASS (OBJECT_CLASS (mc)); -static GlobalProperty compat[] = { -HW_COMPAT_2_8 - };virt_machine_2_9_options (mc); -compat_props_add (mc->compat_props, compat,G_N_ELEMENTS (compat)); +compat_props_add (mc->compat_props, hw_compat_2_8, hw_compat_2_8_len);/* For 2.8 and earlier we falsely claimed in the DT that * our timers were edge-triggered, not level-triggered. */ hw/core/machine.c +46
-0@@ -21,6 +21,7 @@#include "sysemu/numa.h" #include "qemu/error-report.h" #include "sysemu/qtest.h" +#include "hw/pci/pci.h" GlobalProperty hw_compat_3_1[] = {};const size_t hw_compat_3_1_len =G_N_ELEMENTS (hw_compat_3_1);@@ -112,6 +113,51 @@ GlobalProperty hw_compat_2_9[] = { };const size_t hw_compat_2_9_len =G_N_ELEMENTS (hw_compat_2_9); +GlobalProperty hw_compat_2_8[] = { + { + .driver ="fw_cfg_mem" , + .property ="x-file-slots" , + .value =stringify (0x10 ), + },{ + .driver ="fw_cfg_io" , + .property ="x-file-slots" , + .value =stringify (0x10 ), + },{ + .driver ="pflash_cfi01" , + .property ="old-multiple-chip-handling" , + .value ="on" , + },{ + .driver ="pci-bridge" , + .property ="shpc" , + .value ="on" , + },{ + .driver =TYPE_PCI_DEVICE , + .property ="x-pcie-extcap-init" , + .value ="off" , + },{ + .driver ="virtio-pci" , + .property ="x-pcie-deverr-init" , + .value ="off" , + },{ + .driver ="virtio-pci" , + .property ="x-pcie-lnkctl-init" , + .value ="off" , + },{ + .driver ="virtio-pci" , + .property ="x-pcie-pm-init" , + .value ="off" , + },{ + .driver ="cirrus-vga" , + .property ="vgamem_mb" , + .value ="8" , + },{ + .driver ="isa-cirrus-vga" , + .property ="vgamem_mb" , + .value ="8" , + }, +}; +const size_t hw_compat_2_8_len =G_N_ELEMENTS (hw_compat_2_8); +static char *machine_get_accel (Object *obj,Error **errp) {MachineState *ms =MACHINE (obj);hw/i386/pc.c +29
-0@@ -189,6 +189,35 @@ GlobalProperty pc_compat_2_9[] = { };const size_t pc_compat_2_9_len =G_N_ELEMENTS (pc_compat_2_9); +GlobalProperty pc_compat_2_8[] = { + { + .driver =TYPE_X86_CPU , + .property ="tcg-cpuid" , + .value ="off" , + }, + { + .driver ="kvmclock" , + .property ="x-mach-use-reliable-get-clock" , + .value ="off" , + }, + { + .driver ="ICH9-LPC" , + .property ="x-smi-broadcast" , + .value ="off" , + }, + { + .driver =TYPE_X86_CPU , + .property ="vmware-cpuid-freq" , + .value ="off" , + }, + { + .driver ="Haswell-" TYPE_X86_CPU , + .property ="stepping" , + .value ="1" , + }, +}; +const size_t pc_compat_2_8_len =G_N_ELEMENTS (pc_compat_2_8); +void gsi_handler (void *opaque,int n,int level) {GSIState *s = opaque;hw/i386/pc_piix.c +2
-5@@ -504,12 +504,9 @@ DEFINE_I440FX_MACHINE(v2_9, "pc-i440fx-2.9", NULL,static void pc_i440fx_2_8_machine_options (MachineClass *m) { -static GlobalProperty compat[] = { -PC_COMPAT_2_8 - }; -pc_i440fx_2_9_machine_options (m); -compat_props_add (m->compat_props, compat,G_N_ELEMENTS (compat)); +compat_props_add (m->compat_props, hw_compat_2_8, hw_compat_2_8_len); +compat_props_add (m->compat_props, pc_compat_2_8, pc_compat_2_8_len); } DEFINE_I440FX_MACHINE(v2_8, "pc-i440fx-2.8", NULL,hw/i386/pc_q35.c +2
-5@@ -388,12 +388,9 @@ DEFINE_Q35_MACHINE(v2_9, "pc-q35-2.9", NULL,static void pc_q35_2_8_machine_options (MachineClass *m) { -static GlobalProperty compat[] = { -PC_COMPAT_2_8 - }; -pc_q35_2_9_machine_options (m); -compat_props_add (m->compat_props, compat,G_N_ELEMENTS (compat)); +compat_props_add (m->compat_props, hw_compat_2_8, hw_compat_2_8_len); +compat_props_add (m->compat_props, pc_compat_2_8, pc_compat_2_8_len); } DEFINE_Q35_MACHINE(v2_8, "pc-q35-2.8", NULL,hw/ppc/spapr.c +1
-1@@ -4092,7 +4092,6 @@ DEFINE_SPAPR_MACHINE(2_9, "2.9", false);static void spapr_machine_2_8_class_options (MachineClass *mc) {static GlobalProperty compat[] = { -HW_COMPAT_2_8 { .driver =TYPE_SPAPR_PCI_HOST_BRIDGE , .property ="pcie-extended-configuration-space" ,@@ -4101,6 +4100,7 @@ static void spapr_machine_2_8_class_options(MachineClass *mc) };spapr_machine_2_9_class_options (mc); +compat_props_add (mc->compat_props, hw_compat_2_8, hw_compat_2_8_len);compat_props_add (mc->compat_props, compat,G_N_ELEMENTS (compat)); mc->numa_mem_align_shift =23 ; }hw/s390x/s390-virtio-ccw.c +1
-1@@ -774,7 +774,6 @@ static void ccw_machine_2_8_instance_options(MachineState *machine)static void ccw_machine_2_8_class_options (MachineClass *mc) {static GlobalProperty compat[] = { -HW_COMPAT_2_8 { .driver =TYPE_S390_FLIC_COMMON , .property ="adapter_routes_max_batch" ,@@ -783,6 +782,7 @@ static void ccw_machine_2_8_class_options(MachineClass *mc) };ccw_machine_2_9_class_options (mc); +compat_props_add (mc->compat_props, hw_compat_2_8, hw_compat_2_8_len);compat_props_add (mc->compat_props, compat,G_N_ELEMENTS (compat)); } DEFINE_CCW_MACHINE(2_8, "2.8", false);
PATCH v7 13/28 compat: replace PC_COMPAT_2_7 & HW_COMPAT_2_7 macros
In reply to Marc-André LureauUse static arrays instead.
--- 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(-)
include/hw/boards.h +3 -0
@@ -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
include/hw/compat.h +0 -23
@@ -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",\
include/hw/i386/pc.h +2 -32
@@ -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 \
hw/arm/virt.c +1 -4
@@ -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 */
hw/core/machine.c +25 -0
@@ -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);
hw/i386/pc.c +34 -0
@@ -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;
hw/i386/pc_piix.c +2 -5
@@ -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,
hw/i386/pc_q35.c +2 -5
@@ -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,
hw/ppc/spapr.c +1 -1
@@ -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; }
hw/s390x/s390-virtio-ccw.c +1 -4
@@ -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);
Signature · 1 line
2.20.1.2.gb21ebb671b
Re: [Qemu-devel] [PATCH v7 13/28] compat: replace PC_COMPAT_2_7 & HW_COMPAT_2_7 macros
Quoted 4 lines · On Fri, 21 Dec 2018 13:03:55 +0400 Marc-André Lureau…
Use static arrays instead.
Suggested-by Eduardo Habkost <[email protected]>Signed-off-by Marc-André Lureau <[email protected]>
Quoted 12 lines
--- 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(-)
Re: [Qemu-devel] [PATCH v7 13/28] compat: replace PC_COMPAT_2_7 & HW_COMPAT_2_7 macros
In reply to Marc-André LureauQuoted 4 lines · On Fri, 21 Dec 2018 13:03:55 +0400 Marc-André Lureau…
Use static arrays instead.
Suggested-by Eduardo Habkost <[email protected]>Signed-off-by Marc-André Lureau <[email protected]>
Quoted 281 lines
--- 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(-)include/hw/boards.h +3
-0@@ -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 include/hw/compat.h +0
-23@@ -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",\include/hw/i386/pc.h +2
-32@@ -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 \hw/arm/virt.c +1
-4@@ -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 */ hw/core/machine.c +25
-0@@ -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);hw/i386/pc.c +34
-0@@ -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;hw/i386/pc_piix.c +2
-5@@ -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,hw/i386/pc_q35.c +2
-5@@ -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,hw/ppc/spapr.c +1
-1@@ -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; }hw/s390x/s390-virtio-ccw.c +1
-4@@ -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);
PATCH v7 14/28 compat: replace PC_COMPAT_2_6 & HW_COMPAT_2_6 macros
In reply to Marc-André LureauUse static arrays instead.
--- include/hw/boards.h | 3 +++ include/hw/compat.h | 15 --------------- include/hw/i386/pc.h | 23 ++--------------------- hw/arm/virt.c | 5 +---- hw/core/machine.c | 17 +++++++++++++++++ hw/i386/pc.c | 23 +++++++++++++++++++++++ hw/i386/pc_piix.c | 6 ++---- hw/i386/pc_q35.c | 6 ++---- hw/ppc/spapr.c | 2 +- hw/s390x/s390-virtio-ccw.c | 2 +- 10 files changed, 52 insertions(+), 50 deletions(-)
include/hw/boards.h +3 -0
@@ -311,4 +311,7 @@ extern const size_t hw_compat_2_8_len;extern GlobalProperty hw_compat_2_7[];extern const size_t hw_compat_2_7_len; +extern GlobalProperty hw_compat_2_6[]; +extern const size_t hw_compat_2_6_len; +#endif
include/hw/compat.h +0 -15
@@ -1,21 +1,6 @@#ifndef HW_COMPAT_H #define HW_COMPAT_H -#define HW_COMPAT_2_6 \ - {\ - .driver = "virtio-mmio",\ - .property = "format_transport_address",\ - .value = "off",\ - },{\ - .driver = "virtio-pci",\ - .property = "disable-modern",\ - .value = "on",\ - },{\ - .driver = "virtio-pci",\ - .property = "disable-legacy",\ - .value = "off",\ - }, -#define HW_COMPAT_2_5 \ {\ .driver = "isa-fdc",\
include/hw/i386/pc.h +2 -21
@@ -318,27 +318,8 @@ extern const size_t pc_compat_2_8_len;extern GlobalProperty pc_compat_2_7[];extern const size_t pc_compat_2_7_len; -#define PC_COMPAT_2_6 \ - HW_COMPAT_2_6 \ - {\ - .driver = TYPE_X86_CPU,\ - .property = "cpuid-0xb",\ - .value = "off",\ - },{\ - .driver = "vmxnet3",\ - .property = "romfile",\ - .value = "",\ - },\ - {\ - .driver = TYPE_X86_CPU,\ - .property = "fill-mtrr-mask",\ - .value = "off",\ - },\ - {\ - .driver = "apic-common",\ - .property = "legacy-instance-id",\ - .value = "on",\ - }, +extern GlobalProperty pc_compat_2_6[]; +extern const size_t pc_compat_2_6_len;#define PC_COMPAT_2_5 \ HW_COMPAT_2_5
hw/arm/virt.c +1 -4
@@ -1952,12 +1952,9 @@ DEFINE_VIRT_MACHINE(2, 7)static void virt_machine_2_6_options (MachineClass *mc) {VirtMachineClass *vmc =VIRT_MACHINE_CLASS (OBJECT_CLASS (mc)); -static GlobalProperty compat[] = { -HW_COMPAT_2_6 - };virt_machine_2_7_options (mc); -compat_props_add (mc->compat_props, compat,G_N_ELEMENTS (compat)); +compat_props_add (mc->compat_props, hw_compat_2_6, hw_compat_2_6_len); vmc->disallow_affinity_adjustment = true;/* Disable PMU for 2.6 as PMU support was first introduced in 2.7 */ vmc->no_pmu = true;
hw/core/machine.c +17 -0
@@ -183,6 +183,23 @@ GlobalProperty hw_compat_2_7[] = { };const size_t hw_compat_2_7_len =G_N_ELEMENTS (hw_compat_2_7); +GlobalProperty hw_compat_2_6[] = { + { + .driver ="virtio-mmio" , + .property ="format_transport_address" , + .value ="off" , + },{ + .driver ="virtio-pci" , + .property ="disable-modern" , + .value ="on" , + },{ + .driver ="virtio-pci" , + .property ="disable-legacy" , + .value ="off" , + }, +}; +const size_t hw_compat_2_6_len =G_N_ELEMENTS (hw_compat_2_6); +static char *machine_get_accel (Object *obj,Error **errp) {MachineState *ms =MACHINE (obj);
hw/i386/pc.c +23 -0
@@ -252,6 +252,29 @@ GlobalProperty pc_compat_2_7[] = { };const size_t pc_compat_2_7_len =G_N_ELEMENTS (pc_compat_2_7); +GlobalProperty pc_compat_2_6[] = { + { + .driver =TYPE_X86_CPU , + .property ="cpuid-0xb" , + .value ="off" , + },{ + .driver ="vmxnet3" , + .property ="romfile" , + .value ="" , + }, + { + .driver =TYPE_X86_CPU , + .property ="fill-mtrr-mask" , + .value ="off" , + }, + { + .driver ="apic-common" , + .property ="legacy-instance-id" , + .value ="on" , + } +}; +const size_t pc_compat_2_6_len =G_N_ELEMENTS (pc_compat_2_6); +void gsi_handler (void *opaque,int n,int level) {GSIState *s = opaque;
hw/i386/pc_piix.c +2 -4
@@ -525,14 +525,12 @@ DEFINE_I440FX_MACHINE(v2_7, "pc-i440fx-2.7", NULL,static void pc_i440fx_2_6_machine_options (MachineClass *m) {PCMachineClass *pcmc =PC_MACHINE_CLASS (m); -static GlobalProperty compat[] = { -PC_COMPAT_2_6 - };pc_i440fx_2_7_machine_options (m); pcmc->legacy_cpu_hotplug = true; pcmc->linuxboot_dma_enabled = false; -compat_props_add (m->compat_props, compat,G_N_ELEMENTS (compat)); +compat_props_add (m->compat_props, hw_compat_2_6, hw_compat_2_6_len); +compat_props_add (m->compat_props, pc_compat_2_6, pc_compat_2_6_len); } DEFINE_I440FX_MACHINE(v2_6, "pc-i440fx-2.6", NULL,
hw/i386/pc_q35.c +2 -4
@@ -410,14 +410,12 @@ DEFINE_Q35_MACHINE(v2_7, "pc-q35-2.7", NULL,static void pc_q35_2_6_machine_options (MachineClass *m) {PCMachineClass *pcmc =PC_MACHINE_CLASS (m); -static GlobalProperty compat[] = { -PC_COMPAT_2_6 - };pc_q35_2_7_machine_options (m); pcmc->legacy_cpu_hotplug = true; pcmc->linuxboot_dma_enabled = false; -compat_props_add (m->compat_props, compat,G_N_ELEMENTS (compat)); +compat_props_add (m->compat_props, hw_compat_2_6, hw_compat_2_6_len); +compat_props_add (m->compat_props, pc_compat_2_6, pc_compat_2_6_len); } DEFINE_Q35_MACHINE(v2_6, "pc-q35-2.6", NULL,
hw/ppc/spapr.c +1 -1
@@ -4203,7 +4203,6 @@ DEFINE_SPAPR_MACHINE(2_7, "2.7", false);static void spapr_machine_2_6_class_options (MachineClass *mc) {static GlobalProperty compat[] = { -HW_COMPAT_2_6 { .driver =TYPE_SPAPR_PCI_HOST_BRIDGE , .property ="ddw" ,
@@ -4213,6 +4212,7 @@ static void spapr_machine_2_6_class_options(MachineClass *mc)spapr_machine_2_7_class_options (mc); mc->has_hotpluggable_cpus = false; +compat_props_add (mc->compat_props, hw_compat_2_6, hw_compat_2_6_len);compat_props_add (mc->compat_props, compat,G_N_ELEMENTS (compat)); }
hw/s390x/s390-virtio-ccw.c +1 -1
@@ -811,7 +811,6 @@ static void ccw_machine_2_6_class_options(MachineClass *mc) {S390CcwMachineClass *s390mc =S390_MACHINE_CLASS (mc);static GlobalProperty compat[] = { -HW_COMPAT_2_6 { .driver =TYPE_S390_IPL , .property ="iplbext_migration" ,
@@ -825,6 +824,7 @@ static void ccw_machine_2_6_class_options(MachineClass *mc) s390mc->ri_allowed = false;ccw_machine_2_7_class_options (mc); +compat_props_add (mc->compat_props, hw_compat_2_6, hw_compat_2_6_len);compat_props_add (mc->compat_props, compat,G_N_ELEMENTS (compat)); } DEFINE_CCW_MACHINE(2_6, "2.6", false);
Signature · 1 line
2.20.1.2.gb21ebb671b
Re: [Qemu-devel] [PATCH v7 14/28] compat: replace PC_COMPAT_2_6 & HW_COMPAT_2_6 macros
Quoted 4 lines · On Fri, 21 Dec 2018 13:03:56 +0400 Marc-André Lureau…
Use static arrays instead.
Suggested-by Eduardo Habkost <[email protected]>Signed-off-by Marc-André Lureau <[email protected]>
Quoted 12 lines
--- include/hw/boards.h | 3 +++ include/hw/compat.h | 15 --------------- include/hw/i386/pc.h | 23 ++--------------------- hw/arm/virt.c | 5 +---- hw/core/machine.c | 17 +++++++++++++++++ hw/i386/pc.c | 23 +++++++++++++++++++++++ hw/i386/pc_piix.c | 6 ++---- hw/i386/pc_q35.c | 6 ++---- hw/ppc/spapr.c | 2 +- hw/s390x/s390-virtio-ccw.c | 2 +- 10 files changed, 52 insertions(+), 50 deletions(-)
Re: [Qemu-devel] [PATCH v7 14/28] compat: replace PC_COMPAT_2_6 & HW_COMPAT_2_6 macros
In reply to Marc-André LureauQuoted 4 lines · On Fri, 21 Dec 2018 13:03:56 +0400 Marc-André Lureau…
Use static arrays instead.
Suggested-by Eduardo Habkost <[email protected]>Signed-off-by Marc-André Lureau <[email protected]>
Quoted 247 lines
--- include/hw/boards.h | 3 +++ include/hw/compat.h | 15 --------------- include/hw/i386/pc.h | 23 ++--------------------- hw/arm/virt.c | 5 +---- hw/core/machine.c | 17 +++++++++++++++++ hw/i386/pc.c | 23 +++++++++++++++++++++++ hw/i386/pc_piix.c | 6 ++---- hw/i386/pc_q35.c | 6 ++---- hw/ppc/spapr.c | 2 +- hw/s390x/s390-virtio-ccw.c | 2 +- 10 files changed, 52 insertions(+), 50 deletions(-)include/hw/boards.h +3
-0@@ -311,4 +311,7 @@ extern const size_t hw_compat_2_8_len;extern GlobalProperty hw_compat_2_7[];extern const size_t hw_compat_2_7_len; +extern GlobalProperty hw_compat_2_6[]; +extern const size_t hw_compat_2_6_len; +#endif include/hw/compat.h +0
-15@@ -1,21 +1,6 @@#ifndef HW_COMPAT_H #define HW_COMPAT_H -#define HW_COMPAT_2_6 \ - {\ - .driver = "virtio-mmio",\ - .property = "format_transport_address",\ - .value = "off",\ - },{\ - .driver = "virtio-pci",\ - .property = "disable-modern",\ - .value = "on",\ - },{\ - .driver = "virtio-pci",\ - .property = "disable-legacy",\ - .value = "off",\ - }, -#define HW_COMPAT_2_5 \ {\ .driver = "isa-fdc",\include/hw/i386/pc.h +2
-21@@ -318,27 +318,8 @@ extern const size_t pc_compat_2_8_len;extern GlobalProperty pc_compat_2_7[];extern const size_t pc_compat_2_7_len; -#define PC_COMPAT_2_6 \ - HW_COMPAT_2_6 \ - {\ - .driver = TYPE_X86_CPU,\ - .property = "cpuid-0xb",\ - .value = "off",\ - },{\ - .driver = "vmxnet3",\ - .property = "romfile",\ - .value = "",\ - },\ - {\ - .driver = TYPE_X86_CPU,\ - .property = "fill-mtrr-mask",\ - .value = "off",\ - },\ - {\ - .driver = "apic-common",\ - .property = "legacy-instance-id",\ - .value = "on",\ - }, +extern GlobalProperty pc_compat_2_6[]; +extern const size_t pc_compat_2_6_len;#define PC_COMPAT_2_5 \ HW_COMPAT_2_5hw/arm/virt.c +1
-4@@ -1952,12 +1952,9 @@ DEFINE_VIRT_MACHINE(2, 7)static void virt_machine_2_6_options (MachineClass *mc) {VirtMachineClass *vmc =VIRT_MACHINE_CLASS (OBJECT_CLASS (mc)); -static GlobalProperty compat[] = { -HW_COMPAT_2_6 - };virt_machine_2_7_options (mc); -compat_props_add (mc->compat_props, compat,G_N_ELEMENTS (compat)); +compat_props_add (mc->compat_props, hw_compat_2_6, hw_compat_2_6_len); vmc->disallow_affinity_adjustment = true;/* Disable PMU for 2.6 as PMU support was first introduced in 2.7 */ vmc->no_pmu = true;hw/core/machine.c +17
-0@@ -183,6 +183,23 @@ GlobalProperty hw_compat_2_7[] = { };const size_t hw_compat_2_7_len =G_N_ELEMENTS (hw_compat_2_7); +GlobalProperty hw_compat_2_6[] = { + { + .driver ="virtio-mmio" , + .property ="format_transport_address" , + .value ="off" , + },{ + .driver ="virtio-pci" , + .property ="disable-modern" , + .value ="on" , + },{ + .driver ="virtio-pci" , + .property ="disable-legacy" , + .value ="off" , + }, +}; +const size_t hw_compat_2_6_len =G_N_ELEMENTS (hw_compat_2_6); +static char *machine_get_accel (Object *obj,Error **errp) {MachineState *ms =MACHINE (obj);hw/i386/pc.c +23
-0@@ -252,6 +252,29 @@ GlobalProperty pc_compat_2_7[] = { };const size_t pc_compat_2_7_len =G_N_ELEMENTS (pc_compat_2_7); +GlobalProperty pc_compat_2_6[] = { + { + .driver =TYPE_X86_CPU , + .property ="cpuid-0xb" , + .value ="off" , + },{ + .driver ="vmxnet3" , + .property ="romfile" , + .value ="" , + }, + { + .driver =TYPE_X86_CPU , + .property ="fill-mtrr-mask" , + .value ="off" , + }, + { + .driver ="apic-common" , + .property ="legacy-instance-id" , + .value ="on" , + } +}; +const size_t pc_compat_2_6_len =G_N_ELEMENTS (pc_compat_2_6); +void gsi_handler (void *opaque,int n,int level) {GSIState *s = opaque;hw/i386/pc_piix.c +2
-4@@ -525,14 +525,12 @@ DEFINE_I440FX_MACHINE(v2_7, "pc-i440fx-2.7", NULL,static void pc_i440fx_2_6_machine_options (MachineClass *m) {PCMachineClass *pcmc =PC_MACHINE_CLASS (m); -static GlobalProperty compat[] = { -PC_COMPAT_2_6 - };pc_i440fx_2_7_machine_options (m); pcmc->legacy_cpu_hotplug = true; pcmc->linuxboot_dma_enabled = false; -compat_props_add (m->compat_props, compat,G_N_ELEMENTS (compat)); +compat_props_add (m->compat_props, hw_compat_2_6, hw_compat_2_6_len); +compat_props_add (m->compat_props, pc_compat_2_6, pc_compat_2_6_len); } DEFINE_I440FX_MACHINE(v2_6, "pc-i440fx-2.6", NULL,hw/i386/pc_q35.c +2
-4@@ -410,14 +410,12 @@ DEFINE_Q35_MACHINE(v2_7, "pc-q35-2.7", NULL,static void pc_q35_2_6_machine_options (MachineClass *m) {PCMachineClass *pcmc =PC_MACHINE_CLASS (m); -static GlobalProperty compat[] = { -PC_COMPAT_2_6 - };pc_q35_2_7_machine_options (m); pcmc->legacy_cpu_hotplug = true; pcmc->linuxboot_dma_enabled = false; -compat_props_add (m->compat_props, compat,G_N_ELEMENTS (compat)); +compat_props_add (m->compat_props, hw_compat_2_6, hw_compat_2_6_len); +compat_props_add (m->compat_props, pc_compat_2_6, pc_compat_2_6_len); } DEFINE_Q35_MACHINE(v2_6, "pc-q35-2.6", NULL,hw/ppc/spapr.c +1
-1@@ -4203,7 +4203,6 @@ DEFINE_SPAPR_MACHINE(2_7, "2.7", false);static void spapr_machine_2_6_class_options (MachineClass *mc) {static GlobalProperty compat[] = { -HW_COMPAT_2_6 { .driver =TYPE_SPAPR_PCI_HOST_BRIDGE , .property ="ddw" ,@@ -4213,6 +4212,7 @@ static void spapr_machine_2_6_class_options(MachineClass *mc)spapr_machine_2_7_class_options (mc); mc->has_hotpluggable_cpus = false; +compat_props_add (mc->compat_props, hw_compat_2_6, hw_compat_2_6_len);compat_props_add (mc->compat_props, compat,G_N_ELEMENTS (compat)); }hw/s390x/s390-virtio-ccw.c +1
-1@@ -811,7 +811,6 @@ static void ccw_machine_2_6_class_options(MachineClass *mc) {S390CcwMachineClass *s390mc =S390_MACHINE_CLASS (mc);static GlobalProperty compat[] = { -HW_COMPAT_2_6 { .driver =TYPE_S390_IPL , .property ="iplbext_migration" ,@@ -825,6 +824,7 @@ static void ccw_machine_2_6_class_options(MachineClass *mc) s390mc->ri_allowed = false;ccw_machine_2_7_class_options (mc); +compat_props_add (mc->compat_props, hw_compat_2_6, hw_compat_2_6_len);compat_props_add (mc->compat_props, compat,G_N_ELEMENTS (compat)); } DEFINE_CCW_MACHINE(2_6, "2.6", false);
PATCH v7 15/28 compat: replace PC_COMPAT_2_5 & HW_COMPAT_2_5 macros
In reply to Marc-André LureauUse static arrays instead.
--- include/hw/boards.h | 3 +++ include/hw/compat.h | 24 ------------------------ include/hw/i386/pc.h | 4 ++-- hw/core/machine.c | 26 ++++++++++++++++++++++++++ hw/i386/pc.c | 3 +++ hw/i386/pc_piix.c | 6 ++---- hw/i386/pc_q35.c | 6 ++---- hw/ppc/spapr.c | 2 +- hw/s390x/s390-virtio-ccw.c | 6 +----- 9 files changed, 40 insertions(+), 40 deletions(-)
include/hw/boards.h +3 -0
@@ -314,4 +314,7 @@ extern const size_t hw_compat_2_7_len;extern GlobalProperty hw_compat_2_6[];extern const size_t hw_compat_2_6_len; +extern GlobalProperty hw_compat_2_5[]; +extern const size_t hw_compat_2_5_len; +#endif
include/hw/compat.h +0 -24
@@ -1,30 +1,6 @@#ifndef HW_COMPAT_H #define HW_COMPAT_H -#define HW_COMPAT_2_5 \ - {\ - .driver = "isa-fdc",\ - .property = "fallback",\ - .value = "144",\ - },{\ - .driver = "pvscsi",\ - .property = "x-old-pci-configuration",\ - .value = "on",\ - },{\ - .driver = "pvscsi",\ - .property = "x-disable-pcie",\ - .value = "on",\ - },\ - {\ - .driver = "vmxnet3",\ - .property = "x-old-msi-offsets",\ - .value = "on",\ - },{\ - .driver = "vmxnet3",\ - .property = "x-disable-pcie",\ - .value = "on",\ - }, -#define HW_COMPAT_2_4 \ {\ .driver = "virtio-blk-device",\
include/hw/i386/pc.h +2 -2
@@ -321,8 +321,8 @@ extern const size_t pc_compat_2_7_len;extern GlobalProperty pc_compat_2_6[];extern const size_t pc_compat_2_6_len; -#define PC_COMPAT_2_5 \ - HW_COMPAT_2_5 +extern GlobalProperty pc_compat_2_5[]; +extern const size_t pc_compat_2_5_len;/* Helper for setting model-id for CPU models that changed model-id * depending on QEMU versions up to QEMU 2.4.
hw/core/machine.c +26 -0
@@ -200,6 +200,32 @@ GlobalProperty hw_compat_2_6[] = { };const size_t hw_compat_2_6_len =G_N_ELEMENTS (hw_compat_2_6); +GlobalProperty hw_compat_2_5[] = { + { + .driver ="isa-fdc" , + .property ="fallback" , + .value ="144" , + },{ + .driver ="pvscsi" , + .property ="x-old-pci-configuration" , + .value ="on" , + },{ + .driver ="pvscsi" , + .property ="x-disable-pcie" , + .value ="on" , + }, + { + .driver ="vmxnet3" , + .property ="x-old-msi-offsets" , + .value ="on" , + },{ + .driver ="vmxnet3" , + .property ="x-disable-pcie" , + .value ="on" , + }, +}; +const size_t hw_compat_2_5_len =G_N_ELEMENTS (hw_compat_2_5); +static char *machine_get_accel (Object *obj,Error **errp) {MachineState *ms =MACHINE (obj);
hw/i386/pc.c +3 -0
@@ -275,6 +275,9 @@ GlobalProperty pc_compat_2_6[] = { };const size_t pc_compat_2_6_len =G_N_ELEMENTS (pc_compat_2_6); +GlobalProperty pc_compat_2_5[] = {}; +const size_t pc_compat_2_5_len =G_N_ELEMENTS (pc_compat_2_5); +void gsi_handler (void *opaque,int n,int level) {GSIState *s = opaque;
hw/i386/pc_piix.c +2 -4
@@ -539,14 +539,12 @@ DEFINE_I440FX_MACHINE(v2_6, "pc-i440fx-2.6", NULL,static void pc_i440fx_2_5_machine_options (MachineClass *m) {PCMachineClass *pcmc =PC_MACHINE_CLASS (m); -static GlobalProperty compat[] = { -PC_COMPAT_2_5 - };pc_i440fx_2_6_machine_options (m); pcmc->save_tsc_khz = false; m->legacy_fw_cfg_order =1 ; -compat_props_add (m->compat_props, compat,G_N_ELEMENTS (compat)); +compat_props_add (m->compat_props, hw_compat_2_5, hw_compat_2_5_len); +compat_props_add (m->compat_props, pc_compat_2_5, pc_compat_2_5_len); } DEFINE_I440FX_MACHINE(v2_5, "pc-i440fx-2.5", NULL,
hw/i386/pc_q35.c +2 -4
@@ -424,14 +424,12 @@ DEFINE_Q35_MACHINE(v2_6, "pc-q35-2.6", NULL,static void pc_q35_2_5_machine_options (MachineClass *m) {PCMachineClass *pcmc =PC_MACHINE_CLASS (m); -static GlobalProperty compat[] = { -PC_COMPAT_2_5 - };pc_q35_2_6_machine_options (m); pcmc->save_tsc_khz = false; m->legacy_fw_cfg_order =1 ; -compat_props_add (m->compat_props, compat,G_N_ELEMENTS (compat)); +compat_props_add (m->compat_props, hw_compat_2_5, hw_compat_2_5_len); +compat_props_add (m->compat_props, pc_compat_2_5, pc_compat_2_5_len); } DEFINE_Q35_MACHINE(v2_5, "pc-q35-2.5", NULL,
hw/ppc/spapr.c +1 -1
@@ -4226,7 +4226,6 @@ static void spapr_machine_2_5_class_options(MachineClass *mc) {sPAPRMachineClass *smc =SPAPR_MACHINE_CLASS (mc);static GlobalProperty compat[] = { -HW_COMPAT_2_5 { .driver ="spapr-vlan" , .property ="use-rx-buffer-pools" ,
@@ -4236,6 +4235,7 @@ static void spapr_machine_2_5_class_options(MachineClass *mc)spapr_machine_2_6_class_options (mc); smc->use_ohci_by_default = true; +compat_props_add (mc->compat_props, hw_compat_2_5, hw_compat_2_5_len);compat_props_add (mc->compat_props, compat,G_N_ELEMENTS (compat)); }
hw/s390x/s390-virtio-ccw.c +1 -5
@@ -836,12 +836,8 @@ static void ccw_machine_2_5_instance_options(MachineState *machine)static void ccw_machine_2_5_class_options (MachineClass *mc) { -static GlobalProperty compat[] = { -HW_COMPAT_2_5 - }; -ccw_machine_2_6_class_options (mc); -compat_props_add (mc->compat_props, compat,G_N_ELEMENTS (compat)); +compat_props_add (mc->compat_props, hw_compat_2_5, hw_compat_2_5_len); } DEFINE_CCW_MACHINE(2_5, "2.5", false);
Signature · 1 line
2.20.1.2.gb21ebb671b
Re: [Qemu-devel] [PATCH v7 15/28] compat: replace PC_COMPAT_2_5 & HW_COMPAT_2_5 macros
Quoted 4 lines · On Fri, 21 Dec 2018 13:03:57 +0400 Marc-André Lureau…
Use static arrays instead.
Suggested-by Eduardo Habkost <[email protected]>Signed-off-by Marc-André Lureau <[email protected]>
Quoted 12 lines
--- include/hw/boards.h | 3 +++ include/hw/compat.h | 24 ------------------------ include/hw/i386/pc.h | 4 ++-- hw/core/machine.c | 26 ++++++++++++++++++++++++++ hw/i386/pc.c | 3 +++ hw/i386/pc_piix.c | 6 ++---- hw/i386/pc_q35.c | 6 ++---- hw/ppc/spapr.c | 2 +- hw/s390x/s390-virtio-ccw.c | 6 +----- 9 files changed, 40 insertions(+), 40 deletions(-)
Re: [Qemu-devel] [PATCH v7 15/28] compat: replace PC_COMPAT_2_5 & HW_COMPAT_2_5 macros
In reply to Marc-André LureauQuoted 4 lines · On Fri, 21 Dec 2018 13:03:57 +0400 Marc-André Lureau…
Use static arrays instead.
Suggested-by Eduardo Habkost <[email protected]>Signed-off-by Marc-André Lureau <[email protected]>
Quoted 205 lines
--- include/hw/boards.h | 3 +++ include/hw/compat.h | 24 ------------------------ include/hw/i386/pc.h | 4 ++-- hw/core/machine.c | 26 ++++++++++++++++++++++++++ hw/i386/pc.c | 3 +++ hw/i386/pc_piix.c | 6 ++---- hw/i386/pc_q35.c | 6 ++---- hw/ppc/spapr.c | 2 +- hw/s390x/s390-virtio-ccw.c | 6 +----- 9 files changed, 40 insertions(+), 40 deletions(-)include/hw/boards.h +3
-0@@ -314,4 +314,7 @@ extern const size_t hw_compat_2_7_len;extern GlobalProperty hw_compat_2_6[];extern const size_t hw_compat_2_6_len; +extern GlobalProperty hw_compat_2_5[]; +extern const size_t hw_compat_2_5_len; +#endif include/hw/compat.h +0
-24@@ -1,30 +1,6 @@#ifndef HW_COMPAT_H #define HW_COMPAT_H -#define HW_COMPAT_2_5 \ - {\ - .driver = "isa-fdc",\ - .property = "fallback",\ - .value = "144",\ - },{\ - .driver = "pvscsi",\ - .property = "x-old-pci-configuration",\ - .value = "on",\ - },{\ - .driver = "pvscsi",\ - .property = "x-disable-pcie",\ - .value = "on",\ - },\ - {\ - .driver = "vmxnet3",\ - .property = "x-old-msi-offsets",\ - .value = "on",\ - },{\ - .driver = "vmxnet3",\ - .property = "x-disable-pcie",\ - .value = "on",\ - }, -#define HW_COMPAT_2_4 \ {\ .driver = "virtio-blk-device",\include/hw/i386/pc.h +2
-2@@ -321,8 +321,8 @@ extern const size_t pc_compat_2_7_len;extern GlobalProperty pc_compat_2_6[];extern const size_t pc_compat_2_6_len; -#define PC_COMPAT_2_5 \ - HW_COMPAT_2_5 +extern GlobalProperty pc_compat_2_5[]; +extern const size_t pc_compat_2_5_len;/* Helper for setting model-id for CPU models that changed model-id * depending on QEMU versions up to QEMU 2.4. hw/core/machine.c +26
-0@@ -200,6 +200,32 @@ GlobalProperty hw_compat_2_6[] = { };const size_t hw_compat_2_6_len =G_N_ELEMENTS (hw_compat_2_6); +GlobalProperty hw_compat_2_5[] = { + { + .driver ="isa-fdc" , + .property ="fallback" , + .value ="144" , + },{ + .driver ="pvscsi" , + .property ="x-old-pci-configuration" , + .value ="on" , + },{ + .driver ="pvscsi" , + .property ="x-disable-pcie" , + .value ="on" , + }, + { + .driver ="vmxnet3" , + .property ="x-old-msi-offsets" , + .value ="on" , + },{ + .driver ="vmxnet3" , + .property ="x-disable-pcie" , + .value ="on" , + }, +}; +const size_t hw_compat_2_5_len =G_N_ELEMENTS (hw_compat_2_5); +static char *machine_get_accel (Object *obj,Error **errp) {MachineState *ms =MACHINE (obj);hw/i386/pc.c +3
-0@@ -275,6 +275,9 @@ GlobalProperty pc_compat_2_6[] = { };const size_t pc_compat_2_6_len =G_N_ELEMENTS (pc_compat_2_6); +GlobalProperty pc_compat_2_5[] = {}; +const size_t pc_compat_2_5_len =G_N_ELEMENTS (pc_compat_2_5); +void gsi_handler (void *opaque,int n,int level) {GSIState *s = opaque;hw/i386/pc_piix.c +2
-4@@ -539,14 +539,12 @@ DEFINE_I440FX_MACHINE(v2_6, "pc-i440fx-2.6", NULL,static void pc_i440fx_2_5_machine_options (MachineClass *m) {PCMachineClass *pcmc =PC_MACHINE_CLASS (m); -static GlobalProperty compat[] = { -PC_COMPAT_2_5 - };pc_i440fx_2_6_machine_options (m); pcmc->save_tsc_khz = false; m->legacy_fw_cfg_order =1 ; -compat_props_add (m->compat_props, compat,G_N_ELEMENTS (compat)); +compat_props_add (m->compat_props, hw_compat_2_5, hw_compat_2_5_len); +compat_props_add (m->compat_props, pc_compat_2_5, pc_compat_2_5_len); } DEFINE_I440FX_MACHINE(v2_5, "pc-i440fx-2.5", NULL,hw/i386/pc_q35.c +2
-4@@ -424,14 +424,12 @@ DEFINE_Q35_MACHINE(v2_6, "pc-q35-2.6", NULL,static void pc_q35_2_5_machine_options (MachineClass *m) {PCMachineClass *pcmc =PC_MACHINE_CLASS (m); -static GlobalProperty compat[] = { -PC_COMPAT_2_5 - };pc_q35_2_6_machine_options (m); pcmc->save_tsc_khz = false; m->legacy_fw_cfg_order =1 ; -compat_props_add (m->compat_props, compat,G_N_ELEMENTS (compat)); +compat_props_add (m->compat_props, hw_compat_2_5, hw_compat_2_5_len); +compat_props_add (m->compat_props, pc_compat_2_5, pc_compat_2_5_len); } DEFINE_Q35_MACHINE(v2_5, "pc-q35-2.5", NULL,hw/ppc/spapr.c +1
-1@@ -4226,7 +4226,6 @@ static void spapr_machine_2_5_class_options(MachineClass *mc) {sPAPRMachineClass *smc =SPAPR_MACHINE_CLASS (mc);static GlobalProperty compat[] = { -HW_COMPAT_2_5 { .driver ="spapr-vlan" , .property ="use-rx-buffer-pools" ,@@ -4236,6 +4235,7 @@ static void spapr_machine_2_5_class_options(MachineClass *mc)spapr_machine_2_6_class_options (mc); smc->use_ohci_by_default = true; +compat_props_add (mc->compat_props, hw_compat_2_5, hw_compat_2_5_len);compat_props_add (mc->compat_props, compat,G_N_ELEMENTS (compat)); }hw/s390x/s390-virtio-ccw.c +1
-5@@ -836,12 +836,8 @@ static void ccw_machine_2_5_instance_options(MachineState *machine)static void ccw_machine_2_5_class_options (MachineClass *mc) { -static GlobalProperty compat[] = { -HW_COMPAT_2_5 - }; -ccw_machine_2_6_class_options (mc); -compat_props_add (mc->compat_props, compat,G_N_ELEMENTS (compat)); +compat_props_add (mc->compat_props, hw_compat_2_5, hw_compat_2_5_len); } DEFINE_CCW_MACHINE(2_5, "2.5", false);
PATCH v7 16/28 compat: replace PC_COMPAT_2_4 & HW_COMPAT_2_4 macros
In reply to Marc-André LureauUse static arrays instead.
--- include/hw/boards.h | 3 ++ include/hw/compat.h | 27 -------------- include/hw/i386/pc.h | 74 ++------------------------------------ hw/core/machine.c | 29 +++++++++++++++ hw/i386/pc.c | 71 ++++++++++++++++++++++++++++++++++++ hw/i386/pc_piix.c | 6 ++-- hw/i386/pc_q35.c | 6 ++-- hw/ppc/spapr.c | 5 +-- hw/s390x/s390-virtio-ccw.c | 2 +- 9 files changed, 112 insertions(+), 111 deletions(-)
include/hw/boards.h +3 -0
@@ -317,4 +317,7 @@ extern const size_t hw_compat_2_6_len;extern GlobalProperty hw_compat_2_5[];extern const size_t hw_compat_2_5_len; +extern GlobalProperty hw_compat_2_4[]; +extern const size_t hw_compat_2_4_len; +#endif
include/hw/compat.h +0 -27
@@ -1,33 +1,6 @@#ifndef HW_COMPAT_H #define HW_COMPAT_H -#define HW_COMPAT_2_4 \ - {\ - .driver = "virtio-blk-device",\ - .property = "scsi",\ - .value = "true",\ - },{\ - .driver = "e1000",\ - .property = "extra_mac_registers",\ - .value = "off",\ - },{\ - .driver = "virtio-pci",\ - .property = "x-disable-pcie",\ - .value = "on",\ - },{\ - .driver = "virtio-pci",\ - .property = "migrate-extra",\ - .value = "off",\ - },{\ - .driver = "fw_cfg_mem",\ - .property = "dma_enabled",\ - .value = "off",\ - },{\ - .driver = "fw_cfg_io",\ - .property = "dma_enabled",\ - .value = "off",\ - }, -#define HW_COMPAT_2_3 \ {\ .driver = "virtio-blk-pci",\
include/hw/i386/pc.h +3 -71
86 lines not on this page · raw message
hw/core/machine.c +29 -0
@@ -226,6 +226,35 @@ GlobalProperty hw_compat_2_5[] = { };const size_t hw_compat_2_5_len =G_N_ELEMENTS (hw_compat_2_5); +GlobalProperty hw_compat_2_4[] = { + { + .driver ="virtio-blk-device" , + .property ="scsi" , + .value ="true" , + },{ + .driver ="e1000" , + .property ="extra_mac_registers" , + .value ="off" , + },{ + .driver ="virtio-pci" , + .property ="x-disable-pcie" , + .value ="on" , + },{ + .driver ="virtio-pci" , + .property ="migrate-extra" , + .value ="off" , + },{ + .driver ="fw_cfg_mem" , + .property ="dma_enabled" , + .value ="off" , + },{ + .driver ="fw_cfg_io" , + .property ="dma_enabled" , + .value ="off" , + } +}; +const size_t hw_compat_2_4_len =G_N_ELEMENTS (hw_compat_2_4); +static char *machine_get_accel (Object *obj,Error **errp) {MachineState *ms =MACHINE (obj);
hw/i386/pc.c +71 -0
77 lines not on this page · raw message
hw/i386/pc_piix.c +2 -4
@@ -553,14 +553,12 @@ DEFINE_I440FX_MACHINE(v2_5, "pc-i440fx-2.5", NULL,static void pc_i440fx_2_4_machine_options (MachineClass *m) {PCMachineClass *pcmc =PC_MACHINE_CLASS (m); -static GlobalProperty compat[] = { -PC_COMPAT_2_4 - };pc_i440fx_2_5_machine_options (m); m->hw_version ="2.4.0" ; pcmc->broken_reserved_end = true; -compat_props_add (m->compat_props, compat,G_N_ELEMENTS (compat)); +compat_props_add (m->compat_props, hw_compat_2_4, hw_compat_2_4_len); +compat_props_add (m->compat_props, pc_compat_2_4, pc_compat_2_4_len); } DEFINE_I440FX_MACHINE(v2_4, "pc-i440fx-2.4", NULL,
hw/i386/pc_q35.c +2 -4
@@ -438,14 +438,12 @@ DEFINE_Q35_MACHINE(v2_5, "pc-q35-2.5", NULL,static void pc_q35_2_4_machine_options (MachineClass *m) {PCMachineClass *pcmc =PC_MACHINE_CLASS (m); -static GlobalProperty compat[] = { -PC_COMPAT_2_4 - };pc_q35_2_5_machine_options (m); m->hw_version ="2.4.0" ; pcmc->broken_reserved_end = true; -compat_props_add (m->compat_props, compat,G_N_ELEMENTS (compat)); +compat_props_add (m->compat_props, hw_compat_2_4, hw_compat_2_4_len); +compat_props_add (m->compat_props, pc_compat_2_4, pc_compat_2_4_len); } DEFINE_Q35_MACHINE(v2_4, "pc-q35-2.4", NULL,
hw/ppc/spapr.c +1 -4
@@ -4248,13 +4248,10 @@ DEFINE_SPAPR_MACHINE(2_5, "2.5", false);static void spapr_machine_2_4_class_options (MachineClass *mc) {sPAPRMachineClass *smc =SPAPR_MACHINE_CLASS (mc); -static GlobalProperty compat[] = { -HW_COMPAT_2_4 - };spapr_machine_2_5_class_options (mc); smc->dr_lmb_enabled = false; -compat_props_add (mc->compat_props, compat,G_N_ELEMENTS (compat)); +compat_props_add (mc->compat_props, hw_compat_2_4, hw_compat_2_4_len); } DEFINE_SPAPR_MACHINE(2_4, "2.4", false);
hw/s390x/s390-virtio-ccw.c +1 -1
@@ -849,7 +849,6 @@ static void ccw_machine_2_4_instance_options(MachineState *machine)static void ccw_machine_2_4_class_options (MachineClass *mc) {static GlobalProperty compat[] = { -HW_COMPAT_2_4 { .driver =TYPE_S390_SKEYS , .property ="migration-enabled" ,
@@ -890,6 +889,7 @@ static void ccw_machine_2_4_class_options(MachineClass *mc) };ccw_machine_2_5_class_options (mc); +compat_props_add (mc->compat_props, hw_compat_2_4, hw_compat_2_4_len);compat_props_add (mc->compat_props, compat,G_N_ELEMENTS (compat)); } DEFINE_CCW_MACHINE(2_4, "2.4", false);
Signature · 1 line
2.20.1.2.gb21ebb671b
Re: [Qemu-devel] [PATCH v7 16/28] compat: replace PC_COMPAT_2_4 & HW_COMPAT_2_4 macros
Quoted 4 lines · On Fri, 21 Dec 2018 13:03:58 +0400 Marc-André Lureau…
Use static arrays instead.
Suggested-by Eduardo Habkost <[email protected]>Signed-off-by Marc-André Lureau <[email protected]>
Quoted 11 lines
--- include/hw/boards.h | 3 ++ include/hw/compat.h | 27 -------------- include/hw/i386/pc.h | 74 ++------------------------------------ hw/core/machine.c | 29 +++++++++++++++ hw/i386/pc.c | 71 ++++++++++++++++++++++++++++++++++++ hw/i386/pc_piix.c | 6 ++-- hw/i386/pc_q35.c | 6 ++-- hw/ppc/spapr.c | 5 +-- hw/s390x/s390-virtio-ccw.c | 2 +- 9 files changed, 112 insertions(+), 111 deletions(-)
Re: [Qemu-devel] [PATCH v7 16/28] compat: replace PC_COMPAT_2_4 & HW_COMPAT_2_4 macros
In reply to Marc-André LureauQuoted 4 lines · On Fri, 21 Dec 2018 13:03:58 +0400 Marc-André Lureau…
Use static arrays instead.
Suggested-by Eduardo Habkost <[email protected]>Signed-off-by Marc-André Lureau <[email protected]>
Quoted 357 lines
--- include/hw/boards.h | 3 ++ include/hw/compat.h | 27 -------------- include/hw/i386/pc.h | 74 ++------------------------------------ hw/core/machine.c | 29 +++++++++++++++ hw/i386/pc.c | 71 ++++++++++++++++++++++++++++++++++++ hw/i386/pc_piix.c | 6 ++-- hw/i386/pc_q35.c | 6 ++-- hw/ppc/spapr.c | 5 +-- hw/s390x/s390-virtio-ccw.c | 2 +- 9 files changed, 112 insertions(+), 111 deletions(-)include/hw/boards.h +3
-0@@ -317,4 +317,7 @@ extern const size_t hw_compat_2_6_len;extern GlobalProperty hw_compat_2_5[];extern const size_t hw_compat_2_5_len; +extern GlobalProperty hw_compat_2_4[]; +extern const size_t hw_compat_2_4_len; +#endif include/hw/compat.h +0
-27@@ -1,33 +1,6 @@#ifndef HW_COMPAT_H #define HW_COMPAT_H -#define HW_COMPAT_2_4 \ - {\ - .driver = "virtio-blk-device",\ - .property = "scsi",\ - .value = "true",\ - },{\ - .driver = "e1000",\ - .property = "extra_mac_registers",\ - .value = "off",\ - },{\ - .driver = "virtio-pci",\ - .property = "x-disable-pcie",\ - .value = "on",\ - },{\ - .driver = "virtio-pci",\ - .property = "migrate-extra",\ - .value = "off",\ - },{\ - .driver = "fw_cfg_mem",\ - .property = "dma_enabled",\ - .value = "off",\ - },{\ - .driver = "fw_cfg_io",\ - .property = "dma_enabled",\ - .value = "off",\ - }, -#define HW_COMPAT_2_3 \ {\ .driver = "virtio-blk-pci",\include/hw/i386/pc.h +3
-71@@ -324,6 +324,9 @@ extern const size_t pc_compat_2_6_len;extern GlobalProperty pc_compat_2_5[];extern const size_t pc_compat_2_5_len; +extern GlobalProperty pc_compat_2_4[]; +extern const size_t pc_compat_2_4_len; +/* Helper for setting model-id for CPU models that changed model-id * depending on QEMU versions up to QEMU 2.4. */ @@ -344,77 +347,6 @@ extern const size_t pc_compat_2_5_len; .value = "QEMU Virtual CPU version " v,\ }, -#define PC_COMPAT_2_4 \ - HW_COMPAT_2_4 \ - PC_CPU_MODEL_IDS("2.4.0") \ - {\ - .driver = "Haswell-" TYPE_X86_CPU,\ - .property = "abm",\ - .value = "off",\ - },\ - {\ - .driver = "Haswell-noTSX-" TYPE_X86_CPU,\ - .property = "abm",\ - .value = "off",\ - },\ - {\ - .driver = "Broadwell-" TYPE_X86_CPU,\ - .property = "abm",\ - .value = "off",\ - },\ - {\ - .driver = "Broadwell-noTSX-" TYPE_X86_CPU,\ - .property = "abm",\ - .value = "off",\ - },\ - {\ - .driver = "host" "-" TYPE_X86_CPU,\ - .property = "host-cache-info",\ - .value = "on",\ - },\ - {\ - .driver = TYPE_X86_CPU,\ - .property = "check",\ - .value = "off",\ - },\ - {\ - .driver = "qemu64" "-" TYPE_X86_CPU,\ - .property = "sse4a",\ - .value = "on",\ - },\ - {\ - .driver = "qemu64" "-" TYPE_X86_CPU,\ - .property = "abm",\ - .value = "on",\ - },\ - {\ - .driver = "qemu64" "-" TYPE_X86_CPU,\ - .property = "popcnt",\ - .value = "on",\ - },\ - {\ - .driver = "qemu32" "-" TYPE_X86_CPU,\ - .property = "popcnt",\ - .value = "on",\ - },{\ - .driver = "Opteron_G2" "-" TYPE_X86_CPU,\ - .property = "rdtscp",\ - .value = "on",\ - },{\ - .driver = "Opteron_G3" "-" TYPE_X86_CPU,\ - .property = "rdtscp",\ - .value = "on",\ - },{\ - .driver = "Opteron_G4" "-" TYPE_X86_CPU,\ - .property = "rdtscp",\ - .value = "on",\ - },{\ - .driver = "Opteron_G5" "-" TYPE_X86_CPU,\ - .property = "rdtscp",\ - .value = "on",\ - }, - -#define PC_COMPAT_2_3 \ HW_COMPAT_2_3 \ PC_CPU_MODEL_IDS("2.3.0") \hw/core/machine.c +29
-0@@ -226,6 +226,35 @@ GlobalProperty hw_compat_2_5[] = { };const size_t hw_compat_2_5_len =G_N_ELEMENTS (hw_compat_2_5); +GlobalProperty hw_compat_2_4[] = { + { + .driver ="virtio-blk-device" , + .property ="scsi" , + .value ="true" , + },{ + .driver ="e1000" , + .property ="extra_mac_registers" , + .value ="off" , + },{ + .driver ="virtio-pci" , + .property ="x-disable-pcie" , + .value ="on" , + },{ + .driver ="virtio-pci" , + .property ="migrate-extra" , + .value ="off" , + },{ + .driver ="fw_cfg_mem" , + .property ="dma_enabled" , + .value ="off" , + },{ + .driver ="fw_cfg_io" , + .property ="dma_enabled" , + .value ="off" , + } +}; +const size_t hw_compat_2_4_len =G_N_ELEMENTS (hw_compat_2_4); +static char *machine_get_accel (Object *obj,Error **errp) {MachineState *ms =MACHINE (obj);hw/i386/pc.c +71
-0@@ -278,6 +278,77 @@ const size_t pc_compat_2_6_len = G_N_ELEMENTS(pc_compat_2_6);GlobalProperty pc_compat_2_5[] = {};const size_t pc_compat_2_5_len =G_N_ELEMENTS (pc_compat_2_5); +GlobalProperty pc_compat_2_4[] = { + PC_CPU_MODEL_IDS("2.4.0") + { + .driver ="Haswell-" TYPE_X86_CPU , + .property ="abm" , + .value ="off" , + }, + { + .driver ="Haswell-noTSX-" TYPE_X86_CPU , + .property ="abm" , + .value ="off" , + }, + { + .driver ="Broadwell-" TYPE_X86_CPU , + .property ="abm" , + .value ="off" , + }, + { + .driver ="Broadwell-noTSX-" TYPE_X86_CPU , + .property ="abm" , + .value ="off" , + }, + { + .driver ="host" "-" TYPE_X86_CPU , + .property ="host-cache-info" , + .value ="on" , + }, + { + .driver =TYPE_X86_CPU , + .property ="check" , + .value ="off" , + }, + { + .driver ="qemu64" "-" TYPE_X86_CPU , + .property ="sse4a" , + .value ="on" , + }, + { + .driver ="qemu64" "-" TYPE_X86_CPU , + .property ="abm" , + .value ="on" , + }, + { + .driver ="qemu64" "-" TYPE_X86_CPU , + .property ="popcnt" , + .value ="on" , + }, + { + .driver ="qemu32" "-" TYPE_X86_CPU , + .property ="popcnt" , + .value ="on" , + },{ + .driver ="Opteron_G2" "-" TYPE_X86_CPU , + .property ="rdtscp" , + .value ="on" , + },{ + .driver ="Opteron_G3" "-" TYPE_X86_CPU , + .property ="rdtscp" , + .value ="on" , + },{ + .driver ="Opteron_G4" "-" TYPE_X86_CPU , + .property ="rdtscp" , + .value ="on" , + },{ + .driver ="Opteron_G5" "-" TYPE_X86_CPU , + .property ="rdtscp" , + .value ="on" , + } +}; +const size_t pc_compat_2_4_len =G_N_ELEMENTS (pc_compat_2_4); +void gsi_handler (void *opaque,int n,int level) {GSIState *s = opaque;hw/i386/pc_piix.c +2
-4@@ -553,14 +553,12 @@ DEFINE_I440FX_MACHINE(v2_5, "pc-i440fx-2.5", NULL,static void pc_i440fx_2_4_machine_options (MachineClass *m) {PCMachineClass *pcmc =PC_MACHINE_CLASS (m); -static GlobalProperty compat[] = { -PC_COMPAT_2_4 - };pc_i440fx_2_5_machine_options (m); m->hw_version ="2.4.0" ; pcmc->broken_reserved_end = true; -compat_props_add (m->compat_props, compat,G_N_ELEMENTS (compat)); +compat_props_add (m->compat_props, hw_compat_2_4, hw_compat_2_4_len); +compat_props_add (m->compat_props, pc_compat_2_4, pc_compat_2_4_len); } DEFINE_I440FX_MACHINE(v2_4, "pc-i440fx-2.4", NULL,hw/i386/pc_q35.c +2
-4@@ -438,14 +438,12 @@ DEFINE_Q35_MACHINE(v2_5, "pc-q35-2.5", NULL,static void pc_q35_2_4_machine_options (MachineClass *m) {PCMachineClass *pcmc =PC_MACHINE_CLASS (m); -static GlobalProperty compat[] = { -PC_COMPAT_2_4 - };pc_q35_2_5_machine_options (m); m->hw_version ="2.4.0" ; pcmc->broken_reserved_end = true; -compat_props_add (m->compat_props, compat,G_N_ELEMENTS (compat)); +compat_props_add (m->compat_props, hw_compat_2_4, hw_compat_2_4_len); +compat_props_add (m->compat_props, pc_compat_2_4, pc_compat_2_4_len); } DEFINE_Q35_MACHINE(v2_4, "pc-q35-2.4", NULL,hw/ppc/spapr.c +1
-4@@ -4248,13 +4248,10 @@ DEFINE_SPAPR_MACHINE(2_5, "2.5", false);static void spapr_machine_2_4_class_options (MachineClass *mc) {sPAPRMachineClass *smc =SPAPR_MACHINE_CLASS (mc); -static GlobalProperty compat[] = { -HW_COMPAT_2_4 - };spapr_machine_2_5_class_options (mc); smc->dr_lmb_enabled = false; -compat_props_add (mc->compat_props, compat,G_N_ELEMENTS (compat)); +compat_props_add (mc->compat_props, hw_compat_2_4, hw_compat_2_4_len); } DEFINE_SPAPR_MACHINE(2_4, "2.4", false);hw/s390x/s390-virtio-ccw.c +1
-1@@ -849,7 +849,6 @@ static void ccw_machine_2_4_instance_options(MachineState *machine)static void ccw_machine_2_4_class_options (MachineClass *mc) {static GlobalProperty compat[] = { -HW_COMPAT_2_4 { .driver =TYPE_S390_SKEYS , .property ="migration-enabled" ,@@ -890,6 +889,7 @@ static void ccw_machine_2_4_class_options(MachineClass *mc) };ccw_machine_2_5_class_options (mc); +compat_props_add (mc->compat_props, hw_compat_2_4, hw_compat_2_4_len);compat_props_add (mc->compat_props, compat,G_N_ELEMENTS (compat)); } DEFINE_CCW_MACHINE(2_4, "2.4", false);
PATCH v7 17/28 compat: replace PC_COMPAT_2_3 & HW_COMPAT_2_3 macros
In reply to Marc-André LureauUse static arrays instead. I decided to rename the conflicting pc_compat_2_3() function with pc_compat_2_3_fn().
--- include/hw/boards.h | 3 ++ include/hw/compat.h | 39 -------------------- include/hw/i386/pc.h | 88 ++------------------------------------------ hw/core/machine.c | 41 +++++++++++++++++++++ hw/i386/pc.c | 86 +++++++++++++++++++++++++++++++++++++++++++ hw/i386/pc_piix.c | 13 +++---- hw/ppc/spapr.c | 2 +- 7 files changed, 139 insertions(+), 133 deletions(-)
include/hw/boards.h +3 -0
@@ -320,4 +320,7 @@ extern const size_t hw_compat_2_5_len;extern GlobalProperty hw_compat_2_4[];extern const size_t hw_compat_2_4_len; +extern GlobalProperty hw_compat_2_3[]; +extern const size_t hw_compat_2_3_len; +#endif
include/hw/compat.h +0 -39
@@ -1,45 +1,6 @@#ifndef HW_COMPAT_H #define HW_COMPAT_H -#define HW_COMPAT_2_3 \ - {\ - .driver = "virtio-blk-pci",\ - .property = "any_layout",\ - .value = "off",\ - },{\ - .driver = "virtio-balloon-pci",\ - .property = "any_layout",\ - .value = "off",\ - },{\ - .driver = "virtio-serial-pci",\ - .property = "any_layout",\ - .value = "off",\ - },{\ - .driver = "virtio-9p-pci",\ - .property = "any_layout",\ - .value = "off",\ - },{\ - .driver = "virtio-rng-pci",\ - .property = "any_layout",\ - .value = "off",\ - },{\ - .driver = TYPE_PCI_DEVICE,\ - .property = "x-pcie-lnksta-dllla",\ - .value = "off",\ - },{\ - .driver = "migration",\ - .property = "send-configuration",\ - .value = "off",\ - },{\ - .driver = "migration",\ - .property = "send-section-footer",\ - .value = "off",\ - },{\ - .driver = "migration",\ - .property = "store-global-state",\ - .value = "off",\ - }, -#define HW_COMPAT_2_2 \/* empty */
include/hw/i386/pc.h +3 -85
100 lines not on this page · raw message
hw/core/machine.c +41 -0
47 lines not on this page · raw message
hw/i386/pc.c +86 -0
92 lines not on this page · raw message
hw/i386/pc_piix.c +5 -8
@@ -310,7 +310,7 @@ static void pc_init1(MachineState *machine,* HW_COMPAT_*, PC_COMPAT_*, or * pc_*_machine_options(). */ -static void pc_compat_2_3 (MachineState *machine) +static void pc_compat_2_3_fn (MachineState *machine) {PCMachineState *pcms =PC_MACHINE (machine);if (kvm_enabled ()) {
@@ -320,7 +320,7 @@ static void pc_compat_2_3(MachineState *machine)static void pc_compat_2_2 (MachineState *machine) { -pc_compat_2_3 (machine); +pc_compat_2_3_fn (machine); }static void pc_compat_2_1 (MachineState *machine)
@@ -566,16 +566,13 @@ DEFINE_I440FX_MACHINE(v2_4, "pc-i440fx-2.4", NULL,static void pc_i440fx_2_3_machine_options (MachineClass *m) { -static GlobalProperty compat[] = { -PC_COMPAT_2_3 - }; -pc_i440fx_2_4_machine_options (m); m->hw_version ="2.3.0" ; -compat_props_add (m->compat_props, compat,G_N_ELEMENTS (compat)); +compat_props_add (m->compat_props, hw_compat_2_3, hw_compat_2_3_len); +compat_props_add (m->compat_props, pc_compat_2_3, pc_compat_2_3_len); } -DEFINE_I440FX_MACHINE (v2_3,"pc-i440fx-2.3" , pc_compat_2_3, +DEFINE_I440FX_MACHINE (v2_3,"pc-i440fx-2.3" , pc_compat_2_3_fn, pc_i440fx_2_3_machine_options);static void pc_i440fx_2_2_machine_options (MachineClass *m)
hw/ppc/spapr.c +1 -1
@@ -4263,7 +4263,6 @@ DEFINE_SPAPR_MACHINE(2_4, "2.4", false);static void spapr_machine_2_3_class_options (MachineClass *mc) {static GlobalProperty compat[] = { -HW_COMPAT_2_3 { .driver ="spapr-pci-host-bridge" , .property ="dynamic-reconfiguration" ,
@@ -4271,6 +4270,7 @@ static void spapr_machine_2_3_class_options(MachineClass *mc) }, };spapr_machine_2_4_class_options (mc); +compat_props_add (mc->compat_props, hw_compat_2_3, hw_compat_2_3_len);compat_props_add (mc->compat_props, compat,G_N_ELEMENTS (compat)); } DEFINE_SPAPR_MACHINE(2_3, "2.3", false);
Signature · 1 line
2.20.1.2.gb21ebb671b
Re: [Qemu-devel] [PATCH v7 17/28] compat: replace PC_COMPAT_2_3 & HW_COMPAT_2_3 macros
Quoted 5 lines · On Fri, 21 Dec 2018 13:03:59 +0400 Marc-André Lureau…
Use static arrays instead. I decided to rename the conflicting
pc_compat_2_3()function withpc_compat_2_3_fn().Suggested-by Eduardo Habkost <[email protected]>Signed-off-by Marc-André Lureau <[email protected]>
Quoted 9 lines
--- include/hw/boards.h | 3 ++ include/hw/compat.h | 39 -------------------- include/hw/i386/pc.h | 88 ++------------------------------------------ hw/core/machine.c | 41 +++++++++++++++++++++ hw/i386/pc.c | 86 +++++++++++++++++++++++++++++++++++++++++++ hw/i386/pc_piix.c | 13 +++---- hw/ppc/spapr.c | 2 +- 7 files changed, 139 insertions(+), 133 deletions(-)
Re: [Qemu-devel] [PATCH v7 17/28] compat: replace PC_COMPAT_2_3 & HW_COMPAT_2_3 macros
In reply to Marc-André LureauQuoted 5 lines · On Fri, 21 Dec 2018 13:03:59 +0400 Marc-André Lureau…
Use static arrays instead. I decided to rename the conflicting
pc_compat_2_3()function withpc_compat_2_3_fn().Suggested-by Eduardo Habkost <[email protected]>Signed-off-by Marc-André Lureau <[email protected]>
Quoted 389 lines
--- include/hw/boards.h | 3 ++ include/hw/compat.h | 39 -------------------- include/hw/i386/pc.h | 88 ++------------------------------------------ hw/core/machine.c | 41 +++++++++++++++++++++ hw/i386/pc.c | 86 +++++++++++++++++++++++++++++++++++++++++++ hw/i386/pc_piix.c | 13 +++---- hw/ppc/spapr.c | 2 +- 7 files changed, 139 insertions(+), 133 deletions(-)include/hw/boards.h +3
-0@@ -320,4 +320,7 @@ extern const size_t hw_compat_2_5_len;extern GlobalProperty hw_compat_2_4[];extern const size_t hw_compat_2_4_len; +extern GlobalProperty hw_compat_2_3[]; +extern const size_t hw_compat_2_3_len; +#endif include/hw/compat.h +0
-39@@ -1,45 +1,6 @@#ifndef HW_COMPAT_H #define HW_COMPAT_H -#define HW_COMPAT_2_3 \ - {\ - .driver = "virtio-blk-pci",\ - .property = "any_layout",\ - .value = "off",\ - },{\ - .driver = "virtio-balloon-pci",\ - .property = "any_layout",\ - .value = "off",\ - },{\ - .driver = "virtio-serial-pci",\ - .property = "any_layout",\ - .value = "off",\ - },{\ - .driver = "virtio-9p-pci",\ - .property = "any_layout",\ - .value = "off",\ - },{\ - .driver = "virtio-rng-pci",\ - .property = "any_layout",\ - .value = "off",\ - },{\ - .driver = TYPE_PCI_DEVICE,\ - .property = "x-pcie-lnksta-dllla",\ - .value = "off",\ - },{\ - .driver = "migration",\ - .property = "send-configuration",\ - .value = "off",\ - },{\ - .driver = "migration",\ - .property = "send-section-footer",\ - .value = "off",\ - },{\ - .driver = "migration",\ - .property = "store-global-state",\ - .value = "off",\ - }, -#define HW_COMPAT_2_2 \/* empty */ include/hw/i386/pc.h +3
-85@@ -327,6 +327,9 @@ extern const size_t pc_compat_2_5_len;extern GlobalProperty pc_compat_2_4[];extern const size_t pc_compat_2_4_len; +extern GlobalProperty pc_compat_2_3[]; +extern const size_t pc_compat_2_3_len; +/* Helper for setting model-id for CPU models that changed model-id * depending on QEMU versions up to QEMU 2.4. */ @@ -347,91 +350,6 @@ extern const size_t pc_compat_2_4_len; .value = "QEMU Virtual CPU version " v,\ }, -#define PC_COMPAT_2_3 \ - HW_COMPAT_2_3 \ - PC_CPU_MODEL_IDS("2.3.0") \ - {\ - .driver = TYPE_X86_CPU,\ - .property = "arat",\ - .value = "off",\ - },{\ - .driver = "qemu64" "-" TYPE_X86_CPU,\ - .property = "min-level",\ - .value = stringify(4),\ - },{\ - .driver = "kvm64" "-" TYPE_X86_CPU,\ - .property = "min-level",\ - .value = stringify(5),\ - },{\ - .driver = "pentium3" "-" TYPE_X86_CPU,\ - .property = "min-level",\ - .value = stringify(2),\ - },{\ - .driver = "n270" "-" TYPE_X86_CPU,\ - .property = "min-level",\ - .value = stringify(5),\ - },{\ - .driver = "Conroe" "-" TYPE_X86_CPU,\ - .property = "min-level",\ - .value = stringify(4),\ - },{\ - .driver = "Penryn" "-" TYPE_X86_CPU,\ - .property = "min-level",\ - .value = stringify(4),\ - },{\ - .driver = "Nehalem" "-" TYPE_X86_CPU,\ - .property = "min-level",\ - .value = stringify(4),\ - },{\ - .driver = "n270" "-" TYPE_X86_CPU,\ - .property = "min-xlevel",\ - .value = stringify(0x8000000a),\ - },{\ - .driver = "Penryn" "-" TYPE_X86_CPU,\ - .property = "min-xlevel",\ - .value = stringify(0x8000000a),\ - },{\ - .driver = "Conroe" "-" TYPE_X86_CPU,\ - .property = "min-xlevel",\ - .value = stringify(0x8000000a),\ - },{\ - .driver = "Nehalem" "-" TYPE_X86_CPU,\ - .property = "min-xlevel",\ - .value = stringify(0x8000000a),\ - },{\ - .driver = "Westmere" "-" TYPE_X86_CPU,\ - .property = "min-xlevel",\ - .value = stringify(0x8000000a),\ - },{\ - .driver = "SandyBridge" "-" TYPE_X86_CPU,\ - .property = "min-xlevel",\ - .value = stringify(0x8000000a),\ - },{\ - .driver = "IvyBridge" "-" TYPE_X86_CPU,\ - .property = "min-xlevel",\ - .value = stringify(0x8000000a),\ - },{\ - .driver = "Haswell" "-" TYPE_X86_CPU,\ - .property = "min-xlevel",\ - .value = stringify(0x8000000a),\ - },{\ - .driver = "Haswell-noTSX" "-" TYPE_X86_CPU,\ - .property = "min-xlevel",\ - .value = stringify(0x8000000a),\ - },{\ - .driver = "Broadwell" "-" TYPE_X86_CPU,\ - .property = "min-xlevel",\ - .value = stringify(0x8000000a),\ - },{\ - .driver = "Broadwell-noTSX" "-" TYPE_X86_CPU,\ - .property = "min-xlevel",\ - .value = stringify(0x8000000a),\ - },{\ - .driver = TYPE_X86_CPU,\ - .property = "kvm-no-smi-migration",\ - .value = "on",\ - }, -#define PC_COMPAT_2_2 \ HW_COMPAT_2_2 \ PC_CPU_MODEL_IDS("2.2.0") \hw/core/machine.c +41
-0@@ -255,6 +255,47 @@ GlobalProperty hw_compat_2_4[] = { };const size_t hw_compat_2_4_len =G_N_ELEMENTS (hw_compat_2_4); +GlobalProperty hw_compat_2_3[] = { + { + .driver ="virtio-blk-pci" , + .property ="any_layout" , + .value ="off" , + },{ + .driver ="virtio-balloon-pci" , + .property ="any_layout" , + .value ="off" , + },{ + .driver ="virtio-serial-pci" , + .property ="any_layout" , + .value ="off" , + },{ + .driver ="virtio-9p-pci" , + .property ="any_layout" , + .value ="off" , + },{ + .driver ="virtio-rng-pci" , + .property ="any_layout" , + .value ="off" , + },{ + .driver =TYPE_PCI_DEVICE , + .property ="x-pcie-lnksta-dllla" , + .value ="off" , + },{ + .driver ="migration" , + .property ="send-configuration" , + .value ="off" , + },{ + .driver ="migration" , + .property ="send-section-footer" , + .value ="off" , + },{ + .driver ="migration" , + .property ="store-global-state" , + .value ="off" , + }, +}; +const size_t hw_compat_2_3_len =G_N_ELEMENTS (hw_compat_2_3); +static char *machine_get_accel (Object *obj,Error **errp) {MachineState *ms =MACHINE (obj);hw/i386/pc.c +86
-0@@ -349,6 +349,92 @@ GlobalProperty pc_compat_2_4[] = { };const size_t pc_compat_2_4_len =G_N_ELEMENTS (pc_compat_2_4); +GlobalProperty pc_compat_2_3[] = { + PC_CPU_MODEL_IDS("2.3.0") + { + .driver =TYPE_X86_CPU , + .property ="arat" , + .value ="off" , + },{ + .driver ="qemu64" "-" TYPE_X86_CPU , + .property ="min-level" , + .value =stringify (4 ), + },{ + .driver ="kvm64" "-" TYPE_X86_CPU , + .property ="min-level" , + .value =stringify (5 ), + },{ + .driver ="pentium3" "-" TYPE_X86_CPU , + .property ="min-level" , + .value =stringify (2 ), + },{ + .driver ="n270" "-" TYPE_X86_CPU , + .property ="min-level" , + .value =stringify (5 ), + },{ + .driver ="Conroe" "-" TYPE_X86_CPU , + .property ="min-level" , + .value =stringify (4 ), + },{ + .driver ="Penryn" "-" TYPE_X86_CPU , + .property ="min-level" , + .value =stringify (4 ), + },{ + .driver ="Nehalem" "-" TYPE_X86_CPU , + .property ="min-level" , + .value =stringify (4 ), + },{ + .driver ="n270" "-" TYPE_X86_CPU , + .property ="min-xlevel" , + .value =stringify (0x8000000a ), + },{ + .driver ="Penryn" "-" TYPE_X86_CPU , + .property ="min-xlevel" , + .value =stringify (0x8000000a ), + },{ + .driver ="Conroe" "-" TYPE_X86_CPU , + .property ="min-xlevel" , + .value =stringify (0x8000000a ), + },{ + .driver ="Nehalem" "-" TYPE_X86_CPU , + .property ="min-xlevel" , + .value =stringify (0x8000000a ), + },{ + .driver ="Westmere" "-" TYPE_X86_CPU , + .property ="min-xlevel" , + .value =stringify (0x8000000a ), + },{ + .driver ="SandyBridge" "-" TYPE_X86_CPU , + .property ="min-xlevel" , + .value =stringify (0x8000000a ), + },{ + .driver ="IvyBridge" "-" TYPE_X86_CPU , + .property ="min-xlevel" , + .value =stringify (0x8000000a ), + },{ + .driver ="Haswell" "-" TYPE_X86_CPU , + .property ="min-xlevel" , + .value =stringify (0x8000000a ), + },{ + .driver ="Haswell-noTSX" "-" TYPE_X86_CPU , + .property ="min-xlevel" , + .value =stringify (0x8000000a ), + },{ + .driver ="Broadwell" "-" TYPE_X86_CPU , + .property ="min-xlevel" , + .value =stringify (0x8000000a ), + },{ + .driver ="Broadwell-noTSX" "-" TYPE_X86_CPU , + .property ="min-xlevel" , + .value =stringify (0x8000000a ), + },{ + .driver =TYPE_X86_CPU , + .property ="kvm-no-smi-migration" , + .value ="on" , + }, +}; +const size_t pc_compat_2_3_len =G_N_ELEMENTS (pc_compat_2_3); +void gsi_handler (void *opaque,int n,int level) {GSIState *s = opaque;hw/i386/pc_piix.c +5
-8@@ -310,7 +310,7 @@ static void pc_init1(MachineState *machine,* HW_COMPAT_*, PC_COMPAT_*, or * pc_*_machine_options(). */ -static void pc_compat_2_3 (MachineState *machine) +static void pc_compat_2_3_fn (MachineState *machine) {PCMachineState *pcms =PC_MACHINE (machine);if (kvm_enabled ()) {@@ -320,7 +320,7 @@ static void pc_compat_2_3(MachineState *machine)static void pc_compat_2_2 (MachineState *machine) { -pc_compat_2_3 (machine); +pc_compat_2_3_fn (machine); }static void pc_compat_2_1 (MachineState *machine)@@ -566,16 +566,13 @@ DEFINE_I440FX_MACHINE(v2_4, "pc-i440fx-2.4", NULL,static void pc_i440fx_2_3_machine_options (MachineClass *m) { -static GlobalProperty compat[] = { -PC_COMPAT_2_3 - }; -pc_i440fx_2_4_machine_options (m); m->hw_version ="2.3.0" ; -compat_props_add (m->compat_props, compat,G_N_ELEMENTS (compat)); +compat_props_add (m->compat_props, hw_compat_2_3, hw_compat_2_3_len); +compat_props_add (m->compat_props, pc_compat_2_3, pc_compat_2_3_len); } -DEFINE_I440FX_MACHINE (v2_3,"pc-i440fx-2.3" , pc_compat_2_3, +DEFINE_I440FX_MACHINE (v2_3,"pc-i440fx-2.3" , pc_compat_2_3_fn, pc_i440fx_2_3_machine_options);static void pc_i440fx_2_2_machine_options (MachineClass *m)hw/ppc/spapr.c +1
-1@@ -4263,7 +4263,6 @@ DEFINE_SPAPR_MACHINE(2_4, "2.4", false);static void spapr_machine_2_3_class_options (MachineClass *mc) {static GlobalProperty compat[] = { -HW_COMPAT_2_3 { .driver ="spapr-pci-host-bridge" , .property ="dynamic-reconfiguration" ,@@ -4271,6 +4270,7 @@ static void spapr_machine_2_3_class_options(MachineClass *mc) }, };spapr_machine_2_4_class_options (mc); +compat_props_add (mc->compat_props, hw_compat_2_3, hw_compat_2_3_len);compat_props_add (mc->compat_props, compat,G_N_ELEMENTS (compat)); } DEFINE_SPAPR_MACHINE(2_3, "2.3", false);
PATCH v7 18/28 compat: replace PC_COMPAT_2_2 & HW_COMPAT_2_2 macros
In reply to Marc-André LureauUse static arrays instead. I decided to rename the conflicting pc_compat_2_2() function with pc_compat_2_2_fn().
--- include/hw/boards.h | 3 ++ include/hw/compat.h | 3 -- include/hw/i386/pc.h | 97 ++------------------------------------------ hw/core/machine.c | 3 ++ hw/i386/pc.c | 95 +++++++++++++++++++++++++++++++++++++++++++ hw/i386/pc_piix.c | 12 +++--- hw/ppc/spapr.c | 2 +- 7 files changed, 110 insertions(+), 105 deletions(-)
include/hw/boards.h +3 -0
@@ -323,4 +323,7 @@ extern const size_t hw_compat_2_4_len;extern GlobalProperty hw_compat_2_3[];extern const size_t hw_compat_2_3_len; +extern GlobalProperty hw_compat_2_2[]; +extern const size_t hw_compat_2_2_len; +#endif
include/hw/compat.h +0 -3
@@ -1,9 +1,6 @@#ifndef HW_COMPAT_H #define HW_COMPAT_H -#define HW_COMPAT_2_2 \ -/* empty */ -#define HW_COMPAT_2_1 \ {\ .driver = "intel-hda",\
include/hw/i386/pc.h +3 -94
109 lines not on this page · raw message
hw/core/machine.c +3 -0
@@ -296,6 +296,9 @@ GlobalProperty hw_compat_2_3[] = { };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); +static char *machine_get_accel (Object *obj,Error **errp) {MachineState *ms =MACHINE (obj);
hw/i386/pc.c +95 -0
101 lines not on this page · raw message
hw/i386/pc_piix.c +5 -7
@@ -318,14 +318,14 @@ static void pc_compat_2_3_fn(MachineState *machine) } } -static void pc_compat_2_2 (MachineState *machine) +static void pc_compat_2_2_fn (MachineState *machine) {pc_compat_2_3_fn (machine); }static void pc_compat_2_1 (MachineState *machine) { -pc_compat_2_2 (machine); +pc_compat_2_2_fn (machine);x86_cpu_change_kvm_default ("svm" ,NULL ); }
@@ -578,18 +578,16 @@ DEFINE_I440FX_MACHINE(v2_3, "pc-i440fx-2.3", pc_compat_2_3_fn,static void pc_i440fx_2_2_machine_options (MachineClass *m) {PCMachineClass *pcmc =PC_MACHINE_CLASS (m); -static GlobalProperty compat[] = { -PC_COMPAT_2_2 - };pc_i440fx_2_3_machine_options (m); m->hw_version ="2.2.0" ; m->default_machine_opts ="firmware=bios-256k.bin,suppress-vmdesc=on" ; -compat_props_add (m->compat_props, compat,G_N_ELEMENTS (compat)); +compat_props_add (m->compat_props, hw_compat_2_2, hw_compat_2_2_len); +compat_props_add (m->compat_props, pc_compat_2_2, pc_compat_2_2_len); pcmc->rsdp_in_ram = false; } -DEFINE_I440FX_MACHINE (v2_2,"pc-i440fx-2.2" , pc_compat_2_2, +DEFINE_I440FX_MACHINE (v2_2,"pc-i440fx-2.2" , pc_compat_2_2_fn, pc_i440fx_2_2_machine_options);static void pc_i440fx_2_1_machine_options (MachineClass *m)
hw/ppc/spapr.c +1 -1
@@ -4282,7 +4282,6 @@ DEFINE_SPAPR_MACHINE(2_3, "2.3", false);static void spapr_machine_2_2_class_options (MachineClass *mc) {static GlobalProperty compat[] = { -HW_COMPAT_2_2 { .driver =TYPE_SPAPR_PCI_HOST_BRIDGE , .property ="mem_win_size" ,
@@ -4291,6 +4290,7 @@ static void spapr_machine_2_2_class_options(MachineClass *mc) };spapr_machine_2_3_class_options (mc); +compat_props_add (mc->compat_props, hw_compat_2_2, hw_compat_2_2_len);compat_props_add (mc->compat_props, compat,G_N_ELEMENTS (compat)); mc->default_machine_opts ="modern-hotplug-events=off,suppress-vmdesc=on" ; }
Signature · 1 line
2.20.1.2.gb21ebb671b
Re: [Qemu-devel] [PATCH v7 18/28] compat: replace PC_COMPAT_2_2 & HW_COMPAT_2_2 macros
Quoted 5 lines · On Fri, 21 Dec 2018 13:04:00 +0400 Marc-André Lureau…
Use static arrays instead. I decided to rename the conflicting
pc_compat_2_2()function withpc_compat_2_2_fn().Suggested-by Eduardo Habkost <[email protected]>Signed-off-by Marc-André Lureau <[email protected]>
Quoted 9 lines
--- include/hw/boards.h | 3 ++ include/hw/compat.h | 3 -- include/hw/i386/pc.h | 97 ++------------------------------------------ hw/core/machine.c | 3 ++ hw/i386/pc.c | 95 +++++++++++++++++++++++++++++++++++++++++++ hw/i386/pc_piix.c | 12 +++--- hw/ppc/spapr.c | 2 +- 7 files changed, 110 insertions(+), 105 deletions(-)
Re: [Qemu-devel] [PATCH v7 18/28] compat: replace PC_COMPAT_2_2 & HW_COMPAT_2_2 macros
In reply to Marc-André LureauQuoted 5 lines · On Fri, 21 Dec 2018 13:04:00 +0400 Marc-André Lureau…
Use static arrays instead. I decided to rename the conflicting
pc_compat_2_2()function withpc_compat_2_2_fn().Suggested-by Eduardo Habkost <[email protected]>Signed-off-by Marc-André Lureau <[email protected]>
Quoted 334 lines
--- include/hw/boards.h | 3 ++ include/hw/compat.h | 3 -- include/hw/i386/pc.h | 97 ++------------------------------------------ hw/core/machine.c | 3 ++ hw/i386/pc.c | 95 +++++++++++++++++++++++++++++++++++++++++++ hw/i386/pc_piix.c | 12 +++--- hw/ppc/spapr.c | 2 +- 7 files changed, 110 insertions(+), 105 deletions(-)include/hw/boards.h +3
-0@@ -323,4 +323,7 @@ extern const size_t hw_compat_2_4_len;extern GlobalProperty hw_compat_2_3[];extern const size_t hw_compat_2_3_len; +extern GlobalProperty hw_compat_2_2[]; +extern const size_t hw_compat_2_2_len; +#endif include/hw/compat.h +0
-3@@ -1,9 +1,6 @@#ifndef HW_COMPAT_H #define HW_COMPAT_H -#define HW_COMPAT_2_2 \ -/* empty */ -#define HW_COMPAT_2_1 \ {\ .driver = "intel-hda",\include/hw/i386/pc.h +3
-94@@ -330,6 +330,9 @@ extern const size_t pc_compat_2_4_len;extern GlobalProperty pc_compat_2_3[];extern const size_t pc_compat_2_3_len; +extern GlobalProperty pc_compat_2_2[]; +extern const size_t pc_compat_2_2_len; +/* Helper for setting model-id for CPU models that changed model-id * depending on QEMU versions up to QEMU 2.4. */ @@ -350,100 +353,6 @@ extern const size_t pc_compat_2_3_len; .value = "QEMU Virtual CPU version " v,\ }, -#define PC_COMPAT_2_2 \ - HW_COMPAT_2_2 \ - PC_CPU_MODEL_IDS("2.2.0") \ - {\ - .driver = "kvm64" "-" TYPE_X86_CPU,\ - .property = "vme",\ - .value = "off",\ - },\ - {\ - .driver = "kvm32" "-" TYPE_X86_CPU,\ - .property = "vme",\ - .value = "off",\ - },\ - {\ - .driver = "Conroe" "-" TYPE_X86_CPU,\ - .property = "vme",\ - .value = "off",\ - },\ - {\ - .driver = "Penryn" "-" TYPE_X86_CPU,\ - .property = "vme",\ - .value = "off",\ - },\ - {\ - .driver = "Nehalem" "-" TYPE_X86_CPU,\ - .property = "vme",\ - .value = "off",\ - },\ - {\ - .driver = "Westmere" "-" TYPE_X86_CPU,\ - .property = "vme",\ - .value = "off",\ - },\ - {\ - .driver = "SandyBridge" "-" TYPE_X86_CPU,\ - .property = "vme",\ - .value = "off",\ - },\ - {\ - .driver = "Haswell" "-" TYPE_X86_CPU,\ - .property = "vme",\ - .value = "off",\ - },\ - {\ - .driver = "Broadwell" "-" TYPE_X86_CPU,\ - .property = "vme",\ - .value = "off",\ - },\ - {\ - .driver = "Opteron_G1" "-" TYPE_X86_CPU,\ - .property = "vme",\ - .value = "off",\ - },\ - {\ - .driver = "Opteron_G2" "-" TYPE_X86_CPU,\ - .property = "vme",\ - .value = "off",\ - },\ - {\ - .driver = "Opteron_G3" "-" TYPE_X86_CPU,\ - .property = "vme",\ - .value = "off",\ - },\ - {\ - .driver = "Opteron_G4" "-" TYPE_X86_CPU,\ - .property = "vme",\ - .value = "off",\ - },\ - {\ - .driver = "Opteron_G5" "-" TYPE_X86_CPU,\ - .property = "vme",\ - .value = "off",\ - },\ - {\ - .driver = "Haswell" "-" TYPE_X86_CPU,\ - .property = "f16c",\ - .value = "off",\ - },\ - {\ - .driver = "Haswell" "-" TYPE_X86_CPU,\ - .property = "rdrand",\ - .value = "off",\ - },\ - {\ - .driver = "Broadwell" "-" TYPE_X86_CPU,\ - .property = "f16c",\ - .value = "off",\ - },\ - {\ - .driver = "Broadwell" "-" TYPE_X86_CPU,\ - .property = "rdrand",\ - .value = "off",\ - }, -#define PC_COMPAT_2_1 \ HW_COMPAT_2_1 \ PC_CPU_MODEL_IDS("2.1.0") \hw/core/machine.c +3
-0@@ -296,6 +296,9 @@ GlobalProperty hw_compat_2_3[] = { };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); +static char *machine_get_accel (Object *obj,Error **errp) {MachineState *ms =MACHINE (obj);hw/i386/pc.c +95
-0@@ -435,6 +435,101 @@ GlobalProperty pc_compat_2_3[] = { };const size_t pc_compat_2_3_len =G_N_ELEMENTS (pc_compat_2_3); +GlobalProperty pc_compat_2_2[] = { + PC_CPU_MODEL_IDS("2.2.0") + { + .driver ="kvm64" "-" TYPE_X86_CPU , + .property ="vme" , + .value ="off" , + }, + { + .driver ="kvm32" "-" TYPE_X86_CPU , + .property ="vme" , + .value ="off" , + }, + { + .driver ="Conroe" "-" TYPE_X86_CPU , + .property ="vme" , + .value ="off" , + }, + { + .driver ="Penryn" "-" TYPE_X86_CPU , + .property ="vme" , + .value ="off" , + }, + { + .driver ="Nehalem" "-" TYPE_X86_CPU , + .property ="vme" , + .value ="off" , + }, + { + .driver ="Westmere" "-" TYPE_X86_CPU , + .property ="vme" , + .value ="off" , + }, + { + .driver ="SandyBridge" "-" TYPE_X86_CPU , + .property ="vme" , + .value ="off" , + }, + { + .driver ="Haswell" "-" TYPE_X86_CPU , + .property ="vme" , + .value ="off" , + }, + { + .driver ="Broadwell" "-" TYPE_X86_CPU , + .property ="vme" , + .value ="off" , + }, + { + .driver ="Opteron_G1" "-" TYPE_X86_CPU , + .property ="vme" , + .value ="off" , + }, + { + .driver ="Opteron_G2" "-" TYPE_X86_CPU , + .property ="vme" , + .value ="off" , + }, + { + .driver ="Opteron_G3" "-" TYPE_X86_CPU , + .property ="vme" , + .value ="off" , + }, + { + .driver ="Opteron_G4" "-" TYPE_X86_CPU , + .property ="vme" , + .value ="off" , + }, + { + .driver ="Opteron_G5" "-" TYPE_X86_CPU , + .property ="vme" , + .value ="off" , + }, + { + .driver ="Haswell" "-" TYPE_X86_CPU , + .property ="f16c" , + .value ="off" , + }, + { + .driver ="Haswell" "-" TYPE_X86_CPU , + .property ="rdrand" , + .value ="off" , + }, + { + .driver ="Broadwell" "-" TYPE_X86_CPU , + .property ="f16c" , + .value ="off" , + }, + { + .driver ="Broadwell" "-" TYPE_X86_CPU , + .property ="rdrand" , + .value ="off" , + }, +}; +const size_t pc_compat_2_2_len =G_N_ELEMENTS (pc_compat_2_2); +void gsi_handler (void *opaque,int n,int level) {GSIState *s = opaque;hw/i386/pc_piix.c +5
-7@@ -318,14 +318,14 @@ static void pc_compat_2_3_fn(MachineState *machine) } } -static void pc_compat_2_2 (MachineState *machine) +static void pc_compat_2_2_fn (MachineState *machine) {pc_compat_2_3_fn (machine); }static void pc_compat_2_1 (MachineState *machine) { -pc_compat_2_2 (machine); +pc_compat_2_2_fn (machine);x86_cpu_change_kvm_default ("svm" ,NULL ); }@@ -578,18 +578,16 @@ DEFINE_I440FX_MACHINE(v2_3, "pc-i440fx-2.3", pc_compat_2_3_fn,static void pc_i440fx_2_2_machine_options (MachineClass *m) {PCMachineClass *pcmc =PC_MACHINE_CLASS (m); -static GlobalProperty compat[] = { -PC_COMPAT_2_2 - };pc_i440fx_2_3_machine_options (m); m->hw_version ="2.2.0" ; m->default_machine_opts ="firmware=bios-256k.bin,suppress-vmdesc=on" ; -compat_props_add (m->compat_props, compat,G_N_ELEMENTS (compat)); +compat_props_add (m->compat_props, hw_compat_2_2, hw_compat_2_2_len); +compat_props_add (m->compat_props, pc_compat_2_2, pc_compat_2_2_len); pcmc->rsdp_in_ram = false; } -DEFINE_I440FX_MACHINE (v2_2,"pc-i440fx-2.2" , pc_compat_2_2, +DEFINE_I440FX_MACHINE (v2_2,"pc-i440fx-2.2" , pc_compat_2_2_fn, pc_i440fx_2_2_machine_options);static void pc_i440fx_2_1_machine_options (MachineClass *m)hw/ppc/spapr.c +1
-1@@ -4282,7 +4282,6 @@ DEFINE_SPAPR_MACHINE(2_3, "2.3", false);static void spapr_machine_2_2_class_options (MachineClass *mc) {static GlobalProperty compat[] = { -HW_COMPAT_2_2 { .driver =TYPE_SPAPR_PCI_HOST_BRIDGE , .property ="mem_win_size" ,@@ -4291,6 +4290,7 @@ static void spapr_machine_2_2_class_options(MachineClass *mc) };spapr_machine_2_3_class_options (mc); +compat_props_add (mc->compat_props, hw_compat_2_2, hw_compat_2_2_len);compat_props_add (mc->compat_props, compat,G_N_ELEMENTS (compat)); mc->default_machine_opts ="modern-hotplug-events=off,suppress-vmdesc=on" ; }
PATCH v7 19/28 compat: replace PC_COMPAT_2_1 & HW_COMPAT_2_1 macros
In reply to Marc-André LureauUse static arrays instead. I decided to rename the conflicting pc_compat_2_1() function with pc_compat_2_1_fn().
--- 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(-)
include/hw/boards.h +3 -0
@@ -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
include/hw/compat.h +0 -31
@@ -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 */
include/hw/i386/pc.h +3 -14
@@ -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") \ {\
hw/core/machine.c +33 -0
@@ -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);
hw/i386/pc.c +15 -0
@@ -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;
hw/i386/pc_piix.c +5 -7
@@ -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)
hw/ppc/spapr.c +1 -5
@@ -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);
Signature · 1 line
2.20.1.2.gb21ebb671b
Re: [Qemu-devel] [PATCH v7 19/28] compat: replace PC_COMPAT_2_1 & HW_COMPAT_2_1 macros
Quoted 5 lines · On Fri, 21 Dec 2018 13:04:01 +0400 Marc-André Lureau…
Use static arrays instead. I decided to rename the conflicting
pc_compat_2_1()function withpc_compat_2_1_fn().Suggested-by Eduardo Habkost <[email protected]>Signed-off-by Marc-André Lureau <[email protected]>
Quoted 9 lines
--- 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(-)
Re: [Qemu-devel] [PATCH v7 19/28] compat: replace PC_COMPAT_2_1 & HW_COMPAT_2_1 macros
In reply to Marc-André LureauQuoted 5 lines · On Fri, 21 Dec 2018 13:04:01 +0400 Marc-André Lureau…
Use static arrays instead. I decided to rename the conflicting
pc_compat_2_1()function withpc_compat_2_1_fn().Suggested-by Eduardo Habkost <[email protected]>Signed-off-by Marc-André Lureau <[email protected]>
Quoted 230 lines
--- 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(-)include/hw/boards.h +3
-0@@ -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 include/hw/compat.h +0
-31@@ -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 */ include/hw/i386/pc.h +3
-14@@ -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") \ {\hw/core/machine.c +33
-0@@ -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);hw/i386/pc.c +15
-0@@ -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;hw/i386/pc_piix.c +5
-7@@ -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)hw/ppc/spapr.c +1
-5@@ -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);
PATCH v7 20/28 include: remove compat.h
In reply to Marc-André LureauThe header is now empty.
--- include/hw/compat.h | 4 ---- include/hw/i386/pc.h | 1 - hw/arm/virt.c | 1 - hw/ppc/spapr.c | 1 - hw/s390x/s390-virtio-ccw.c | 1 - 5 files changed, 8 deletions(-) delete mode 100644 include/hw/compat.h
include/hw/compat.h deleted +0 -4
@@ -1,4 +0,0 @@ -#ifndef HW_COMPAT_H -#define HW_COMPAT_H - -#endif /* HW_COMPAT_H */
include/hw/i386/pc.h +0 -1
@@ -13,7 +13,6 @@#include "qemu/bitmap.h" #include "sysemu/sysemu.h" #include "hw/pci/pci.h" -#include "hw/compat.h" #include "hw/mem/pc-dimm.h" #include "hw/mem/nvdimm.h" #include "hw/acpi/acpi_dev_interface.h"
hw/arm/virt.c +0 -1
@@ -43,7 +43,6 @@#include "sysemu/numa.h" #include "sysemu/sysemu.h" #include "sysemu/kvm.h" -#include "hw/compat.h" #include "hw/loader.h" #include "exec/address-spaces.h" #include "qemu/bitops.h"
hw/ppc/spapr.c +0 -1
@@ -70,7 +70,6 @@#include "hw/nmi.h" #include "hw/intc/intc.h" -#include "hw/compat.h" #include "qemu/cutils.h" #include "hw/ppc/spapr_cpu_core.h" #include "hw/mem/memory-device.h"
hw/s390x/s390-virtio-ccw.c +0 -1
@@ -28,7 +28,6 @@#include "hw/s390x/storage-keys.h" #include "hw/s390x/storage-attributes.h" #include "hw/s390x/event-facility.h" -#include "hw/compat.h" #include "ipl.h" #include "hw/s390x/s390-virtio-ccw.h" #include "hw/s390x/css-bridge.h"
Signature · 1 line
2.20.1.2.gb21ebb671b
Re: [Qemu-devel] [PATCH v7 20/28] include: remove compat.h
Quoted 11 lines · On Fri, 21 Dec 2018 13:04:02 +0400 Marc-André Lureau…
The header is now empty.
Signed-off-by Marc-André Lureau <[email protected]>--- include/hw/compat.h | 4 ---- include/hw/i386/pc.h | 1 - hw/arm/virt.c | 1 - hw/ppc/spapr.c | 1 - hw/s390x/s390-virtio-ccw.c | 1 - 5 files changed, 8 deletions(-) delete mode 100644 include/hw/compat.h
Re: [Qemu-devel] [PATCH v7 20/28] include: remove compat.h
In reply to Marc-André LureauQuoted 3 lines · On Fri, 21 Dec 2018 13:04:02 +0400 Marc-André Lureau…
The header is now empty.
Signed-off-by Marc-André Lureau <[email protected]>
Quoted 67 lines
--- include/hw/compat.h | 4 ---- include/hw/i386/pc.h | 1 - hw/arm/virt.c | 1 - hw/ppc/spapr.c | 1 - hw/s390x/s390-virtio-ccw.c | 1 - 5 files changed, 8 deletions(-) delete mode 100644 include/hw/compat.hinclude/hw/compat.h deleted +0
-4@@ -1,4 +0,0 @@ -#ifndef HW_COMPAT_H -#define HW_COMPAT_H - -#endif /* HW_COMPAT_H */ include/hw/i386/pc.h +0
-1@@ -13,7 +13,6 @@#include "qemu/bitmap.h" #include "sysemu/sysemu.h" #include "hw/pci/pci.h" -#include "hw/compat.h" #include "hw/mem/pc-dimm.h" #include "hw/mem/nvdimm.h" #include "hw/acpi/acpi_dev_interface.h" hw/arm/virt.c +0
-1@@ -43,7 +43,6 @@#include "sysemu/numa.h" #include "sysemu/sysemu.h" #include "sysemu/kvm.h" -#include "hw/compat.h" #include "hw/loader.h" #include "exec/address-spaces.h" #include "qemu/bitops.h" hw/ppc/spapr.c +0
-1@@ -70,7 +70,6 @@#include "hw/nmi.h" #include "hw/intc/intc.h" -#include "hw/compat.h" #include "qemu/cutils.h" #include "hw/ppc/spapr_cpu_core.h" #include "hw/mem/memory-device.h" hw/s390x/s390-virtio-ccw.c +0
-1@@ -28,7 +28,6 @@#include "hw/s390x/storage-keys.h" #include "hw/s390x/storage-attributes.h" #include "hw/s390x/event-facility.h" -#include "hw/compat.h" #include "ipl.h" #include "hw/s390x/s390-virtio-ccw.h" #include "hw/s390x/css-bridge.h"
PATCH v7 21/28 compat: remove remaining PC_COMPAT macros
In reply to Marc-André LureauUse static arrays instead. I decided to rename the conflicting pc_compat_2_1() function with pc_compat_2_1_fn().
--- include/hw/i386/pc.h | 236 +++---------------------------------------- hw/i386/pc.c | 232 ++++++++++++++++++++++++++++++++++++++++++ hw/i386/pc_piix.c | 57 ++++------- 3 files changed, 267 insertions(+), 258 deletions(-)
include/hw/i386/pc.h +15 -221
@@ -335,6 +335,21 @@ extern const size_t pc_compat_2_2_len;extern GlobalProperty pc_compat_2_1[];extern const size_t pc_compat_2_1_len; +extern GlobalProperty pc_compat_2_0[]; +extern const size_t pc_compat_2_0_len; + +extern GlobalProperty pc_compat_1_7[]; +extern const size_t pc_compat_1_7_len; + +extern GlobalProperty pc_compat_1_6[]; +extern const size_t pc_compat_1_6_len; + +extern GlobalProperty pc_compat_1_5[]; +extern const size_t pc_compat_1_5_len; + +extern GlobalProperty pc_compat_1_4[]; +extern const size_t pc_compat_1_4_len; +/* Helper for setting model-id for CPU models that changed model-id * depending on QEMU versions up to QEMU 2.4. */
@@ -355,227 +370,6 @@ extern const size_t pc_compat_2_1_len; .value = "QEMU Virtual CPU version " v,\ }, -#define PC_COMPAT_2_0 \ - PC_CPU_MODEL_IDS("2.0.0") \ - {\ - .driver = "virtio-scsi-pci",\ - .property = "any_layout",\ - .value = "off",\ - },{\ - .driver = "PIIX4_PM",\ - .property = "memory-hotplug-support",\ - .value = "off",\ - },\ - {\ - .driver = "apic",\ - .property = "version",\ - .value = stringify(0x11),\ - },\ - {\ - .driver = "nec-usb-xhci",\ - .property = "superspeed-ports-first",\ - .value = "off",\ - },\ - {\ - .driver = "nec-usb-xhci",\ - .property = "force-pcie-endcap",\ - .value = "on",\ - },\ - {\ - .driver = "pci-serial",\ - .property = "prog_if",\ - .value = stringify(0),\ - },\ - {\ - .driver = "pci-serial-2x",\ - .property = "prog_if",\ - .value = stringify(0),\ - },\ - {\ - .driver = "pci-serial-4x",\ - .property = "prog_if",\ - .value = stringify(0),\ - },\ - {\ - .driver = "virtio-net-pci",\ - .property = "guest_announce",\ - .value = "off",\ - },\ - {\ - .driver = "ICH9-LPC",\ - .property = "memory-hotplug-support",\ - .value = "off",\ - },{\ - .driver = "xio3130-downstream",\ - .property = COMPAT_PROP_PCP,\ - .value = "off",\ - },{\ - .driver = "ioh3420",\ - .property = COMPAT_PROP_PCP,\ - .value = "off",\ - }, - -#define PC_COMPAT_1_7 \ - PC_CPU_MODEL_IDS("1.7.0") \ - {\ - .driver = TYPE_USB_DEVICE,\ - .property = "msos-desc",\ - .value = "no",\ - },\ - {\ - .driver = "PIIX4_PM",\ - .property = "acpi-pci-hotplug-with-bridge-support",\ - .value = "off",\ - },\ - {\ - .driver = "hpet",\ - .property = HPET_INTCAP,\ - .value = stringify(4),\ - }, - -#define PC_COMPAT_1_6 \ - PC_CPU_MODEL_IDS("1.6.0") \ - {\ - .driver = "e1000",\ - .property = "mitigation",\ - .value = "off",\ - },{\ - .driver = "qemu64-" TYPE_X86_CPU,\ - .property = "model",\ - .value = stringify(2),\ - },{\ - .driver = "qemu32-" TYPE_X86_CPU,\ - .property = "model",\ - .value = stringify(3),\ - },{\ - .driver = "i440FX-pcihost",\ - .property = "short_root_bus",\ - .value = stringify(1),\ - },{\ - .driver = "q35-pcihost",\ - .property = "short_root_bus",\ - .value = stringify(1),\ - }, - -#define PC_COMPAT_1_5 \ - PC_CPU_MODEL_IDS("1.5.0") \ - {\ - .driver = "Conroe-" TYPE_X86_CPU,\ - .property = "model",\ - .value = stringify(2),\ - },{\ - .driver = "Conroe-" TYPE_X86_CPU,\ - .property = "min-level",\ - .value = stringify(2),\ - },{\ - .driver = "Penryn-" TYPE_X86_CPU,\ - .property = "model",\ - .value = stringify(2),\ - },{\ - .driver = "Penryn-" TYPE_X86_CPU,\ - .property = "min-level",\ - .value = stringify(2),\ - },{\ - .driver = "Nehalem-" TYPE_X86_CPU,\ - .property = "model",\ - .value = stringify(2),\ - },{\ - .driver = "Nehalem-" TYPE_X86_CPU,\ - .property = "min-level",\ - .value = stringify(2),\ - },{\ - .driver = "virtio-net-pci",\ - .property = "any_layout",\ - .value = "off",\ - },{\ - .driver = TYPE_X86_CPU,\ - .property = "pmu",\ - .value = "on",\ - },{\ - .driver = "i440FX-pcihost",\ - .property = "short_root_bus",\ - .value = stringify(0),\ - },{\ - .driver = "q35-pcihost",\ - .property = "short_root_bus",\ - .value = stringify(0),\ - }, - -#define PC_COMPAT_1_4 \ - PC_CPU_MODEL_IDS("1.4.0") \ - {\ - .driver = "scsi-hd",\ - .property = "discard_granularity",\ - .value = stringify(0),\ - },{\ - .driver = "scsi-cd",\ - .property = "discard_granularity",\ - .value = stringify(0),\ - },{\ - .driver = "scsi-disk",\ - .property = "discard_granularity",\ - .value = stringify(0),\ - },{\ - .driver = "ide-hd",\ - .property = "discard_granularity",\ - .value = stringify(0),\ - },{\ - .driver = "ide-cd",\ - .property = "discard_granularity",\ - .value = stringify(0),\ - },{\ - .driver = "ide-drive",\ - .property = "discard_granularity",\ - .value = stringify(0),\ - },{\ - .driver = "virtio-blk-pci",\ - .property = "discard_granularity",\ - .value = stringify(0),\ - },{\ - .driver = "virtio-serial-pci",\ - .property = "vectors",\ - /* DEV_NVECTORS_UNSPECIFIED as a uint32_t string */\ - .value = stringify(0xFFFFFFFF),\ - },{ \ - .driver = "virtio-net-pci", \ - .property = "ctrl_guest_offloads", \ - .value = "off", \ - },{\ - .driver = "e1000",\ - .property = "romfile",\ - .value = "pxe-e1000.rom",\ - },{\ - .driver = "ne2k_pci",\ - .property = "romfile",\ - .value = "pxe-ne2k_pci.rom",\ - },{\ - .driver = "pcnet",\ - .property = "romfile",\ - .value = "pxe-pcnet.rom",\ - },{\ - .driver = "rtl8139",\ - .property = "romfile",\ - .value = "pxe-rtl8139.rom",\ - },{\ - .driver = "virtio-net-pci",\ - .property = "romfile",\ - .value = "pxe-virtio.rom",\ - },{\ - .driver = "486-" TYPE_X86_CPU,\ - .property = "model",\ - .value = stringify(0),\ - },\ - {\ - .driver = "n270" "-" TYPE_X86_CPU,\ - .property = "movbe",\ - .value = "off",\ - },\ - {\ - .driver = "Westmere" "-" TYPE_X86_CPU,\ - .property = "pclmulqdq",\ - .value = "off",\ - }, -#define DEFINE_PC_MACHINE (suffix, namestr, initfn, optsfn) \ static void pc_machine_##suffix##_class_init(ObjectClass *oc, void *data) \ { \
hw/i386/pc.c +232 -0
244 lines not on this page · raw message
hw/i386/pc_piix.c +20 -37
141 lines not on this page · raw message
Signature · 1 line
2.20.1.2.gb21ebb671b
Re: [Qemu-devel] [PATCH v7 21/28] compat: remove remaining PC_COMPAT macros
Quoted 10 lines · On Fri, 21 Dec 2018 13:04:03 +0400 Marc-André Lureau…
Use static arrays instead. I decided to rename the conflicting
pc_compat_2_1()function withpc_compat_2_1_fn().Suggested-by Eduardo Habkost <[email protected]>Signed-off-by Marc-André Lureau <[email protected]>--- include/hw/i386/pc.h | 236 +++---------------------------------------- hw/i386/pc.c | 232 ++++++++++++++++++++++++++++++++++++++++++ hw/i386/pc_piix.c | 57 ++++------- 3 files changed, 267 insertions(+), 258 deletions(-)
Re: [Qemu-devel] [PATCH v7 21/28] compat: remove remaining PC_COMPAT macros
In reply to Marc-André LureauQuoted 5 lines · On Fri, 21 Dec 2018 13:04:03 +0400 Marc-André Lureau…
Use static arrays instead. I decided to rename the conflicting
pc_compat_2_1()function withpc_compat_2_1_fn().Suggested-by Eduardo Habkost <[email protected]>Signed-off-by Marc-André Lureau <[email protected]>
Quoted 658 lines
--- include/hw/i386/pc.h | 236 +++---------------------------------------- hw/i386/pc.c | 232 ++++++++++++++++++++++++++++++++++++++++++ hw/i386/pc_piix.c | 57 ++++------- 3 files changed, 267 insertions(+), 258 deletions(-)include/hw/i386/pc.h +15
-221@@ -335,6 +335,21 @@ extern const size_t pc_compat_2_2_len;extern GlobalProperty pc_compat_2_1[];extern const size_t pc_compat_2_1_len; +extern GlobalProperty pc_compat_2_0[]; +extern const size_t pc_compat_2_0_len; + +extern GlobalProperty pc_compat_1_7[]; +extern const size_t pc_compat_1_7_len; + +extern GlobalProperty pc_compat_1_6[]; +extern const size_t pc_compat_1_6_len; + +extern GlobalProperty pc_compat_1_5[]; +extern const size_t pc_compat_1_5_len; + +extern GlobalProperty pc_compat_1_4[]; +extern const size_t pc_compat_1_4_len; +/* Helper for setting model-id for CPU models that changed model-id * depending on QEMU versions up to QEMU 2.4. */ @@ -355,227 +370,6 @@ extern const size_t pc_compat_2_1_len; .value = "QEMU Virtual CPU version " v,\ }, -#define PC_COMPAT_2_0 \ - PC_CPU_MODEL_IDS("2.0.0") \ - {\ - .driver = "virtio-scsi-pci",\ - .property = "any_layout",\ - .value = "off",\ - },{\ - .driver = "PIIX4_PM",\ - .property = "memory-hotplug-support",\ - .value = "off",\ - },\ - {\ - .driver = "apic",\ - .property = "version",\ - .value = stringify(0x11),\ - },\ - {\ - .driver = "nec-usb-xhci",\ - .property = "superspeed-ports-first",\ - .value = "off",\ - },\ - {\ - .driver = "nec-usb-xhci",\ - .property = "force-pcie-endcap",\ - .value = "on",\ - },\ - {\ - .driver = "pci-serial",\ - .property = "prog_if",\ - .value = stringify(0),\ - },\ - {\ - .driver = "pci-serial-2x",\ - .property = "prog_if",\ - .value = stringify(0),\ - },\ - {\ - .driver = "pci-serial-4x",\ - .property = "prog_if",\ - .value = stringify(0),\ - },\ - {\ - .driver = "virtio-net-pci",\ - .property = "guest_announce",\ - .value = "off",\ - },\ - {\ - .driver = "ICH9-LPC",\ - .property = "memory-hotplug-support",\ - .value = "off",\ - },{\ - .driver = "xio3130-downstream",\ - .property = COMPAT_PROP_PCP,\ - .value = "off",\ - },{\ - .driver = "ioh3420",\ - .property = COMPAT_PROP_PCP,\ - .value = "off",\ - }, - -#define PC_COMPAT_1_7 \ - PC_CPU_MODEL_IDS("1.7.0") \ - {\ - .driver = TYPE_USB_DEVICE,\ - .property = "msos-desc",\ - .value = "no",\ - },\ - {\ - .driver = "PIIX4_PM",\ - .property = "acpi-pci-hotplug-with-bridge-support",\ - .value = "off",\ - },\ - {\ - .driver = "hpet",\ - .property = HPET_INTCAP,\ - .value = stringify(4),\ - }, - -#define PC_COMPAT_1_6 \ - PC_CPU_MODEL_IDS("1.6.0") \ - {\ - .driver = "e1000",\ - .property = "mitigation",\ - .value = "off",\ - },{\ - .driver = "qemu64-" TYPE_X86_CPU,\ - .property = "model",\ - .value = stringify(2),\ - },{\ - .driver = "qemu32-" TYPE_X86_CPU,\ - .property = "model",\ - .value = stringify(3),\ - },{\ - .driver = "i440FX-pcihost",\ - .property = "short_root_bus",\ - .value = stringify(1),\ - },{\ - .driver = "q35-pcihost",\ - .property = "short_root_bus",\ - .value = stringify(1),\ - }, - -#define PC_COMPAT_1_5 \ - PC_CPU_MODEL_IDS("1.5.0") \ - {\ - .driver = "Conroe-" TYPE_X86_CPU,\ - .property = "model",\ - .value = stringify(2),\ - },{\ - .driver = "Conroe-" TYPE_X86_CPU,\ - .property = "min-level",\ - .value = stringify(2),\ - },{\ - .driver = "Penryn-" TYPE_X86_CPU,\ - .property = "model",\ - .value = stringify(2),\ - },{\ - .driver = "Penryn-" TYPE_X86_CPU,\ - .property = "min-level",\ - .value = stringify(2),\ - },{\ - .driver = "Nehalem-" TYPE_X86_CPU,\ - .property = "model",\ - .value = stringify(2),\ - },{\ - .driver = "Nehalem-" TYPE_X86_CPU,\ - .property = "min-level",\ - .value = stringify(2),\ - },{\ - .driver = "virtio-net-pci",\ - .property = "any_layout",\ - .value = "off",\ - },{\ - .driver = TYPE_X86_CPU,\ - .property = "pmu",\ - .value = "on",\ - },{\ - .driver = "i440FX-pcihost",\ - .property = "short_root_bus",\ - .value = stringify(0),\ - },{\ - .driver = "q35-pcihost",\ - .property = "short_root_bus",\ - .value = stringify(0),\ - }, - -#define PC_COMPAT_1_4 \ - PC_CPU_MODEL_IDS("1.4.0") \ - {\ - .driver = "scsi-hd",\ - .property = "discard_granularity",\ - .value = stringify(0),\ - },{\ - .driver = "scsi-cd",\ - .property = "discard_granularity",\ - .value = stringify(0),\ - },{\ - .driver = "scsi-disk",\ - .property = "discard_granularity",\ - .value = stringify(0),\ - },{\ - .driver = "ide-hd",\ - .property = "discard_granularity",\ - .value = stringify(0),\ - },{\ - .driver = "ide-cd",\ - .property = "discard_granularity",\ - .value = stringify(0),\ - },{\ - .driver = "ide-drive",\ - .property = "discard_granularity",\ - .value = stringify(0),\ - },{\ - .driver = "virtio-blk-pci",\ - .property = "discard_granularity",\ - .value = stringify(0),\ - },{\ - .driver = "virtio-serial-pci",\ - .property = "vectors",\ - /* DEV_NVECTORS_UNSPECIFIED as a uint32_t string */\ - .value = stringify(0xFFFFFFFF),\ - },{ \ - .driver = "virtio-net-pci", \ - .property = "ctrl_guest_offloads", \ - .value = "off", \ - },{\ - .driver = "e1000",\ - .property = "romfile",\ - .value = "pxe-e1000.rom",\ - },{\ - .driver = "ne2k_pci",\ - .property = "romfile",\ - .value = "pxe-ne2k_pci.rom",\ - },{\ - .driver = "pcnet",\ - .property = "romfile",\ - .value = "pxe-pcnet.rom",\ - },{\ - .driver = "rtl8139",\ - .property = "romfile",\ - .value = "pxe-rtl8139.rom",\ - },{\ - .driver = "virtio-net-pci",\ - .property = "romfile",\ - .value = "pxe-virtio.rom",\ - },{\ - .driver = "486-" TYPE_X86_CPU,\ - .property = "model",\ - .value = stringify(0),\ - },\ - {\ - .driver = "n270" "-" TYPE_X86_CPU,\ - .property = "movbe",\ - .value = "off",\ - },\ - {\ - .driver = "Westmere" "-" TYPE_X86_CPU,\ - .property = "pclmulqdq",\ - .value = "off",\ - }, -#define DEFINE_PC_MACHINE (suffix, namestr, initfn, optsfn) \ static void pc_machine_##suffix##_class_init(ObjectClass *oc, void *data) \ { \hw/i386/pc.c +232
-0@@ -72,6 +72,7 @@#include "qapi/visitor.h" #include "qom/cpu.h" #include "hw/nmi.h" +#include "hw/usb.h" #include "hw/i386/intel_iommu.h" #include "hw/net/ne2000-isa.h" @@ -545,6 +546,237 @@ GlobalProperty pc_compat_2_1[] = { };const size_t pc_compat_2_1_len =G_N_ELEMENTS (pc_compat_2_1); +GlobalProperty pc_compat_2_0[] = { + PC_CPU_MODEL_IDS("2.0.0") + { + .driver ="virtio-scsi-pci" , + .property ="any_layout" , + .value ="off" , + },{ + .driver ="PIIX4_PM" , + .property ="memory-hotplug-support" , + .value ="off" , + }, + { + .driver ="apic" , + .property ="version" , + .value =stringify (0x11 ), + }, + { + .driver ="nec-usb-xhci" , + .property ="superspeed-ports-first" , + .value ="off" , + }, + { + .driver ="nec-usb-xhci" , + .property ="force-pcie-endcap" , + .value ="on" , + }, + { + .driver ="pci-serial" , + .property ="prog_if" , + .value =stringify (0 ), + }, + { + .driver ="pci-serial-2x" , + .property ="prog_if" , + .value =stringify (0 ), + }, + { + .driver ="pci-serial-4x" , + .property ="prog_if" , + .value =stringify (0 ), + }, + { + .driver ="virtio-net-pci" , + .property ="guest_announce" , + .value ="off" , + }, + { + .driver ="ICH9-LPC" , + .property ="memory-hotplug-support" , + .value ="off" , + },{ + .driver ="xio3130-downstream" , + .property =COMPAT_PROP_PCP , + .value ="off" , + },{ + .driver ="ioh3420" , + .property =COMPAT_PROP_PCP , + .value ="off" , + }, +}; +const size_t pc_compat_2_0_len =G_N_ELEMENTS (pc_compat_2_0); + +GlobalProperty pc_compat_1_7[] = { + PC_CPU_MODEL_IDS("1.7.0") + { + .driver =TYPE_USB_DEVICE , + .property ="msos-desc" , + .value ="no" , + }, + { + .driver ="PIIX4_PM" , + .property ="acpi-pci-hotplug-with-bridge-support" , + .value ="off" , + }, + { + .driver ="hpet" , + .property =HPET_INTCAP , + .value =stringify (4 ), + }, +}; +const size_t pc_compat_1_7_len =G_N_ELEMENTS (pc_compat_1_7); + +GlobalProperty pc_compat_1_6[] = { + PC_CPU_MODEL_IDS("1.6.0") + { + .driver ="e1000" , + .property ="mitigation" , + .value ="off" , + },{ + .driver ="qemu64-" TYPE_X86_CPU , + .property ="model" , + .value =stringify (2 ), + },{ + .driver ="qemu32-" TYPE_X86_CPU , + .property ="model" , + .value =stringify (3 ), + },{ + .driver ="i440FX-pcihost" , + .property ="short_root_bus" , + .value =stringify (1 ), + },{ + .driver ="q35-pcihost" , + .property ="short_root_bus" , + .value =stringify (1 ), + }, +}; +const size_t pc_compat_1_6_len =G_N_ELEMENTS (pc_compat_1_6); + +GlobalProperty pc_compat_1_5[] = { + PC_CPU_MODEL_IDS("1.5.0") + { + .driver ="Conroe-" TYPE_X86_CPU , + .property ="model" , + .value =stringify (2 ), + },{ + .driver ="Conroe-" TYPE_X86_CPU , + .property ="min-level" , + .value =stringify (2 ), + },{ + .driver ="Penryn-" TYPE_X86_CPU , + .property ="model" , + .value =stringify (2 ), + },{ + .driver ="Penryn-" TYPE_X86_CPU , + .property ="min-level" , + .value =stringify (2 ), + },{ + .driver ="Nehalem-" TYPE_X86_CPU , + .property ="model" , + .value =stringify (2 ), + },{ + .driver ="Nehalem-" TYPE_X86_CPU , + .property ="min-level" , + .value =stringify (2 ), + },{ + .driver ="virtio-net-pci" , + .property ="any_layout" , + .value ="off" , + },{ + .driver =TYPE_X86_CPU , + .property ="pmu" , + .value ="on" , + },{ + .driver ="i440FX-pcihost" , + .property ="short_root_bus" , + .value =stringify (0 ), + },{ + .driver ="q35-pcihost" , + .property ="short_root_bus" , + .value =stringify (0 ), + }, +}; +const size_t pc_compat_1_5_len =G_N_ELEMENTS (pc_compat_1_5); + +GlobalProperty pc_compat_1_4[] = { + PC_CPU_MODEL_IDS("1.4.0") + { + .driver ="scsi-hd" , + .property ="discard_granularity" , + .value =stringify (0 ), + },{ + .driver ="scsi-cd" , + .property ="discard_granularity" , + .value =stringify (0 ), + },{ + .driver ="scsi-disk" , + .property ="discard_granularity" , + .value =stringify (0 ), + },{ + .driver ="ide-hd" , + .property ="discard_granularity" , + .value =stringify (0 ), + },{ + .driver ="ide-cd" , + .property ="discard_granularity" , + .value =stringify (0 ), + },{ + .driver ="ide-drive" , + .property ="discard_granularity" , + .value =stringify (0 ), + },{ + .driver ="virtio-blk-pci" , + .property ="discard_granularity" , + .value =stringify (0 ), + },{ + .driver ="virtio-serial-pci" , + .property ="vectors" , +/* DEV_NVECTORS_UNSPECIFIED as a uint32_t string */ + .value =stringify (0xFFFFFFFF ), + },{ + .driver ="virtio-net-pci" , + .property ="ctrl_guest_offloads" , + .value ="off" , + },{ + .driver ="e1000" , + .property ="romfile" , + .value ="pxe-e1000.rom" , + },{ + .driver ="ne2k_pci" , + .property ="romfile" , + .value ="pxe-ne2k_pci.rom" , + },{ + .driver ="pcnet" , + .property ="romfile" , + .value ="pxe-pcnet.rom" , + },{ + .driver ="rtl8139" , + .property ="romfile" , + .value ="pxe-rtl8139.rom" , + },{ + .driver ="virtio-net-pci" , + .property ="romfile" , + .value ="pxe-virtio.rom" , + },{ + .driver ="486-" TYPE_X86_CPU , + .property ="model" , + .value =stringify (0 ), + }, + { + .driver ="n270" "-" TYPE_X86_CPU , + .property ="movbe" , + .value ="off" , + }, + { + .driver ="Westmere" "-" TYPE_X86_CPU , + .property ="pclmulqdq" , + .value ="off" , + }, +}; +const size_t pc_compat_1_4_len =G_N_ELEMENTS (pc_compat_1_4); +void gsi_handler (void *opaque,int n,int level) {GSIState *s = opaque;hw/i386/pc_piix.c +20
-37@@ -329,35 +329,35 @@ static void pc_compat_2_1_fn(MachineState *machine)x86_cpu_change_kvm_default ("svm" ,NULL ); } -static void pc_compat_2_0 (MachineState *machine) +static void pc_compat_2_0_fn (MachineState *machine) {pc_compat_2_1_fn (machine); } -static void pc_compat_1_7 (MachineState *machine) +static void pc_compat_1_7_fn (MachineState *machine) { -pc_compat_2_0 (machine); +pc_compat_2_0_fn (machine);x86_cpu_change_kvm_default ("x2apic" ,NULL ); } -static void pc_compat_1_6 (MachineState *machine) +static void pc_compat_1_6_fn (MachineState *machine) { -pc_compat_1_7 (machine); +pc_compat_1_7_fn (machine); } -static void pc_compat_1_5 (MachineState *machine) +static void pc_compat_1_5_fn (MachineState *machine) { -pc_compat_1_6 (machine); +pc_compat_1_6_fn (machine); } -static void pc_compat_1_4 (MachineState *machine) +static void pc_compat_1_4_fn (MachineState *machine) { -pc_compat_1_5 (machine); +pc_compat_1_5_fn (machine); }static void pc_compat_1_3 (MachineState *machine) { -pc_compat_1_4 (machine); +pc_compat_1_4_fn (machine);enable_compat_apic_id_mode (); }@@ -609,13 +609,10 @@ DEFINE_I440FX_MACHINE(v2_1, "pc-i440fx-2.1", pc_compat_2_1_fn,static void pc_i440fx_2_0_machine_options (MachineClass *m) {PCMachineClass *pcmc =PC_MACHINE_CLASS (m); -static GlobalProperty compat[] = { -PC_COMPAT_2_0 - };pc_i440fx_2_1_machine_options (m); m->hw_version ="2.0.0" ; -compat_props_add (m->compat_props, compat,G_N_ELEMENTS (compat)); +compat_props_add (m->compat_props, pc_compat_2_0, pc_compat_2_0_len); pcmc->smbios_legacy_mode = true; pcmc->has_reserved_memory = false;/* This value depends on the actual DSDT and SSDT compiled into @@ -638,73 +635,59 @@ static void pc_i440fx_2_0_machine_options(MachineClass *m) pcmc->acpi_data_size =0x10000 ; } -DEFINE_I440FX_MACHINE (v2_0,"pc-i440fx-2.0" , pc_compat_2_0, +DEFINE_I440FX_MACHINE (v2_0,"pc-i440fx-2.0" , pc_compat_2_0_fn, pc_i440fx_2_0_machine_options);static void pc_i440fx_1_7_machine_options (MachineClass *m) {PCMachineClass *pcmc =PC_MACHINE_CLASS (m); -static GlobalProperty compat[] = { -PC_COMPAT_1_7 - };pc_i440fx_2_0_machine_options (m); m->hw_version ="1.7.0" ; m->default_machine_opts =NULL ; m->option_rom_has_mr = true; -compat_props_add (m->compat_props, compat,G_N_ELEMENTS (compat)); +compat_props_add (m->compat_props, pc_compat_1_7, pc_compat_1_7_len); pcmc->smbios_defaults = false; pcmc->gigabyte_align = false; pcmc->legacy_acpi_table_size =6414 ; } -DEFINE_I440FX_MACHINE (v1_7,"pc-i440fx-1.7" , pc_compat_1_7, +DEFINE_I440FX_MACHINE (v1_7,"pc-i440fx-1.7" , pc_compat_1_7_fn, pc_i440fx_1_7_machine_options);static void pc_i440fx_1_6_machine_options (MachineClass *m) {PCMachineClass *pcmc =PC_MACHINE_CLASS (m); -static GlobalProperty compat[] = { -PC_COMPAT_1_6 - };pc_i440fx_1_7_machine_options (m); m->hw_version ="1.6.0" ; m->rom_file_has_mr = false; -compat_props_add (m->compat_props, compat,G_N_ELEMENTS (compat)); +compat_props_add (m->compat_props, pc_compat_1_6, pc_compat_1_6_len); pcmc->has_acpi_build = false; } -DEFINE_I440FX_MACHINE (v1_6,"pc-i440fx-1.6" , pc_compat_1_6, +DEFINE_I440FX_MACHINE (v1_6,"pc-i440fx-1.6" , pc_compat_1_6_fn, pc_i440fx_1_6_machine_options);static void pc_i440fx_1_5_machine_options (MachineClass *m) { -static GlobalProperty compat[] = { -PC_COMPAT_1_5 - }; -pc_i440fx_1_6_machine_options (m); m->hw_version ="1.5.0" ; -compat_props_add (m->compat_props, compat,G_N_ELEMENTS (compat)); +compat_props_add (m->compat_props, pc_compat_1_5, pc_compat_1_5_len); } -DEFINE_I440FX_MACHINE (v1_5,"pc-i440fx-1.5" , pc_compat_1_5, +DEFINE_I440FX_MACHINE (v1_5,"pc-i440fx-1.5" , pc_compat_1_5_fn, pc_i440fx_1_5_machine_options);static void pc_i440fx_1_4_machine_options (MachineClass *m) { -static GlobalProperty compat[] = { -PC_COMPAT_1_4 - }; -pc_i440fx_1_5_machine_options (m); m->hw_version ="1.4.0" ; m->hot_add_cpu =NULL ; -compat_props_add (m->compat_props, compat,G_N_ELEMENTS (compat)); +compat_props_add (m->compat_props, pc_compat_1_4, pc_compat_1_4_len); } -DEFINE_I440FX_MACHINE (v1_4,"pc-i440fx-1.4" , pc_compat_1_4, +DEFINE_I440FX_MACHINE (v1_4,"pc-i440fx-1.4" , pc_compat_1_4_fn, pc_i440fx_1_4_machine_options);static void pc_i440fx_1_3_machine_options (MachineClass *m)
PATCH v7 22/28 qdev: make a separate helper function to apply compat properties
In reply to Marc-André LureauThis will allow to apply compat properties on other objects than QDev easily.
--- include/hw/qdev-core.h | 2 ++ hw/core/qdev.c | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-)
include/hw/qdev-core.h +2 -0
@@ -422,6 +422,8 @@ const char *qdev_fw_name(DeviceState *dev);Object *qdev_get_machine (void ); +void object_apply_compat_props (Object *obj); +/* FIXME: make this a link<> */ void qdev_set_parent_bus (DeviceState *dev,BusState *bus);
hw/core/qdev.c +5 -1
@@ -970,7 +970,7 @@ static void device_initfn(Object *obj)QLIST_INIT (&dev->gpios); } -static void device_post_init (Object *obj) +void object_apply_compat_props (Object *obj) {if (object_dynamic_cast (qdev_get_machine (),TYPE_MACHINE )) {MachineState *m =MACHINE (qdev_get_machine ());
@@ -982,7 +982,11 @@ static void device_post_init(Object *obj) }object_apply_global_props (obj, mc->compat_props, &error_abort); } +} +static void device_post_init (Object *obj) +{ +object_apply_compat_props (obj);qdev_prop_set_globals (DEVICE (obj)); }
Signature · 1 line
2.20.1.2.gb21ebb671b
Re: [Qemu-devel] [PATCH v7 22/28] qdev: make a separate helper function to apply compat properties
Quoted 3 lines · On Fri, 21 Dec 2018 13:04:04 +0400 Marc-André Lureau…
This will allow to apply compat properties on other objects than QDev easily.
Signed-off-by Marc-André Lureau <[email protected]>
[...]
Re: [Qemu-devel] [PATCH v7 22/28] qdev: make a separate helper function to apply compat properties
In reply to Marc-André LureauQuoted 7 lines · On Fri, 21 Dec 2018 13:04:04 +0400 Marc-André Lureau…
This will allow to apply compat properties on other objects than QDev easily.
Signed-off-by Marc-André Lureau <[email protected]>--- include/hw/qdev-core.h | 2 ++ hw/core/qdev.c | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-)
PATCH v7 23/28 qdev: all globals are now user-provided
In reply to Marc-André LureauAll globals are now either provided via -global or through -cpu features (CPU features are implemented by registering globals).
If the global isn't being used, it should warn in either case.
We can thus consider that all global_props are "user-provided" globals. No need to track this per-globals anymore.
--- include/hw/qdev-core.h | 3 -- hw/core/qdev-properties.c | 4 --- tests/test-qdev-global-props.c | 57 ++++------------------------------ vl.c | 1 - 4 files changed, 6 insertions(+), 59 deletions(-)
include/hw/qdev-core.h +0 -3
@@ -249,8 +249,6 @@ struct PropertyInfo {/** * GlobalProperty: -* @user_provided: Set to true if property comes from user-provided config -* (command-line or config file). * @used: Set to true if property was used when initializing a device. * @errp: Error destination, used like first argument of error_setg() * in case property setting fails later. If @errp is NULL, we
@@ -262,7 +260,6 @@ typedef struct GlobalProperty {const char *driver;const char *property;const char *value; -bool user_provided;bool used;Error **errp; } GlobalProperty;
hw/core/qdev-properties.c +0 -4
@@ -1192,9 +1192,6 @@ int qdev_prop_check_globals(void)if (prop->used) {continue ; } -if (!prop->user_provided) { -continue ; - } oc =object_class_by_name (prop->driver); oc =object_class_dynamic_cast (oc,TYPE_DEVICE );if (!oc) {
@@ -1233,7 +1230,6 @@ void qdev_prop_set_globals(DeviceState *dev)if (!dev->hotplugged && prop->errp) {error_propagate (prop->errp, err); }else { -assert (prop->user_provided);warn_report_err (err); } }
tests/test-qdev-global-props.c +6 -51
75 lines not on this page · raw message
vl.c +0 -1
@@ -2952,7 +2952,6 @@ static int global_init_func(void *opaque, QemuOpts *opts, Error **errp) g->driver =qemu_opt_get (opts,"driver" ); g->property =qemu_opt_get (opts,"property" ); g->value =qemu_opt_get (opts,"value" ); - g->user_provided = true; g->errp = &error_fatal;qdev_prop_register_global (g);return 0 ;
Signature · 1 line
2.20.1.2.gb21ebb671b
Re: [Qemu-devel] [PATCH v7 23/28] qdev: all globals are now user-provided
Quoted 8 lines · On Fri, 21 Dec 2018 13:04:05 +0400 Marc-André Lureau…
All globals are now either provided via -global or through -cpu features (CPU features are implemented by registering globals).
If the global isn't being used, it should warn in either case.
We can thus consider that all
global_propsare "user-provided" globals. No need to track this per-globals anymore.
Quoted 8 lines
Signed-off-by Marc-André Lureau <[email protected]>Reviewed-by Igor Mammedov <[email protected]>--- include/hw/qdev-core.h | 3 -- hw/core/qdev-properties.c | 4 --- tests/test-qdev-global-props.c | 57 ++++------------------------------ vl.c | 1 - 4 files changed, 6 insertions(+), 59 deletions(-)
PATCH v7 24/28 qdev-props: convert global_props to GPtrArray
In reply to Marc-André LureauA step towards being able to call a common function, object_apply_global_props().
--- hw/core/qdev-properties.c | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-)
hw/core/qdev-properties.c +20 -9
@@ -1173,22 +1173,32 @@ void qdev_prop_set_ptr(DeviceState *dev, const char *name, void *value) *ptr = value; } -static GList *global_props; +static GPtrArray *global_props (void ) +{ +static GPtrArray *gp; + +if (!gp) { + gp =g_ptr_array_new (); + } + +return gp; +}void qdev_prop_register_global (GlobalProperty *prop) { - global_props =g_list_append (global_props, prop); +g_ptr_array_add (global_props (), prop); }int qdev_prop_check_globals (void ) { -GList *l; -int ret =0 ; +int i, ret =0 ; -for (l = global_props; l; l = l->next) { -GlobalProperty *prop = l->data; +for (i =0 ; i <global_props ()->len; i++) { +GlobalProperty *prop;ObjectClass *oc;DeviceClass *dc; + + prop =g_ptr_array_index (global_props (), i);if (prop->used) {continue ; }
@@ -1213,12 +1223,13 @@ int qdev_prop_check_globals(void)void qdev_prop_set_globals (DeviceState *dev) { -GList *l; +int i; -for (l = global_props; l; l = l->next) { -GlobalProperty *prop = l->data; +for (i =0 ; i <global_props ()->len; i++) { +GlobalProperty *prop;Error *err =NULL ; + prop =g_ptr_array_index (global_props (), i);if (object_dynamic_cast (OBJECT (dev), prop->driver) ==NULL ) {continue ; }
Signature · 1 line
2.20.1.2.gb21ebb671b
Re: [Qemu-devel] [PATCH v7 24/28] qdev-props: convert global_props to GPtrArray
Quoted 9 lines · On Fri, 21 Dec 2018 13:04:06 +0400 Marc-André Lureau…
A step towards being able to call a common function,
object_apply_global_props().Signed-off-by Marc-André Lureau <[email protected]>Reviewed-by Igor Mammedov <[email protected]>--- hw/core/qdev-properties.c | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-)
PATCH v7 25/28 qdev-props: remove errp from GlobalProperty
In reply to Marc-André LureauAll qdev_prop_register_global() set &error_fatal for errp, except '-rtc driftfix=slew', which arguably should also use &error_fatal, as otherwise failing to apply the property would only report a warning.
--- include/hw/qdev-core.h | 6 ------ hw/core/qdev-properties.c | 4 ++-- qom/cpu.c | 1 - target/i386/cpu.c | 1 - target/sparc/cpu.c | 1 - vl.c | 1 - 6 files changed, 2 insertions(+), 12 deletions(-)
include/hw/qdev-core.h +0 -6
@@ -250,18 +250,12 @@ struct PropertyInfo {/** * GlobalProperty: * @used: Set to true if property was used when initializing a device. -* @errp: Error destination, used like first argument of error_setg() -* in case property setting fails later. If @errp is NULL, we -* print warnings instead of ignoring errors silently. For -* hotplugged devices, errp is always ignored and warnings are -* printed instead. */ typedef struct GlobalProperty {const char *driver;const char *property;const char *value;bool used; -Error **errp; }GlobalProperty ; static inline void
hw/core/qdev-properties.c +2 -2
@@ -1238,8 +1238,8 @@ void qdev_prop_set_globals(DeviceState *dev)if (err !=NULL ) {error_prepend (&err,"can't apply global %s.%s=%s: " , prop->driver, prop->property, prop->value); -if (!dev->hotplugged && prop->errp) { -error_propagate (prop->errp, err); +if (!dev->hotplugged) { +error_propagate (&error_fatal, err); }else {warn_report_err (err); }
qom/cpu.c +0 -1
@@ -312,7 +312,6 @@ static void cpu_common_parse_features(const char *typename, char *features, prop->driver = typename; prop->property =g_strdup (featurestr); prop->value =g_strdup (val); - prop->errp = &error_fatal;qdev_prop_register_global (prop); }else { error_setg(errp, "Expected key=value format, found %s.",
target/i386/cpu.c +0 -1
@@ -3568,7 +3568,6 @@ static void x86_cpu_parse_featurestr(const char *typename, char *features, prop->driver = typename; prop->property =g_strdup (name); prop->value =g_strdup (val); - prop->errp = &error_fatal;qdev_prop_register_global (prop); }
target/sparc/cpu.c +0 -1
@@ -111,7 +111,6 @@ cpu_add_feat_as_prop(const char *typename, const char *name, const char *val) prop->driver = typename; prop->property =g_strdup (name); prop->value =g_strdup (val); - prop->errp = &error_fatal;qdev_prop_register_global (prop); }
vl.c +0 -1
@@ -2952,7 +2952,6 @@ static int global_init_func(void *opaque, QemuOpts *opts, Error **errp) g->driver =qemu_opt_get (opts,"driver" ); g->property =qemu_opt_get (opts,"property" ); g->value =qemu_opt_get (opts,"value" ); - g->errp = &error_fatal;qdev_prop_register_global (g);return 0 ; }
Signature · 1 line
2.20.1.2.gb21ebb671b
Re: [Qemu-devel] [PATCH v7 25/28] qdev-props: remove errp from GlobalProperty
Quoted 21 lines · On Fri, 21 Dec 2018 13:04:07 +0400 Marc-André Lureau…
All
qdev_prop_register_global()set&error_fatalfor errp, except '-rtc driftfix=slew', which arguably should also use&error_fatal, as otherwise failing to apply the property would only report a warning.Signed-off-by Marc-André Lureau <[email protected]>Reviewed-by Igor Mammedov <[email protected]>--- include/hw/qdev-core.h | 6 ------ hw/core/qdev-properties.c | 4 ++-- qom/cpu.c | 1 - target/i386/cpu.c | 1 - target/sparc/cpu.c | 1 - vl.c | 1 - 6 files changed, 2 insertions(+), 12 deletions(-)hw/core/qdev-properties.c +0
-0
hw/core/qdev-properties.c void qdev_prop_set_globals(DeviceState *dev) · line 1242
Quoted 7 lines
hw/core/qdev-properties.c +2
-2@@ -1238,8 +1238,8 @@ void qdev_prop_set_globals(DeviceState *dev)if (err !=NULL ) {error_prepend (&err,"can't apply global %s.%s=%s: " , prop->driver, prop->property, prop->value); -if (!dev->hotplugged && prop->errp) { -error_propagate (prop->errp, err); +if (!dev->hotplugged) { +error_propagate (&error_fatal, err);
Might want to add a comment to this function that any error is fatal for non-hotplugged devices.
hw/core/qdev-properties.c void qdev_prop_set_globals(DeviceState *dev) · line 1245
Quoted 3 lines
hw/core/qdev-properties.c +0
-0}else {warn_report_err (err); }
Re: [Qemu-devel] [PATCH v7 25/28] qdev-props: remove errp from GlobalProperty
Hi
Quoted 20 lines · Cornelia Huck
Quoted 15 lines · On Fri, 21 Dec 2018 13:04:07 +0400 Marc-André Lureau…
All
qdev_prop_register_global()set&error_fatalfor errp, except '-rtc driftfix=slew', which arguably should also use&error_fatal, as otherwise failing to apply the property would only report a warning.Signed-off-by Marc-André Lureau <[email protected]>Reviewed-by Igor Mammedov <[email protected]>--- include/hw/qdev-core.h | 6 ------ hw/core/qdev-properties.c | 4 ++-- qom/cpu.c | 1 - target/i386/cpu.c | 1 - target/sparc/cpu.c | 1 - vl.c | 1 - 6 files changed, 2 insertions(+), 12 deletions(-)
Quoted 16 lines
hw/core/qdev-properties.c void qdev_prop_set_globals(DeviceState *dev) · line 1242
Quoted 12 lines
hw/core/qdev-properties.c +2
-2@@ -1238,8 +1238,8 @@ void qdev_prop_set_globals(DeviceState *dev)if (err !=NULL ) {error_prepend (&err,"can't apply global %s.%s=%s: " , prop->driver, prop->property, prop->value); -if (!dev->hotplugged && prop->errp) { -error_propagate (prop->errp, err); +if (!dev->hotplugged) { +error_propagate (&error_fatal, err);Might want to add a comment to this function that any error is fatal for non-hotplugged devices.
What about adding the following comment to GlobalProperty?
* An error is fatal for non-hotplugged devices, when the global is applied.
Quoted 6 lines
hw/core/qdev-properties.c void qdev_prop_set_globals(DeviceState *dev) · line 1245
Quoted 3 lines
hw/core/qdev-properties.c +0
-0}else {warn_report_err (err); }Reviewed-by Cornelia Huck <[email protected]>
thanks
Signature · 1 line
Marc-André Lureau
Re: [Qemu-devel] [PATCH v7 25/28] qdev-props: remove errp from GlobalProperty
Quoted 40 lines · On Fri, 4 Jan 2019 14:57:26 +0400 Marc-André Lureau…
Hi
Quoted 20 lines · Cornelia Huck
Quoted 15 lines · On Fri, 21 Dec 2018 13:04:07 +0400 Marc-André Lureau…
All
qdev_prop_register_global()set&error_fatalfor errp, except '-rtc driftfix=slew', which arguably should also use&error_fatal, as otherwise failing to apply the property would only report a warning.Signed-off-by Marc-André Lureau <[email protected]>Reviewed-by Igor Mammedov <[email protected]>--- include/hw/qdev-core.h | 6 ------ hw/core/qdev-properties.c | 4 ++-- qom/cpu.c | 1 - target/i386/cpu.c | 1 - target/sparc/cpu.c | 1 - vl.c | 1 - 6 files changed, 2 insertions(+), 12 deletions(-)Quoted 16 lines
hw/core/qdev-properties.c void qdev_prop_set_globals(DeviceState *dev) · line 1242
Quoted 12 lines
hw/core/qdev-properties.c +2
-2@@ -1238,8 +1238,8 @@ void qdev_prop_set_globals(DeviceState *dev)if (err !=NULL ) {error_prepend (&err,"can't apply global %s.%s=%s: " , prop->driver, prop->property, prop->value); -if (!dev->hotplugged && prop->errp) { -error_propagate (prop->errp, err); +if (!dev->hotplugged) { +error_propagate (&error_fatal, err);Might want to add a comment to this function that any error is fatal for non-hotplugged devices.
Quoted 3 lines
What about adding the following comment to GlobalProperty?
* An error is fatal for non-hotplugged devices, when the global is applied.
Sounds good.
Quoted 10 lines
Quoted 7 lines
hw/core/qdev-properties.c void qdev_prop_set_globals(DeviceState *dev) · line 1245
Quoted 4 lines
hw/core/qdev-properties.c +0
-0}else {warn_report_err (err); }Reviewed-by Cornelia Huck <[email protected]>thanks
PATCH v7 26/28 qdev-props: call object_apply_global_props()
In reply to Marc-André LureauIt's now possible to use the common function.
Teach object_apply_global_props() to warn if Error argument is NULL.
--- hw/core/qdev-properties.c | 24 ++---------------------- qom/object.c | 12 +++++++++++- 2 files changed, 13 insertions(+), 23 deletions(-)
hw/core/qdev-properties.c +2 -22
@@ -1223,28 +1223,8 @@ int qdev_prop_check_globals(void)void qdev_prop_set_globals (DeviceState *dev) { -int i; - -for (i =0 ; i <global_props ()->len; i++) { -GlobalProperty *prop; -Error *err =NULL ; - - prop =g_ptr_array_index (global_props (), i); -if (object_dynamic_cast (OBJECT (dev), prop->driver) ==NULL ) { -continue ; - } - prop->used = true; -object_property_parse (OBJECT (dev), prop->value, prop->property, &err); -if (err !=NULL ) { -error_prepend (&err,"can't apply global %s.%s=%s: " , - prop->driver, prop->property, prop->value); -if (!dev->hotplugged) { -error_propagate (&error_fatal, err); - }else { -warn_report_err (err); - } - } - } +object_apply_global_props (OBJECT (dev),global_props (), + dev->hotplugged ?NULL : &error_fatal); }/* --- 64bit unsigned int 'size' type --- */
qom/object.c +11 -1
@@ -390,7 +390,17 @@ void object_apply_global_props(Object *obj, const GPtrArray *props, Error **errpif (err !=NULL ) {error_prepend (&err,"can't apply global %s.%s=%s: " , p->driver, p->property, p->value); -error_propagate (errp, err); +/* +* If errp != NULL, propagate error and return. +* If errp == NULL, report a warning, but keep going +* with the remaining globals. +*/ +if (errp) { +error_propagate (errp, err); +return ; + }else { +warn_report_err (err); + } } } }
Signature · 1 line
2.20.1.2.gb21ebb671b
Re: [Qemu-devel] [PATCH v7 26/28] qdev-props: call object_apply_global_props()
Quoted 10 lines · On Fri, 21 Dec 2018 13:04:08 +0400 Marc-André Lureau…
It's now possible to use the common function.
Teach
object_apply_global_props()to warn if Error argument is NULL.Signed-off-by Marc-André Lureau <[email protected]>Reviewed-by Igor Mammedov <[email protected]>--- hw/core/qdev-properties.c | 24 ++---------------------- qom/object.c | 12 +++++++++++- 2 files changed, 13 insertions(+), 23 deletions(-)
PATCH v7 27/28 arm: replace instance_post_init()
In reply to Marc-André LureauReplace arm_cpu_post_init() instance callback by calling it from leaf classes, to avoid potential ordering issue with other post_init callbacks.
--- target/arm/cpu-qom.h | 3 +++ target/arm/cpu.h | 2 ++ target/arm/cpu.c | 30 ++++++++++++++++++++++++------ target/arm/cpu64.c | 24 ++++++++++++++++++++---- 4 files changed, 49 insertions(+), 10 deletions(-)
target/arm/cpu-qom.h +3 -0
@@ -35,6 +35,8 @@ struct arm_boot_info;#define TYPE_ARM_MAX_CPU "max-" TYPE_ARM_CPU +typedef struct ARMCPUInfo ARMCPUInfo ; +/** * ARMCPUClass: * @parent_realize: The parent class' realize handler.
@@ -47,6 +49,7 @@ typedef struct ARMCPUClass {CPUClass parent_class;/*< public >*/ +const ARMCPUInfo *info;DeviceRealize parent_realize;void (*parent_reset)(CPUState *cpu); } ARMCPUClass;
target/arm/cpu.h +2 -0
@@ -884,6 +884,8 @@ static inline ARMCPU *arm_env_get_cpu(CPUARMState *env)return container_of (env,ARMCPU , env); } +void arm_cpu_post_init (Object *obj); +uint64_t arm_cpu_mp_affinity (int idx,uint8_t clustersz);#define ENV_GET_CPU (e) CPU(arm_env_get_cpu(e))
target/arm/cpu.c +24 -6
@@ -740,7 +740,7 @@ static Property arm_cpu_pmsav7_dregion_property =static Property arm_cpu_initsvtor_property =DEFINE_PROP_UINT32 ("init-svtor" ,ARMCPU , init_svtor,0 ); -static void arm_cpu_post_init (Object *obj) +void arm_cpu_post_init (Object *obj) {ARMCPU *cpu =ARM_CPU (obj);
@@ -1457,8 +1457,10 @@ static void cortex_m33_initfn(Object *obj)static void arm_v7m_class_init (ObjectClass *oc,void *data) { +ARMCPUClass *acc =ARM_CPU_CLASS (oc);CPUClass *cc =CPU_CLASS (oc); + acc->info = data;#ifndef CONFIG_USER_ONLY cc->do_interrupt = arm_v7m_cpu_do_interrupt;#endif
@@ -1959,11 +1961,11 @@ static void arm_max_initfn(Object *obj)#endif /* !defined(CONFIG_USER_ONLY) || !defined(TARGET_AARCH64) */ -typedef struct ARMCPUInfo { +struct ARMCPUInfo {const char *name;void (*initfn)(Object *obj);void (*class_init)(ObjectClass *oc,void *data); -}ARMCPUInfo ; +};static const ARMCPUInfo arm_cpus[] = { #if !defined(CONFIG_USER_ONLY) || !defined(TARGET_AARCH64)
@@ -2113,6 +2115,7 @@ static void arm_host_initfn(Object *obj)ARMCPU *cpu =ARM_CPU (obj);kvm_arm_set_cpu_features_from_host (cpu); +arm_cpu_post_init (ARM_CPU (obj)); }static const TypeInfo host_arm_cpu_type_info = {
@@ -2127,14 +2130,30 @@ static const TypeInfo host_arm_cpu_type_info = {#endif +static void arm_cpu_instance_init (Object *obj) +{ +ARMCPUClass *acc =ARM_CPU_GET_CLASS (obj); + + acc->info->initfn (obj); +arm_cpu_post_init (obj); +} + +static void cpu_register_class_init (ObjectClass *oc,void *data) +{ +ARMCPUClass *acc =ARM_CPU_CLASS (oc); + + acc->info = data; +} +static void cpu_register (const ARMCPUInfo *info) {TypeInfo type_info = { .parent =TYPE_ARM_CPU , .instance_size =sizeof (ARMCPU ), - .instance_init = info->initfn, + .instance_init = arm_cpu_instance_init, .class_size =sizeof (ARMCPUClass), - .class_init = info->class_init, + .class_init = info->class_init ?: cpu_register_class_init, + .class_data = (void *)info, }; type_info.name =g_strdup_printf ("%s-" TYPE_ARM_CPU , info->name);
@@ -2147,7 +2166,6 @@ static const TypeInfo arm_cpu_type_info = { .parent = TYPE_CPU, .instance_size = sizeof(ARMCPU), .instance_init = arm_cpu_initfn, - .instance_post_init = arm_cpu_post_init, .instance_finalize = arm_cpu_finalizefn, .abstract = true, .class_size = sizeof(ARMCPUClass),
target/arm/cpu64.c +20 -4
@@ -364,11 +364,11 @@ static void aarch64_max_initfn(Object *obj) } } -typedef struct ARMCPUInfo { +struct ARMCPUInfo {const char *name;void (*initfn)(Object *obj);void (*class_init)(ObjectClass *oc,void *data); -}ARMCPUInfo ; +};static const ARMCPUInfo aarch64_cpus[] = { { .name ="cortex-a57" , .initfn = aarch64_a57_initfn },
@@ -452,14 +452,30 @@ static void aarch64_cpu_class_init(ObjectClass *oc, void *data) cc->gdb_arch_name = aarch64_gdb_arch_name; } +static void aarch64_cpu_instance_init (Object *obj) +{ +ARMCPUClass *acc =ARM_CPU_GET_CLASS (obj); + + acc->info->initfn (obj); +arm_cpu_post_init (obj); +} + +static void cpu_register_class_init (ObjectClass *oc,void *data) +{ +ARMCPUClass *acc =ARM_CPU_CLASS (oc); + + acc->info = data; +} +static void aarch64_cpu_register (const ARMCPUInfo *info) {TypeInfo type_info = { .parent =TYPE_AARCH64_CPU , .instance_size =sizeof (ARMCPU ), - .instance_init = info->initfn, + .instance_init = aarch64_cpu_instance_init, .class_size =sizeof (ARMCPUClass), - .class_init = info->class_init, + .class_init = info->class_init ?: cpu_register_class_init, + .class_data = (void *)info, }; type_info.name =g_strdup_printf ("%s-" TYPE_ARM_CPU , info->name);
Signature · 1 line
2.20.1.2.gb21ebb671b
PATCH v7 28/28 hostmem: use object id for memory region name with >= 4.0
In reply to Marc-André Lureauhostmem-file and hostmem-memfd use the whole object path for the memory region name, and hostname-ram uses only the path component (the object id, or canonical path basename):
qemu -m 1024 -object memory-backend-file,id=mem,size=1G,mem-path=/tmp/foo -numa node,memdev=mem -monitor stdio (qemu) info ramblock
Block Name PSize Offset Used Total
/objects/mem 4 KiB 0x0000000000000000 0x0000000040000000 0x0000000040000000
qemu -m 1024 -object memory-backend-memfd,id=mem,size=1G -numa node,memdev=mem -monitor stdio (qemu) info ramblock
Block Name PSize Offset Used Total
/objects/mem 4 KiB 0x0000000000000000 0x0000000040000000 0x0000000040000000
qemu -m 1024 -object memory-backend-ram,id=mem,size=1G -numa node,memdev=mem -monitor stdio (qemu) info ramblock
Block Name PSize Offset Used Total
mem 4 KiB 0x0000000000000000 0x0000000040000000 0x0000000040000000
For consistency, change to use object id for -file and -memfd as well with >= 4.0.
Having a consistent naming allows to migrate to different hostmem backends.
--- include/sysemu/hostmem.h | 3 ++- backends/hostmem-file.c | 8 ++++---- backends/hostmem-memfd.c | 2 +- backends/hostmem-ram.c | 9 ++++----- backends/hostmem.c | 36 ++++++++++++++++++++++++++++++++++++ hw/core/machine.c | 12 +++++++++++- 6 files changed, 58 insertions(+), 12 deletions(-)
include/sysemu/hostmem.h +2 -1
@@ -53,7 +53,7 @@ struct HostMemoryBackend {/* protected */ uint64_t size; -bool merge, dump; +bool merge, dump, use_canonical_path;bool prealloc, force_prealloc, is_mapped, share;DECLARE_BITMAP (host_nodes,MAX_NODES +1 );HostMemPolicy policy;
@@ -67,5 +67,6 @@ MemoryRegion *host_memory_backend_get_memory(HostMemoryBackend *backend);void host_memory_backend_set_mapped (HostMemoryBackend *backend,bool mapped);bool host_memory_backend_is_mapped (HostMemoryBackend *backend);size_t host_memory_backend_pagesize (HostMemoryBackend *memdev); +char *host_memory_backend_get_name (HostMemoryBackend *backend);#endif
backends/hostmem-file.c +4 -4
@@ -43,7 +43,7 @@ file_backend_memory_alloc(HostMemoryBackend *backend, Error **errp) {HostMemoryBackendFile *fb =MEMORY_BACKEND_FILE (backend);#ifdef CONFIG_POSIX -gchar *path; +gchar *name;#endif if (!backend->size) {
@@ -58,14 +58,14 @@ file_backend_memory_alloc(HostMemoryBackend *backend, Error **errp)error_setg (errp,"-mem-path not supported on this host" );#else backend->force_prealloc = mem_prealloc; - path =object_get_canonical_path (OBJECT (backend)); + name =host_memory_backend_get_name (backend);memory_region_init_ram_from_file (&backend->mr,OBJECT (backend), - path, + name, backend->size, fb->align, (backend->share ?RAM_SHARED :0 ) | (fb->is_pmem ?RAM_PMEM :0 ), fb->mem_path, errp); -g_free (path); +g_free (name);#endif }
backends/hostmem-memfd.c +1 -1
@@ -53,7 +53,7 @@ memfd_backend_memory_alloc(HostMemoryBackend *backend, Error **errp)return ; } - name =object_get_canonical_path (OBJECT (backend)); + name =host_memory_backend_get_name (backend);memory_region_init_ram_from_fd (&backend->mr,OBJECT (backend), name, backend->size, backend->share, fd, errp);
backends/hostmem-ram.c +4 -5
@@ -16,21 +16,20 @@#define TYPE_MEMORY_BACKEND_RAM "memory-backend-ram" -static void ram_backend_memory_alloc (HostMemoryBackend *backend,Error **errp) { -char *path; +char *name;if (!backend->size) {error_setg (errp,"can't create backend with size 0" );return ; } - path =object_get_canonical_path_component (OBJECT (backend)); -memory_region_init_ram_shared_nomigrate (&backend->mr,OBJECT (backend), path, + name =host_memory_backend_get_name (backend); +memory_region_init_ram_shared_nomigrate (&backend->mr,OBJECT (backend), name, backend->size, backend->share, errp); -g_free (path); +g_free (name); } static void
backends/hostmem.c +36 -0
@@ -28,6 +28,16 @@ QEMU_BUILD_BUG_ON(HOST_MEM_POLICY_BIND != MPOL_BIND);QEMU_BUILD_BUG_ON (HOST_MEM_POLICY_INTERLEAVE !=MPOL_INTERLEAVE );#endif +char * +host_memory_backend_get_name (HostMemoryBackend *backend) +{ +if (!backend->use_canonical_path) { +return object_get_canonical_path_component (OBJECT (backend)); + } + +return object_get_canonical_path (OBJECT (backend)); +} +static void host_memory_backend_get_size (Object *obj,Visitor *v,const char *name,void *opaque,Error **errp)
@@ -247,6 +257,11 @@ static void host_memory_backend_init(Object *obj) backend->prealloc = mem_prealloc; } +static void host_memory_backend_post_init (Object *obj) +{ +object_apply_compat_props (obj); +} +bool host_memory_backend_mr_inited (HostMemoryBackend *backend) {/*
@@ -395,6 +410,23 @@ static void host_memory_backend_set_share(Object *o, bool value, Error **errp) backend->share = value; } +static bool +host_memory_backend_get_use_canonical_path (Object *obj,Error **errp) +{ +HostMemoryBackend *backend =MEMORY_BACKEND (obj); + +return backend->use_canonical_path; +} + +static void +host_memory_backend_set_use_canonical_path (Object *obj,bool value, +Error **errp) +{ +HostMemoryBackend *backend =MEMORY_BACKEND (obj); + + backend->use_canonical_path = value; +} +static void host_memory_backend_class_init (ObjectClass *oc,void *data) {
@@ -441,6 +473,9 @@ host_memory_backend_class_init(ObjectClass *oc, void *data) &error_abort);object_class_property_set_description (oc,"share" ,"Mark the memory as private to QEMU or shared" , &error_abort); +object_class_property_add_bool (oc,"x-use-canonical-path-for-ramblock-id" , + host_memory_backend_get_use_canonical_path, + host_memory_backend_set_use_canonical_path, &error_abort); }static const TypeInfo host_memory_backend_info = {
@@ -451,6 +486,7 @@ static const TypeInfo host_memory_backend_info = { .class_init = host_memory_backend_class_init, .instance_size = sizeof(HostMemoryBackend), .instance_init = host_memory_backend_init, + .instance_post_init = host_memory_backend_post_init, .interfaces = (InterfaceInfo []) { {TYPE_USER_CREATABLE }, { }
hw/core/machine.c +11 -1
@@ -23,7 +23,17 @@#include "sysemu/qtest.h" #include "hw/pci/pci.h" -GlobalProperty hw_compat_3_1[] = {}; +GlobalProperty hw_compat_3_1[] = { + { + .driver ="memory-backend-file" , + .property ="x-use-canonical-path-for-ramblock-id" , + .value ="true" , + },{ + .driver ="memory-backend-memfd" , + .property ="x-use-canonical-path-for-ramblock-id" , + .value ="true" , + }, +};const size_t hw_compat_3_1_len =G_N_ELEMENTS (hw_compat_3_1);GlobalProperty hw_compat_3_0[] = {};
Signature · 1 line
2.20.1.2.gb21ebb671b
Hi
Quoted 14 lines · Marc-André Lureau
Hi,
During "[PATCH v2 05/10] qom/globals: generalize
object_property_set_globals()" review, Eduardo suggested to rework the GlobalProperty handling, so that -global is limited to QDev only and we avoid mixing the machine compats and the user-provided -global properties (instead of generalizing -global to various object kinds, like I proposed in v2)."qdev: do not mix compat props with global props" patch decouples a bit user-provided -global from machine compat properties. This allows to get rid of "
user_provided" and "errp" fields in following patches.
Quoted 8 lines
A new compat property "x-use-canonical-path-for-ramblock-id" is added to hostmem for legacy canonical path names, set to true for -file and -memfd with qemu < 4.0.
(this series was initially titled "[PATCH v2 00/10] hostmem: use object "id" for memory region name with >= 3.1", but its focus is more in refactoring the global and compatilibity properties handling now)
Beside the rebase conflicts, and added comment in patch 25, all patches have been reviewed-by. I have pushed the rebased version on
github: https://github.com/elmarco/qemu/tree/props
Eduardo, Igor, who is making the pullreq? I could also send it, if you are okay.
Thanks
Quoted 122 lines
v7:
- rebased (s390 conflicts)
- rename self/backend in last patch
- add some r-b tagsv6:
- split "hw: apply machine compat properties without touching globals"
- replace PC_COMPAT_* and HW_COMPAT_* defines with static arrays
- add ARMCPUInfo *info in ARMCPUClass for "arm: replaceinstance_post_init()" patch
- rebased, commit message updates, add some r-b tagsv5:
- replace theSET_COMPATmacros, use normal function instead (suggested by Eduardo)
- replace theTYPE_COMPAT_PROPSinterface approach for explicitobject_apply_compat_props(), solving post-init ordering issues.
- get back to coupling compat properties with machine, in qdev (although there is still some discussion how to improve this, it can be changed later)
- mark the "arm: replaceinstance_post_init()" as RFC, since it is not longer required for this series
- change machines version from 3.2 to 4.0
- add some r-b tagsv4:
- fix accel/machine compat props apply order inversion
- split "qdev: do not mix compat props with global props": replace usingcurrent_machineby newcompat_propsglobal, introduceSET_COMPAT()macro, use GPtrArray.
- add a comment about "qdev-props: callobject_apply_global_props()" error reporting
- add "arm: replaceinstance_post_init()", to solve the post-init ordering issue
- add "hw/arm/virt: add virt-3.2 machine type" for completeness
- commit message improvements
- rebased, add r-b tagsv3:
- GlobalProperties improvements/cleanups
- drop generalizing the -global idea
- "replace" theset_globalsflag with aTYPE_COMPAT_PROPSinterface
- update hw/i386 machine version to 3.2
- add "qom: make interface types abstract" interface cleanupv2:
- replace "qom/user-creatable: add a few helper macros" patch for a more optimized "qom: makeuser_creatable_complete()specific to UserCreatable"
- renameregister_global_list()toregister_global_properties()
- callobject_property_set_globals()after post-init
- add and use a ObjectClass.set_globals flag, instead of dynamically check object class inobject_property_set_globals()
- use object "id" in >= 3.1 instead of canonical path, add compat property "x-use-canonical-path-for-ramblock-id" in base hostmem class.Marc-André Lureau (28):
hw: apply accel compat properties without touching globals
machines: replace COMPAT define with a static array
hw: apply machine compat properties without touching globals
machine: move compat properties out of globals
hw: removeSET_MACHINE_COMPAT
compat: replacePC_COMPAT_3_1&HW_COMPAT_3_1macros
compat: replacePC_COMPAT_3_0&HW_COMPAT_3_0macros
compat: replacePC_COMPAT_2_12&HW_COMPAT_2_12macros
compat: replacePC_COMPAT_2_11&HW_COMPAT_2_11macros
compat: replacePC_COMPAT_2_10&HW_COMPAT_2_10macros
compat: replacePC_COMPAT_2_9&HW_COMPAT_2_9macros
compat: replacePC_COMPAT_2_8&HW_COMPAT_2_8macros
compat: replacePC_COMPAT_2_7&HW_COMPAT_2_7macros
compat: replacePC_COMPAT_2_6&HW_COMPAT_2_6macros
compat: replacePC_COMPAT_2_5&HW_COMPAT_2_5macros
compat: replacePC_COMPAT_2_4&HW_COMPAT_2_4macros
compat: replacePC_COMPAT_2_3&HW_COMPAT_2_3macros
compat: replacePC_COMPAT_2_2&HW_COMPAT_2_2macros
compat: replacePC_COMPAT_2_1&HW_COMPAT_2_1macros
include: removecompat.h
compat: remove remainingPC_COMPATmacros
qdev: make a separate helper function to apply compat properties
qdev: all globals are now user-provided
qdev-props: convertglobal_propsto GPtrArray
qdev-props: remove errp from GlobalProperty
qdev-props: callobject_apply_global_props()
arm: replaceinstance_post_init()
hostmem: use object id for memory region name with >= 4.0include/hw/boards.h | 59 ++- include/hw/compat.h | 291 -------------- include/hw/i386/pc.h | 684 +++------------------------------ include/hw/qdev-core.h | 21 +- include/qom/object.h | 3 + include/sysemu/accel.h | 4 +- include/sysemu/hostmem.h | 3 +- target/arm/cpu-qom.h | 3 + target/arm/cpu.h | 2 + accel/accel.c | 12 - backends/hostmem-file.c | 8 +- backends/hostmem-memfd.c | 2 +- backends/hostmem-ram.c | 9 +- backends/hostmem.c | 36 ++ hw/arm/virt.c | 46 +-- hw/core/machine.c | 339 +++++++++++++++- hw/core/qdev-properties.c | 49 +-- hw/core/qdev.c | 15 + hw/i386/pc.c | 668 ++++++++++++++++++++++++++++++++ hw/i386/pc_piix.c | 603 +++++++++++++++-------------- hw/i386/pc_q35.c | 36 +- hw/ppc/spapr.c | 207 +++++----- hw/s390x/s390-virtio-ccw.c | 196 +++++----- hw/xen/xen-common.c | 41 +- qom/cpu.c | 1 - qom/object.c | 35 ++ target/arm/cpu.c | 30 +- target/arm/cpu64.c | 24 +- target/i386/cpu.c | 1 - target/sparc/cpu.c | 1 - tests/test-qdev-global-props.c | 57 +-- vl.c | 4 - 32 files changed, 1818 insertions(+), 1672 deletions(-) delete mode 100644 include/hw/compat.h
Quoted 4 lines
--
2.20.1.2.gb21ebb671b
--
Marc-André Lureau
Eduardo Habkost
Acked-byQuoted 27 lines · Marc-André Lureau
Hi
Quoted 14 lines · Marc-André Lureau
Hi,
During "[PATCH v2 05/10] qom/globals: generalize
object_property_set_globals()" review, Eduardo suggested to rework the GlobalProperty handling, so that -global is limited to QDev only and we avoid mixing the machine compats and the user-provided -global properties (instead of generalizing -global to various object kinds, like I proposed in v2)."qdev: do not mix compat props with global props" patch decouples a bit user-provided -global from machine compat properties. This allows to get rid of "
user_provided" and "errp" fields in following patches.Quoted 8 lines
A new compat property "x-use-canonical-path-for-ramblock-id" is added to hostmem for legacy canonical path names, set to true for -file and -memfd with qemu < 4.0.
(this series was initially titled "[PATCH v2 00/10] hostmem: use object "id" for memory region name with >= 3.1", but its focus is more in refactoring the global and compatilibity properties handling now)
Quoted 5 lines
Beside the rebase conflicts, and added comment in patch 25, all patches have been reviewed-by. I have pushed the rebased version on
github: https://github.com/elmarco/qemu/tree/propsEduardo, Igor, who is making the pullreq? I could also send it, if you are okay.
I was planning to merge this next week, but if you are willing to send the pull request, that's even better. Thanks!
Signature · 1 line
Eduardo