QOM CPUState patch queue 2012-12-06
Hello,
This is my current QOM CPU patch queue. Please pull.
Regards,
Andreas
The following changes since commit 19e6c50d2d843220efbdd3b2db21d83c122c364a:
target-mips: Fix incorrect shift for SHILO and SHILOV (2012-12-06 08:12:14 +0100)
are available in the git repository at:
git://github.com/afaerber/qemu-cpu.git qom-cpu
for you to fetch changes up to d7f57a46d07c0a72295a56704ab0fecefb2aaea8:
target-i386: Postpone cpuid_level update to realize time (2012-12-06 09:17:06 +0100)
----------------------------------------------------------------
Eduardo Habkost (11):
user: Move *-user/qemu-types.h to main directory
user: Rename qemu-types.h to qemu-user-types.h ui/vnc-palette.c: Include headers it needs qapi/qmp-registry.c: Include headers it needs qga/channel-posix.c: Include headers it needs
qlist.h: Do not include qemu-common.h
Create qemu-types.h for struct typedefs
sysemu.h: Include qemu-types.h instead of qemu-common.h
qdev: qdev_create(): use error_report() instead of hw_error() target-i386/cpu.c: Coding style fixes
target-i386: Separate feature string parsing from CPU model lookup
Igor Mammedov (2):
target-i386: Use define for cpuid vendor string size
target-i386: Postpone cpuid_level update to realize time
bsd-user/qemu-types.h | 24 ------- bsd-user/qemu.h | 2 +- cpu-all.h | 2 +- hw/qdev-core.h | 11 +-- hw/qdev.c | 8 ++- linux-user/qemu.h | 2 +- qapi/qmp-registry.c | 2 + qemu-common.h | 52 +------------- qemu-types.h | 61 ++++++++++++++++ linux-user/qemu-types.h => qemu-user-types.h | 0 qga/channel-posix.c | 5 ++ qlist.h | 1 - sysemu.h | 2 +- target-i386/cpu.c | 100 ++++++++++++++++---------- target-i386/cpu.h | 2 + ui/vnc-palette.c | 2 + 16 Dateien geändert, 144 Zeilen hinzugefügt(+), 132 Zeilen entfernt(-) delete mode 100644 bsd-user/qemu-types.h create mode 100644 qemu-types.h rename linux-user/qemu-types.h => qemu-user-types.h (100%)
PATCH 1/13 user: Move *-user/qemu-types.h to main directory
From: Eduardo Habkost <[email protected]>
The bsd-user/qemu-types.h and linux-user/qemu-types.h files are almost the same, but linux-user has the additional definitions of tswapal().
This moves the linux-user file to the main directory, so the same file can be used by linux-user and bsd-user.
--- bsd-user/qemu-types.h | 24 ------------------------ linux-user/qemu-types.h => qemu-types.h | 0 2 Dateien geändert, 24 Zeilen entfernt(-) delete mode 100644 bsd-user/qemu-types.h rename linux-user/qemu-types.h => qemu-types.h (100%)
bsd-user/qemu-types.h deleted +0 -24
@@ -1,24 +0,0 @@ -#ifndef QEMU_TYPES_H -#define QEMU_TYPES_H -#include "cpu.h" - -#ifdef TARGET_ABI32 -typedef uint32_t abi_ulong ; -typedef int32_t abi_long ; -#define TARGET_ABI_FMT_lx "%08x" -#define TARGET_ABI_FMT_ld "%d" -#define TARGET_ABI_FMT_lu "%u" -#define TARGET_ABI_BITS 32 -#else -typedef target_ulong abi_ulong ; -typedef target_long abi_long ; -#define TARGET_ABI_FMT_lx TARGET_FMT_lx -#define TARGET_ABI_FMT_ld TARGET_FMT_ld -#define TARGET_ABI_FMT_lu TARGET_FMT_lu -#define TARGET_ABI_BITS TARGET_LONG_BITS -/* for consistency, define ABI32 too */ -#if TARGET_ABI_BITS ==32 -#define TARGET_ABI32 1 -#endif -#endif -#endif
qemu-types.h renamed from linux-user/qemu-types.h +0 -0
Signature · 1 line
1.7.10.4
PATCH 2/13 user: Rename qemu-types.h to qemu-user-types.h
In reply to Andreas FärberFrom: Eduardo Habkost <[email protected]>
The header file is specific for *-user, but I plan to introduce a more generic qemu-types.h file, so I'm renaming it.
--- bsd-user/qemu.h | 2 +- cpu-all.h | 2 +- linux-user/qemu.h | 2 +- qemu-types.h => qemu-user-types.h | 0 4 Dateien geändert, 3 Zeilen hinzugefügt(+), 3 Zeilen entfernt(-) rename qemu-types.h => qemu-user-types.h (100%)
bsd-user/qemu.h +1 -1
@@ -11,7 +11,7 @@#include <stdlib.h> #endif /* DEBUG_REMAP */ -#include "qemu-types.h" +#include "qemu-user-types.h" enum BSDType { target_freebsd,
cpu-all.h +1 -1
@@ -180,7 +180,7 @@ static inline void tswap64s(uint64_t *s)#if defined(CONFIG_USER_ONLY )#include <assert.h> -#include "qemu-types.h" +#include "qemu-user-types.h" /* On some host systems the guest address space is reserved on the host. * This allows the guest address space to be offset to a convenient location.
linux-user/qemu.h +1 -1
@@ -11,7 +11,7 @@#include <stdlib.h> #endif /* DEBUG_REMAP */ -#include "qemu-types.h" +#include "qemu-user-types.h" #include "thunk.h" #include "syscall_defs.h"
qemu-user-types.h renamed from qemu-types.h +0 -0
Signature · 1 line
1.7.10.4
PATCH 3/13 ui/vnc-palette.c: Include headers it needs
In reply to Andreas FärberFrom: Eduardo Habkost <[email protected]>
Include:
- <glib.h> for g_malloc0()
- <string.h> for memset()
Some of those headers were probably being included by accident because some other headers were including qemu-common.h, but those headers should eventually stop including qemu-common.h.
--- ui/vnc-palette.c | 2 ++
1 Datei geändert, 2 Zeilen hinzugefügt(+)
ui/vnc-palette.c +2 -0
@@ -27,6 +27,8 @@*/ #include "vnc-palette.h" +#include <glib.h> +#include <string.h> static VncPaletteEntry *palette_find (const VncPalette *palette,uint32_t color,unsigned int hash)
Signature · 1 line
1.7.10.4
PATCH 4/13 qapi/qmp-registry.c: Include headers it needs
In reply to Andreas FärberFrom: Eduardo Habkost <[email protected]>
Include:
- <glib.h> for g_malloc0()
- <string.h> for strcmp()
Some of those headers were probably being included by accident because some other headers were including qemu-common.h, but those headers should eventually stop including qemu-common.h.
--- qapi/qmp-registry.c | 2 ++
1 Datei geändert, 2 Zeilen hinzugefügt(+)
qapi/qmp-registry.c +2 -0
@@ -12,6 +12,8 @@* */ +#include <glib.h> +#include <string.h> #include "qapi/qmp-core.h" static QTAILQ_HEAD(QmpCommandList, QmpCommand) qmp_commands =
Signature · 1 line
1.7.10.4
PATCH 5/13 qga/channel-posix.c: Include headers it needs
In reply to Andreas FärberFrom: Eduardo Habkost <[email protected]>
Include:
- <errno.h> for errno
- <unistd.h> & <fcntl.h> for fcntl()
- <stdlib.h> for exit()
- "osdep.h" for qemu_open()
Some of those headers were probably being included by accident because some other headers were including qemu-common.h, but those headers should eventually stop including qemu-common.h.
--- qga/channel-posix.c | 5 +++++
1 Datei geändert, 5 Zeilen hinzugefügt(+)
qga/channel-posix.c +5 -0
@@ -1,5 +1,10 @@#include <glib.h> #include <termios.h> +#include <errno.h> +#include <unistd.h> +#include <fcntl.h> +#include <stdlib.h> +#include "osdep.h" #include "qemu_socket.h" #include "qga/channel.h"
Signature · 1 line
1.7.10.4
PATCH 6/13 qlist.h: Do not include qemu-common.h
In reply to Andreas FärberFrom: Eduardo Habkost <[email protected]>
I don't know why it was including it, as I don't see any code that depends on anything from qemu-common.h.
--- qlist.h | 1 -
1 Datei geändert, 1 Zeile entfernt(-)
qlist.h +0 -1
@@ -15,7 +15,6 @@#include "qobject.h" #include "qemu-queue.h" -#include "qemu-common.h" #include "qemu-queue.h" typedef struct QListEntry {
Signature · 1 line
1.7.10.4
PATCH 7/13 Create qemu-types.h for struct typedefs
In reply to Andreas FärberFrom: Eduardo Habkost <[email protected]>
Instead of keeping all those struct typedefs in qemu-common.h, move it to a header that can be safely included by other headers, containing only the struct typedefs and not pulling in other dependencies.
Also, move some of the qdev-core.h typedefs to the new file, too, so other headers don't need to include qdev-core.h only because of DeviceState and other typedefs.
This will help us remove qemu-common.h dependencies from some headers later.
--- hw/qdev-core.h | 11 +--------- qemu-common.h | 52 +---------------------------------------------- qemu-types.h | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 Dateien geändert, 63 Zeilen hinzugefügt(+), 61 Zeilen entfernt(-) create mode 100644 qemu-types.h
hw/qdev-core.h +1 -10
@@ -3,20 +3,11 @@#include "qemu-queue.h" #include "qemu-option.h" +#include "qemu-types.h" #include "qemu/object.h" #include "hw/irq.h" #include "error.h" -typedef struct Property Property ; - -typedef struct PropertyInfo PropertyInfo ; - -typedef struct CompatProperty CompatProperty ; - -typedef struct BusState BusState ; - -typedef struct BusClass BusClass ; -enum DevState {DEV_STATE_CREATED =1 ,DEV_STATE_INITIALIZED ,
qemu-common.h +1 -51
70 lines not on this page · raw message
qemu-types.h new file +61 -0
61 lines not on this page · raw message
Signature · 1 line
1.7.10.4
PATCH 8/13 sysemu.h: Include qemu-types.h instead of qemu-common.h
In reply to Andreas FärberFrom: Eduardo Habkost <[email protected]>
It just needs the Monitor and DeviceState typedefs, so it doesn't need all of qemu-common.h.
--- sysemu.h | 2 +-
1 Datei geändert, 1 Zeile hinzugefügt(+), 1 Zeile entfernt(-)
sysemu.h +1 -1
@@ -2,7 +2,7 @@#define SYSEMU_H /* Misc. things related to the system emulator. */ -#include "qemu-common.h" +#include "qemu-types.h" #include "qemu-option.h" #include "qemu-queue.h" #include "qemu-timer.h"
Signature · 1 line
1.7.10.4
PATCH 9/13 qdev: qdev_create(): use error_report() instead of hw_error()
In reply to Andreas FärberFrom: Eduardo Habkost <[email protected]>
hw_error() is specific for fatal hardware emulation errors, not for internal errors related to the qdev object/class abstraction or object initialization.
Replace it with an error_report() call, followed by abort().
This will also help reduce dependencies of the qdev code (as hw_error() is from cpus.o, and depends on the CPU list from exec.o).
--- hw/qdev.c | 8 +++++---
1 Datei geändert, 5 Zeilen hinzugefügt(+), 3 Zeilen entfernt(-)
hw/qdev.c +5 -3
@@ -109,10 +109,12 @@ DeviceState *qdev_create(BusState *bus, const char *name) dev =qdev_try_create (bus, name);if (!dev) {if (bus) { -hw_error ("Unknown device '%s' for bus '%s'\n" , name, -object_get_typename (OBJECT (bus))); +error_report ("Unknown device '%s' for bus '%s'\n" , name, +object_get_typename (OBJECT (bus))); +abort (); }else { -hw_error ("Unknown device '%s' for default sysbus\n" , name); +error_report ("Unknown device '%s' for default sysbus\n" , name); +abort (); } }
Signature · 1 line
1.7.10.4
PATCH 10/13 target-i386/cpu.c: Coding style fixes
In reply to Andreas FärberFrom: Eduardo Habkost <[email protected]>
- Use spaces instead of tabs on cpu_x86_cpuid().
- Use braces on 'if' statement cpu_x86_find_by_name().
--- target-i386/cpu.c | 30 ++++++++++++++++--------------
1 Datei geändert, 16 Zeilen hinzugefügt(+), 14 Zeilen entfernt(-)
target-i386/cpu.c +16 -14
@@ -1215,7 +1215,7 @@ static int cpu_x86_find_by_name(x86_def_t *x86_cpu_def, const char *cpu_model)char *s =g_strdup (cpu_model);char *featurestr, *name =strtok (s,"," ); -/* Features to be added*/ +/* Features to be added */ uint32_t plus_features =0 , plus_ext_features =0 ;uint32_t plus_ext2_features =0 , plus_ext3_features =0 ;uint32_t plus_kvm_features = kvm_default_features, plus_svm_features =0 ;
@@ -1227,9 +1227,11 @@ static int cpu_x86_find_by_name(x86_def_t *x86_cpu_def, const char *cpu_model)uint32_t minus_7_0_ebx_features =0 ;uint32_t numvalue; -for (def = x86_defs; def; def = def->next) -if (name && !strcmp (name, def->name)) +for (def = x86_defs; def; def = def->next) { +if (name && !strcmp (name, def->name)) {break ; + } + }if (kvm_enabled () && name &&strcmp (name,"host" ) ==0 ) {kvm_cpu_fill_host (x86_cpu_def); }else if (!def) {
@@ -1835,17 +1837,17 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count, }break ;case 0x8000000A : -if (env->cpuid_ext3_features &CPUID_EXT3_SVM ) { - *eax =0x00000001 ;/* SVM Revision */ - *ebx =0x00000010 ;/* nr of ASIDs */ - *ecx =0 ; - *edx = env->cpuid_svm_features;/* optional features */ - }else { - *eax =0 ; - *ebx =0 ; - *ecx =0 ; - *edx =0 ; - } +if (env->cpuid_ext3_features &CPUID_EXT3_SVM ) { + *eax =0x00000001 ;/* SVM Revision */ + *ebx =0x00000010 ;/* nr of ASIDs */ + *ecx =0 ; + *edx = env->cpuid_svm_features;/* optional features */ + }else { + *eax =0 ; + *ebx =0 ; + *ecx =0 ; + *edx =0 ; + }break ;case 0xC0000000 : *eax = env->cpuid_xlevel2;
Signature · 1 line
1.7.10.4
PATCH 11/13 target-i386: Separate feature string parsing from CPU model lookup
In reply to Andreas FärberFrom: Eduardo Habkost <[email protected]>
Instead of parsing the whole cpu_model string inside cpu_x86_find_by_name(), first split it into the CPU model name and the full feature string, then parse the feature string into pieces.
When using CPU model classes, those two pieces of information will be used at different moments (CPU model name will be used to find CPU class, feature string will be used after CPU object was created), so making the split in two steps will make it easier to refactor the code later.
This should also help on the CPU properties work, that will just need to replace the cpu_x86_parse_featurestr() logic (and can keep the CPU model lookup code as-is).
--- target-i386/cpu.c | 69 +++++++++++++++++++++++++++++++++++------------------
1 Datei geändert, 46 Zeilen hinzugefügt(+), 23 Zeilen entfernt(-)
target-i386/cpu.c +46 -23
@@ -1208,25 +1208,10 @@ static void x86_cpuid_set_tsc_freq(Object *obj, Visitor *v, void *opaque, cpu->env.tsc_khz = value /1000 ; } -static int cpu_x86_find_by_name (x86_def_t *x86_cpu_def,const char *cpu_model) +static int cpu_x86_find_by_name (x86_def_t *x86_cpu_def,const char *name) { -unsigned int i;x86_def_t *def; -char *s =g_strdup (cpu_model); -char *featurestr, *name =strtok (s,"," ); -/* Features to be added */ -uint32_t plus_features =0 , plus_ext_features =0 ; -uint32_t plus_ext2_features =0 , plus_ext3_features =0 ; -uint32_t plus_kvm_features = kvm_default_features, plus_svm_features =0 ; -uint32_t plus_7_0_ebx_features =0 ; -/* Features to be removed */ -uint32_t minus_features =0 , minus_ext_features =0 ; -uint32_t minus_ext2_features =0 , minus_ext3_features =0 ; -uint32_t minus_kvm_features =0 , minus_svm_features =0 ; -uint32_t minus_7_0_ebx_features =0 ; -uint32_t numvalue; -for (def = x86_defs; def; def = def->next) {if (name && !strcmp (name, def->name)) {break ;
@@ -1235,16 +1220,37 @@ static int cpu_x86_find_by_name(x86_def_t *x86_cpu_def, const char *cpu_model)if (kvm_enabled () && name &&strcmp (name,"host" ) ==0 ) {kvm_cpu_fill_host (x86_cpu_def); }else if (!def) { - goto error; +return -1 ; }else {memcpy (x86_cpu_def, def,sizeof (*def)); } +return 0 ; +} + +/* Parse "+feature,-feature,feature=foo" CPU feature string +*/ +static int cpu_x86_parse_featurestr (x86_def_t *x86_cpu_def,char *features) +{ +unsigned int i; +char *featurestr;/* Single 'key=value" string being parsed */ +/* Features to be added */ +uint32_t plus_features =0 , plus_ext_features =0 ; +uint32_t plus_ext2_features =0 , plus_ext3_features =0 ; +uint32_t plus_kvm_features = kvm_default_features, plus_svm_features =0 ; +uint32_t plus_7_0_ebx_features =0 ; +/* Features to be removed */ +uint32_t minus_features =0 , minus_ext_features =0 ; +uint32_t minus_ext2_features =0 , minus_ext3_features =0 ; +uint32_t minus_kvm_features =0 , minus_svm_features =0 ; +uint32_t minus_7_0_ebx_features =0 ; +uint32_t numvalue; +add_flagname_to_bitmaps ("hypervisor" , &plus_features, &plus_ext_features, &plus_ext2_features, &plus_ext3_features, &plus_kvm_features, &plus_svm_features, &plus_7_0_ebx_features); - featurestr =strtok (NULL ,"," ); + featurestr = features ?strtok (features,"," ) :NULL ;while (featurestr) {char *val;
@@ -1378,11 +1384,9 @@ static int cpu_x86_find_by_name(x86_def_t *x86_cpu_def, const char *cpu_model)if (x86_cpu_def->cpuid_7_0_ebx_features && x86_cpu_def->level <7 ) { x86_cpu_def->level =7 ; } -g_free (s);return 0 ; error: -g_free (s);return -1 ; }
@@ -1492,11 +1496,25 @@ int cpu_x86_register(X86CPU *cpu, const char *cpu_model)CPUX86State *env = &cpu->env;x86_def_t def1, *def = &def1;Error *error =NULL ; +char *name, *features; +gchar **model_pieces;memset (def,0 ,sizeof (*def)); -if (cpu_x86_find_by_name (def, cpu_model) <0 ) -return -1 ; + model_pieces =g_strsplit (cpu_model,"," ,2 ); +if (!model_pieces[0 ]) { + goto error; + } + name = model_pieces[0 ]; + features = model_pieces[1 ]; + +if (cpu_x86_find_by_name (def, name) <0 ) { + goto error; + } + +if (cpu_x86_parse_featurestr (def, features) <0 ) { + goto error; + }if (def->vendor1) { env->cpuid_vendor1 = def->vendor1; env->cpuid_vendor2 = def->vendor2;
@@ -1553,9 +1571,14 @@ int cpu_x86_register(X86CPU *cpu, const char *cpu_model)if (error) {fprintf (stderr,"%s\n" ,error_get_pretty (error));error_free (error); -return -1 ; + goto error; } + +g_strfreev (model_pieces);return 0 ; +error: +g_strfreev (model_pieces); +return -1 ; }#if !defined(CONFIG_USER_ONLY )
Signature · 1 line
1.7.10.4
PATCH 12/13 target-i386: Use define for cpuid vendor string size
In reply to Andreas FärberFrom: Igor Mammedov <[email protected]>
--- target-i386/cpu.c | 6 +++--- target-i386/cpu.h | 2 ++
2 Dateien geändert, 5 Zeilen hinzugefügt(+), 3 Zeilen entfernt(-)
target-i386/cpu.c +3 -3
@@ -1106,13 +1106,13 @@ static char *x86_cpuid_get_vendor(Object *obj, Error **errp)char *value;int i; - value = (char *)g_malloc (12 +1 ); + value = (char *)g_malloc (CPUID_VENDOR_SZ +1 );for (i =0 ; i <4 ; i++) { value[i ] = env->cpuid_vendor1 >> (8 * i); value[i +4 ] = env->cpuid_vendor2 >> (8 * i); value[i +8 ] = env->cpuid_vendor3 >> (8 * i); } - value[12 ] ='\0' ; + value[CPUID_VENDOR_SZ ] ='\0' ;return value; }
@@ -1123,7 +1123,7 @@ static void x86_cpuid_set_vendor(Object *obj, const char *value,CPUX86State *env = &cpu->env;int i; -if (strlen (value) !=12 ) { +if (strlen (value) !=CPUID_VENDOR_SZ ) {error_set (errp,QERR_PROPERTY_VALUE_BAD ,"" ,"vendor" , value);return ;
target-i386/cpu.h +2 -0
@@ -510,6 +510,8 @@#define CPUID_7_0_EBX_ADX (1 << 19)#define CPUID_7_0_EBX_SMAP (1 << 20) +#define CPUID_VENDOR_SZ 12 +#define CPUID_VENDOR_INTEL_1 0x756e6547/* "Genu" */ #define CPUID_VENDOR_INTEL_2 0x49656e69/* "ineI" */ #define CPUID_VENDOR_INTEL_3 0x6c65746e/* "ntel" */
Signature · 1 line
1.7.10.4
PATCH 13/13 target-i386: Postpone cpuid_level update to realize time
In reply to Andreas FärberFrom: Igor Mammedov <[email protected]>
Delay capping cpuid_level to 7 to realize time so property setters for cpuid_7_0_ebx_features and "level" could be used in any order/time between x86_cpu_initfn() and x86_cpu_realize().
--- target-i386/cpu.c | 3 ---
1 Datei geändert, 3 Zeilen entfernt(-)
target-i386/cpu.c +0 -3
@@ -1381,9 +1381,6 @@ static int cpu_x86_parse_featurestr(x86_def_t *x86_cpu_def, char *features)if (kvm_check_features_against_host (x86_cpu_def) && enforce_cpuid) goto error; } -if (x86_cpu_def->cpuid_7_0_ebx_features && x86_cpu_def->level <7 ) { - x86_cpu_def->level =7 ; - }return 0 ; error:
Signature · 1 line
1.7.10.4
Re: [Qemu-devel] [PATCH 13/13] target-i386: Postpone cpuid_level update to realize time
On Thu, Dec 06, 2012 at 10:06:57AM +0100, Andreas Färber wrote:
[...]
Quoted 9 lines
--- target-i386/cpu.c | 3 ---1 Datei geändert, 3 Zeilen entfernt(-)
target-i386/cpu.c +0
-0
target-i386/cpu.c static int cpu_x86_parse_featurestr(x86_def_t *x86_cpu_def, char *features) · line 1386
Quoted 9 lines
target-i386/cpu.c +0
-3@@ -1381,9 +1381,6 @@ static int cpu_x86_parse_featurestr(x86_def_t *x86_cpu_def, char *features)if (kvm_check_features_against_host (x86_cpu_def) && enforce_cpuid) goto error; } -if (x86_cpu_def->cpuid_7_0_ebx_features && x86_cpu_def->level <7 ) { - x86_cpu_def->level =7 ; - }return 0 ; error:
NACK. A patch chunk is missing. I will resend the fixed version, just in case.
Signature · 1 line
Eduardo
Re: [Qemu-devel] [PATCH 13/13] target-i386: Postpone cpuid_level update to realize time
Am 07.12.2012 18:57, schrieb Eduardo Habkost:
Quoted 19 lines · Andreas Färber
[...]
Quoted 17 lines
--- target-i386/cpu.c | 3 ---1 Datei geändert, 3 Zeilen entfernt(-)
target-i386/cpu.c +0
-3@@ -1381,9 +1381,6 @@ static int cpu_x86_parse_featurestr(x86_def_t *x86_cpu_def, char *features)if (kvm_check_features_against_host (x86_cpu_def) && enforce_cpuid) goto error; } -if (x86_cpu_def->cpuid_7_0_ebx_features && x86_cpu_def->level <7 ) { - x86_cpu_def->level =7 ; - }return 0 ;
Quoted 4 lines
target-i386/cpu.c static int cpu_x86_parse_featurestr(x86_def_t *x86_cpu_def, char *features) · line 1386
Quoted 1 line
target-i386/cpu.c +0
-0error:NACK. A patch chunk is missing. I will resend the fixed version, just in case.
Uh, mismerge... thanks for noticing! Fixed.
https://github.com/afaerber/qemu-cpu/commits/qom-cpu
Andreas
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
PATCH 1/1 target-i386: Postpone cpuid_level update to realize time
In reply to Andreas FärberFrom: Igor Mammedov <[email protected]>
Delay capping cpuid_level to 7 to realize time so property setters for cpuid_7_0_ebx_features and "level" could be used in any order/time between x86_cpu_initfn() and x86_cpu_realize().
---
The patch in the pull request sent by Andreas is not the right one (a patch chunk is missing). I'm resending the correct patch.
--- target-i386/cpu.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
target-i386/cpu.c +5 -3
@@ -1381,9 +1381,6 @@ static int cpu_x86_parse_featurestr(x86_def_t *x86_cpu_def, char *features)if (kvm_check_features_against_host (x86_cpu_def) && enforce_cpuid) goto error; } -if (x86_cpu_def->cpuid_7_0_ebx_features && x86_cpu_def->level <7 ) { - x86_cpu_def->level =7 ; - }return 0 ; error:
@@ -2074,6 +2071,11 @@ static void x86_cpu_apic_init(X86CPU *cpu, Error **errp)void x86_cpu_realize (Object *obj,Error **errp) {X86CPU *cpu =X86_CPU (obj); +CPUX86State *env = &cpu->env; + +if (env->cpuid_7_0_ebx_features && env->cpuid_level <7 ) { + env->cpuid_level =7 ; + }#ifndef CONFIG_USER_ONLY qemu_register_reset (x86_cpu_machine_reset_cb, cpu);
Signature · 1 line
1.7.11.7
Re: [Qemu-devel] [PATCH] target-i386: Postpone cpuid_level update to realize time
Am 07.12.2012 19:00, schrieb Eduardo Habkost:
Quoted 6 lines
From: Igor Mammedov <[email protected]>
Delay capping
cpuid_levelto 7 to realize time so property setters forcpuid_7_0_ebx_featuresand "level" could be used in any order/time betweenx86_cpu_initfn()andx86_cpu_realize().
Quoted 6 lines
Signed-off-by Igor Mammedov <[email protected]>Reviewed-by Eduardo Habkost <[email protected]>Signed-off-by Eduardo Habkost <[email protected]>---
The patch in the pull request sent by Andreas is not the right one (a patch chunk is missing). I'm resending the correct patch.
Igor's patch didn't apply cleanly despite --3way, seems one hunk got lost. Sorry!
Quoted 4 lines
target-i386/cpu.c +0
-0
[...]
target-i386/cpu.c static void x86_cpu_apic_init(X86CPU *cpu, Error **errp) · line 2081
Quoted 12 lines
target-i386/cpu.c +5
-0@@ -2074,6 +2071,11 @@ static void x86_cpu_apic_init(X86CPU *cpu, Error **errp)void x86_cpu_realize (Object *obj,Error **errp) {X86CPU *cpu =X86_CPU (obj); +CPUX86State *env = &cpu->env; + +if (env->cpuid_7_0_ebx_features && env->cpuid_level <7 ) { + env->cpuid_level =7 ; + }#ifndef CONFIG_USER_ONLY qemu_register_reset (x86_cpu_machine_reset_cb, cpu);
I manually patch'ed in this missing hunk and made you a Signed-off-by. Pull was updated with new commit hash and stats already.
Thanks,
Andreas
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
Am 06.12.2012 10:06, schrieb Andreas Färber:
Quoted 10 lines
Hello,
This is my current QOM CPU patch queue. Please pull.
Regards,
AndreasCc Eduardo Habkost <[email protected]>Cc Igor Mammedov <[email protected]>Cc Paolo Bonzini <[email protected]>
Both branches updated with a fix:
The following changes since commit 19e6c50d2d843220efbdd3b2db21d83c122c364a:
target-mips: Fix incorrect shift for SHILO and SHILOV (2012-12-06
08:12:14 +0100)
are available in the git repository at:
git://github.com/afaerber/qemu-cpu.git qom-cpu
for you to fetch changes up to b34d12d153e6e5c5e5e00eac510b054a94409deb:
target-i386: Postpone cpuid_level update to realize time (2012-12-07
19:03:04 +0100)
----------------------------------------------------------------
Eduardo Habkost (11):
user: Move *-user/qemu-types.h to main directory
user: Rename qemu-types.h to qemu-user-types.h ui/vnc-palette.c: Include headers it needs qapi/qmp-registry.c: Include headers it needs qga/channel-posix.c: Include headers it needs
qlist.h: Do not include qemu-common.h
Create qemu-types.h for struct typedefs
sysemu.h: Include qemu-types.h instead of qemu-common.h
qdev: qdev_create(): use error_report() instead of hw_error() target-i386/cpu.c: Coding style fixes
target-i386: Separate feature string parsing from CPU model lookup
Igor Mammedov (2):
target-i386: Use define for cpuid vendor string size
target-i386: Postpone cpuid_level update to realize time
bsd-user/qemu-types.h | 24 ------ bsd-user/qemu.h | 2 +- cpu-all.h | 2 +- hw/qdev-core.h | 11 +-- hw/qdev.c | 8 +- linux-user/qemu.h | 2 +- qapi/qmp-registry.c | 2 + qemu-common.h | 52 +------------ qemu-types.h | 61 +++++++++++++++ linux-user/qemu-types.h => qemu-user-types.h | 0 qga/channel-posix.c | 5 ++ qlist.h | 1 - sysemu.h | 2 +- target-i386/cpu.c | 105 ++++++++++++++++---------- target-i386/cpu.h | 2 + ui/vnc-palette.c | 2 + 16 Dateien geändert, 149 Zeilen hinzugefügt(+), 132 Zeilen entfernt(-) delete mode 100644 bsd-user/qemu-types.h create mode 100644 qemu-types.h rename linux-user/qemu-types.h => qemu-user-types.h (100%)
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 6 lines · Andreas Färber
Hello,
This is my current QOM CPU patch queue. Please pull.
Regards,
Andreas
Pulled. Thanks.
Regards,
Anthony Liguori
Quoted 56 lines
Cc Eduardo Habkost <[email protected]>Cc Igor Mammedov <[email protected]>Cc Paolo Bonzini <[email protected]>The following changes since commit
19e6c50d2d843220efbdd3b2db21d83c122c364a:target-mips: Fix incorrect shift for SHILO and SHILOV (2012-12-06 08:12:14 +0100)
are available in the git repository at:
git://github.com/afaerber/qemu-cpu.gitqom-cpufor you to fetch changes up to
d7f57a46d07c0a72295a56704ab0fecefb2aaea8:target-i386: Postpone
cpuid_levelupdate to realize time (2012-12-06 09:17:06 +0100)----------------------------------------------------------------
Eduardo Habkost (11):
user: Move*-user/qemu-types.hto main directory
user: Renameqemu-types.htoqemu-user-types.hui/vnc-palette.c: Include headers it needsqapi/qmp-registry.c: Include headers it needsqga/channel-posix.c: Include headers it needs
qlist.h: Do not includeqemu-common.h
Createqemu-types.hfor struct typedefs
sysemu.h: Includeqemu-types.hinstead ofqemu-common.h
qdev:qdev_create(): useerror_report()instead ofhw_error()target-i386/cpu.c: Coding style fixes
target-i386: Separate feature string parsing from CPU model lookupIgor Mammedov (2):
target-i386: Use define for cpuid vendor string size
target-i386: Postponecpuid_levelupdate to realize timebsd-user/qemu-types.h | 24 ------- bsd-user/qemu.h | 2 +- cpu-all.h | 2 +- hw/qdev-core.h | 11 +-- hw/qdev.c | 8 ++- linux-user/qemu.h | 2 +- qapi/qmp-registry.c | 2 + qemu-common.h | 52 +------------- qemu-types.h | 61 ++++++++++++++++ linux-user/qemu-types.h => qemu-user-types.h | 0 qga/channel-posix.c | 5 ++ qlist.h | 1 - sysemu.h | 2 +- target-i386/cpu.c | 100 ++++++++++++++++---------- target-i386/cpu.h | 2 + ui/vnc-palette.c | 2 + 16 Dateien geändert, 144 Zeilen hinzugefügt(+), 132 Zeilen entfernt(-) delete mode 100644 bsd-user/qemu-types.h create mode 100644 qemu-types.h rename linux-user/qemu-types.h => qemu-user-types.h (100%)
Il 10/12/2012 17:57, Anthony Liguori ha scritto:
Quoted 10 lines
Quoted 6 lines · Andreas Färber
Hello,
This is my current QOM CPU patch queue. Please pull.
Regards,
AndreasPulled. Thanks.
Thanks, I'll rebase the directory stuff as soon as possible, please help reviewing it in the meantime! :)
Paolo