From d494352c2f7818aeba184a8ef757569083740bb2 Mon Sep 17 00:00:00 2001 From: Eduardo Habkost Date: Sat, 9 Apr 2016 16:42:44 -0300 Subject: osdep: Move default qemu_hw_version() value to a macro The macro will be used by code that will stop calling qemu_hw_version() at runtime and just need a constant value. Signed-off-by: Eduardo Habkost --- include/qemu/osdep.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'include') diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h index 994bfa023a..693769403f 100644 --- a/include/qemu/osdep.h +++ b/include/qemu/osdep.h @@ -327,6 +327,15 @@ static inline void qemu_timersub(const struct timeval *val1, void qemu_set_cloexec(int fd); +/* Starting on QEMU 2.5, qemu_hw_version() returns "2.5+" by default + * instead of QEMU_VERSION, so setting hw_version on MachineClass + * is no longer mandatory. + * + * Do NOT change this string, or it will break compatibility on all + * machine classes that don't set hw_version. + */ +#define QEMU_HW_VERSION "2.5+" + /* QEMU "hardware version" setting. Used to replace code that exposed * QEMU_VERSION to guests in the past and need to keep compatibility. * Do not use qemu_hw_version() in new code. -- cgit v1.2.3-55-g7522 From cd6c1b7057bc897675897f44d15277c3a6e7b118 Mon Sep 17 00:00:00 2001 From: Eduardo Habkost Date: Sat, 9 Apr 2016 16:26:38 -0300 Subject: 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 Signed-off-by: Eduardo Habkost --- hw/i386/pc_piix.c | 13 +++++++++++++ include/hw/i386/pc.h | 29 +++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+) (limited to 'include') diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index 32918bb294..24e7042680 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -582,6 +582,7 @@ DEFINE_I440FX_MACHINE(v1_4, "pc-i440fx-1.4", pc_compat_1_4, #define PC_COMPAT_1_3 \ + PC_CPU_MODEL_IDS("1.3.0") \ {\ .driver = "usb-tablet",\ .property = "usb_version",\ @@ -613,6 +614,7 @@ DEFINE_I440FX_MACHINE(v1_3, "pc-1.3", pc_compat_1_3, #define PC_COMPAT_1_2 \ + PC_CPU_MODEL_IDS("1.2.0") \ {\ .driver = "nec-usb-xhci",\ .property = "msi",\ @@ -651,6 +653,7 @@ DEFINE_I440FX_MACHINE(v1_2, "pc-1.2", pc_compat_1_2, #define PC_COMPAT_1_1 \ + PC_CPU_MODEL_IDS("1.1.0") \ {\ .driver = "virtio-scsi-pci",\ .property = "hotplug",\ @@ -693,6 +696,7 @@ DEFINE_I440FX_MACHINE(v1_1, "pc-1.1", pc_compat_1_2, #define PC_COMPAT_1_0 \ + PC_CPU_MODEL_IDS("1.0") \ {\ .driver = TYPE_ISA_FDC,\ .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); +#define PC_COMPAT_0_15 \ + PC_CPU_MODEL_IDS("0.15") + static void pc_i440fx_0_15_machine_options(MachineClass *m) { pc_i440fx_1_0_machine_options(m); 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, @@ -733,6 +741,7 @@ DEFINE_I440FX_MACHINE(v0_15, "pc-0.15", pc_compat_1_2, #define PC_COMPAT_0_14 \ + PC_CPU_MODEL_IDS("0.14") \ {\ .driver = "virtio-blk-pci",\ .property = "event_idx",\ @@ -771,6 +780,7 @@ DEFINE_I440FX_MACHINE(v0_14, "pc-0.14", pc_compat_1_2, #define PC_COMPAT_0_13 \ + PC_CPU_MODEL_IDS("0.13") \ {\ .driver = TYPE_PCI_DEVICE,\ .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 \ + PC_CPU_MODEL_IDS("0.12") \ {\ .driver = "virtio-serial-pci",\ .property = "max_ports",\ @@ -841,6 +852,7 @@ DEFINE_I440FX_MACHINE(v0_12, "pc-0.12", pc_compat_0_13, #define PC_COMPAT_0_11 \ + PC_CPU_MODEL_IDS("0.11") \ {\ .driver = "virtio-blk-pci",\ .property = "vectors",\ @@ -871,6 +883,7 @@ DEFINE_I440FX_MACHINE(v0_11, "pc-0.11", pc_compat_0_13, #define PC_COMPAT_0_10 \ + PC_CPU_MODEL_IDS("0.10") \ {\ .driver = "virtio-blk-pci",\ .property = "class",\ diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index 367b6dbf0e..9ca23098bd 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -359,8 +359,29 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *); #define PC_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 \ HW_COMPAT_2_4 \ + PC_CPU_MODEL_IDS("2.4.0") \ {\ .driver = "Haswell-" TYPE_X86_CPU,\ .property = "abm",\ @@ -431,6 +452,7 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *); #define PC_COMPAT_2_3 \ HW_COMPAT_2_3 \ + PC_CPU_MODEL_IDS("2.3.0") \ {\ .driver = TYPE_X86_CPU,\ .property = "arat",\ @@ -511,6 +533,7 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *); #define PC_COMPAT_2_2 \ HW_COMPAT_2_2 \ + PC_CPU_MODEL_IDS("2.3.0") \ {\ .driver = "kvm64" "-" TYPE_X86_CPU,\ .property = "vme",\ @@ -604,6 +627,7 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *); #define PC_COMPAT_2_1 \ HW_COMPAT_2_1 \ + PC_CPU_MODEL_IDS("2.1.0") \ {\ .driver = "coreduo" "-" TYPE_X86_CPU,\ .property = "vmx",\ @@ -616,6 +640,7 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *); }, #define PC_COMPAT_2_0 \ + PC_CPU_MODEL_IDS("2.0.0") \ {\ .driver = "virtio-scsi-pci",\ .property = "any_layout",\ @@ -675,6 +700,7 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *); }, #define PC_COMPAT_1_7 \ + PC_CPU_MODEL_IDS("1.7.0") \ {\ .driver = TYPE_USB_DEVICE,\ .property = "msos-desc",\ @@ -692,6 +718,7 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *); }, #define PC_COMPAT_1_6 \ + PC_CPU_MODEL_IDS("1.6.0") \ {\ .driver = "e1000",\ .property = "mitigation",\ @@ -715,6 +742,7 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *); }, #define PC_COMPAT_1_5 \ + PC_CPU_MODEL_IDS("1.5.0") \ {\ .driver = "Conroe-" TYPE_X86_CPU,\ .property = "model",\ @@ -758,6 +786,7 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *); }, #define PC_COMPAT_1_4 \ + PC_CPU_MODEL_IDS("1.4.0") \ {\ .driver = "scsi-hd",\ .property = "discard_granularity",\ -- cgit v1.2.3-55-g7522 From 3e2c0e062f0963a6b73b0cd1990fad79495463d9 Mon Sep 17 00:00:00 2001 From: Eduardo Habkost Date: Fri, 30 Oct 2015 18:10:57 -0200 Subject: cpu: Eliminate cpudef_init(), cpudef_setup() x86_cpudef_init() doesn't do anything anymore, cpudef_init(), cpudef_setup(), and x86_cpudef_init() can be finally removed. Signed-off-by: Eduardo Habkost --- arch_init.c | 7 ------- bsd-user/main.c | 3 --- include/sysemu/arch_init.h | 1 - linux-user/main.c | 3 --- target-i386/cpu.c | 4 ---- target-i386/cpu.h | 2 -- vl.c | 7 ------- 7 files changed, 27 deletions(-) (limited to 'include') diff --git a/arch_init.c b/arch_init.c index 07f047fad4..fa059731ed 100644 --- a/arch_init.c +++ b/arch_init.c @@ -274,13 +274,6 @@ void do_smbios_option(QemuOpts *opts) #endif } -void cpudef_init(void) -{ -#if defined(cpudef_setup) - cpudef_setup(); /* parse cpu definitions in target config file */ -#endif -} - int kvm_available(void) { #ifdef CONFIG_KVM diff --git a/bsd-user/main.c b/bsd-user/main.c index 8e338c7f22..9f592be96f 100644 --- a/bsd-user/main.c +++ b/bsd-user/main.c @@ -753,9 +753,6 @@ int main(int argc, char **argv) } cpu_model = NULL; -#if defined(cpudef_setup) - cpudef_setup(); /* parse cpu definitions in target config file (TBD) */ -#endif optind = 1; for(;;) { diff --git a/include/sysemu/arch_init.h b/include/sysemu/arch_init.h index c38892fec6..d690dfabdf 100644 --- a/include/sysemu/arch_init.h +++ b/include/sysemu/arch_init.h @@ -30,7 +30,6 @@ extern const uint32_t arch_type; void select_soundhw(const char *optarg); void do_acpitable_option(const QemuOpts *opts); void do_smbios_option(QemuOpts *opts); -void cpudef_init(void); void audio_init(void); int kvm_available(void); int xen_available(void); diff --git a/linux-user/main.c b/linux-user/main.c index ba38aed431..95ed11d85c 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -4154,9 +4154,6 @@ int main(int argc, char **argv, char **envp) } cpu_model = NULL; -#if defined(cpudef_setup) - cpudef_setup(); /* parse cpu definitions in target config file (TBD) */ -#endif srand(time(NULL)); diff --git a/target-i386/cpu.c b/target-i386/cpu.c index 14f64cb3b9..e615486596 100644 --- a/target-i386/cpu.c +++ b/target-i386/cpu.c @@ -2274,10 +2274,6 @@ void cpu_clear_apic_feature(CPUX86State *env) #endif /* !CONFIG_USER_ONLY */ -void x86_cpudef_setup(void) -{ -} - void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count, uint32_t *eax, uint32_t *ebx, uint32_t *ecx, uint32_t *edx) diff --git a/target-i386/cpu.h b/target-i386/cpu.h index a91d000407..cd26decaaf 100644 --- a/target-i386/cpu.h +++ b/target-i386/cpu.h @@ -1225,7 +1225,6 @@ X86CPU *cpu_x86_init(const char *cpu_model); X86CPU *cpu_x86_create(const char *cpu_model, Error **errp); int cpu_x86_exec(CPUState *cpu); void x86_cpu_list(FILE *f, fprintf_function cpu_fprintf); -void x86_cpudef_setup(void); int cpu_x86_support_mca_broadcast(CPUX86State *env); int cpu_get_pic_interrupt(CPUX86State *s); @@ -1403,7 +1402,6 @@ uint64_t cpu_get_tsc(CPUX86State *env); #define cpu_exec cpu_x86_exec #define cpu_signal_handler cpu_x86_signal_handler #define cpu_list x86_cpu_list -#define cpudef_setup x86_cpudef_setup /* MMU modes definitions */ #define MMU_MODE0_SUFFIX _ksmap diff --git a/vl.c b/vl.c index 2569dbb8d8..18d1423e57 100644 --- a/vl.c +++ b/vl.c @@ -4047,13 +4047,6 @@ int main(int argc, char **argv, char **envp) qemu_set_hw_version(machine_class->hw_version); } - /* Init CPU def lists, based on config - * - Must be called after all the qemu_read_config_file() calls - * - Must be called before list_cpus() - * - Must be called before machine_class->init() - */ - cpudef_init(); - if (cpu_model && is_help_option(cpu_model)) { list_cpus(stdout, &fprintf, cpu_model); exit(0); -- cgit v1.2.3-55-g7522