diff options
Diffstat (limited to 'hw')
-rw-r--r-- | hw/arm/virt.c | 46 | ||||
-rw-r--r-- | hw/core/machine.c | 347 | ||||
-rw-r--r-- | hw/core/qdev-properties.c | 49 | ||||
-rw-r--r-- | hw/core/qdev.c | 15 | ||||
-rw-r--r-- | hw/i386/pc.c | 674 | ||||
-rw-r--r-- | hw/i386/pc_piix.c | 508 | ||||
-rw-r--r-- | hw/i386/pc_q35.c | 36 | ||||
-rw-r--r-- | hw/ppc/spapr.c | 207 | ||||
-rw-r--r-- | hw/s390x/s390-virtio-ccw.c | 196 | ||||
-rw-r--r-- | hw/xen/xen-common.c | 41 |
10 files changed, 1542 insertions, 577 deletions
diff --git a/hw/arm/virt.c b/hw/arm/virt.c index c2641e56ea..99c2b6e60d 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -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" @@ -1872,84 +1871,63 @@ static void virt_machine_4_0_options(MachineClass *mc) } DEFINE_VIRT_MACHINE_AS_LATEST(4, 0) -#define VIRT_COMPAT_3_1 \ - HW_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, hw_compat_3_1, hw_compat_3_1_len); } DEFINE_VIRT_MACHINE(3, 1) -#define VIRT_COMPAT_3_0 \ - HW_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, hw_compat_3_0, hw_compat_3_0_len); } DEFINE_VIRT_MACHINE(3, 0) -#define 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)); virt_machine_3_0_options(mc); - SET_MACHINE_COMPAT(mc, VIRT_COMPAT_2_12); + compat_props_add(mc->compat_props, hw_compat_2_12, hw_compat_2_12_len); vmc->no_highmem_ecam = true; mc->max_cpus = 255; } DEFINE_VIRT_MACHINE(2, 12) -#define 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)); virt_machine_2_12_options(mc); - SET_MACHINE_COMPAT(mc, VIRT_COMPAT_2_11); + 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) -#define VIRT_COMPAT_2_10 \ - HW_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, 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; } DEFINE_VIRT_MACHINE(2, 10) -#define VIRT_COMPAT_2_9 \ - HW_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, hw_compat_2_9, hw_compat_2_9_len); } DEFINE_VIRT_MACHINE(2, 9) -#define 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)); virt_machine_2_9_options(mc); - SET_MACHINE_COMPAT(mc, VIRT_COMPAT_2_8); + 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. */ @@ -1957,15 +1935,12 @@ static void virt_machine_2_8_options(MachineClass *mc) } DEFINE_VIRT_MACHINE(2, 8) -#define 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)); virt_machine_2_8_options(mc); - SET_MACHINE_COMPAT(mc, VIRT_COMPAT_2_7); + 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 */ @@ -1973,15 +1948,12 @@ static void virt_machine_2_7_options(MachineClass *mc) } DEFINE_VIRT_MACHINE(2, 7) -#define 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)); virt_machine_2_7_options(mc); - SET_MACHINE_COMPAT(mc, VIRT_COMPAT_2_6); + 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; diff --git a/hw/core/machine.c b/hw/core/machine.c index 4439ea663f..f8563efb86 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -21,6 +21,334 @@ #include "sysemu/numa.h" #include "qemu/error-report.h" #include "sysemu/qtest.h" +#include "hw/pci/pci.h" + +GlobalProperty hw_compat_3_1[] = { + { + .driver = "pcie-root-port", + .property = "x-speed", + .value = "2_5", + },{ + .driver = "pcie-root-port", + .property = "x-width", + .value = "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[] = {}; +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); + +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); + +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); + +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); + +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); + +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); + +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); + +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); + +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); + +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); + +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) { @@ -647,6 +975,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 +1165,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, diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index 943dc2654b..5da1439a8b 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -1173,28 +1173,35 @@ 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; } - if (!prop->user_provided) { - continue; - } oc = object_class_by_name(prop->driver); oc = object_class_dynamic_cast(oc, TYPE_DEVICE); if (!oc) { @@ -1216,28 +1223,8 @@ int qdev_prop_check_globals(void) void qdev_prop_set_globals(DeviceState *dev) { - GList *l; - - for (l = global_props; l; l = l->next) { - GlobalProperty *prop = l->data; - Error *err = NULL; - - 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 && prop->errp) { - error_propagate(prop->errp, err); - } else { - assert(prop->user_provided); - warn_report_err(err); - } - } - } + object_apply_global_props(OBJECT(dev), global_props(), + dev->hotplugged ? NULL : &error_fatal); } /* --- 64bit unsigned int 'size' type --- */ diff --git a/hw/core/qdev.c b/hw/core/qdev.c index 6b3cc55b27..3769a2bccb 100644 --- a/hw/core/qdev.c +++ b/hw/core/qdev.c @@ -970,8 +970,23 @@ static void device_initfn(Object *obj) QLIST_INIT(&dev->gpios); } +void object_apply_compat_props(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); + } +} + static void device_post_init(Object *obj) { + object_apply_compat_props(obj); qdev_prop_set_globals(DEVICE(obj)); } diff --git a/hw/i386/pc.c b/hw/i386/pc.c index f248662e97..4952feb476 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -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" @@ -109,6 +110,679 @@ static struct e820_entry *e820_table; static unsigned e820_entries; struct hpet_fw_config hpet_cfg = {.count = UINT8_MAX}; +GlobalProperty pc_compat_3_1[] = { + { + .driver = "intel-iommu", + .property = "dma-drain", + .value = "off", + }, +}; +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); + +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); + +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); + +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); + +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); + +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); + +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); + +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); + +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); + +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); + +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); + +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); + +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; diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index 7f1cb527b5..ed6984638e 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -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()) { @@ -318,46 +318,46 @@ static void pc_compat_2_3(MachineState *machine) } } -static void pc_compat_2_2(MachineState *machine) +static void pc_compat_2_2_fn(MachineState *machine) { - pc_compat_2_3(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(machine); + pc_compat_2_2_fn(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(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(); } @@ -443,7 +443,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, 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, @@ -452,7 +453,8 @@ DEFINE_I440FX_MACHINE(v3_1, "pc-i440fx-3.1", NULL, 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, 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, @@ -461,7 +463,8 @@ DEFINE_I440FX_MACHINE(v3_0, "pc-i440fx-3.0", NULL, 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, 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, @@ -470,7 +473,8 @@ DEFINE_I440FX_MACHINE(v2_12, "pc-i440fx-2.12", NULL, 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, 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, @@ -479,7 +483,8 @@ DEFINE_I440FX_MACHINE(v2_11, "pc-i440fx-2.11", NULL, 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, 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; } @@ -489,7 +494,8 @@ DEFINE_I440FX_MACHINE(v2_10, "pc-i440fx-2.10", NULL, 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, 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; } @@ -499,109 +505,114 @@ DEFINE_I440FX_MACHINE(v2_9, "pc-i440fx-2.9", NULL, 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, 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, pc_i440fx_2_8_machine_options); - 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, 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, pc_i440fx_2_7_machine_options); - static void pc_i440fx_2_6_machine_options(MachineClass *m) { PCMachineClass *pcmc = PC_MACHINE_CLASS(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, 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, pc_i440fx_2_6_machine_options); - static void pc_i440fx_2_5_machine_options(MachineClass *m) { PCMachineClass *pcmc = PC_MACHINE_CLASS(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, 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, pc_i440fx_2_5_machine_options); - static void pc_i440fx_2_4_machine_options(MachineClass *m) { PCMachineClass *pcmc = PC_MACHINE_CLASS(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, 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, pc_i440fx_2_4_machine_options) - 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_COMPAT_2_3); + 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) { PCMachineClass *pcmc = PC_MACHINE_CLASS(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_COMPAT_2_2); + 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) { PCMachineClass *pcmc = PC_MACHINE_CLASS(m); + pc_i440fx_2_2_machine_options(m); m->hw_version = "2.1.0"; m->default_display = NULL; - SET_MACHINE_COMPAT(m, PC_COMPAT_2_1); + 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) { PCMachineClass *pcmc = PC_MACHINE_CLASS(m); + pc_i440fx_2_1_machine_options(m); m->hw_version = "2.0.0"; - SET_MACHINE_COMPAT(m, PC_COMPAT_2_0); + 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 @@ -624,329 +635,330 @@ 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); + pc_i440fx_2_0_machine_options(m); m->hw_version = "1.7.0"; m->default_machine_opts = NULL; m->option_rom_has_mr = true; - SET_MACHINE_COMPAT(m, PC_COMPAT_1_7); + 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); + pc_i440fx_1_7_machine_options(m); m->hw_version = "1.6.0"; m->rom_file_has_mr = false; - SET_MACHINE_COMPAT(m, PC_COMPAT_1_6); + 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) { pc_i440fx_1_6_machine_options(m); m->hw_version = "1.5.0"; - SET_MACHINE_COMPAT(m, PC_COMPAT_1_5); + 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) { pc_i440fx_1_5_machine_options(m); m->hw_version = "1.4.0"; m->hot_add_cpu = NULL; - SET_MACHINE_COMPAT(m, PC_COMPAT_1_4); + 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); - -#define PC_COMPAT_1_3 \ - PC_CPU_MODEL_IDS("1.3.0") \ - {\ - .driver = "usb-tablet",\ - .property = "usb_version",\ - .value = stringify(1),\ - },{\ - .driver = "virtio-net-pci",\ - .property = "ctrl_mac_addr",\ - .value = "off", \ - },{ \ - .driver = "virtio-net-pci", \ - .property = "mq", \ - .value = "off", \ - }, {\ - .driver = "e1000",\ - .property = "autonegotiation",\ - .value = "off",\ - }, - - static void pc_i440fx_1_3_machine_options(MachineClass *m) { + static GlobalProperty compat[] = { + PC_CPU_MODEL_IDS("1.3.0") + { + .driver = "usb-tablet", + .property = "usb_version", + .value = stringify(1), + },{ + .driver = "virtio-net-pci", + .property = "ctrl_mac_addr", + .value = "off", + },{ + .driver = "virtio-net-pci", + .property = "mq", + .value = "off", + }, { + .driver = "e1000", + .property = "autonegotiation", + .value = "off", + }, + }; + pc_i440fx_1_4_machine_options(m); m->hw_version = "1.3.0"; - SET_MACHINE_COMPAT(m, PC_COMPAT_1_3); + compat_props_add(m->compat_props, compat, G_N_ELEMENTS(compat)); } DEFINE_I440FX_MACHINE(v1_3, "pc-1.3", pc_compat_1_3, pc_i440fx_1_3_machine_options); -#define PC_COMPAT_1_2 \ - PC_CPU_MODEL_IDS("1.2.0") \ - {\ - .driver = "nec-usb-xhci",\ - .property = "msi",\ - .value = "off",\ - },{\ - .driver = "nec-usb-xhci",\ - .property = "msix",\ - .value = "off",\ - },{\ - .driver = "ivshmem",\ - .property = "use64",\ - .value = "0",\ - },{\ - .driver = "qxl",\ - .property = "revision",\ - .value = stringify(3),\ - },{\ - .driver = "qxl-vga",\ - .property = "revision",\ - .value = stringify(3),\ - },{\ - .driver = "VGA",\ - .property = "mmio",\ - .value = "off",\ - }, - static void pc_i440fx_1_2_machine_options(MachineClass *m) { + static GlobalProperty compat[] = { + PC_CPU_MODEL_IDS("1.2.0") + { + .driver = "nec-usb-xhci", + .property = "msi", + .value = "off", + },{ + .driver = "nec-usb-xhci", + .property = "msix", + .value = "off", + },{ + .driver = "ivshmem", + .property = "use64", + .value = "0", + },{ + .driver = "qxl", + .property = "revision", + .value = stringify(3), + },{ + .driver = "qxl-vga", + .property = "revision", + .value = stringify(3), + },{ + .driver = "VGA", + .property = "mmio", + .value = "off", + }, + }; + pc_i440fx_1_3_machine_options(m); m->hw_version = "1.2.0"; - SET_MACHINE_COMPAT(m, PC_COMPAT_1_2); + compat_props_add(m->compat_props, compat, G_N_ELEMENTS(compat)); } DEFINE_I440FX_MACHINE(v1_2, "pc-1.2", pc_compat_1_2, pc_i440fx_1_2_machine_options); -#define PC_COMPAT_1_1 \ - PC_CPU_MODEL_IDS("1.1.0") \ - {\ - .driver = "virtio-scsi-pci",\ - .property = "hotplug",\ - .value = "off",\ - },{\ - .driver = "virtio-scsi-pci",\ - .property = "param_change",\ - .value = "off",\ - },{\ - .driver = "VGA",\ - .property = "vgamem_mb",\ - .value = stringify(8),\ - },{\ - .driver = "vmware-svga",\ - .property = "vgamem_mb",\ - .value = stringify(8),\ - },{\ - .driver = "qxl-vga",\ - .property = "vgamem_mb",\ - .value = stringify(8),\ - },{\ - .driver = "qxl",\ - .property = "vgamem_mb",\ - .value = stringify(8),\ - },{\ - .driver = "virtio-blk-pci",\ - .property = "config-wce",\ - .value = "off",\ - }, - static void pc_i440fx_1_1_machine_options(MachineClass *m) { + static GlobalProperty compat[] = { + PC_CPU_MODEL_IDS("1.1.0") + { + .driver = "virtio-scsi-pci", + .property = "hotplug", + .value = "off", + },{ + .driver = "virtio-scsi-pci", + .property = "param_change", + .value = "off", + },{ + .driver = "VGA", + .property = "vgamem_mb", + .value = stringify(8), + },{ + .driver = "vmware-svga", + .property = "vgamem_mb", + .value = stringify(8), + },{ + .driver = "qxl-vga", + .property = "vgamem_mb", + .value = stringify(8), + },{ + .driver = "qxl", + .property = "vgamem_mb", + .value = stringify(8), + },{ + .driver = "virtio-blk-pci", + .property = "config-wce", + .value = "off", + }, + }; + pc_i440fx_1_2_machine_options(m); m->hw_version = "1.1.0"; - SET_MACHINE_COMPAT(m, PC_COMPAT_1_1); + compat_props_add(m->compat_props, compat, G_N_ELEMENTS(compat)); } DEFINE_I440FX_MACHINE(v1_1, "pc-1.1", pc_compat_1_2, pc_i440fx_1_1_machine_options); - -#define PC_COMPAT_1_0 \ - PC_CPU_MODEL_IDS("1.0") \ - {\ - .driver = TYPE_ISA_FDC,\ - .property = "check_media_rate",\ - .value = "off",\ - }, {\ - .driver = "virtio-balloon-pci",\ - .property = "class",\ - .value = stringify(PCI_CLASS_MEMORY_RAM),\ - },{\ - .driver = "apic-common",\ - .property = "vapic",\ - .value = "off",\ - },{\ - .driver = TYPE_USB_DEVICE,\ - .property = "full-path",\ - .value = "no",\ - }, - static void pc_i440fx_1_0_machine_options(MachineClass *m) { + static GlobalProperty compat[] = { + PC_CPU_MODEL_IDS("1.0") + { + .driver = TYPE_ISA_FDC, + .property = "check_media_rate", + .value = "off", + },{ + .driver = "virtio-balloon-pci", + .property = "class", + .value = stringify(PCI_CLASS_MEMORY_RAM), + },{ + .driver = "apic-common", + .property = "vapic", + .value = "off", + },{ + .driver = TYPE_USB_DEVICE, + .property = "full-path", + .value = "no", + }, + }; + pc_i440fx_1_1_machine_options(m); m->hw_version = "1.0"; - SET_MACHINE_COMPAT(m, PC_COMPAT_1_0); + compat_props_add(m->compat_props, compat, G_N_ELEMENTS(compat)); } DEFINE_I440FX_MACHINE(v1_0, "pc-1.0", pc_compat_1_2, pc_i440fx_1_0_machine_options); -#define PC_COMPAT_0_15 \ - PC_CPU_MODEL_IDS("0.15") - static void pc_i440fx_0_15_machine_options(MachineClass *m) { + static GlobalProperty compat[] = { + PC_CPU_MODEL_IDS("0.15") + }; + 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_COMPAT_0_15); + compat_props_add(m->compat_props, compat, G_N_ELEMENTS(compat)); } DEFINE_I440FX_MACHINE(v0_15, "pc-0.15", pc_compat_1_2, pc_i440fx_0_15_machine_options); -#define PC_COMPAT_0_14 \ - PC_CPU_MODEL_IDS("0.14") \ - {\ - .driver = "virtio-blk-pci",\ - .property = "event_idx",\ - .value = "off",\ - },{\ - .driver = "virtio-serial-pci",\ - .property = "event_idx",\ - .value = "off",\ - },{\ - .driver = "virtio-net-pci",\ - .property = "event_idx",\ - .value = "off",\ - },{\ - .driver = "virtio-balloon-pci",\ - .property = "event_idx",\ - .value = "off",\ - },{\ - .driver = "qxl",\ - .property = "revision",\ - .value = stringify(2),\ - },{\ - .driver = "qxl-vga",\ - .property = "revision",\ - .value = stringify(2),\ - }, - static void pc_i440fx_0_14_machine_options(MachineClass *m) { + static GlobalProperty compat[] = { + PC_CPU_MODEL_IDS("0.14") + { + .driver = "virtio-blk-pci", + .property = "event_idx", + .value = "off", + },{ + .driver = "virtio-serial-pci", + .property = "event_idx", + .value = "off", + },{ + .driver = "virtio-net-pci", + .property = "event_idx", + .value = "off", + },{ + .driver = "virtio-balloon-pci", + .property = "event_idx", + .value = "off", + },{ + .driver = "qxl", + .property = "revision", + .value = stringify(2), + },{ + .driver = "qxl-vga", + .property = "revision", + .value = stringify(2), + }, + }; + pc_i440fx_0_15_machine_options(m); m->hw_version = "0.14"; - SET_MACHINE_COMPAT(m, PC_COMPAT_0_14); + compat_props_add(m->compat_props, compat, G_N_ELEMENTS(compat)); } DEFINE_I440FX_MACHINE(v0_14, "pc-0.14", pc_compat_1_2, pc_i440fx_0_14_machine_options); - -#define PC_COMPAT_0_13 \ - PC_CPU_MODEL_IDS("0.13") \ - {\ - .driver = TYPE_PCI_DEVICE,\ - .property = "command_serr_enable",\ - .value = "off",\ - },{\ - .driver = "AC97",\ - .property = "use_broken_id",\ - .value = stringify(1),\ - },{\ - .driver = "virtio-9p-pci",\ - .property = "vectors",\ - .value = stringify(0),\ - },{\ - .driver = "VGA",\ - .property = "rombar",\ - .value = stringify(0),\ - },{\ - .driver = "vmware-svga",\ - .property = "rombar",\ - .value = stringify(0),\ - }, - static void pc_i440fx_0_13_machine_options(MachineClass *m) { PCMachineClass *pcmc = PC_MACHINE_CLASS(m); + static GlobalProperty compat[] = { + PC_CPU_MODEL_IDS("0.13") + { + .driver = TYPE_PCI_DEVICE, + .property = "command_serr_enable", + .value = "off", + },{ + .driver = "AC97", + .property = "use_broken_id", + .value = stringify(1), + },{ + .driver = "virtio-9p-pci", + .property = "vectors", + .value = stringify(0), + },{ + .driver = "VGA", + .property = "rombar", + .value = stringify(0), + },{ + .driver = "vmware-svga", + .property = "rombar", + .value = stringify(0), + }, + }; + pc_i440fx_0_14_machine_options(m); m->hw_version = "0.13"; - SET_MACHINE_COMPAT(m, PC_COMPAT_0_13); + compat_props_add(m->compat_props, compat, G_N_ELEMENTS(compat)); pcmc->kvmclock_enabled = false; } DEFINE_I440FX_MACHINE(v0_13, "pc-0.13", pc_compat_0_13, pc_i440fx_0_13_machine_options); - -#define PC_COMPAT_0_12 \ - PC_CPU_MODEL_IDS("0.12") \ - {\ - .driver = "virtio-serial-pci",\ - .property = "max_ports",\ - .value = stringify(1),\ - },{\ - .driver = "virtio-serial-pci",\ - .property = "vectors",\ - .value = stringify(0),\ - },{\ - .driver = "usb-mouse",\ - .property = "serial",\ - .value = "1",\ - },{\ - .driver = "usb-tablet",\ - .property = "serial",\ - .value = "1",\ - },{\ - .driver = "usb-kbd",\ - .property = "serial",\ - .value = "1",\ - }, - static void pc_i440fx_0_12_machine_options(MachineClass *m) { + static GlobalProperty compat[] = { + PC_CPU_MODEL_IDS("0.12") + { + .driver = "virtio-serial-pci", + .property = "max_ports", + .value = stringify(1), + },{ + .driver = "virtio-serial-pci", + .property = "vectors", + .value = stringify(0), + },{ + .driver = "usb-mouse", + .property = "serial", + .value = "1", + },{ + .driver = "usb-tablet", + .property = "serial", + .value = "1", + },{ + .driver = "usb-kbd", + .property = "serial", + .value = "1", + }, + }; + 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, compat, G_N_ELEMENTS(compat)); } DEFINE_I440FX_MACHINE(v0_12, "pc-0.12", pc_compat_0_13, diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c index 0a3f3f18e4..94494e6441 100644 --- a/hw/i386/pc_q35.c +++ b/hw/i386/pc_q35.c @@ -326,7 +326,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, 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, @@ -335,7 +336,8 @@ DEFINE_Q35_MACHINE(v3_1, "pc-q35-3.1", NULL, 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, 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, @@ -344,7 +346,8 @@ DEFINE_Q35_MACHINE(v3_0, "pc-q35-3.0", NULL, 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, 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, @@ -356,7 +359,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, 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, @@ -365,7 +369,8 @@ DEFINE_Q35_MACHINE(v2_11, "pc-q35-2.11", NULL, 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, 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; } @@ -376,7 +381,8 @@ DEFINE_Q35_MACHINE(v2_10, "pc-q35-2.10", NULL, 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, 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, @@ -385,7 +391,8 @@ DEFINE_Q35_MACHINE(v2_9, "pc-q35-2.9", NULL, 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, 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, @@ -395,7 +402,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, 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, @@ -404,10 +412,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); + 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, 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, @@ -416,10 +426,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); + 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, 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, @@ -428,10 +440,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); + 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, 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, diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 19a07c5c9d..5671608cea 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -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" @@ -4021,13 +4020,10 @@ DEFINE_SPAPR_MACHINE(4_0, "4.0", true); /* * pseries-3.1 */ -#define SPAPR_COMPAT_3_1 \ - HW_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, hw_compat_3_1, hw_compat_3_1_len); mc->default_cpu_type = POWERPC_CPU_TYPE_NAME("power8_v2.0"); } @@ -4036,15 +4032,13 @@ DEFINE_SPAPR_MACHINE(3_1, "3.1", false); /* * pseries-3.0 */ -#define SPAPR_COMPAT_3_0 \ - HW_COMPAT_3_0 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, hw_compat_3_0, hw_compat_3_0_len); smc->legacy_irq_allocation = true; smc->irq = &spapr_irq_xics_legacy; @@ -4055,25 +4049,25 @@ DEFINE_SPAPR_MACHINE(3_0, "3.0", false); /* * pseries-2.12 */ -#define SPAPR_COMPAT_2_12 \ - HW_COMPAT_2_12 \ - { \ - .driver = TYPE_POWERPC_CPU, \ - .property = "pre-3.0-migration", \ - .value = "on", \ - }, \ - { \ - .driver = TYPE_SPAPR_CPU_CORE, \ - .property = "pre-3.0-migration", \ - .value = "on", \ - }, - static void spapr_machine_2_12_class_options(MachineClass *mc) { sPAPRMachineClass *smc = SPAPR_MACHINE_CLASS(mc); + static GlobalProperty compat[] = { + { + .driver = TYPE_POWERPC_CPU, + .property = "pre-3.0-migration", + .value = "on", + }, + { + .driver = TYPE_SPAPR_CPU_CORE, + .property = "pre-3.0-migration", + .value = "on", + }, + }; spapr_machine_3_0_class_options(mc); - SET_MACHINE_COMPAT(mc, SPAPR_COMPAT_2_12); + 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 * hpt-max-page-size capability. Of course we can't do it here @@ -4100,8 +4094,6 @@ DEFINE_SPAPR_MACHINE(2_12_sxxm, "2.12-sxxm", false); /* * pseries-2.11 */ -#define SPAPR_COMPAT_2_11 \ - HW_COMPAT_2_11 static void spapr_machine_2_11_class_options(MachineClass *mc) { @@ -4109,7 +4101,7 @@ 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, hw_compat_2_11, hw_compat_2_11_len); } DEFINE_SPAPR_MACHINE(2_11, "2.11", false); @@ -4117,13 +4109,11 @@ DEFINE_SPAPR_MACHINE(2_11, "2.11", false); /* * pseries-2.10 */ -#define SPAPR_COMPAT_2_10 \ - HW_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, hw_compat_2_10, hw_compat_2_10_len); } DEFINE_SPAPR_MACHINE(2_10, "2.10", false); @@ -4131,20 +4121,21 @@ DEFINE_SPAPR_MACHINE(2_10, "2.10", false); /* * pseries-2.9 */ -#define SPAPR_COMPAT_2_9 \ - HW_COMPAT_2_9 \ - { \ - .driver = TYPE_POWERPC_CPU, \ - .property = "pre-2.10-migration", \ - .value = "on", \ - }, \ static void spapr_machine_2_9_class_options(MachineClass *mc) { sPAPRMachineClass *smc = SPAPR_MACHINE_CLASS(mc); + static GlobalProperty compat[] = { + { + .driver = TYPE_POWERPC_CPU, + .property = "pre-2.10-migration", + .value = "on", + }, + }; spapr_machine_2_10_class_options(mc); - SET_MACHINE_COMPAT(mc, SPAPR_COMPAT_2_9); + 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; smc->resize_hpt_default = SPAPR_RESIZE_HPT_DISABLED; @@ -4155,18 +4146,20 @@ DEFINE_SPAPR_MACHINE(2_9, "2.9", false); /* * pseries-2.8 */ -#define SPAPR_COMPAT_2_8 \ - HW_COMPAT_2_8 \ - { \ - .driver = TYPE_SPAPR_PCI_HOST_BRIDGE, \ - .property = "pcie-extended-configuration-space", \ - .value = "off", \ - }, static void spapr_machine_2_8_class_options(MachineClass *mc) { + static GlobalProperty compat[] = { + { + .driver = TYPE_SPAPR_PCI_HOST_BRIDGE, + .property = "pcie-extended-configuration-space", + .value = "off", + }, + }; + spapr_machine_2_9_class_options(mc); - SET_MACHINE_COMPAT(mc, SPAPR_COMPAT_2_8); + 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; } @@ -4175,28 +4168,6 @@ DEFINE_SPAPR_MACHINE(2_8, "2.8", false); /* * pseries-2.7 */ -#define SPAPR_COMPAT_2_7 \ - HW_COMPAT_2_7 \ - { \ - .driver = TYPE_SPAPR_PCI_HOST_BRIDGE, \ - .property = "mem_win_size", \ - .value = stringify(SPAPR_PCI_2_7_MMIO_WIN_SIZE),\ - }, \ - { \ - .driver = TYPE_SPAPR_PCI_HOST_BRIDGE, \ - .property = "mem64_win_size", \ - .value = "0", \ - }, \ - { \ - .driver = TYPE_POWERPC_CPU, \ - .property = "pre-2.8-migration", \ - .value = "on", \ - }, \ - { \ - .driver = TYPE_SPAPR_PCI_HOST_BRIDGE, \ - .property = "pre-2.8-migration", \ - .value = "on", \ - }, static void phb_placement_2_7(sPAPRMachineState *spapr, uint32_t index, uint64_t *buid, hwaddr *pio, @@ -4250,11 +4221,34 @@ static void phb_placement_2_7(sPAPRMachineState *spapr, uint32_t index, static void spapr_machine_2_7_class_options(MachineClass *mc) { sPAPRMachineClass *smc = SPAPR_MACHINE_CLASS(mc); + static GlobalProperty compat[] = { + { + .driver = TYPE_SPAPR_PCI_HOST_BRIDGE, + .property = "mem_win_size", + .value = stringify(SPAPR_PCI_2_7_MMIO_WIN_SIZE), + }, + { + .driver = TYPE_SPAPR_PCI_HOST_BRIDGE, + .property = "mem64_win_size", + .value = "0", + }, + { + .driver = TYPE_POWERPC_CPU, + .property = "pre-2.8-migration", + .value = "on", + }, + { + .driver = TYPE_SPAPR_PCI_HOST_BRIDGE, + .property = "pre-2.8-migration", + .value = "on", + }, + }; 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, 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; } @@ -4263,19 +4257,21 @@ DEFINE_SPAPR_MACHINE(2_7, "2.7", false); /* * pseries-2.6 */ -#define SPAPR_COMPAT_2_6 \ - HW_COMPAT_2_6 \ - { \ - .driver = TYPE_SPAPR_PCI_HOST_BRIDGE,\ - .property = "ddw",\ - .value = stringify(off),\ - }, static void spapr_machine_2_6_class_options(MachineClass *mc) { + static GlobalProperty compat[] = { + { + .driver = TYPE_SPAPR_PCI_HOST_BRIDGE, + .property = "ddw", + .value = stringify(off), + }, + }; + 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, hw_compat_2_6, hw_compat_2_6_len); + compat_props_add(mc->compat_props, compat, G_N_ELEMENTS(compat)); } DEFINE_SPAPR_MACHINE(2_6, "2.6", false); @@ -4283,21 +4279,22 @@ DEFINE_SPAPR_MACHINE(2_6, "2.6", false); /* * pseries-2.5 */ -#define SPAPR_COMPAT_2_5 \ - HW_COMPAT_2_5 \ - { \ - .driver = "spapr-vlan", \ - .property = "use-rx-buffer-pools", \ - .value = "off", \ - }, static void spapr_machine_2_5_class_options(MachineClass *mc) { sPAPRMachineClass *smc = SPAPR_MACHINE_CLASS(mc); + static GlobalProperty compat[] = { + { + .driver = "spapr-vlan", + .property = "use-rx-buffer-pools", + .value = "off", + }, + }; 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, hw_compat_2_5, hw_compat_2_5_len); + compat_props_add(mc->compat_props, compat, G_N_ELEMENTS(compat)); } DEFINE_SPAPR_MACHINE(2_5, "2.5", false); @@ -4305,8 +4302,6 @@ DEFINE_SPAPR_MACHINE(2_5, "2.5", false); /* * pseries-2.4 */ -#define SPAPR_COMPAT_2_4 \ - HW_COMPAT_2_4 static void spapr_machine_2_4_class_options(MachineClass *mc) { @@ -4314,7 +4309,7 @@ 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, hw_compat_2_4, hw_compat_2_4_len); } DEFINE_SPAPR_MACHINE(2_4, "2.4", false); @@ -4322,18 +4317,19 @@ DEFINE_SPAPR_MACHINE(2_4, "2.4", false); /* * pseries-2.3 */ -#define SPAPR_COMPAT_2_3 \ - HW_COMPAT_2_3 \ - {\ - .driver = "spapr-pci-host-bridge",\ - .property = "dynamic-reconfiguration",\ - .value = "off",\ - }, static void spapr_machine_2_3_class_options(MachineClass *mc) { + static GlobalProperty compat[] = { + { + .driver = "spapr-pci-host-bridge", + .property = "dynamic-reconfiguration", + .value = "off", + }, + }; spapr_machine_2_4_class_options(mc); - SET_MACHINE_COMPAT(mc, SPAPR_COMPAT_2_3); + 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); @@ -4341,18 +4337,19 @@ DEFINE_SPAPR_MACHINE(2_3, "2.3", false); * pseries-2.2 */ -#define SPAPR_COMPAT_2_2 \ - HW_COMPAT_2_2 \ - {\ - .driver = TYPE_SPAPR_PCI_HOST_BRIDGE,\ - .property = "mem_win_size",\ - .value = "0x20000000",\ - }, - static void spapr_machine_2_2_class_options(MachineClass *mc) { + static GlobalProperty compat[] = { + { + .driver = TYPE_SPAPR_PCI_HOST_BRIDGE, + .property = "mem_win_size", + .value = "0x20000000", + }, + }; + spapr_machine_2_3_class_options(mc); - SET_MACHINE_COMPAT(mc, SPAPR_COMPAT_2_2); + 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"; } DEFINE_SPAPR_MACHINE(2_2, "2.2", false); @@ -4360,13 +4357,11 @@ DEFINE_SPAPR_MACHINE(2_2, "2.2", false); /* * pseries-2.1 */ -#define SPAPR_COMPAT_2_1 \ - HW_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, hw_compat_2_1, hw_compat_2_1_len); } DEFINE_SPAPR_MACHINE(2_1, "2.1", false); diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c index fd9d0b0542..c737507053 100644 --- a/hw/s390x/s390-virtio-ccw.c +++ b/hw/s390x/s390-virtio-ccw.c @@ -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" @@ -651,100 +650,6 @@ bool css_migration_enabled(void) } \ type_init(ccw_machine_register_##suffix) -#define CCW_COMPAT_3_1 \ - HW_COMPAT_3_1 - -#define CCW_COMPAT_3_0 \ - HW_COMPAT_3_0 - -#define CCW_COMPAT_2_12 \ - HW_COMPAT_2_12 - -#define CCW_COMPAT_2_11 \ - HW_COMPAT_2_11 \ - {\ - .driver = TYPE_SCLP_EVENT_FACILITY,\ - .property = "allow_all_mask_sizes",\ - .value = "off",\ - }, - -#define CCW_COMPAT_2_10 \ - HW_COMPAT_2_10 - -#define CCW_COMPAT_2_9 \ - HW_COMPAT_2_9 \ - {\ - .driver = TYPE_S390_STATTRIB,\ - .property = "migration-enabled",\ - .value = "off",\ - }, - -#define CCW_COMPAT_2_8 \ - HW_COMPAT_2_8 \ - {\ - .driver = TYPE_S390_FLIC_COMMON,\ - .property = "adapter_routes_max_batch",\ - .value = "64",\ - }, - -#define CCW_COMPAT_2_7 \ - HW_COMPAT_2_7 - -#define CCW_COMPAT_2_6 \ - HW_COMPAT_2_6 \ - {\ - .driver = TYPE_S390_IPL,\ - .property = "iplbext_migration",\ - .value = "off",\ - }, {\ - .driver = TYPE_VIRTUAL_CSS_BRIDGE,\ - .property = "css_dev_path",\ - .value = "off",\ - }, - -#define CCW_COMPAT_2_5 \ - HW_COMPAT_2_5 - -#define CCW_COMPAT_2_4 \ - HW_COMPAT_2_4 \ - {\ - .driver = TYPE_S390_SKEYS,\ - .property = "migration-enabled",\ - .value = "off",\ - },{\ - .driver = "virtio-blk-ccw",\ - .property = "max_revision",\ - .value = "0",\ - },{\ - .driver = "virtio-balloon-ccw",\ - .property = "max_revision",\ - .value = "0",\ - },{\ - .driver = "virtio-serial-ccw",\ - .property = "max_revision",\ - .value = "0",\ - },{\ - .driver = "virtio-9p-ccw",\ - .property = "max_revision",\ - .value = "0",\ - },{\ - .driver = "virtio-rng-ccw",\ - .property = "max_revision",\ - .value = "0",\ - },{\ - .driver = "virtio-net-ccw",\ - .property = "max_revision",\ - .value = "0",\ - },{\ - .driver = "virtio-scsi-ccw",\ - .property = "max_revision",\ - .value = "0",\ - },{\ - .driver = "vhost-scsi-ccw",\ - .property = "max_revision",\ - .value = "0",\ - }, - static void ccw_machine_4_0_instance_options(MachineState *machine) { } @@ -762,7 +667,7 @@ 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, hw_compat_3_1, hw_compat_3_1_len); } DEFINE_CCW_MACHINE(3_1, "3.1", false); @@ -777,7 +682,7 @@ 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, hw_compat_3_0, hw_compat_3_0_len); } DEFINE_CCW_MACHINE(3_0, "3.0", false); @@ -791,7 +696,7 @@ 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, hw_compat_2_12, hw_compat_2_12_len); } DEFINE_CCW_MACHINE(2_12, "2.12", false); @@ -806,8 +711,17 @@ static void ccw_machine_2_11_instance_options(MachineState *machine) static void ccw_machine_2_11_class_options(MachineClass *mc) { + static GlobalProperty compat[] = { + { + .driver = TYPE_SCLP_EVENT_FACILITY, + .property = "allow_all_mask_sizes", + .value = "off", + }, + }; + ccw_machine_2_12_class_options(mc); - SET_MACHINE_COMPAT(mc, CCW_COMPAT_2_11); + 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); @@ -819,7 +733,7 @@ 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, hw_compat_2_10, hw_compat_2_10_len); } DEFINE_CCW_MACHINE(2_10, "2.10", false); @@ -836,9 +750,17 @@ static void ccw_machine_2_9_instance_options(MachineState *machine) static void ccw_machine_2_9_class_options(MachineClass *mc) { S390CcwMachineClass *s390mc = S390_MACHINE_CLASS(mc); + static GlobalProperty compat[] = { + { + .driver = TYPE_S390_STATTRIB, + .property = "migration-enabled", + .value = "off", + }, + }; ccw_machine_2_10_class_options(mc); - SET_MACHINE_COMPAT(mc, CCW_COMPAT_2_9); + 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; } DEFINE_CCW_MACHINE(2_9, "2.9", false); @@ -850,8 +772,17 @@ static void ccw_machine_2_8_instance_options(MachineState *machine) static void ccw_machine_2_8_class_options(MachineClass *mc) { + static GlobalProperty compat[] = { + { + .driver = TYPE_S390_FLIC_COMMON, + .property = "adapter_routes_max_batch", + .value = "64", + }, + }; + ccw_machine_2_9_class_options(mc); - SET_MACHINE_COMPAT(mc, CCW_COMPAT_2_8); + 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); @@ -866,7 +797,7 @@ 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, hw_compat_2_7, hw_compat_2_7_len); } DEFINE_CCW_MACHINE(2_7, "2.7", false); @@ -878,10 +809,22 @@ static void ccw_machine_2_6_instance_options(MachineState *machine) static void ccw_machine_2_6_class_options(MachineClass *mc) { S390CcwMachineClass *s390mc = S390_MACHINE_CLASS(mc); + static GlobalProperty compat[] = { + { + .driver = TYPE_S390_IPL, + .property = "iplbext_migration", + .value = "off", + }, { + .driver = TYPE_VIRTUAL_CSS_BRIDGE, + .property = "css_dev_path", + .value = "off", + }, + }; 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, 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); @@ -893,7 +836,7 @@ 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, hw_compat_2_5, hw_compat_2_5_len); } DEFINE_CCW_MACHINE(2_5, "2.5", false); @@ -904,8 +847,49 @@ static void ccw_machine_2_4_instance_options(MachineState *machine) static void ccw_machine_2_4_class_options(MachineClass *mc) { + static GlobalProperty compat[] = { + { + .driver = TYPE_S390_SKEYS, + .property = "migration-enabled", + .value = "off", + },{ + .driver = "virtio-blk-ccw", + .property = "max_revision", + .value = "0", + },{ + .driver = "virtio-balloon-ccw", + .property = "max_revision", + .value = "0", + },{ + .driver = "virtio-serial-ccw", + .property = "max_revision", + .value = "0", + },{ + .driver = "virtio-9p-ccw", + .property = "max_revision", + .value = "0", + },{ + .driver = "virtio-rng-ccw", + .property = "max_revision", + .value = "0", + },{ + .driver = "virtio-net-ccw", + .property = "max_revision", + .value = "0", + },{ + .driver = "virtio-scsi-ccw", + .property = "max_revision", + .value = "0", + },{ + .driver = "vhost-scsi-ccw", + .property = "max_revision", + .value = "0", + }, + }; + ccw_machine_2_5_class_options(mc); - SET_MACHINE_COMPAT(mc, CCW_COMPAT_2_4); + 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); diff --git a/hw/xen/xen-common.c b/hw/xen/xen-common.c index 6ec14c73ca..d51148b6b3 100644 --- a/hw/xen/xen-common.c +++ b/hw/xen/xen-common.c @@ -159,33 +159,34 @@ 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", - }, - { /* end of list */ }, -}; - 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; 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, compat, G_N_ELEMENTS(compat)); } #define TYPE_XEN_ACCEL ACCEL_CLASS_NAME("xen") |