[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 09/20] target-i386: move kvm_check_features_against_
From: |
Igor Mammedov |
Subject: |
[Qemu-devel] [PATCH 09/20] target-i386: move kvm_check_features_against_host() check to realize time |
Date: |
Mon, 17 Dec 2012 17:01:21 +0100 |
Signed-off-by: Igor Mammedov <address@hidden>
---
target-i386/cpu.c | 23 ++++++++++++-----------
1 files changed, 12 insertions(+), 11 deletions(-)
diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index 24bfd95..e075b59 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -951,19 +951,20 @@ static int unavailable_host_feature(struct
model_features_t *f, uint32_t mask)
*
* This function may be called only if KVM is enabled.
*/
-static int kvm_check_features_against_host(x86_def_t *guest_def)
+static int kvm_check_features_against_host(X86CPU *cpu)
{
+ CPUX86State *env = &cpu->env;
x86_def_t host_def;
uint32_t mask;
int rv, i;
struct model_features_t ft[] = {
- {&guest_def->features, &host_def.features,
+ {&env->cpuid_features, &host_def.features,
~0, feature_name, 0x00000000},
- {&guest_def->ext_features, &host_def.ext_features,
+ {&env->cpuid_ext_features, &host_def.ext_features,
~CPUID_EXT_HYPERVISOR, ext_feature_name, 0x00000001},
- {&guest_def->ext2_features, &host_def.ext2_features,
+ {&env->cpuid_ext2_features, &host_def.ext2_features,
~PPRO_FEATURES, ext2_feature_name, 0x80000000},
- {&guest_def->ext3_features, &host_def.ext3_features,
+ {&env->cpuid_ext3_features, &host_def.ext3_features,
~CPUID_EXT3_SVM, ext3_feature_name, 0x80000001}};
assert(kvm_enabled());
@@ -1428,12 +1429,6 @@ static int cpu_x86_parse_featurestr(x86_def_t
*x86_cpu_def, char *features)
x86_cpu_def->kvm_features &= ~minus_kvm_features;
x86_cpu_def->svm_features &= ~minus_svm_features;
x86_cpu_def->cpuid_7_0_ebx_features &= ~minus_7_0_ebx_features;
-#ifdef CONFIG_KVM
- if (check_cpuid && kvm_enabled()) {
- if (kvm_check_features_against_host(x86_cpu_def) && enforce_cpuid)
- goto error;
- }
-#endif
return 0;
error:
@@ -2106,6 +2101,12 @@ void x86_cpu_realize(Object *obj, Error **errp)
env->cpuid_svm_features &= TCG_SVM_FEATURES;
} else {
#ifdef CONFIG_KVM
+ if (check_cpuid && kvm_check_features_against_host(cpu)
+ && enforce_cpuid) {
+ error_setg(errp, "Host's CPU doesn't support requested features");
+ return;
+ }
+
filter_features_for_kvm(cpu);
#endif
}
--
1.7.1
- [Qemu-devel] [PATCH 07/20 v2] target-i386: cpu_x86_register() consolidate freeing resources, (continued)
[Qemu-devel] [PATCH 08/20] target-i386: compile kvm only functions if CONFIG_KVM is defined, Igor Mammedov, 2012/12/17
[Qemu-devel] [PATCH 14/20] target-i386: set custom 'vendor' without intermediate x86_def_t, Igor Mammedov, 2012/12/17
[Qemu-devel] [PATCH 09/20] target-i386: move kvm_check_features_against_host() check to realize time,
Igor Mammedov <=
[Qemu-devel] [PATCH 13/20] target-i386: convert [cpuid_]vendor_override to bool, Igor Mammedov, 2012/12/17
[Qemu-devel] [PATCH 06/20] target-i386: move out CPU features initialization in separate func, Igor Mammedov, 2012/12/17
[Qemu-devel] [PATCH 05/20] target-i386: move setting defaults out of cpu_x86_parse_featurestr(), Igor Mammedov, 2012/12/17
[Qemu-devel] [PATCH 10/20] target-i386: prepare cpu_x86_parse_featurestr() to return a set of key, value property pairs, Igor Mammedov, 2012/12/17
- Re: [Qemu-devel] [PATCH 10/20] target-i386: prepare cpu_x86_parse_featurestr() to return a set of key, value property pairs, Eduardo Habkost, 2012/12/19
- Re: [Qemu-devel] [PATCH 10/20] target-i386: prepare cpu_x86_parse_featurestr() to return a set of key, value property pairs, Igor Mammedov, 2012/12/19
- Re: [Qemu-devel] [PATCH 10/20] target-i386: prepare cpu_x86_parse_featurestr() to return a set of key, value property pairs, Eduardo Habkost, 2012/12/20
- Re: [Qemu-devel] [PATCH 10/20] target-i386: prepare cpu_x86_parse_featurestr() to return a set of key, value property pairs, Igor Mammedov, 2012/12/20
- Re: [Qemu-devel] [PATCH 10/20] target-i386: prepare cpu_x86_parse_featurestr() to return a set of key, value property pairs, Eduardo Habkost, 2012/12/20