QOM CPUState patch queue 2012-09-21
Hello Anthony,
Please pull a small batch of CPUState-related patches towards x86 CPU hotplug and fixing some issues with alpha-linux-user.
The branch is mirrored on both GitHub and repo.or.cz for your convenience. :-)
Regards,
Andreas
P.S. Will be mostly offline throughout next week.
The following changes since commit c26032b2c91721245bfec542d94f37a0238e986e:
target-xtensa: don't emit extra tcg_gen_goto_tb (2012-09-21 03:07:27 +0400)
are available in the git repository at:
git://github.com/afaerber/qemu-cpu.git qom-cpu
for you to fetch changes up to eeed53faccb82e17d2a4f31705eb1c5719f6e614:
target-alpha: Make cpu_alpha_init() reentrant (2012-09-21 15:12:59 +0200)
----------------------------------------------------------------
Andreas Färber (2):
MAINTAINERS: Add entry for QOM CPU
target-i386: Drop unused setscalar() macro
Eduardo Habkost (5):
target-i386: Add missing CPUID_* constants
target-i386: Move CPU models from cpus-x86_64.conf to C Eliminate cpus-x86_64.conf file
target-i386: x86_cpudef_setup() coding style change
target-i386: Kill cpudef config section support
Peter Maydell (2):
target-i386: Fold -cpu ?cpuid, ?model output into -cpu help, drop ?dump Drop cpu_list_id macro
Richard Henderson (2):
target-alpha: Initialize env->cpu_model_str
target-alpha: Make cpu_alpha_init() reentrant
MAINTAINERS | 6 + Makefile | 1 - arch_init.c | 1 - cpus.c | 6 +- linux-user/main.c | 6 +- sysconfigs/target/cpus-x86_64.conf | 128 ----------- target-alpha/translate.c | 7 +- target-i386/cpu.c | 411 +++++++++++++++++++++--------------- target-i386/cpu.h | 26 ++- 9 Dateien geändert, 281 Zeilen hinzugefügt(+), 311 Zeilen entfernt(-) delete mode 100644 sysconfigs/target/cpus-x86_64.conf
PATCH 1/11 MAINTAINERS: Add entry for QOM CPU
--- MAINTAINERS | 6 ++++++
1 Datei geändert, 6 Zeilen hinzugefügt(+)
MAINTAINERS +6 -0
@@ -531,6 +531,12 @@ M: Anthony Liguori <[email protected]> S: Maintained F: qemu-char.c +CPU +M: Andreas Färber <[email protected]> +S: Supported +F: qom/cpu.c +F: include/qemu/cpu.h + Device Tree M: Peter Crosthwaite <[email protected]> M: Alexander Graf <[email protected]>
Signature · 1 line
1.7.10.4
PATCH 2/11 target-i386: Fold -cpu ?cpuid, ?model output into -cpu help, drop ?dump
In reply to Andreas FärberFrom: Peter Maydell <[email protected]>
Commit c8057f95 (accidentally) disabled the ability to pass option strings starting with '?' to the target-specific cpu_list function, so the target-i386 specific "-cpu ?dump", "-cpu ?cpuid" and "-cpu ?model" stopped working.
Since these options are undocumented and not used by libvirt, simply drop them completely rather than reinstating them with new style syntax. Instead, we fold the ?model and ?cpuid output into the output of the plain "-cpu help" output. The detailed output produced by ?dump is dropped.
--- target-i386/cpu.c | 64 +++++++++--------------------------------------------
1 Datei geändert, 11 Zeilen hinzugefügt(+), 53 Zeilen entfernt(-)
target-i386/cpu.c +11 -53
@@ -1073,70 +1073,28 @@ static void listflags(char *buf, int bufsize, uint32_t fbits, } } -/* generate CPU information: -* -? list model names -* -?model list model names/IDs -* -?dump output all model (x86_def_t) data -* -?cpuid list all recognized cpuid flag names -*/ +/* generate CPU information */ void x86_cpu_list (FILE *f,fprintf_function cpu_fprintf,const char *optarg) { -unsigned char model = !strcmp ("?model" , optarg); -unsigned char dump = !strcmp ("?dump" , optarg); -unsigned char cpuid = !strcmp ("?cpuid" , optarg);x86_def_t *def;char buf[256 ]; -if (cpuid) { - (*cpu_fprintf)(f,"Recognized CPUID flags:\n" ); -listflags (buf,sizeof (buf), (uint32_t )~0 , feature_name,1 ); - (*cpu_fprintf)(f," f_edx: %s\n" , buf); -listflags (buf,sizeof (buf), (uint32_t )~0 , ext_feature_name,1 ); - (*cpu_fprintf)(f," f_ecx: %s\n" , buf); -listflags (buf,sizeof (buf), (uint32_t )~0 , ext2_feature_name,1 ); - (*cpu_fprintf)(f," extf_edx: %s\n" , buf); -listflags (buf,sizeof (buf), (uint32_t )~0 , ext3_feature_name,1 ); - (*cpu_fprintf)(f," extf_ecx: %s\n" , buf); -return ; - }for (def = x86_defs; def; def = def->next) {snprintf (buf,sizeof (buf), def->flags ?"[%s]" :"%s" , def->name); -if (model || dump) { - (*cpu_fprintf)(f,"x86 %16s %-48s\n" , buf, def->model_id); - }else { - (*cpu_fprintf)(f,"x86 %16s\n" , buf); - } -if (dump) { -memcpy (buf, &def->vendor1,sizeof (def->vendor1)); -memcpy (buf +4 , &def->vendor2,sizeof (def->vendor2)); -memcpy (buf +8 , &def->vendor3,sizeof (def->vendor3)); - buf[12 ] ='\0' ; - (*cpu_fprintf)(f, -" family %d model %d stepping %d level %d xlevel 0x%x" -" vendor \"%s\"\n" , - def->family, def->model, def->stepping, def->level, - def->xlevel, buf); -listflags (buf,sizeof (buf), def->features, feature_name,0 ); - (*cpu_fprintf)(f," feature_edx %08x (%s)\n" , def->features, - buf); -listflags (buf,sizeof (buf), def->ext_features, ext_feature_name, -0 ); - (*cpu_fprintf)(f," feature_ecx %08x (%s)\n" , def->ext_features, - buf); -listflags (buf,sizeof (buf), def->ext2_features, ext2_feature_name, -0 ); - (*cpu_fprintf)(f," extfeature_edx %08x (%s)\n" , - def->ext2_features, buf); -listflags (buf,sizeof (buf), def->ext3_features, ext3_feature_name, -0 ); - (*cpu_fprintf)(f," extfeature_ecx %08x (%s)\n" , - def->ext3_features, buf); - (*cpu_fprintf)(f,"\n" ); - } + (*cpu_fprintf)(f,"x86 %16s %-48s\n" , buf, def->model_id); }if (kvm_enabled ()) { (*cpu_fprintf)(f,"x86 %16s\n" ,"[host]" ); } + (*cpu_fprintf)(f,"\nRecognized CPUID flags:\n" ); +listflags (buf,sizeof (buf), (uint32_t )~0 , feature_name,1 ); + (*cpu_fprintf)(f," f_edx: %s\n" , buf); +listflags (buf,sizeof (buf), (uint32_t )~0 , ext_feature_name,1 ); + (*cpu_fprintf)(f," f_ecx: %s\n" , buf); +listflags (buf,sizeof (buf), (uint32_t )~0 , ext2_feature_name,1 ); + (*cpu_fprintf)(f," extf_edx: %s\n" , buf); +listflags (buf,sizeof (buf), (uint32_t )~0 , ext3_feature_name,1 ); + (*cpu_fprintf)(f," extf_ecx: %s\n" , buf); }CpuDefinitionInfoList *arch_query_cpu_definitions (Error **errp)
Signature · 1 line
1.7.10.4
PATCH 3/11 Drop cpu_list_id macro
In reply to Andreas FärberFrom: Peter Maydell <[email protected]>
Since the only user of the extended cpu_list_id() format was the x86 ?model/?dump/?cpuid output, we can drop it completely.
--- cpus.c | 6 ++---- linux-user/main.c | 6 ++---- target-i386/cpu.c | 4 ++-- target-i386/cpu.h | 4 ++--
4 Dateien geändert, 8 Zeilen hinzugefügt(+), 12 Zeilen entfernt(-)
cpus.c +2 -4
@@ -1192,10 +1192,8 @@ void set_cpu_log_filename(const char *optarg)void list_cpus (FILE *f,fprintf_function cpu_fprintf,const char *optarg) {/* XXX: implement xxx_cpu_list for targets that still miss it */ -#if defined(cpu_list_id) -cpu_list_id (f, cpu_fprintf, optarg); -#elif defined(cpu_list) -cpu_list (f, cpu_fprintf);/* deprecated */ +#if defined(cpu_list) +cpu_list (f, cpu_fprintf);#endif }
linux-user/main.c +2 -4
@@ -3130,10 +3130,8 @@ static void handle_arg_cpu(const char *arg) cpu_model =strdup (arg);if (cpu_model ==NULL ||is_help_option (cpu_model)) {/* XXX: implement xxx_cpu_list for targets that still miss it */ -#if defined(cpu_list_id) -cpu_list_id (stdout, &fprintf,"" ); -#elif defined(cpu_list) -cpu_list (stdout, &fprintf);/* deprecated */ +#if defined(cpu_list) +cpu_list (stdout, &fprintf);#endif exit (1 ); }
target-i386/cpu.c +2 -2
@@ -1073,8 +1073,8 @@ static void listflags(char *buf, int bufsize, uint32_t fbits, } } -/* generate CPU information */ -void x86_cpu_list (FILE *f,fprintf_function cpu_fprintf,const char *optarg) +/* generate CPU information. */ +void x86_cpu_list (FILE *f,fprintf_function cpu_fprintf) {x86_def_t *def;char buf[256 ];
target-i386/cpu.h +2 -2
@@ -792,7 +792,7 @@ typedef struct CPUX86State {X86CPU *cpu_x86_init (const char *cpu_model);int cpu_x86_exec (CPUX86State *s); -void x86_cpu_list (FILE *f,fprintf_function cpu_fprintf,const char *optarg); +void x86_cpu_list (FILE *f,fprintf_function cpu_fprintf);void x86_cpudef_setup (void );int cpu_x86_support_mca_broadcast (CPUX86State *env);
@@ -976,7 +976,7 @@ static inline CPUX86State *cpu_init(const char *cpu_model)#define cpu_exec cpu_x86_exec#define cpu_gen_code cpu_x86_gen_code#define cpu_signal_handler cpu_x86_signal_handler -#define cpu_list_id x86_cpu_list +#define cpu_list x86_cpu_list#define cpudef_setup x86_cpudef_setup#define CPU_SAVE_VERSION 12
Signature · 1 line
1.7.10.4
PATCH 4/11 target-i386: Add missing CPUID_* constants
In reply to Andreas FärberFrom: Eduardo Habkost <[email protected]>
Those constants will be used by new CPU model definitions.
--- target-i386/cpu.h | 22 ++++++++++++++++++++++
1 Datei geändert, 22 Zeilen hinzugefügt(+)
target-i386/cpu.h +22 -0
@@ -382,6 +382,7 @@#define CPUID_PBE (1 << 31)#define CPUID_EXT_SSE3 (1 << 0) +#define CPUID_EXT_PCLMULQDQ (1 << 1)#define CPUID_EXT_DTES64 (1 << 2)#define CPUID_EXT_MONITOR (1 << 3)#define CPUID_EXT_DSCPL (1 << 4)
@@ -401,14 +402,33 @@#define CPUID_EXT_MOVBE (1 << 22)#define CPUID_EXT_POPCNT (1 << 23)#define CPUID_EXT_TSC_DEADLINE_TIMER (1 << 24) +#define CPUID_EXT_AES (1 << 25)#define CPUID_EXT_XSAVE (1 << 26)#define CPUID_EXT_OSXSAVE (1 << 27) +#define CPUID_EXT_AVX (1 << 28)#define CPUID_EXT_HYPERVISOR (1 << 31) +#define CPUID_EXT2_FPU (1 << 0) +#define CPUID_EXT2_DE (1 << 2) +#define CPUID_EXT2_PSE (1 << 3) +#define CPUID_EXT2_TSC (1 << 4) +#define CPUID_EXT2_MSR (1 << 5) +#define CPUID_EXT2_PAE (1 << 6) +#define CPUID_EXT2_MCE (1 << 7) +#define CPUID_EXT2_CX8 (1 << 8) +#define CPUID_EXT2_APIC (1 << 9)#define CPUID_EXT2_SYSCALL (1 << 11) +#define CPUID_EXT2_MTRR (1 << 12) +#define CPUID_EXT2_PGE (1 << 13) +#define CPUID_EXT2_MCA (1 << 14) +#define CPUID_EXT2_CMOV (1 << 15) +#define CPUID_EXT2_PAT (1 << 16) +#define CPUID_EXT2_PSE36 (1 << 17)#define CPUID_EXT2_MP (1 << 19)#define CPUID_EXT2_NX (1 << 20)#define CPUID_EXT2_MMXEXT (1 << 22) +#define CPUID_EXT2_MMX (1 << 23) +#define CPUID_EXT2_FXSR (1 << 24)#define CPUID_EXT2_FFXSR (1 << 25)#define CPUID_EXT2_PDPE1GB (1 << 26)#define CPUID_EXT2_RDTSCP (1 << 27)
@@ -427,7 +447,9 @@#define CPUID_EXT3_3DNOWPREFETCH (1 << 8)#define CPUID_EXT3_OSVW (1 << 9)#define CPUID_EXT3_IBS (1 << 10) +#define CPUID_EXT3_XOP (1 << 11)#define CPUID_EXT3_SKINIT (1 << 12) +#define CPUID_EXT3_FMA4 (1 << 16)#define CPUID_SVM_NPT (1 << 0)#define CPUID_SVM_LBRV (1 << 1)
Signature · 1 line
1.7.10.4
PATCH 5/11 target-i386: Move CPU models from cpus-x86_64.conf to C
In reply to Andreas FärberFrom: Eduardo Habkost <[email protected]>
Those models are maintained by QEMU and may require compatibility code to be added when making some changes. Keeping the data in the C source code should make it simpler to handle those details.
--- sysconfigs/target/cpus-x86_64.conf | 129 +-------------------- target-i386/cpu.c | 219 ++++++++++++++++++++++++++++++++++++
2 Dateien geändert, 220 Zeilen hinzugefügt(+), 128 Zeilen entfernt(-)
sysconfigs/target/cpus-x86_64.conf +1 -128
@@ -1,128 +1 @@ -# x86 CPU MODELS - -[cpudef] - name = "Conroe" - level = "2" - vendor = "GenuineIntel" - family = "6" - model = "2" - stepping = "3" - feature_edx = "sse2 sse fxsr mmx clflush pse36 pat cmov mca pge mtrr sep apic cx8 mce pae msr tsc pse de fpu" - feature_ecx = "ssse3 sse3" - extfeature_edx = "i64 xd syscall" - extfeature_ecx = "lahf_lm" - xlevel = "0x8000000A" - model_id = "Intel Celeron_4x0 (Conroe/Merom Class Core 2)" - -[cpudef] - name = "Penryn" - level = "2" - vendor = "GenuineIntel" - family = "6" - model = "2" - stepping = "3" - feature_edx = "sse2 sse fxsr mmx clflush pse36 pat cmov mca pge mtrr sep apic cx8 mce pae msr tsc pse de fpu" - feature_ecx = "sse4.1 cx16 ssse3 sse3" - extfeature_edx = "i64 xd syscall" - extfeature_ecx = "lahf_lm" - xlevel = "0x8000000A" - model_id = "Intel Core 2 Duo P9xxx (Penryn Class Core 2)" - -[cpudef] - name = "Nehalem" - level = "2" - vendor = "GenuineIntel" - family = "6" - model = "2" - stepping = "3" - feature_edx = "sse2 sse fxsr mmx clflush pse36 pat cmov mca pge mtrr sep apic cx8 mce pae msr tsc pse de fpu" - feature_ecx = "popcnt sse4.2 sse4.1 cx16 ssse3 sse3" - extfeature_edx = "i64 syscall xd" - extfeature_ecx = "lahf_lm" - xlevel = "0x8000000A" - model_id = "Intel Core i7 9xx (Nehalem Class Core i7)" - -[cpudef] - name = "Westmere" - level = "11" - vendor = "GenuineIntel" - family = "6" - model = "44" - stepping = "1" - feature_edx = "sse2 sse fxsr mmx clflush pse36 pat cmov mca pge mtrr sep apic cx8 mce pae msr tsc pse de fpu" - feature_ecx = "aes popcnt sse4.2 sse4.1 cx16 ssse3 sse3" - extfeature_edx = "i64 syscall xd" - extfeature_ecx = "lahf_lm" - xlevel = "0x8000000A" - model_id = "Westmere E56xx/L56xx/X56xx (Nehalem-C)" - -[cpudef] - name = "SandyBridge" - level = "0xd" - vendor = "GenuineIntel" - family = "6" - model = "42" - stepping = "1" - feature_edx = " sse2 sse fxsr mmx clflush pse36 pat cmov mca pge mtrr sep apic cx8 mce pae msr tsc pse de fpu" - feature_ecx = "avx xsave aes tsc-deadline popcnt x2apic sse4.2 sse4.1 cx16 ssse3 pclmulqdq sse3" - extfeature_edx = "i64 rdtscp nx syscall " - extfeature_ecx = "lahf_lm" - xlevel = "0x8000000A" - model_id = "Intel Xeon E312xx (Sandy Bridge)" - -[cpudef] - name = "Opteron_G1" - level = "5" - vendor = "AuthenticAMD" - family = "15" - model = "6" - stepping = "1" - feature_edx = "sse2 sse fxsr mmx clflush pse36 pat cmov mca pge mtrr sep apic cx8 mce pae msr tsc pse de fpu" - feature_ecx = "sse3" - extfeature_edx = "lm fxsr mmx nx pse36 pat cmov mca pge mtrr syscall apic cx8 mce pae msr tsc pse de fpu" - extfeature_ecx = " " - xlevel = "0x80000008" - model_id = "AMD Opteron 240 (Gen 1 Class Opteron)" - -[cpudef] - name = "Opteron_G2" - level = "5" - vendor = "AuthenticAMD" - family = "15" - model = "6" - stepping = "1" - feature_edx = "sse2 sse fxsr mmx clflush pse36 pat cmov mca pge mtrr sep apic cx8 mce pae msr tsc pse de fpu" - feature_ecx = "cx16 sse3" - extfeature_edx = "lm rdtscp fxsr mmx nx pse36 pat cmov mca pge mtrr syscall apic cx8 mce pae msr tsc pse de fpu" - extfeature_ecx = "svm lahf_lm" - xlevel = "0x80000008" - model_id = "AMD Opteron 22xx (Gen 2 Class Opteron)" - -[cpudef] - name = "Opteron_G3" - level = "5" - vendor = "AuthenticAMD" - family = "15" - model = "6" - stepping = "1" - feature_edx = "sse2 sse fxsr mmx clflush pse36 pat cmov mca pge mtrr sep apic cx8 mce pae msr tsc pse de fpu" - feature_ecx = "popcnt cx16 monitor sse3" - extfeature_edx = "lm rdtscp fxsr mmx nx pse36 pat cmov mca pge mtrr syscall apic cx8 mce pae msr tsc pse de fpu" - extfeature_ecx = "misalignsse sse4a abm svm lahf_lm" - xlevel = "0x80000008" - model_id = "AMD Opteron 23xx (Gen 3 Class Opteron)" - -[cpudef] - name = "Opteron_G4" - level = "0xd" - vendor = "AuthenticAMD" - family = "21" - model = "1" - stepping = "2" - feature_edx = "sse2 sse fxsr mmx clflush pse36 pat cmov mca pge mtrr sep apic cx8 mce pae msr tsc pse de fpu" - feature_ecx = "avx xsave aes popcnt sse4.2 sse4.1 cx16 ssse3 pclmulqdq sse3" - extfeature_edx = "lm rdtscp pdpe1gb fxsr mmx nx pse36 pat cmov mca pge mtrr syscall apic cx8 mce pae msr tsc pse de fpu" - extfeature_ecx = " fma4 xop 3dnowprefetch misalignsse sse4a abm svm lahf_lm" - xlevel = "0x8000001A" - model_id = "AMD Opteron 62xx class CPU" - +# The CPU models from this file are now built-in in the QEMU source code
target-i386/cpu.c +219 -0
225 lines not on this page · raw message
Signature · 1 line
1.7.10.4
PATCH 6/11 Eliminate cpus-x86_64.conf file
In reply to Andreas FärberFrom: Eduardo Habkost <[email protected]>
This file is not needed anymore, as QEMU won't ship any config-based cpudefs out of the box, relying only on the builtin CPU models.
--- Makefile | 1 - arch_init.c | 1 - sysconfigs/target/cpus-x86_64.conf | 1 - 3 Dateien geändert, 3 Zeilen entfernt(-) delete mode 100644 sysconfigs/target/cpus-x86_64.conf
Makefile +0 -1
@@ -298,7 +298,6 @@ install-confdir: install-sysconfig: install-datadir install-confdir $(INSTALL_DATA) $(SRC_PATH)/sysconfigs/target/target-x86_64.conf "$(DESTDIR)$(qemu_confdir)" - $(INSTALL_DATA) $(SRC_PATH)/sysconfigs/target/cpus-x86_64.conf "$(DESTDIR)$(qemu_datadir)" install: all $(if $(BUILD_DOCS),install-doc) install-sysconfig install-datadir $(INSTALL_DIR) "$(DESTDIR)$(bindir)"
arch_init.c +0 -1
@@ -136,7 +136,6 @@ static struct defconfig_file {/* Indicates it is an user config file (disabled by -no-user-config) */ bool userconfig; } default_config_files[] = { - { CONFIG_QEMU_DATADIR "/cpus-" TARGET_ARCH ".conf", false }, { CONFIG_QEMU_CONFDIR "/qemu.conf", true }, { CONFIG_QEMU_CONFDIR "/target-" TARGET_ARCH ".conf", true }, { NULL }, /* end of list */
sysconfigs/target/cpus-x86_64.conf deleted +0 -1
@@ -1 +0,0 @@ -# The CPU models from this file are now built-in in the QEMU source code
Signature · 1 line
1.7.10.4
PATCH 7/11 target-i386: x86_cpudef_setup() coding style change
In reply to Andreas FärberFrom: Eduardo Habkost <[email protected]>
Make source code lines shorter.
--- target-i386/cpu.c | 15 +++++++++------
1 Datei geändert, 9 Zeilen hinzugefügt(+), 6 Zeilen entfernt(-)
target-i386/cpu.c +9 -6
@@ -1513,20 +1513,23 @@ void x86_cpudef_setup(void)static const char *model_with_versions[] = {"qemu32" ,"qemu64" ,"athlon" };for (i =0 ; i <ARRAY_SIZE (builtin_x86_defs); ++i) { - builtin_x86_defs[i].next = x86_defs; - builtin_x86_defs[i].flags =1 ; +x86_def_t *def = &builtin_x86_defs[i]; + def->next = x86_defs; + def->flags =1 ;/* Look for specific "cpudef" models that */ /* have the QEMU version in .model_id */ for (j =0 ; j <ARRAY_SIZE (model_with_versions); j++) { -if (strcmp (model_with_versions[j], builtin_x86_defs[i].name) ==0 ) { -pstrcpy (builtin_x86_defs[i].model_id,sizeof (builtin_x86_defs[i].model_id),"QEMU Virtual CPU version " ); -pstrcat (builtin_x86_defs[i].model_id,sizeof (builtin_x86_defs[i].model_id),qemu_get_version ()); +if (strcmp (model_with_versions[j], def->name) ==0 ) { +pstrcpy (def->model_id,sizeof (def->model_id), +"QEMU Virtual CPU version " ); +pstrcat (def->model_id,sizeof (def->model_id), +qemu_get_version ());break ; } } - x86_defs = &builtin_x86_defs[i]; + x86_defs = def; }#if !defined(CONFIG_USER_ONLY )qemu_opts_foreach (qemu_find_opts ("cpudef" ), cpudef_register,NULL ,0 );
Signature · 1 line
1.7.10.4
PATCH 8/11 target-i386: Kill cpudef config section support
In reply to Andreas FärberFrom: Eduardo Habkost <[email protected]>
It's nice to have a flexible system to maintain CPU models as data, but this is holding us from making improvements in the CPU code because it's not using the common infra-structure, and because the machine-type data is still inside C code.
Users who want to configure CPU features directly may simply use the "-cpu" command-line option (and maybe an equivalent -device option in the future) to set CPU features.
--- target-i386/cpu.c | 101 ++---------------------------------------------------
1 Datei geändert, 2 Zeilen hinzugefügt(+), 99 Zeilen entfernt(-)
target-i386/cpu.c +2 -99
@@ -240,7 +240,6 @@ typedef struct x86_def_t {uint32_t xlevel;char model_id[48 ];int vendor_override; -uint32_t flags;/* Store the results of Centaur's CPUID instructions */ uint32_t ext4_features;uint32_t xlevel2;
@@ -1299,7 +1298,7 @@ void x86_cpu_list(FILE *f, fprintf_function cpu_fprintf)char buf[256 ];for (def = x86_defs; def; def = def->next) { -snprintf (buf,sizeof (buf), def->flags ?"[%s]" :"%s" , def->name); +snprintf (buf,sizeof (buf),"%s" , def->name); (*cpu_fprintf)(f,"x86 %16s %-48s\n" , buf, def->model_id); }if (kvm_enabled ()) {
@@ -1393,16 +1392,6 @@ int cpu_x86_register(X86CPU *cpu, const char *cpu_model) }#if !defined(CONFIG_USER_ONLY ) -/* copy vendor id string to 32 bit register, nul pad as needed -*/ -static void cpyid (const char *s,uint32_t *id) -{ -char *d = (char *)id; -char i; - -for (i =sizeof (*id); i--; ) - *d++ = *s ? *s++ :'\0' ; -}/* interpret radix and convert from string to arbitrary scalar, * otherwise flag failure
@@ -1416,87 +1405,6 @@ static void cpyid(const char *s, uint32_t *id) *str && !*pend ? (*pval = ul) : (*perr =1 ); \ } -/* map cpuid options to feature bits, otherwise return failure -* (option tags in *str are delimited by whitespace) -*/ -static void setfeatures (uint32_t *pval,const char *str, -const char **featureset,int *perr) -{ -const char *p, *q; - -for (q = p = str; *p || *q; q = p) { -while (iswhite (*p)) - q = ++p; -while (*p && !iswhite (*p)) - ++p; -if (!*q && !*p) -return ; -if (!lookup_feature (pval, q, p, featureset)) { -fprintf (stderr,"error: feature \"%.*s\" not available in set\n" , - (int )(p - q), q); - *perr =1 ; -return ; - } - } -} - -/* map config file options to x86_def_t form -*/ -static int cpudef_setfield (const char *name,const char *str,void *opaque) -{ -x86_def_t *def = opaque; -int err =0 ; - -if (!strcmp (name,"name" )) { -g_free ((void *)def->name); - def->name =g_strdup (str); - }else if (!strcmp (name,"model_id" )) { -strncpy (def->model_id, str,sizeof (def->model_id)); - }else if (!strcmp (name,"level" )) { - setscalar(&def->level, str, &err) - }else if (!strcmp (name,"vendor" )) { -cpyid (&str[0 ], &def->vendor1); -cpyid (&str[4 ], &def->vendor2); -cpyid (&str[8 ], &def->vendor3); - }else if (!strcmp (name,"family" )) { - setscalar(&def->family, str, &err) - }else if (!strcmp (name,"model" )) { - setscalar(&def->model, str, &err) - }else if (!strcmp (name,"stepping" )) { - setscalar(&def->stepping, str, &err) - }else if (!strcmp (name,"feature_edx" )) { -setfeatures (&def->features, str, feature_name, &err); - }else if (!strcmp (name,"feature_ecx" )) { -setfeatures (&def->ext_features, str, ext_feature_name, &err); - }else if (!strcmp (name,"extfeature_edx" )) { -setfeatures (&def->ext2_features, str, ext2_feature_name, &err); - }else if (!strcmp (name,"extfeature_ecx" )) { -setfeatures (&def->ext3_features, str, ext3_feature_name, &err); - }else if (!strcmp (name,"xlevel" )) { - setscalar(&def->xlevel, str, &err) - }else { -fprintf (stderr,"error: unknown option [%s = %s]\n" , name, str); -return (1 ); - } -if (err) { -fprintf (stderr,"error: bad option value [%s = %s]\n" , name, str); -return (1 ); - } -return (0 ); -} - -/* register config file entry as x86_def_t -*/ -static int cpudef_register (QemuOpts *opts,void *opaque) -{ -x86_def_t *def =g_malloc0 (sizeof (x86_def_t)); - -qemu_opt_foreach (opts, cpudef_setfield, def,1 ); - def->next = x86_defs; - x86_defs = def; -return (0 ); -} -void cpu_clear_apic_feature (CPUX86State *env) { env->cpuid_features &= ~CPUID_APIC ;
@@ -1504,8 +1412,7 @@ void cpu_clear_apic_feature(CPUX86State *env)#endif /* !CONFIG_USER_ONLY */ -/* register "cpudef" models defined in configuration file. Here we first -* preload any built-in definitions +/* Initialize list of CPU models, filling some non-static fields if necessary */ void x86_cpudef_setup (void ) {
@@ -1515,7 +1422,6 @@ void x86_cpudef_setup(void)for (i =0 ; i <ARRAY_SIZE (builtin_x86_defs); ++i) {x86_def_t *def = &builtin_x86_defs[i]; def->next = x86_defs; - def->flags =1 ;/* Look for specific "cpudef" models that */ /* have the QEMU version in .model_id */
@@ -1531,9 +1437,6 @@ void x86_cpudef_setup(void) x86_defs = def; } -#if !defined(CONFIG_USER_ONLY ) -qemu_opts_foreach (qemu_find_opts ("cpudef" ), cpudef_register,NULL ,0 ); -#endif } static void get_cpuid_vendor(CPUX86State *env, uint32_t *ebx,
Signature · 1 line
1.7.10.4
PATCH 9/11 target-i386: Drop unused setscalar() macro
In reply to Andreas FärberIt was only used by now removed setfeatures() function.
--- target-i386/cpu.c | 12 ------------
1 Datei geändert, 12 Zeilen entfernt(-)
target-i386/cpu.c +0 -12
@@ -1393,18 +1393,6 @@ int cpu_x86_register(X86CPU *cpu, const char *cpu_model)#if !defined(CONFIG_USER_ONLY ) -/* interpret radix and convert from string to arbitrary scalar, -* otherwise flag failure -*/ -#define setscalar (pval, str, perr) \ -{ \ - char *pend; \ - unsigned long ul; \ - \ - ul = strtoul(str, &pend, 0); \ - *str && !*pend ? (*pval = ul) : (*perr = 1); \ -} -void cpu_clear_apic_feature (CPUX86State *env) { env->cpuid_features &= ~CPUID_APIC ;
Signature · 1 line
1.7.10.4
PATCH 10/11 target-alpha: Initialize env->cpu_model_str
In reply to Andreas FärberFrom: Richard Henderson <[email protected]>
Save the cpu_model_str so that we have a non-null value when creating a new cpu during clone.
--- target-alpha/translate.c | 1 +
1 Datei geändert, 1 Zeile hinzugefügt(+)
target-alpha/translate.c +1 -0
@@ -3549,6 +3549,7 @@ CPUAlphaState * cpu_alpha_init (const char *cpu_model) } env->implver = implver; env->amask = amask; + env->cpu_model_str = cpu_model;qemu_init_vcpu (env);return env;
Signature · 1 line
1.7.10.4
PATCH 11/11 target-alpha: Make cpu_alpha_init() reentrant
In reply to Andreas FärberFrom: Richard Henderson <[email protected]>
Guard against duplicate TCG initialization, triggered by linux-user NPTL emulation.
--- target-alpha/translate.c | 6 +++++-
1 Datei geändert, 5 Zeilen hinzugefügt(+), 1 Zeile entfernt(-)
target-alpha/translate.c +5 -1
@@ -3525,6 +3525,7 @@ static const struct cpu_def_t cpu_defs[] = {CPUAlphaState *cpu_alpha_init (const char *cpu_model) { +static bool inited;AlphaCPU *cpu;CPUAlphaState *env;int implver, amask, i, max;
@@ -3532,7 +3533,10 @@ CPUAlphaState * cpu_alpha_init (const char *cpu_model) cpu =ALPHA_CPU (object_new (TYPE_ALPHA_CPU )); env = &cpu->env; -alpha_translate_init (); +if (!inited) { + inited = true; +alpha_translate_init (); + }/* Default to ev67; no reason not to emulate insns by default. */ implver =IMPLVER_21264 ;
Signature · 1 line
1.7.10.4
Re: [Qemu-devel] [PATCH 11/11] target-alpha: Make cpu_alpha_init() reentrant
Quoted 8 lines · Andreas Färber
From: Richard Henderson <[email protected]>
Guard against duplicate TCG initialization, triggered by linux-user NPTL emulation.
Signed-off-by Richard Henderson <[email protected]>[AF: Split off into separate patch]Signed-off-by Andreas Färber <[email protected]>
Not needed, it turns out. There's an init check inside alpha_translate_init.
r~
Re: [Qemu-devel] [PATCH 11/11] target-alpha: Make cpu_alpha_init() reentrant
Am 21.09.2012 17:19, schrieb Richard Henderson:
Quoted 11 lines · Andreas Färber
Quoted 8 lines
From: Richard Henderson <[email protected]>
Guard against duplicate TCG initialization, triggered by linux-user NPTL emulation.
Signed-off-by Richard Henderson <[email protected]>[AF: Split off into separate patch]Signed-off-by Andreas Färber <[email protected]>Not needed, it turns out. There's an init check inside
alpha_translate_init.
Dropped from branches.
Thanks and sorry for not noticing myself,
/F
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
Quoted 7 lines · Andreas Färber
Hello Anthony,
Please pull a small batch of CPUState-related patches towards x86 CPU hotplug and fixing some issues with alpha-linux-user.
The branch is mirrored on both GitHub and repo.or.cz for your convenience. :-)
Thank you! repo.or.cz tends to be not responsive 30% of the time I try to merge pull requests. I would strongly recommend people use other hosting providers.
Quoted 4 lines
Regards,
Andreas
P.S. Will be mostly offline throughout next week.
Thanks for the heads up. Enjoy your holiday!
Regards,
Anthony Liguori
Quoted 52 lines
Cc Anthony Liguori <[email protected]>Cc Eduardo Habkost <[email protected]>Cc Igor Mammedov <[email protected]>Cc Don Slutz <[email protected]>Cc Richard Henderson <[email protected]>The following changes since commit
c26032b2c91721245bfec542d94f37a0238e986e:target-xtensa: don't emit extra
tcg_gen_goto_tb(2012-09-21 03:07:27 +0400)are available in the git repository at:
git://github.com/afaerber/qemu-cpu.gitqom-cpufor you to fetch changes up to
eeed53faccb82e17d2a4f31705eb1c5719f6e614:target-alpha: Make
cpu_alpha_init()reentrant (2012-09-21 15:12:59 +0200)----------------------------------------------------------------
Andreas Färber (2):
MAINTAINERS: Add entry for QOM CPU
target-i386: Drop unusedsetscalar()macroEduardo Habkost (5):
target-i386: Add missing CPUID_* constants
target-i386: Move CPU models from cpus-x86_64.conf to C Eliminate cpus-x86_64.conf file
target-i386:x86_cpudef_setup()coding style change
target-i386: Kill cpudef config section supportPeter Maydell (2):
target-i386: Fold -cpu ?cpuid, ?model output into -cpu help, drop ?dump Dropcpu_list_idmacroRichard Henderson (2):
target-alpha: Initializeenv->cpu_model_str
target-alpha: Makecpu_alpha_init()reentrantMAINTAINERS | 6 + Makefile | 1 - arch_init.c | 1 - cpus.c | 6 +- linux-user/main.c | 6 +- sysconfigs/target/cpus-x86_64.conf | 128 ----------- target-alpha/translate.c | 7 +- target-i386/cpu.c | 411 +++++++++++++++++++++--------------- target-i386/cpu.h | 26 ++- 9 Dateien geändert, 281 Zeilen hinzugefügt(+), 311 Zeilen entfernt(-) delete mode 100644 sysconfigs/target/cpus-x86_64.conf
Am 21.09.2012 16:38, schrieb Andreas Färber:
Quoted 9 lines
Hello Anthony,
Please pull a small batch of CPUState-related patches towards x86 CPU hotplug and fixing some issues with alpha-linux-user.
The branch is mirrored on both GitHub and repo.or.cz for your convenience. :-)
Regards,
Andreas
Updated:
The following changes since commit c26032b2c91721245bfec542d94f37a0238e986e:
target-xtensa: don't emit extra tcg_gen_goto_tb (2012-09-21 03:07:27
+0400)
are available in the git repository at:
git://github.com/afaerber/qemu-cpu.git qom-cpu
for you to fetch changes up to 2b85cf0efd81a6190320e7b488a0a4bad9743cc3:
target-alpha: Initialize env->cpu_model_str (2012-09-21 15:12:59 +0200)
----------------------------------------------------------------
Andreas Färber (2):
MAINTAINERS: Add entry for QOM CPU
target-i386: Drop unused setscalar() macro
Eduardo Habkost (5):
target-i386: Add missing CPUID_* constants
target-i386: Move CPU models from cpus-x86_64.conf to C Eliminate cpus-x86_64.conf file
target-i386: x86_cpudef_setup() coding style change
target-i386: Kill cpudef config section support
Peter Maydell (2):
target-i386: Fold -cpu ?cpuid, ?model output into -cpu help, drop
?dump
Drop cpu_list_id macro
Richard Henderson (1):
target-alpha: Initialize env->cpu_model_str
MAINTAINERS | 6 + Makefile | 1 - arch_init.c | 1 - cpus.c | 6 +- linux-user/main.c | 6 +- sysconfigs/target/cpus-x86_64.conf | 128 ----------- target-alpha/translate.c | 1 + target-i386/cpu.c | 411 +++++++++++++++++++++--------------- target-i386/cpu.h | 26 ++- 9 Dateien geändert, 276 Zeilen hinzugefügt(+), 310 Zeilen entfernt(-) delete mode 100644 sysconfigs/target/cpus-x86_64.conf
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
Quoted 11 lines · Andreas Färber
Hello Anthony,
Please pull a small batch of CPUState-related patches towards x86 CPU hotplug and fixing some issues with alpha-linux-user.
The branch is mirrored on both GitHub and repo.or.cz for your convenience. :-)
Regards,
Andreas
P.S. Will be mostly offline throughout next week.
Pulled. Thanks.
Regards,
Anthony Liguori
Quoted 52 lines
Cc Anthony Liguori <[email protected]>Cc Eduardo Habkost <[email protected]>Cc Igor Mammedov <[email protected]>Cc Don Slutz <[email protected]>Cc Richard Henderson <[email protected]>The following changes since commit
c26032b2c91721245bfec542d94f37a0238e986e:target-xtensa: don't emit extra
tcg_gen_goto_tb(2012-09-21 03:07:27 +0400)are available in the git repository at:
git://github.com/afaerber/qemu-cpu.gitqom-cpufor you to fetch changes up to
eeed53faccb82e17d2a4f31705eb1c5719f6e614:target-alpha: Make
cpu_alpha_init()reentrant (2012-09-21 15:12:59 +0200)----------------------------------------------------------------
Andreas Färber (2):
MAINTAINERS: Add entry for QOM CPU
target-i386: Drop unusedsetscalar()macroEduardo Habkost (5):
target-i386: Add missing CPUID_* constants
target-i386: Move CPU models from cpus-x86_64.conf to C Eliminate cpus-x86_64.conf file
target-i386:x86_cpudef_setup()coding style change
target-i386: Kill cpudef config section supportPeter Maydell (2):
target-i386: Fold -cpu ?cpuid, ?model output into -cpu help, drop ?dump Dropcpu_list_idmacroRichard Henderson (2):
target-alpha: Initializeenv->cpu_model_str
target-alpha: Makecpu_alpha_init()reentrantMAINTAINERS | 6 + Makefile | 1 - arch_init.c | 1 - cpus.c | 6 +- linux-user/main.c | 6 +- sysconfigs/target/cpus-x86_64.conf | 128 ----------- target-alpha/translate.c | 7 +- target-i386/cpu.c | 411 +++++++++++++++++++++--------------- target-i386/cpu.h | 26 ++- 9 Dateien geändert, 281 Zeilen hinzugefügt(+), 311 Zeilen entfernt(-) delete mode 100644 sysconfigs/target/cpus-x86_64.conf