[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 05/19] target-i386: Isolate KVM-specific code on CPU
From: |
Andreas Färber |
Subject: |
[Qemu-devel] [PULL 05/19] target-i386: Isolate KVM-specific code on CPU feature filtering logic |
Date: |
Thu, 26 Jun 2014 00:12:05 +0200 |
From: Eduardo Habkost <address@hidden>
This will allow us to re-use the feature filtering logic (and the
check/enforce flag logic) for TCG.
Reviewed-by: Richard Henderson <address@hidden>
Signed-off-by: Eduardo Habkost <address@hidden>
Signed-off-by: Andreas Färber <address@hidden>
---
target-i386/cpu.c | 22 +++++++++++++---------
1 file changed, 13 insertions(+), 9 deletions(-)
diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index f2c3583..5e12556 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -1815,6 +1815,16 @@ CpuDefinitionInfoList *arch_query_cpu_definitions(Error
**errp)
return cpu_list;
}
+static uint32_t x86_cpu_get_supported_feature_word(FeatureWord w)
+{
+ FeatureWordInfo *wi = &feature_word_info[w];
+
+ assert(kvm_enabled());
+ return kvm_arch_get_supported_cpuid(kvm_state, wi->cpuid_eax,
+ wi->cpuid_ecx,
+ wi->cpuid_reg);
+}
+
/*
* Filters CPU feature words based on host availability of each feature.
*
@@ -1822,20 +1832,14 @@ CpuDefinitionInfoList *arch_query_cpu_definitions(Error
**errp)
*
* Returns: 0 if all flags are supported by the host, non-zero otherwise.
*/
-static int filter_features_for_kvm(X86CPU *cpu)
+static int x86_cpu_filter_features(X86CPU *cpu)
{
CPUX86State *env = &cpu->env;
- KVMState *s = kvm_state;
FeatureWord w;
int rv = 0;
- assert(kvm_enabled());
-
for (w = 0; w < FEATURE_WORDS; w++) {
- FeatureWordInfo *wi = &feature_word_info[w];
- uint32_t host_feat = kvm_arch_get_supported_cpuid(s, wi->cpuid_eax,
- wi->cpuid_ecx,
- wi->cpuid_reg);
+ uint32_t host_feat = x86_cpu_get_supported_feature_word(w);
uint32_t requested_features = env->features[w];
env->features[w] &= host_feat;
cpu->filtered_features[w] = requested_features & ~env->features[w];
@@ -2598,7 +2602,7 @@ static void x86_cpu_realizefn(DeviceState *dev, Error
**errp)
env->features[FEAT_8000_0001_ECX] &= TCG_EXT3_FEATURES;
env->features[FEAT_SVM] &= TCG_SVM_FEATURES;
} else {
- if (filter_features_for_kvm(cpu) && cpu->enforce_cpuid) {
+ if (x86_cpu_filter_features(cpu) && cpu->enforce_cpuid) {
error_setg(&local_err,
"Host's CPU doesn't support requested features");
goto out;
--
1.8.4.5
- [Qemu-devel] [PULL 00/19] QOM CPUState patch queue 2014-06-26, Andreas Färber, 2014/06/25
- [Qemu-devel] [PULL 01/19] target-i386: kvm: Don't enable MONITOR by default on any CPU model, Andreas Färber, 2014/06/25
- [Qemu-devel] [PULL 12/19] target-i386: Support check/enforce flags in TCG mode, too, Andreas Färber, 2014/06/25
- [Qemu-devel] [PULL 03/19] target-i386: Merge feature filtering/checking functions, Andreas Färber, 2014/06/25
- [Qemu-devel] [PULL 02/19] target-i386: Simplify reporting of unavailable features, Andreas Färber, 2014/06/25
- [Qemu-devel] [PULL 06/19] target-i386: Make TCG feature filtering more readable, Andreas Färber, 2014/06/25
- [Qemu-devel] [PULL 07/19] target-i386: Filter FEAT_7_0_EBX TCG features too, Andreas Färber, 2014/06/25
- [Qemu-devel] [PULL 09/19] target-i386: Define TCG_*_FEATURES earlier in cpu.c, Andreas Färber, 2014/06/25
- [Qemu-devel] [PULL 05/19] target-i386: Isolate KVM-specific code on CPU feature filtering logic,
Andreas Färber <=
- [Qemu-devel] [PULL 10/19] target-i386: Loop-based copying and setting/unsetting of feature words, Andreas Färber, 2014/06/25
- [Qemu-devel] [PULL 04/19] target-i386: Pass FeatureWord argument to report_unavailable_features(), Andreas Färber, 2014/06/25
- [Qemu-devel] [PULL 13/19] target-i386: Add "migratable" property to "host" CPU model, Andreas Färber, 2014/06/25
- [Qemu-devel] [PULL 11/19] target-i386: Loop-based feature word filtering in TCG mode, Andreas Färber, 2014/06/25
- [Qemu-devel] [PULL 08/19] target-i386: Filter KVM and 0xC0000001 features on TCG, Andreas Färber, 2014/06/25
- [Qemu-devel] [PULL 16/19] target-i386: block migration and savevm if invariant tsc is exposed, Andreas Färber, 2014/06/25
- [Qemu-devel] [PULL 14/19] target-i386: Set migratable=yes by default on "host" CPU mooel, Andreas Färber, 2014/06/25
- [Qemu-devel] [PULL 17/19] target-i386: Support "invariant tsc" flag, Andreas Färber, 2014/06/25
- [Qemu-devel] [PULL 19/19] target-i386: Broadwell CPU model, Andreas Färber, 2014/06/25
- [Qemu-devel] [PULL 15/19] savevm: check vmsd for migratability status, Andreas Färber, 2014/06/25