pc: Set CPU model-id on compat_props for pc <= 2.4

Instead of relying on x86_cpudef_setup() calling
qemu_hw_version(), just make old machines set model-id explicitly
on compat_props for qemu64, qemu32, and athlon. This will allow
us to eliminate x86_cpudef_setup() later.

Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
This commit is contained in:
Eduardo Habkost 2016-04-09 16:26:38 -03:00
parent d494352c2f
commit cd6c1b7057
2 changed files with 42 additions and 0 deletions

View File

@ -582,6 +582,7 @@ DEFINE_I440FX_MACHINE(v1_4, "pc-i440fx-1.4", pc_compat_1_4,
#define PC_COMPAT_1_3 \ #define PC_COMPAT_1_3 \
PC_CPU_MODEL_IDS("1.3.0") \
{\ {\
.driver = "usb-tablet",\ .driver = "usb-tablet",\
.property = "usb_version",\ .property = "usb_version",\
@ -613,6 +614,7 @@ DEFINE_I440FX_MACHINE(v1_3, "pc-1.3", pc_compat_1_3,
#define PC_COMPAT_1_2 \ #define PC_COMPAT_1_2 \
PC_CPU_MODEL_IDS("1.2.0") \
{\ {\
.driver = "nec-usb-xhci",\ .driver = "nec-usb-xhci",\
.property = "msi",\ .property = "msi",\
@ -651,6 +653,7 @@ DEFINE_I440FX_MACHINE(v1_2, "pc-1.2", pc_compat_1_2,
#define PC_COMPAT_1_1 \ #define PC_COMPAT_1_1 \
PC_CPU_MODEL_IDS("1.1.0") \
{\ {\
.driver = "virtio-scsi-pci",\ .driver = "virtio-scsi-pci",\
.property = "hotplug",\ .property = "hotplug",\
@ -693,6 +696,7 @@ DEFINE_I440FX_MACHINE(v1_1, "pc-1.1", pc_compat_1_2,
#define PC_COMPAT_1_0 \ #define PC_COMPAT_1_0 \
PC_CPU_MODEL_IDS("1.0") \
{\ {\
.driver = TYPE_ISA_FDC,\ .driver = TYPE_ISA_FDC,\
.property = "check_media_rate",\ .property = "check_media_rate",\
@ -722,10 +726,14 @@ DEFINE_I440FX_MACHINE(v1_0, "pc-1.0", pc_compat_1_2,
pc_i440fx_1_0_machine_options); 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 void pc_i440fx_0_15_machine_options(MachineClass *m)
{ {
pc_i440fx_1_0_machine_options(m); pc_i440fx_1_0_machine_options(m);
m->hw_version = "0.15"; m->hw_version = "0.15";
SET_MACHINE_COMPAT(m, PC_COMPAT_0_15);
} }
DEFINE_I440FX_MACHINE(v0_15, "pc-0.15", pc_compat_1_2, DEFINE_I440FX_MACHINE(v0_15, "pc-0.15", pc_compat_1_2,
@ -733,6 +741,7 @@ DEFINE_I440FX_MACHINE(v0_15, "pc-0.15", pc_compat_1_2,
#define PC_COMPAT_0_14 \ #define PC_COMPAT_0_14 \
PC_CPU_MODEL_IDS("0.14") \
{\ {\
.driver = "virtio-blk-pci",\ .driver = "virtio-blk-pci",\
.property = "event_idx",\ .property = "event_idx",\
@ -771,6 +780,7 @@ DEFINE_I440FX_MACHINE(v0_14, "pc-0.14", pc_compat_1_2,
#define PC_COMPAT_0_13 \ #define PC_COMPAT_0_13 \
PC_CPU_MODEL_IDS("0.13") \
{\ {\
.driver = TYPE_PCI_DEVICE,\ .driver = TYPE_PCI_DEVICE,\
.property = "command_serr_enable",\ .property = "command_serr_enable",\
@ -807,6 +817,7 @@ DEFINE_I440FX_MACHINE(v0_13, "pc-0.13", pc_compat_0_13,
#define PC_COMPAT_0_12 \ #define PC_COMPAT_0_12 \
PC_CPU_MODEL_IDS("0.12") \
{\ {\
.driver = "virtio-serial-pci",\ .driver = "virtio-serial-pci",\
.property = "max_ports",\ .property = "max_ports",\
@ -841,6 +852,7 @@ DEFINE_I440FX_MACHINE(v0_12, "pc-0.12", pc_compat_0_13,
#define PC_COMPAT_0_11 \ #define PC_COMPAT_0_11 \
PC_CPU_MODEL_IDS("0.11") \
{\ {\
.driver = "virtio-blk-pci",\ .driver = "virtio-blk-pci",\
.property = "vectors",\ .property = "vectors",\
@ -871,6 +883,7 @@ DEFINE_I440FX_MACHINE(v0_11, "pc-0.11", pc_compat_0_13,
#define PC_COMPAT_0_10 \ #define PC_COMPAT_0_10 \
PC_CPU_MODEL_IDS("0.10") \
{\ {\
.driver = "virtio-blk-pci",\ .driver = "virtio-blk-pci",\
.property = "class",\ .property = "class",\

View File

@ -359,8 +359,29 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *);
#define PC_COMPAT_2_5 \ #define PC_COMPAT_2_5 \
HW_COMPAT_2_5 HW_COMPAT_2_5
/* Helper for setting model-id for CPU models that changed model-id
* depending on QEMU versions up to QEMU 2.4.
*/
#define PC_CPU_MODEL_IDS(v) \
{\
.driver = "qemu32-" TYPE_X86_CPU,\
.property = "model-id",\
.value = "QEMU Virtual CPU version " v,\
},\
{\
.driver = "qemu64-" TYPE_X86_CPU,\
.property = "model-id",\
.value = "QEMU Virtual CPU version " v,\
},\
{\
.driver = "athlon-" TYPE_X86_CPU,\
.property = "model-id",\
.value = "QEMU Virtual CPU version " v,\
},
#define PC_COMPAT_2_4 \ #define PC_COMPAT_2_4 \
HW_COMPAT_2_4 \ HW_COMPAT_2_4 \
PC_CPU_MODEL_IDS("2.4.0") \
{\ {\
.driver = "Haswell-" TYPE_X86_CPU,\ .driver = "Haswell-" TYPE_X86_CPU,\
.property = "abm",\ .property = "abm",\
@ -431,6 +452,7 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *);
#define PC_COMPAT_2_3 \ #define PC_COMPAT_2_3 \
HW_COMPAT_2_3 \ HW_COMPAT_2_3 \
PC_CPU_MODEL_IDS("2.3.0") \
{\ {\
.driver = TYPE_X86_CPU,\ .driver = TYPE_X86_CPU,\
.property = "arat",\ .property = "arat",\
@ -511,6 +533,7 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *);
#define PC_COMPAT_2_2 \ #define PC_COMPAT_2_2 \
HW_COMPAT_2_2 \ HW_COMPAT_2_2 \
PC_CPU_MODEL_IDS("2.3.0") \
{\ {\
.driver = "kvm64" "-" TYPE_X86_CPU,\ .driver = "kvm64" "-" TYPE_X86_CPU,\
.property = "vme",\ .property = "vme",\
@ -604,6 +627,7 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *);
#define PC_COMPAT_2_1 \ #define PC_COMPAT_2_1 \
HW_COMPAT_2_1 \ HW_COMPAT_2_1 \
PC_CPU_MODEL_IDS("2.1.0") \
{\ {\
.driver = "coreduo" "-" TYPE_X86_CPU,\ .driver = "coreduo" "-" TYPE_X86_CPU,\
.property = "vmx",\ .property = "vmx",\
@ -616,6 +640,7 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *);
}, },
#define PC_COMPAT_2_0 \ #define PC_COMPAT_2_0 \
PC_CPU_MODEL_IDS("2.0.0") \
{\ {\
.driver = "virtio-scsi-pci",\ .driver = "virtio-scsi-pci",\
.property = "any_layout",\ .property = "any_layout",\
@ -675,6 +700,7 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *);
}, },
#define PC_COMPAT_1_7 \ #define PC_COMPAT_1_7 \
PC_CPU_MODEL_IDS("1.7.0") \
{\ {\
.driver = TYPE_USB_DEVICE,\ .driver = TYPE_USB_DEVICE,\
.property = "msos-desc",\ .property = "msos-desc",\
@ -692,6 +718,7 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *);
}, },
#define PC_COMPAT_1_6 \ #define PC_COMPAT_1_6 \
PC_CPU_MODEL_IDS("1.6.0") \
{\ {\
.driver = "e1000",\ .driver = "e1000",\
.property = "mitigation",\ .property = "mitigation",\
@ -715,6 +742,7 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *);
}, },
#define PC_COMPAT_1_5 \ #define PC_COMPAT_1_5 \
PC_CPU_MODEL_IDS("1.5.0") \
{\ {\
.driver = "Conroe-" TYPE_X86_CPU,\ .driver = "Conroe-" TYPE_X86_CPU,\
.property = "model",\ .property = "model",\
@ -758,6 +786,7 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *);
}, },
#define PC_COMPAT_1_4 \ #define PC_COMPAT_1_4 \
PC_CPU_MODEL_IDS("1.4.0") \
{\ {\
.driver = "scsi-hd",\ .driver = "scsi-hd",\
.property = "discard_granularity",\ .property = "discard_granularity",\