aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEduardo Habkost <ehabkost@redhat.com>2013-05-06 13:20:08 -0300
committerAndreas Färber <afaerber@suse.de>2013-05-06 19:16:30 +0200
commit034acf4a581b03fc10cba772f731ae521e00fcd8 (patch)
tree61034b14cfad2ba5c8b00ed4dd6a684ba3c4b663
parent8e8aba5054c043027445c880fcb9dbc8f6a217f3 (diff)
target-i386: Introduce X86CPU::filtered_features field
This field will contain the feature bits that were filtered out because of missing host support. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
-rw-r--r--target-i386/cpu-qom.h3
-rw-r--r--target-i386/cpu.c9
2 files changed, 9 insertions, 3 deletions
diff --git a/target-i386/cpu-qom.h b/target-i386/cpu-qom.h
index f890f1c912..849cedf94c 100644
--- a/target-i386/cpu-qom.h
+++ b/target-i386/cpu-qom.h
@@ -65,6 +65,9 @@ typedef struct X86CPU {
/*< public >*/
CPUX86State env;
+
+ /* Features that were filtered out because of missing host capabilities */
+ uint32_t filtered_features[FEATURE_WORDS];
} X86CPU;
static inline X86CPU *x86_env_get_cpu(CPUX86State *env)
diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index 3857514bb2..38793bc5c8 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -1698,9 +1698,12 @@ static void filter_features_for_kvm(X86CPU *cpu)
for (w = 0; w < FEATURE_WORDS; w++) {
FeatureWordInfo *wi = &feature_word_info[w];
- env->features[w] &= kvm_arch_get_supported_cpuid(s, wi->cpuid_eax,
- wi->cpuid_ecx,
- wi->cpuid_reg);
+ uint32_t host_feat = kvm_arch_get_supported_cpuid(s, wi->cpuid_eax,
+ wi->cpuid_ecx,
+ wi->cpuid_reg);
+ uint32_t requested_features = env->features[w];
+ env->features[w] &= host_feat;
+ cpu->filtered_features[w] = requested_features & ~env->features[w];
}
}
#endif