|
|
4ec855 |
From e7f11d39d1ef78f47ed6d45ecd278d51c502f131 Mon Sep 17 00:00:00 2001
|
|
|
4ec855 |
From: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
4ec855 |
Date: Fri, 22 Nov 2019 11:53:37 +0000
|
|
|
4ec855 |
Subject: [PATCH 04/16] i386: display known CPUID features linewrapped, in
|
|
|
4ec855 |
alphabetical order
|
|
|
4ec855 |
MIME-Version: 1.0
|
|
|
4ec855 |
Content-Type: text/plain; charset=UTF-8
|
|
|
4ec855 |
Content-Transfer-Encoding: 8bit
|
|
|
4ec855 |
|
|
|
4ec855 |
RH-Author: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
4ec855 |
Message-id: <20191122115348.25000-5-pbonzini@redhat.com>
|
|
|
4ec855 |
Patchwork-id: 92605
|
|
|
4ec855 |
O-Subject: [RHEL8.2/rhel qemu-kvm PATCH 04/15] i386: display known CPUID features linewrapped, in alphabetical order
|
|
|
4ec855 |
Bugzilla: 1689270
|
|
|
4ec855 |
RH-Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
|
|
|
4ec855 |
RH-Acked-by: Eduardo Habkost <ehabkost@redhat.com>
|
|
|
4ec855 |
RH-Acked-by: Maxim Levitsky <mlevitsk@redhat.com>
|
|
|
4ec855 |
|
|
|
4ec855 |
From: Daniel P. Berrangé <berrange@redhat.com>
|
|
|
4ec855 |
|
|
|
4ec855 |
When using '-cpu help' the list of CPUID features is grouped according
|
|
|
4ec855 |
to the internal low level CPUID grouping. The data printed results in
|
|
|
4ec855 |
very long lines too.
|
|
|
4ec855 |
|
|
|
4ec855 |
This combines to make it hard for users to read the output and identify
|
|
|
4ec855 |
if QEMU knows about the feature they wish to use.
|
|
|
4ec855 |
|
|
|
4ec855 |
This change gets rid of the grouping of features and treats all flags as
|
|
|
4ec855 |
single list. The list is sorted into alphabetical order and the printing
|
|
|
4ec855 |
with line wrapping at the 77th column.
|
|
|
4ec855 |
|
|
|
4ec855 |
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
|
|
|
4ec855 |
Message-Id: <20180606165527.17365-4-berrange@redhat.com>
|
|
|
4ec855 |
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
|
|
|
4ec855 |
(cherry picked from commit cc643b1e7898414b56f551bbd42d4ed8c2ae127a)
|
|
|
4ec855 |
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
|
|
4ec855 |
---
|
|
|
4ec855 |
target/i386/cpu.c | 41 +++++++++++++++++++++++++++--------------
|
|
|
4ec855 |
1 file changed, 27 insertions(+), 14 deletions(-)
|
|
|
4ec855 |
|
|
|
4ec855 |
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
|
|
|
4ec855 |
index 52f1f33..d0c48c2 100644
|
|
|
4ec855 |
--- a/target/i386/cpu.c
|
|
|
4ec855 |
+++ b/target/i386/cpu.c
|
|
|
4ec855 |
@@ -3651,17 +3651,21 @@ static void x86_cpu_class_check_missing_features(X86CPUClass *xcc,
|
|
|
4ec855 |
|
|
|
4ec855 |
/* Print all cpuid feature names in featureset
|
|
|
4ec855 |
*/
|
|
|
4ec855 |
-static void listflags(FILE *f, fprintf_function print, const char **featureset)
|
|
|
4ec855 |
+static void listflags(FILE *f, fprintf_function print, GList *features)
|
|
|
4ec855 |
{
|
|
|
4ec855 |
- int bit;
|
|
|
4ec855 |
- bool first = true;
|
|
|
4ec855 |
-
|
|
|
4ec855 |
- for (bit = 0; bit < 32; bit++) {
|
|
|
4ec855 |
- if (featureset[bit]) {
|
|
|
4ec855 |
- print(f, "%s%s", first ? "" : " ", featureset[bit]);
|
|
|
4ec855 |
- first = false;
|
|
|
4ec855 |
+ size_t len = 0;
|
|
|
4ec855 |
+ GList *tmp;
|
|
|
4ec855 |
+
|
|
|
4ec855 |
+ for (tmp = features; tmp; tmp = tmp->next) {
|
|
|
4ec855 |
+ const char *name = tmp->data;
|
|
|
4ec855 |
+ if ((len + strlen(name) + 1) >= 75) {
|
|
|
4ec855 |
+ print(f, "\n");
|
|
|
4ec855 |
+ len = 0;
|
|
|
4ec855 |
}
|
|
|
4ec855 |
+ print(f, "%s%s", len == 0 ? " " : " ", name);
|
|
|
4ec855 |
+ len += strlen(name) + 1;
|
|
|
4ec855 |
}
|
|
|
4ec855 |
+ print(f, "\n");
|
|
|
4ec855 |
}
|
|
|
4ec855 |
|
|
|
4ec855 |
/* Sort alphabetically by type name, respecting X86CPUClass::ordering. */
|
|
|
4ec855 |
@@ -3708,26 +3712,35 @@ static void x86_cpu_list_entry(gpointer data, gpointer user_data)
|
|
|
4ec855 |
/* list available CPU models and flags */
|
|
|
4ec855 |
void x86_cpu_list(FILE *f, fprintf_function cpu_fprintf)
|
|
|
4ec855 |
{
|
|
|
4ec855 |
- int i;
|
|
|
4ec855 |
+ int i, j;
|
|
|
4ec855 |
CPUListState s = {
|
|
|
4ec855 |
.file = f,
|
|
|
4ec855 |
.cpu_fprintf = cpu_fprintf,
|
|
|
4ec855 |
};
|
|
|
4ec855 |
GSList *list;
|
|
|
4ec855 |
+ GList *names = NULL;
|
|
|
4ec855 |
|
|
|
4ec855 |
(*cpu_fprintf)(f, "Available CPUs:\n");
|
|
|
4ec855 |
list = get_sorted_cpu_model_list();
|
|
|
4ec855 |
g_slist_foreach(list, x86_cpu_list_entry, &s);
|
|
|
4ec855 |
g_slist_free(list);
|
|
|
4ec855 |
|
|
|
4ec855 |
- (*cpu_fprintf)(f, "\nRecognized CPUID flags:\n");
|
|
|
4ec855 |
+ names = NULL;
|
|
|
4ec855 |
for (i = 0; i < ARRAY_SIZE(feature_word_info); i++) {
|
|
|
4ec855 |
FeatureWordInfo *fw = &feature_word_info[i];
|
|
|
4ec855 |
-
|
|
|
4ec855 |
- (*cpu_fprintf)(f, " ");
|
|
|
4ec855 |
- listflags(f, cpu_fprintf, fw->feat_names);
|
|
|
4ec855 |
- (*cpu_fprintf)(f, "\n");
|
|
|
4ec855 |
+ for (j = 0; j < 32; j++) {
|
|
|
4ec855 |
+ if (fw->feat_names[j]) {
|
|
|
4ec855 |
+ names = g_list_append(names, (gpointer)fw->feat_names[j]);
|
|
|
4ec855 |
+ }
|
|
|
4ec855 |
+ }
|
|
|
4ec855 |
}
|
|
|
4ec855 |
+
|
|
|
4ec855 |
+ names = g_list_sort(names, (GCompareFunc)strcmp);
|
|
|
4ec855 |
+
|
|
|
4ec855 |
+ (*cpu_fprintf)(f, "\nRecognized CPUID flags:\n");
|
|
|
4ec855 |
+ listflags(f, cpu_fprintf, names);
|
|
|
4ec855 |
+ (*cpu_fprintf)(f, "\n");
|
|
|
4ec855 |
+ g_list_free(names);
|
|
|
4ec855 |
}
|
|
|
4ec855 |
|
|
|
4ec855 |
static void x86_cpu_definition_entry(gpointer data, gpointer user_data)
|
|
|
4ec855 |
--
|
|
|
4ec855 |
1.8.3.1
|
|
|
4ec855 |
|