]> git.proxmox.com Git - mirror_qemu.git/commitdiff
Introduce DEVICE_CATEGORY_CPU for CPU devices
authorThomas Huth <thuth@redhat.com>
Fri, 20 Jan 2017 13:01:16 +0000 (14:01 +0100)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 27 Jan 2017 17:07:31 +0000 (18:07 +0100)
Now that CPUs show up in the help text of "-device ?",
we should group them into an appropriate category.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <1484917276-7107-1-git-send-email-thuth@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
hw/cpu/core.c
include/hw/qdev-core.h
qdev-monitor.c
qom/cpu.c

index eff90c12bec53a7773fa6a4c2926d976d59b0c9d..2bf960d6a8fe222588019639b09308abc8d1f620 100644 (file)
@@ -72,10 +72,18 @@ static void cpu_core_instance_init(Object *obj)
     core->nr_threads = smp_threads;
 }
 
+static void cpu_core_class_init(ObjectClass *oc, void *data)
+{
+    DeviceClass *dc = DEVICE_CLASS(oc);
+
+    set_bit(DEVICE_CATEGORY_CPU, dc->categories);
+}
+
 static const TypeInfo cpu_core_type_info = {
     .name = TYPE_CPU_CORE,
     .parent = TYPE_DEVICE,
     .abstract = true,
+    .class_init = cpu_core_class_init,
     .instance_size = sizeof(CPUCore),
     .instance_init = cpu_core_instance_init,
 };
index 2c973473f75af341b487afea117ac012ffd3980f..b44b47676576d86137ff573b9d1a4b4e4245c79b 100644 (file)
@@ -26,6 +26,7 @@ typedef enum DeviceCategory {
     DEVICE_CATEGORY_DISPLAY,
     DEVICE_CATEGORY_SOUND,
     DEVICE_CATEGORY_MISC,
+    DEVICE_CATEGORY_CPU,
     DEVICE_CATEGORY_MAX
 } DeviceCategory;
 
index 81d01df928608ef4cf141c83b056344045be717d..549f45f06652d44f00116b36eaf8163eb0919e0b 100644 (file)
@@ -137,6 +137,7 @@ static void qdev_print_devinfos(bool show_no_user)
         [DEVICE_CATEGORY_DISPLAY] = "Display",
         [DEVICE_CATEGORY_SOUND]   = "Sound",
         [DEVICE_CATEGORY_MISC]    = "Misc",
+        [DEVICE_CATEGORY_CPU]     = "CPU",
         [DEVICE_CATEGORY_MAX]     = "Uncategorized",
     };
     GSList *list, *elt;
index 7f575879f6a1d94a44e06bd2d86d5bdc1bc8cd8b..e815db7799cb2fe605c033d804cee387d36900f8 100644 (file)
--- a/qom/cpu.c
+++ b/qom/cpu.c
@@ -415,6 +415,7 @@ static void cpu_class_init(ObjectClass *klass, void *data)
     k->cpu_exec_enter = cpu_common_noop;
     k->cpu_exec_exit = cpu_common_noop;
     k->cpu_exec_interrupt = cpu_common_exec_interrupt;
+    set_bit(DEVICE_CATEGORY_CPU, dc->categories);
     dc->realize = cpu_common_realizefn;
     dc->unrealize = cpu_common_unrealizefn;
     /*