[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 2/6] i386: Add ordering field to CPUClass
From: |
Eduardo Habkost |
Subject: |
[Qemu-devel] [PATCH 2/6] i386: Add ordering field to CPUClass |
Date: |
Thu, 19 Jan 2017 19:04:45 -0200 |
Instead of using kvm_enabled to order the "-cpu help" list, use a
new "ordering" field for that.
Signed-off-by: Eduardo Habkost <address@hidden>
---
target/i386/cpu-qom.h | 2 ++
target/i386/cpu.c | 8 ++++----
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/target/i386/cpu-qom.h b/target/i386/cpu-qom.h
index 8cd607e9a2..14abd0a8c1 100644
--- a/target/i386/cpu-qom.h
+++ b/target/i386/cpu-qom.h
@@ -48,6 +48,7 @@ typedef struct X86CPUDefinition X86CPUDefinition;
* X86CPUClass:
* @cpu_def: CPU model definition
* @kvm_required: Whether CPU model requires KVM to be enabled.
+ * @ordering: Ordering on the "-cpu help" CPU model list.
* @migration_safe: See CpuDefinitionInfo::migration_safe
* @parent_realize: The parent class' realize handler.
* @parent_reset: The parent class' reset handler.
@@ -63,6 +64,7 @@ typedef struct X86CPUClass {
X86CPUDefinition *cpu_def;
bool kvm_required;
+ int ordering;
bool migration_safe;
/* Optional description of CPU model.
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 7947c8737c..0c6d8d605e 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -1550,6 +1550,7 @@ static void host_x86_cpu_class_init(ObjectClass *oc, void
*data)
uint32_t eax = 0, ebx = 0, ecx = 0, edx = 0;
xcc->kvm_required = true;
+ xcc->ordering = 9;
host_cpuid(0x0, 0, &eax, &ebx, &ecx, &edx);
x86_cpu_vendor_words2str(host_cpudef.vendor, ebx, edx, ecx);
@@ -2127,7 +2128,7 @@ static void listflags(FILE *f, fprintf_function print,
const char **featureset)
}
}
-/* Sort alphabetically by type name, listing kvm_required models last. */
+/* Sort alphabetically by type name, respecting X86CPUClass::ordering. */
static gint x86_cpu_list_compare(gconstpointer a, gconstpointer b)
{
ObjectClass *class_a = (ObjectClass *)a;
@@ -2136,9 +2137,8 @@ static gint x86_cpu_list_compare(gconstpointer a,
gconstpointer b)
X86CPUClass *cc_b = X86_CPU_CLASS(class_b);
const char *name_a, *name_b;
- if (cc_a->kvm_required != cc_b->kvm_required) {
- /* kvm_required items go last */
- return cc_a->kvm_required ? 1 : -1;
+ if (cc_a->ordering != cc_b->ordering) {
+ return cc_a->ordering - cc_b->ordering;
} else {
name_a = object_class_get_name(class_a);
name_b = object_class_get_name(class_b);
--
2.11.0.259.g40922b1
- [Qemu-devel] [PATCH 0/6] i386: Add "max" CPU model to TCG and KVM, Eduardo Habkost, 2017/01/19
- [Qemu-devel] [PATCH 1/6] i386: Unset cannot_destroy_with_object_finalize_yet on "host" model, Eduardo Habkost, 2017/01/19
- [Qemu-devel] [PATCH 2/6] i386: Add ordering field to CPUClass,
Eduardo Habkost <=
- [Qemu-devel] [PATCH 3/6] i386: Rename X86CPU::host_features to X86CPU::max_features, Eduardo Habkost, 2017/01/19
- [Qemu-devel] [PATCH 4/6] i386: Create "max" CPU model, Eduardo Habkost, 2017/01/19
- [Qemu-devel] [PATCH 6/6] i386: Don't set CPUClass::cpu_def on "max" model, Eduardo Habkost, 2017/01/19
- [Qemu-devel] [PATCH 5/6] i386: Make "max" model not use any host CPUID info on TCG, Eduardo Habkost, 2017/01/19
- Re: [Qemu-devel] [PATCH 0/6] i386: Add "max" CPU model to TCG and KVM, Peter Maydell, 2017/01/20
- Re: [Qemu-devel] [PATCH 0/6] i386: Add "max" CPU model to TCG and KVM, David Hildenbrand, 2017/01/20
- Re: [Qemu-devel] [PATCH 0/6] i386: Add "max" CPU model to TCG and KVM, Cornelia Huck, 2017/01/20