aboutsummaryrefslogtreecommitdiff
path: root/target/i386/cpu.h
diff options
context:
space:
mode:
authorEduardo Habkost <ehabkost@redhat.com>2017-03-27 11:48:15 -0300
committerEduardo Habkost <ehabkost@redhat.com>2017-03-28 16:41:10 -0300
commitd4a606b38b5d4b3689b86cc1575908e82179ecfb (patch)
tree7dc48e446d058d92e47de8fff87bbab9189198d8 /target/i386/cpu.h
parenta7b0ffacc125f06ef277a2afa54a52e7f22e11fe (diff)
downloadqemu-d4a606b38b5d4b3689b86cc1575908e82179ecfb.zip
qemu-d4a606b38b5d4b3689b86cc1575908e82179ecfb.tar.gz
qemu-d4a606b38b5d4b3689b86cc1575908e82179ecfb.tar.bz2
i386: Don't override -cpu options on -cpu host/max
The existing code for "host" and "max" CPU models overrides every single feature in the CPU object at realize time, even the ones that were explicitly enabled or disabled by the user using "feat=on" or "feat=off", while features set using +feat/-feat are kept. This means "-cpu host,+invtsc" works as expected, while "-cpu host,invtsc=on" doesn't. This was a known bug, already documented in a comment inside x86_cpu_expand_features(). What makes this bug worse now is that libvirt 3.0.0 and newer now use "feat=on|off" instead of +feat/-feat when it detects a QEMU version that supports it (see libvirt commit d47db7b16dd5422c7e487c8c8ee5b181a2f9cd66). Change the feature property getter/setter to set a env->user_features field, to keep track of features that were explicitly changed using QOM properties. Then make the max_features code not override user features when handling "-cpu host" and "-cpu max". This will also allow us to remove the plus_features/minus_features hack in the future, but I plan to do that after 2.9.0 is released. Reported-by: Jiri Denemark <jdenemar@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Message-Id: <20170327144815.8043-3-ehabkost@redhat.com> Reviewed-by: Igor Mammedov <imammedo@redhat.com> Tested-by: Jiri Denemark <jdenemar@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Diffstat (limited to 'target/i386/cpu.h')
-rw-r--r--target/i386/cpu.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/target/i386/cpu.h b/target/i386/cpu.h
index 07401ad..c4602ca 100644
--- a/target/i386/cpu.h
+++ b/target/i386/cpu.h
@@ -1147,6 +1147,8 @@ typedef struct CPUX86State {
uint32_t cpuid_vendor3;
uint32_t cpuid_version;
FeatureWordArray features;
+ /* Features that were explicitly enabled/disabled */
+ FeatureWordArray user_features;
uint32_t cpuid_model[12];
/* MTRRs */