hw: apply machine compat properties without touching globals

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 <marcandre.lureau@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Acked-by: Eduardo Habkost <ehabkost@redhat.com>
This commit is contained in:
Marc-André Lureau 2018-12-01 23:44:11 +04:00
parent fa386d989d
commit b66bbee39f
9 changed files with 148 additions and 93 deletions

View file

@ -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;

View file

@ -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();
}
}
@ -836,24 +837,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,

View file

@ -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));

View file

@ -447,7 +447,8 @@ static void pc_i440fx_3_1_machine_options(MachineClass *m)
pc_i440fx_4_0_machine_options(m);
m->is_default = 0;
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_I440FX_MACHINE(v3_1, "pc-i440fx-3.1", NULL,
@ -460,7 +461,8 @@ static GlobalProperty pc_compat_3_0[] = {
static void pc_i440fx_3_0_machine_options(MachineClass *m)
{
pc_i440fx_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_I440FX_MACHINE(v3_0, "pc-i440fx-3.0", NULL,
@ -473,7 +475,8 @@ static GlobalProperty pc_compat_2_12[] = {
static void pc_i440fx_2_12_machine_options(MachineClass *m)
{
pc_i440fx_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_I440FX_MACHINE(v2_12, "pc-i440fx-2.12", NULL,
@ -486,7 +489,8 @@ static GlobalProperty pc_compat_2_11[] = {
static void pc_i440fx_2_11_machine_options(MachineClass *m)
{
pc_i440fx_2_12_machine_options(m);
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_I440FX_MACHINE(v2_11, "pc-i440fx-2.11", NULL,
@ -499,7 +503,8 @@ static GlobalProperty pc_compat_2_10[] = {
static void pc_i440fx_2_10_machine_options(MachineClass *m)
{
pc_i440fx_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->auto_enable_numa_with_memhp = false;
}
@ -513,7 +518,8 @@ static GlobalProperty pc_compat_2_9[] = {
static void pc_i440fx_2_9_machine_options(MachineClass *m)
{
pc_i440fx_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));
m->numa_auto_assign_ram = numa_legacy_auto_assign_ram;
}
@ -527,7 +533,8 @@ static GlobalProperty pc_compat_2_8[] = {
static void pc_i440fx_2_8_machine_options(MachineClass *m)
{
pc_i440fx_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_I440FX_MACHINE(v2_8, "pc-i440fx-2.8", NULL,
@ -540,7 +547,8 @@ static GlobalProperty pc_compat_2_7[] = {
static void pc_i440fx_2_7_machine_options(MachineClass *m)
{
pc_i440fx_2_8_machine_options(m);
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_I440FX_MACHINE(v2_7, "pc-i440fx-2.7", NULL,
@ -556,7 +564,8 @@ static void pc_i440fx_2_6_machine_options(MachineClass *m)
pc_i440fx_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_I440FX_MACHINE(v2_6, "pc-i440fx-2.6", NULL,
@ -572,7 +581,8 @@ static void pc_i440fx_2_5_machine_options(MachineClass *m)
pc_i440fx_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_I440FX_MACHINE(v2_5, "pc-i440fx-2.5", NULL,
@ -588,7 +598,8 @@ static void pc_i440fx_2_4_machine_options(MachineClass *m)
pc_i440fx_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_I440FX_MACHINE(v2_4, "pc-i440fx-2.4", NULL,
@ -602,7 +613,8 @@ static void pc_i440fx_2_3_machine_options(MachineClass *m)
{
pc_i440fx_2_4_machine_options(m);
m->hw_version = "2.3.0";
SET_MACHINE_COMPAT(m, pc_compatp_2_3);
compat_props_add(m->compat_props,
pc_compatp_2_3, G_N_ELEMENTS(pc_compatp_2_3));
}
DEFINE_I440FX_MACHINE(v2_3, "pc-i440fx-2.3", pc_compat_2_3,
@ -618,7 +630,8 @@ static void pc_i440fx_2_2_machine_options(MachineClass *m)
pc_i440fx_2_3_machine_options(m);
m->hw_version = "2.2.0";
m->default_machine_opts = "firmware=bios-256k.bin,suppress-vmdesc=on";
SET_MACHINE_COMPAT(m, pc_compatp_2_2);
compat_props_add(m->compat_props,
pc_compatp_2_2, G_N_ELEMENTS(pc_compatp_2_2));
pcmc->rsdp_in_ram = false;
}
@ -635,7 +648,8 @@ static void pc_i440fx_2_1_machine_options(MachineClass *m)
pc_i440fx_2_2_machine_options(m);
m->hw_version = "2.1.0";
m->default_display = NULL;
SET_MACHINE_COMPAT(m, pc_compatp_2_1);
compat_props_add(m->compat_props,
pc_compatp_2_1, G_N_ELEMENTS(pc_compatp_2_1));
pcmc->smbios_uuid_encoded = false;
pcmc->enforce_aligned_dimm = false;
}
@ -652,7 +666,8 @@ static void pc_i440fx_2_0_machine_options(MachineClass *m)
PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
pc_i440fx_2_1_machine_options(m);
m->hw_version = "2.0.0";
SET_MACHINE_COMPAT(m, pc_compatp_2_0);
compat_props_add(m->compat_props,
pc_compatp_2_0, G_N_ELEMENTS(pc_compatp_2_0));
pcmc->smbios_legacy_mode = true;
pcmc->has_reserved_memory = false;
/* This value depends on the actual DSDT and SSDT compiled into
@ -689,7 +704,8 @@ static void pc_i440fx_1_7_machine_options(MachineClass *m)
m->hw_version = "1.7.0";
m->default_machine_opts = NULL;
m->option_rom_has_mr = true;
SET_MACHINE_COMPAT(m, pc_compatp_1_7);
compat_props_add(m->compat_props,
pc_compatp_1_7, G_N_ELEMENTS(pc_compatp_1_7));
pcmc->smbios_defaults = false;
pcmc->gigabyte_align = false;
pcmc->legacy_acpi_table_size = 6414;
@ -708,7 +724,8 @@ static void pc_i440fx_1_6_machine_options(MachineClass *m)
pc_i440fx_1_7_machine_options(m);
m->hw_version = "1.6.0";
m->rom_file_has_mr = false;
SET_MACHINE_COMPAT(m, pc_compatp_1_6);
compat_props_add(m->compat_props,
pc_compatp_1_6, G_N_ELEMENTS(pc_compatp_1_6));
pcmc->has_acpi_build = false;
}
@ -723,7 +740,8 @@ static void pc_i440fx_1_5_machine_options(MachineClass *m)
{
pc_i440fx_1_6_machine_options(m);
m->hw_version = "1.5.0";
SET_MACHINE_COMPAT(m, pc_compatp_1_5);
compat_props_add(m->compat_props,
pc_compatp_1_5, G_N_ELEMENTS(pc_compatp_1_5));
}
DEFINE_I440FX_MACHINE(v1_5, "pc-i440fx-1.5", pc_compat_1_5,
@ -738,7 +756,8 @@ static void pc_i440fx_1_4_machine_options(MachineClass *m)
pc_i440fx_1_5_machine_options(m);
m->hw_version = "1.4.0";
m->hot_add_cpu = NULL;
SET_MACHINE_COMPAT(m, pc_compatp_1_4);
compat_props_add(m->compat_props,
pc_compatp_1_4, G_N_ELEMENTS(pc_compatp_1_4));
}
DEFINE_I440FX_MACHINE(v1_4, "pc-i440fx-1.4", pc_compat_1_4,
@ -769,7 +788,8 @@ static void pc_i440fx_1_3_machine_options(MachineClass *m)
{
pc_i440fx_1_4_machine_options(m);
m->hw_version = "1.3.0";
SET_MACHINE_COMPAT(m, pc_compatp_1_3);
compat_props_add(m->compat_props,
pc_compatp_1_3, G_N_ELEMENTS(pc_compatp_1_3));
}
DEFINE_I440FX_MACHINE(v1_3, "pc-1.3", pc_compat_1_3,
@ -809,7 +829,8 @@ static void pc_i440fx_1_2_machine_options(MachineClass *m)
{
pc_i440fx_1_3_machine_options(m);
m->hw_version = "1.2.0";
SET_MACHINE_COMPAT(m, pc_compatp_1_2);
compat_props_add(m->compat_props,
pc_compatp_1_2, G_N_ELEMENTS(pc_compatp_1_2));
}
DEFINE_I440FX_MACHINE(v1_2, "pc-1.2", pc_compat_1_2,
@ -853,7 +874,8 @@ static void pc_i440fx_1_1_machine_options(MachineClass *m)
{
pc_i440fx_1_2_machine_options(m);
m->hw_version = "1.1.0";
SET_MACHINE_COMPAT(m, pc_compatp_1_1);
compat_props_add(m->compat_props,
pc_compatp_1_1, G_N_ELEMENTS(pc_compatp_1_1));
}
DEFINE_I440FX_MACHINE(v1_1, "pc-1.1", pc_compat_1_2,
@ -884,7 +906,8 @@ static void pc_i440fx_1_0_machine_options(MachineClass *m)
{
pc_i440fx_1_1_machine_options(m);
m->hw_version = "1.0";
SET_MACHINE_COMPAT(m, pc_compatp_1_0);
compat_props_add(m->compat_props,
pc_compatp_1_0, G_N_ELEMENTS(pc_compatp_1_0));
}
DEFINE_I440FX_MACHINE(v1_0, "pc-1.0", pc_compat_1_2,
@ -900,7 +923,8 @@ static void pc_i440fx_0_15_machine_options(MachineClass *m)
pc_i440fx_1_0_machine_options(m);
m->hw_version = "0.15";
m->deprecation_reason = "use a newer machine type instead";
SET_MACHINE_COMPAT(m, pc_compatp_0_15);
compat_props_add(m->compat_props,
pc_compatp_0_15, G_N_ELEMENTS(pc_compatp_0_15));
}
DEFINE_I440FX_MACHINE(v0_15, "pc-0.15", pc_compat_1_2,
@ -940,7 +964,8 @@ static void pc_i440fx_0_14_machine_options(MachineClass *m)
{
pc_i440fx_0_15_machine_options(m);
m->hw_version = "0.14";
SET_MACHINE_COMPAT(m, pc_compatp_0_14);
compat_props_add(m->compat_props,
pc_compatp_0_14, G_N_ELEMENTS(pc_compatp_0_14));
}
DEFINE_I440FX_MACHINE(v0_14, "pc-0.14", pc_compat_1_2,
@ -976,7 +1001,8 @@ static void pc_i440fx_0_13_machine_options(MachineClass *m)
PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
pc_i440fx_0_14_machine_options(m);
m->hw_version = "0.13";
SET_MACHINE_COMPAT(m, pc_compatp_0_13);
compat_props_add(m->compat_props,
pc_compatp_0_13, G_N_ELEMENTS(pc_compatp_0_13));
pcmc->kvmclock_enabled = false;
}
@ -1012,7 +1038,8 @@ static void pc_i440fx_0_12_machine_options(MachineClass *m)
{
pc_i440fx_0_13_machine_options(m);
m->hw_version = "0.12";
SET_MACHINE_COMPAT(m, pc_compat_0_12);
compat_props_add(m->compat_props,
pc_compat_0_12, G_N_ELEMENTS(pc_compat_0_12));
}
DEFINE_I440FX_MACHINE(v0_12, "pc-0.12", pc_compat_0_13,

View file

@ -330,7 +330,8 @@ static void pc_q35_3_1_machine_options(MachineClass *m)
pc_q35_4_0_machine_options(m);
m->default_kernel_irqchip_split = false;
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,
@ -343,7 +344,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,
@ -356,7 +358,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,
@ -372,7 +375,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,
@ -385,7 +389,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;
}
@ -400,7 +405,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,
@ -413,7 +419,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,
@ -427,7 +434,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,
@ -443,7 +451,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,
@ -459,7 +468,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,
@ -475,7 +485,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,

View file

@ -4028,7 +4028,8 @@ static GlobalProperty spapr_compat_3_1[] = {
static void spapr_machine_3_1_class_options(MachineClass *mc)
{
spapr_machine_4_0_class_options(mc);
SET_MACHINE_COMPAT(mc, spapr_compat_3_1);
compat_props_add(mc->compat_props,
spapr_compat_3_1, G_N_ELEMENTS(spapr_compat_3_1));
mc->default_cpu_type = POWERPC_CPU_TYPE_NAME("power8_v2.0");
}
@ -4046,7 +4047,8 @@ static void spapr_machine_3_0_class_options(MachineClass *mc)
sPAPRMachineClass *smc = SPAPR_MACHINE_CLASS(mc);
spapr_machine_3_1_class_options(mc);
SET_MACHINE_COMPAT(mc, spapr_compat_3_0);
compat_props_add(mc->compat_props,
spapr_compat_3_0, G_N_ELEMENTS(spapr_compat_3_0));
smc->legacy_irq_allocation = true;
smc->irq = &spapr_irq_xics_legacy;
@ -4076,7 +4078,8 @@ static void spapr_machine_2_12_class_options(MachineClass *mc)
sPAPRMachineClass *smc = SPAPR_MACHINE_CLASS(mc);
spapr_machine_3_0_class_options(mc);
SET_MACHINE_COMPAT(mc, spapr_compat_2_12);
compat_props_add(mc->compat_props,
spapr_compat_2_12, G_N_ELEMENTS(spapr_compat_2_12));
/* We depend on kvm_enabled() to choose a default value for the
* hpt-max-page-size capability. Of course we can't do it here
@ -4113,7 +4116,8 @@ static void spapr_machine_2_11_class_options(MachineClass *mc)
spapr_machine_2_12_class_options(mc);
smc->default_caps.caps[SPAPR_CAP_HTM] = SPAPR_CAP_ON;
SET_MACHINE_COMPAT(mc, spapr_compat_2_11);
compat_props_add(mc->compat_props,
spapr_compat_2_11, G_N_ELEMENTS(spapr_compat_2_11));
}
DEFINE_SPAPR_MACHINE(2_11, "2.11", false);
@ -4128,7 +4132,8 @@ static GlobalProperty spapr_compat_2_10[] = {
static void spapr_machine_2_10_class_options(MachineClass *mc)
{
spapr_machine_2_11_class_options(mc);
SET_MACHINE_COMPAT(mc, spapr_compat_2_10);
compat_props_add(mc->compat_props,
spapr_compat_2_10, G_N_ELEMENTS(spapr_compat_2_10));
}
DEFINE_SPAPR_MACHINE(2_10, "2.10", false);
@ -4150,7 +4155,8 @@ static void spapr_machine_2_9_class_options(MachineClass *mc)
sPAPRMachineClass *smc = SPAPR_MACHINE_CLASS(mc);
spapr_machine_2_10_class_options(mc);
SET_MACHINE_COMPAT(mc, spapr_compat_2_9);
compat_props_add(mc->compat_props,
spapr_compat_2_9, G_N_ELEMENTS(spapr_compat_2_9));
mc->numa_auto_assign_ram = numa_legacy_auto_assign_ram;
smc->pre_2_10_has_unused_icps = true;
smc->resize_hpt_default = SPAPR_RESIZE_HPT_DISABLED;
@ -4173,7 +4179,8 @@ static GlobalProperty spapr_compat_2_8[] = {
static void spapr_machine_2_8_class_options(MachineClass *mc)
{
spapr_machine_2_9_class_options(mc);
SET_MACHINE_COMPAT(mc, spapr_compat_2_8);
compat_props_add(mc->compat_props,
spapr_compat_2_8, G_N_ELEMENTS(spapr_compat_2_8));
mc->numa_mem_align_shift = 23;
}
@ -4262,7 +4269,8 @@ 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";
SET_MACHINE_COMPAT(mc, spapr_compat_2_7);
compat_props_add(mc->compat_props,
spapr_compat_2_7, G_N_ELEMENTS(spapr_compat_2_7));
smc->phb_placement = phb_placement_2_7;
}
@ -4284,7 +4292,8 @@ static void spapr_machine_2_6_class_options(MachineClass *mc)
{
spapr_machine_2_7_class_options(mc);
mc->has_hotpluggable_cpus = false;
SET_MACHINE_COMPAT(mc, spapr_compat_2_6);
compat_props_add(mc->compat_props,
spapr_compat_2_6, G_N_ELEMENTS(spapr_compat_2_6));
}
DEFINE_SPAPR_MACHINE(2_6, "2.6", false);
@ -4307,7 +4316,8 @@ static void spapr_machine_2_5_class_options(MachineClass *mc)
spapr_machine_2_6_class_options(mc);
smc->use_ohci_by_default = true;
SET_MACHINE_COMPAT(mc, spapr_compat_2_5);
compat_props_add(mc->compat_props,
spapr_compat_2_5, G_N_ELEMENTS(spapr_compat_2_5));
}
DEFINE_SPAPR_MACHINE(2_5, "2.5", false);
@ -4325,7 +4335,8 @@ static void spapr_machine_2_4_class_options(MachineClass *mc)
spapr_machine_2_5_class_options(mc);
smc->dr_lmb_enabled = false;
SET_MACHINE_COMPAT(mc, spapr_compat_2_4);
compat_props_add(mc->compat_props,
spapr_compat_2_4, G_N_ELEMENTS(spapr_compat_2_4));
}
DEFINE_SPAPR_MACHINE(2_4, "2.4", false);
@ -4345,7 +4356,8 @@ static GlobalProperty spapr_compat_2_3[] = {
static void spapr_machine_2_3_class_options(MachineClass *mc)
{
spapr_machine_2_4_class_options(mc);
SET_MACHINE_COMPAT(mc, spapr_compat_2_3);
compat_props_add(mc->compat_props,
spapr_compat_2_3, G_N_ELEMENTS(spapr_compat_2_3));
}
DEFINE_SPAPR_MACHINE(2_3, "2.3", false);
@ -4364,7 +4376,8 @@ static GlobalProperty spapr_compat_2_2[] = {
static void spapr_machine_2_2_class_options(MachineClass *mc)
{
spapr_machine_2_3_class_options(mc);
SET_MACHINE_COMPAT(mc, spapr_compat_2_2);
compat_props_add(mc->compat_props,
spapr_compat_2_2, G_N_ELEMENTS(spapr_compat_2_2));
mc->default_machine_opts = "modern-hotplug-events=off,suppress-vmdesc=on";
}
DEFINE_SPAPR_MACHINE(2_2, "2.2", false);
@ -4379,7 +4392,8 @@ static GlobalProperty spapr_compat_2_1[] = {
static void spapr_machine_2_1_class_options(MachineClass *mc)
{
spapr_machine_2_2_class_options(mc);
SET_MACHINE_COMPAT(mc, spapr_compat_2_1);
compat_props_add(mc->compat_props,
spapr_compat_2_1, G_N_ELEMENTS(spapr_compat_2_1));
}
DEFINE_SPAPR_MACHINE(2_1, "2.1", false);

View file

@ -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);

View file

@ -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;

1
vl.c
View file

@ -2996,7 +2996,6 @@ static void user_register_global_props(void)
*/
static void register_global_properties(MachineState *ms)
{
machine_register_compat_props(ms);
user_register_global_props();
}