[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v3 3/5] target-i386: Define CPUID filtering function
From: |
Eduardo Habkost |
Subject: |
[Qemu-devel] [PATCH v3 3/5] target-i386: Define CPUID filtering functions before x86_cpu_list() |
Date: |
Mon, 19 Sep 2016 16:42:53 -0300 |
Just move code to another place so the it can be reused by the
query-cpu-definitions code.
Signed-off-by: Eduardo Habkost <address@hidden>
---
target-i386/cpu.c | 68 +++++++++++++++++++++++++++----------------------------
1 file changed, 34 insertions(+), 34 deletions(-)
diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index 1a42233..a755309 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -2071,6 +2071,40 @@ static void x86_cpu_parse_featurestr(const char
*typename, char *features,
}
}
+/*
+ * Filters CPU feature words based on host availability of each feature.
+ *
+ * Returns: 0 if all flags are supported by the host, non-zero otherwise.
+ */
+static int x86_cpu_filter_features(X86CPU *cpu)
+{
+ CPUX86State *env = &cpu->env;
+ FeatureWord w;
+ int rv = 0;
+
+ for (w = 0; w < FEATURE_WORDS; w++) {
+ uint32_t host_feat =
+ x86_cpu_get_supported_feature_word(w, cpu->migratable);
+ uint32_t requested_features = env->features[w];
+ env->features[w] &= host_feat;
+ cpu->filtered_features[w] = requested_features & ~env->features[w];
+ if (cpu->filtered_features[w]) {
+ rv = 1;
+ }
+ }
+
+ return rv;
+}
+
+static void x86_cpu_report_filtered_features(X86CPU *cpu)
+{
+ FeatureWord w;
+
+ for (w = 0; w < FEATURE_WORDS; w++) {
+ report_unavailable_features(w, cpu->filtered_features[w]);
+ }
+}
+
/* Print all cpuid feature names in featureset
*/
static void listflags(FILE *f, fprintf_function print, const char **featureset)
@@ -2200,40 +2234,6 @@ static uint32_t
x86_cpu_get_supported_feature_word(FeatureWord w,
return r;
}
-/*
- * Filters CPU feature words based on host availability of each feature.
- *
- * Returns: 0 if all flags are supported by the host, non-zero otherwise.
- */
-static int x86_cpu_filter_features(X86CPU *cpu)
-{
- CPUX86State *env = &cpu->env;
- FeatureWord w;
- int rv = 0;
-
- for (w = 0; w < FEATURE_WORDS; w++) {
- uint32_t host_feat =
- x86_cpu_get_supported_feature_word(w, cpu->migratable);
- uint32_t requested_features = env->features[w];
- env->features[w] &= host_feat;
- cpu->filtered_features[w] = requested_features & ~env->features[w];
- if (cpu->filtered_features[w]) {
- rv = 1;
- }
- }
-
- return rv;
-}
-
-static void x86_cpu_report_filtered_features(X86CPU *cpu)
-{
- FeatureWord w;
-
- for (w = 0; w < FEATURE_WORDS; w++) {
- report_unavailable_features(w, cpu->filtered_features[w]);
- }
-}
-
static void x86_cpu_apply_props(X86CPU *cpu, PropValue *props)
{
PropValue *pv;
--
2.7.4
- [Qemu-devel] [PATCH v3 0/5] Add runnability info to query-cpu-definitions, Eduardo Habkost, 2016/09/19
- [Qemu-devel] [PATCH v3 4/5] qmp: Add runnability information to query-cpu-definitions, Eduardo Habkost, 2016/09/19
- [Qemu-devel] [PATCH v3 5/5] target-i386: Return runnability information on query-cpu-definitions, Eduardo Habkost, 2016/09/19
- [Qemu-devel] [PATCH v3 3/5] target-i386: Define CPUID filtering functions before x86_cpu_list(),
Eduardo Habkost <=
- [Qemu-devel] [PATCH v3 1/5] target-i386: List CPU models using subclass list, Eduardo Habkost, 2016/09/19
- [Qemu-devel] [PATCH v3 2/5] target-i386: Move warning code outside x86_cpu_filter_features(), Eduardo Habkost, 2016/09/19
- Re: [Qemu-devel] [libvirt] [PATCH v3 0/5] Add runnability info to query-cpu-definitions, no-reply, 2016/09/19