Skip to contentSkip to conversation

qemu-help: improve -device command line help

PATCH Superseded Marcel Apfelbaum 3 participants 9 messages Jul 28, 2013 – Jul 29, 2013 Arm i.MX and Layerscape

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

cover qemu-help: improve -device command line help

Running qemu with "-device ?" option returns ~145 lines. It is hard to manage understanding the output.

Theses patches aim to partially solve the problem by dividing the devices into logical categories like "Network/Display/..." and sorting them by it.

Categories:
Assembly - hosts/hubs/...
Management - controllers
...
(All others are self explanatory)

Changes from RFC patch:
Made category a bitmap to support multifunction PCI devices. Assigned all devices to their category.

Marcel Apfelbaum (2):
qemu-help: Sort devices by logical functionality
devices: Associate devices to their logical category

 hw/9pfs/virtio-9p-device.c         |  1 +
 hw/audio/ac97.c                    |  1 +
 hw/audio/adlib.c                   |  1 +
 hw/audio/cs4231a.c                 |  1 +
 hw/audio/es1370.c                  |  1 +
 hw/audio/gus.c                     |  1 +
 hw/audio/hda-codec.c               |  3 ++
 hw/audio/intel-hda.c               |  3 ++
 hw/audio/pcspk.c                   |  1 +
 hw/audio/pl041.c                   |  1 +
 hw/audio/sb16.c                    |  1 +
 hw/block/fdc.c                     |  3 ++
 hw/block/nvme.c                    |  1 +
 hw/block/pc_sysfw.c                |  1 +
 hw/block/pflash_cfi01.c            |  1 +
 hw/block/virtio-blk.c              |  1 +
 hw/char/imx_serial.c               |  1 +
 hw/char/ipack.c                    |  1 +
 hw/char/ipoctal232.c               |  1 +
 hw/char/parallel.c                 |  1 +
 hw/char/serial-isa.c               |  1 +
 hw/char/serial-pci.c               |  3 ++
 hw/char/tpci200.c                  |  1 +
 hw/char/virtio-serial-bus.c        |  2 ++
 hw/core/sysbus.c                   |  1 +
 hw/display/cirrus_vga.c            |  2 ++
 hw/display/g364fb.c                |  1 +
 hw/display/pl110.c                 |  3 ++
 hw/display/qxl.c                   |  2 ++
 hw/display/vga-isa.c               |  1 +
 hw/display/vga-pci.c               |  1 +
 hw/display/vmware_vga.c            |  1 +
 hw/i2c/bitbang_i2c.c               |  1 +
 hw/i2c/core.c                      |  1 +
 hw/i386/kvm/pci-assign.c           |  1 +
 hw/ide/ahci.c                      |  1 +
 hw/ide/ich.c                       |  1 +
 hw/ide/isa.c                       |  1 +
 hw/ide/piix.c                      |  3 ++
 hw/ide/qdev.c                      |  1 +
 hw/ide/via.c                       |  1 +
 hw/isa/i82378.c                    |  1 +
 hw/isa/isa-bus.c                   |  1 +
 hw/isa/lpc_ich9.c                  |  1 +
 hw/isa/vt82c686.c                  |  3 ++
 hw/misc/applesmc.c                 |  1 +
 hw/misc/debugexit.c                |  1 +
 hw/misc/ivshmem.c                  |  1 +
 hw/misc/pc-testdev.c               |  1 +
 hw/misc/pci-testdev.c              |  1 +
 hw/misc/sga.c                      |  1 +
 hw/misc/vfio.c                     |  1 +
 hw/net/e1000.c                     |  1 +
 hw/net/eepro100.c                  |  1 +
 hw/net/lance.c                     |  1 +
 hw/net/mipsnet.c                   |  1 +
 hw/net/ne2000-isa.c                |  1 +
 hw/net/ne2000.c                    |  1 +
 hw/net/opencores_eth.c             |  1 +
 hw/net/pcnet-pci.c                 |  1 +
 hw/net/rtl8139.c                   |  1 +
 hw/net/virtio-net.c                |  1 +
 hw/net/vmxnet3.c                   |  1 +
 hw/pci-bridge/i82801b11.c          |  2 ++
 hw/pci-bridge/ioh3420.c            |  1 +
 hw/pci-bridge/pci_bridge_dev.c     |  1 +
 hw/pci-bridge/xio3130_downstream.c |  1 +
 hw/pci-bridge/xio3130_upstream.c   |  1 +
 hw/pci-host/apb.c                  |  2 ++
 hw/pci-host/ppce500.c              |  1 +
 hw/pci-host/prep.c                 |  1 +
 hw/pci-host/q35.c                  |  2 ++
 hw/scsi/esp-pci.c                  |  2 ++
 hw/scsi/esp.c                      |  1 +
 hw/scsi/lsi53c895a.c               |  1 +
 hw/scsi/megasas.c                  |  1 +
 hw/scsi/scsi-bus.c                 |  1 +
 hw/scsi/vhost-scsi.c               |  1 +
 hw/scsi/virtio-scsi.c              |  3 ++
 hw/scsi/vmw_pvscsi.c               |  1 +
 hw/usb/ccid-card-emulated.c        |  1 +
 hw/usb/ccid-card-passthru.c        |  1 +
 hw/usb/dev-audio.c                 |  1 +
 hw/usb/dev-bluetooth.c             |  1 +
 hw/usb/dev-hid.c                   |  3 ++
 hw/usb/dev-hub.c                   |  1 +
 hw/usb/dev-network.c               |  1 +
 hw/usb/dev-serial.c                |  2 ++
 hw/usb/dev-smartcard-reader.c      |  2 ++
 hw/usb/dev-storage.c               |  1 +
 hw/usb/dev-uas.c                   |  1 +
 hw/usb/dev-wacom.c                 |  1 +
 hw/usb/hcd-ehci-pci.c              |  2 ++
 hw/usb/hcd-ehci-sysbus.c           |  8 +++++
 hw/usb/hcd-ohci.c                  |  2 ++
 hw/usb/hcd-uhci.c                  |  1 +
 hw/usb/hcd-xhci.c                  |  1 +
 hw/usb/host-libusb.c               |  1 +
 hw/usb/host-linux.c                |  1 +
 hw/usb/redirect.c                  |  1 +
 hw/virtio/virtio-balloon.c         |  1 +
 hw/virtio/virtio-mmio.c            |  1 +
 hw/virtio/virtio-pci.c             |  8 +++++
 hw/virtio/virtio-rng.c             |  1 +
 hw/watchdog/wdt_i6300esb.c         |  1 +
 hw/xen/xen_platform.c              |  1 +
 hw/xen/xen_pt.c                    |  1 +
 include/hw/qdev-core.h             | 15 +++++++++
 qdev-monitor.c                     | 63 ++++++++++++++++++++++++++++++++++++--
 109 files changed, 226 insertions(+), 2 deletions(-)
Signature · 1 line
1.8.3.1
#1 lore raw

PATCH 1/2 qemu-help: Sort devices by logical functionality

Categorize devices that appear as output to "-device ?" command by logical functionality. Sort the devices by logical categories before showing them to user.

The sort is done by functionality rather than alphabetical.

---
Changes from RFC
Made category a bitmap to support multifunction PCI devices

 include/hw/qdev-core.h | 15 ++++++++++++
 qdev-monitor.c         | 62 ++++++++++++++++++++++++++++++++++++++++++++++++--
 2 files changed, 75 insertions(+), 2 deletions(-)
include/hw/qdev-core.h +15 -0
index 7fbffcb..9130f97 100644
@@ -17,6 +17,19 @@ enum {
 #define DEVICE_CLASS(klass) OBJECT_CLASS_CHECK(DeviceClass, (klass), TYPE_DEVICE)
 #define DEVICE_GET_CLASS(obj) OBJECT_GET_CLASS(DeviceClass, (obj), TYPE_DEVICE)
 
+#define MAX_DEVICE_CATEGORY 8
+
+typedef enum DeviceCategory {
+    DEVICE_CATEGORY_ASSEMBLY,
+    DEVICE_CATEGORY_MANAGEMENT,
+    DEVICE_CATEGORY_STORAGE,
+    DEVICE_CATEGORY_NETWORK,
+    DEVICE_CATEGORY_INPUT,
+    DEVICE_CATEGORY_DISPLAY,
+    DEVICE_CATEGORY_SOUND,
+    DEVICE_CATEGORY_MISC,
+} DeviceCategory;
+
 typedef int (*qdev_initfn)(DeviceState *dev);
 typedef int (*qdev_event)(DeviceState *dev);
 typedef void (*qdev_resetfn)(DeviceState *dev);
@@ -80,6 +93,8 @@ typedef struct DeviceClass {
     ObjectClass parent_class;
     /*< public >*/
 
+    /* DeviceCategory bitmap */
+    unsigned int categories;
     const char *fw_name;
     const char *desc;
     Property *props;
qdev-monitor.c +60 -2

96 lines not on this page · raw message

Signature · 1 line
1.8.3.1
#3 lore raw

PATCH 2/2 devices: Associate devices to their logical category

In reply to Marcel Apfelbaum

The category will be used to sort the devices displayed in the command line help.

---
 hw/9pfs/virtio-9p-device.c         | 1 +
 hw/audio/ac97.c                    | 1 +
 hw/audio/adlib.c                   | 1 +
 hw/audio/cs4231a.c                 | 1 +
 hw/audio/es1370.c                  | 1 +
 hw/audio/gus.c                     | 1 +
 hw/audio/hda-codec.c               | 3 +++
 hw/audio/intel-hda.c               | 3 +++
 hw/audio/pcspk.c                   | 1 +
 hw/audio/pl041.c                   | 1 +
 hw/audio/sb16.c                    | 1 +
 hw/block/fdc.c                     | 3 +++
 hw/block/nvme.c                    | 1 +
 hw/block/pc_sysfw.c                | 1 +
 hw/block/pflash_cfi01.c            | 1 +
 hw/block/virtio-blk.c              | 1 +
 hw/char/imx_serial.c               | 1 +
 hw/char/ipack.c                    | 1 +
 hw/char/ipoctal232.c               | 1 +
 hw/char/parallel.c                 | 1 +
 hw/char/serial-isa.c               | 1 +
 hw/char/serial-pci.c               | 3 +++
 hw/char/tpci200.c                  | 1 +
 hw/char/virtio-serial-bus.c        | 2 ++
 hw/core/sysbus.c                   | 1 +
 hw/display/cirrus_vga.c            | 2 ++
 hw/display/g364fb.c                | 1 +
 hw/display/pl110.c                 | 3 +++
 hw/display/qxl.c                   | 2 ++
 hw/display/vga-isa.c               | 1 +
 hw/display/vga-pci.c               | 1 +
 hw/display/vmware_vga.c            | 1 +
 hw/i2c/bitbang_i2c.c               | 1 +
 hw/i2c/core.c                      | 1 +
 hw/i386/kvm/pci-assign.c           | 1 +
 hw/ide/ahci.c                      | 1 +
 hw/ide/ich.c                       | 1 +
 hw/ide/isa.c                       | 1 +
 hw/ide/piix.c                      | 3 +++
 hw/ide/qdev.c                      | 1 +
 hw/ide/via.c                       | 1 +
 hw/isa/i82378.c                    | 1 +
 hw/isa/isa-bus.c                   | 1 +
 hw/isa/lpc_ich9.c                  | 1 +
 hw/isa/vt82c686.c                  | 3 +++
 hw/misc/applesmc.c                 | 1 +
 hw/misc/debugexit.c                | 1 +
 hw/misc/ivshmem.c                  | 1 +
 hw/misc/pc-testdev.c               | 1 +
 hw/misc/pci-testdev.c              | 1 +
 hw/misc/sga.c                      | 1 +
 hw/misc/vfio.c                     | 1 +
 hw/net/e1000.c                     | 1 +
 hw/net/eepro100.c                  | 1 +
 hw/net/lance.c                     | 1 +
 hw/net/mipsnet.c                   | 1 +
 hw/net/ne2000-isa.c                | 1 +
 hw/net/ne2000.c                    | 1 +
 hw/net/opencores_eth.c             | 1 +
 hw/net/pcnet-pci.c                 | 1 +
 hw/net/rtl8139.c                   | 1 +
 hw/net/virtio-net.c                | 1 +
 hw/net/vmxnet3.c                   | 1 +
 hw/pci-bridge/i82801b11.c          | 2 ++
 hw/pci-bridge/ioh3420.c            | 1 +
 hw/pci-bridge/pci_bridge_dev.c     | 1 +
 hw/pci-bridge/xio3130_downstream.c | 1 +
 hw/pci-bridge/xio3130_upstream.c   | 1 +
 hw/pci-host/apb.c                  | 2 ++
 hw/pci-host/ppce500.c              | 1 +
 hw/pci-host/prep.c                 | 1 +
 hw/pci-host/q35.c                  | 2 ++
 hw/scsi/esp-pci.c                  | 2 ++
 hw/scsi/esp.c                      | 1 +
 hw/scsi/lsi53c895a.c               | 1 +
 hw/scsi/megasas.c                  | 1 +
 hw/scsi/scsi-bus.c                 | 1 +
 hw/scsi/vhost-scsi.c               | 1 +
 hw/scsi/virtio-scsi.c              | 3 +++
 hw/scsi/vmw_pvscsi.c               | 1 +
 hw/usb/ccid-card-emulated.c        | 1 +
 hw/usb/ccid-card-passthru.c        | 1 +
 hw/usb/dev-audio.c                 | 1 +
 hw/usb/dev-bluetooth.c             | 1 +
 hw/usb/dev-hid.c                   | 3 +++
 hw/usb/dev-hub.c                   | 1 +
 hw/usb/dev-network.c               | 1 +
 hw/usb/dev-serial.c                | 2 ++
 hw/usb/dev-smartcard-reader.c      | 2 ++
 hw/usb/dev-storage.c               | 1 +
 hw/usb/dev-uas.c                   | 1 +
 hw/usb/dev-wacom.c                 | 1 +
 hw/usb/hcd-ehci-pci.c              | 2 ++
 hw/usb/hcd-ehci-sysbus.c           | 8 ++++++++
 hw/usb/hcd-ohci.c                  | 2 ++
 hw/usb/hcd-uhci.c                  | 1 +
 hw/usb/hcd-xhci.c                  | 1 +
 hw/usb/host-libusb.c               | 1 +
 hw/usb/host-linux.c                | 1 +
 hw/usb/redirect.c                  | 1 +
 hw/virtio/virtio-balloon.c         | 1 +
 hw/virtio/virtio-mmio.c            | 1 +
 hw/virtio/virtio-pci.c             | 8 ++++++++
 hw/virtio/virtio-rng.c             | 1 +
 hw/watchdog/wdt_i6300esb.c         | 1 +
 hw/xen/xen_platform.c              | 1 +
 hw/xen/xen_pt.c                    | 1 +
 107 files changed, 150 insertions(+)
hw/9pfs/virtio-9p-device.c +1 -0
index 35e2af4..1036ded 100644
@@ -149,6 +149,7 @@ static void virtio_9p_class_init(ObjectClass *klass, void *data)
     DeviceClass *dc = DEVICE_CLASS(klass);
     VirtioDeviceClass *vdc = VIRTIO_DEVICE_CLASS(klass);
     dc->props = virtio_9p_properties;
+    dc->categories = (1 << DEVICE_CATEGORY_STORAGE);
     vdc->init = virtio_9p_device_init;
     vdc->get_features = virtio_9p_get_features;
     vdc->get_config = virtio_9p_get_config;
hw/audio/ac97.c +1 -0
index 365b2f1..bc706b6 100644
@@ -1420,6 +1420,7 @@ static void ac97_class_init (ObjectClass *klass, void *data)
     k->device_id = PCI_DEVICE_ID_INTEL_82801AA_5;
     k->revision = 0x01;
     k->class_id = PCI_CLASS_MULTIMEDIA_AUDIO;
+    dc->categories = (1 << DEVICE_CATEGORY_SOUND);
     dc->desc = "Intel 82801AA AC97 Audio";
     dc->vmsd = &vmstate_ac97;
     dc->props = ac97_properties;
hw/audio/adlib.c +1 -0
index f72e6ee..327f2a0 100644
@@ -364,6 +364,7 @@ static void adlib_class_initfn (ObjectClass *klass, void *data)
     DeviceClass *dc = DEVICE_CLASS (klass);
 
     dc->realize = adlib_realizefn;
+    dc->categories = (1 << DEVICE_CATEGORY_SOUND);
     dc->desc = ADLIB_DESC;
     dc->props = adlib_properties;
 }
hw/audio/cs4231a.c +1 -0
index 7365c3c..defcacb 100644
@@ -685,6 +685,7 @@ static void cs4231a_class_initfn (ObjectClass *klass, void *data)
 
     dc->realize = cs4231a_realizefn;
     dc->reset = cs4231a_reset;
+    dc->categories = (1 << DEVICE_CATEGORY_SOUND);
     dc->desc = "Crystal Semiconductor CS4231A";
     dc->vmsd = &vmstate_cs4231a;
     dc->props = cs4231a_properties;
hw/audio/es1370.c +1 -0
index f2c40da..a02352f 100644
@@ -1069,6 +1069,7 @@ static void es1370_class_init (ObjectClass *klass, void *data)
     k->class_id = PCI_CLASS_MULTIMEDIA_AUDIO;
     k->subsystem_vendor_id = 0x4942;
     k->subsystem_id = 0x4c4c;
+    dc->categories = (1 << DEVICE_CATEGORY_SOUND);
     dc->desc = "ENSONIQ AudioPCI ES1370";
     dc->vmsd = &vmstate_es1370;
 }
hw/audio/gus.c +1 -0
index f45ed0b..175202f 100644
@@ -315,6 +315,7 @@ static void gus_class_initfn (ObjectClass *klass, void *data)
     DeviceClass *dc = DEVICE_CLASS (klass);
 
     dc->realize = gus_realizefn;
+    dc->categories = (1 << DEVICE_CATEGORY_SOUND);
     dc->desc = "Gravis Ultrasound GF1";
     dc->vmsd = &vmstate_gus;
     dc->props = gus_properties;
hw/audio/hda-codec.c +3 -0
index 362d8c0..d553adb 100644
@@ -1034,6 +1034,7 @@ static void hda_audio_output_class_init(ObjectClass *klass, void *data)
     k->exit = hda_audio_exit;
     k->command = hda_audio_command;
     k->stream = hda_audio_stream;
+    dc->categories = (1 << DEVICE_CATEGORY_SOUND);
     dc->desc = "HDA Audio Codec, output-only (line-out)";
     dc->vmsd = &vmstate_hda_audio;
     dc->props = hda_audio_properties;
@@ -1055,6 +1056,7 @@ static void hda_audio_duplex_class_init(ObjectClass *klass, void *data)
     k->exit = hda_audio_exit;
     k->command = hda_audio_command;
     k->stream = hda_audio_stream;
+    dc->categories = (1 << DEVICE_CATEGORY_SOUND);
     dc->desc = "HDA Audio Codec, duplex (line-out, line-in)";
     dc->vmsd = &vmstate_hda_audio;
     dc->props = hda_audio_properties;
@@ -1076,6 +1078,7 @@ static void hda_audio_micro_class_init(ObjectClass *klass, void *data)
     k->exit = hda_audio_exit;
     k->command = hda_audio_command;
     k->stream = hda_audio_stream;
+    dc->categories = (1 << DEVICE_CATEGORY_SOUND);
     dc->desc = "HDA Audio Codec, duplex (speaker, microphone)";
     dc->vmsd = &vmstate_hda_audio;
     dc->props = hda_audio_properties;
hw/audio/intel-hda.c +3 -0
index 58984dc..d09b8b5 100644
@@ -1258,6 +1258,7 @@ static void intel_hda_class_init_ich6(ObjectClass *klass, void *data)
 
     k->device_id = 0x2668;
     k->revision = 1;
+    dc->categories = (1 << DEVICE_CATEGORY_SOUND);
     dc->desc = "Intel HD Audio Controller (ich6)";
 }
 
@@ -1268,6 +1269,7 @@ static void intel_hda_class_init_ich9(ObjectClass *klass, void *data)
 
     k->device_id = 0x293e;
     k->revision = 3;
+    dc->categories = (1 << DEVICE_CATEGORY_SOUND);
     dc->desc = "Intel HD Audio Controller (ich9)";
 }
 
@@ -1296,6 +1298,7 @@ static void hda_codec_device_class_init(ObjectClass *klass, void *data)
     DeviceClass *k = DEVICE_CLASS(klass);
     k->init = hda_codec_dev_init;
     k->exit = hda_codec_dev_exit;
+    k->categories = (1 << DEVICE_CATEGORY_SOUND);
     k->bus_type = TYPE_HDA_BUS;
     k->props = hda_props;
 }
hw/audio/pcspk.c +1 -0
index 7ad59a1..e754e24 100644
@@ -191,6 +191,7 @@ static void pcspk_class_initfn(ObjectClass *klass, void *data)
     DeviceClass *dc = DEVICE_CLASS(klass);
 
     dc->realize = pcspk_realizefn;
+    dc->categories = (1 << DEVICE_CATEGORY_SOUND);
     dc->no_user = 1;
     dc->props = pcspk_properties;
 }
hw/audio/pl041.c +1 -0
index 7d331b9..52b4225 100644
@@ -626,6 +626,7 @@ static void pl041_device_class_init(ObjectClass *klass, void *data)
     SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
 
     k->init = pl041_init;
+    dc->categories = (1 << DEVICE_CATEGORY_SOUND);
     dc->no_user = 1;
     dc->reset = pl041_device_reset;
     dc->vmsd = &vmstate_pl041;
hw/audio/sb16.c +1 -0
index e697bc1..88d92ab 100644
@@ -1412,6 +1412,7 @@ static void sb16_class_initfn (ObjectClass *klass, void *data)
     DeviceClass *dc = DEVICE_CLASS (klass);
 
     dc->realize = sb16_realizefn;
+    dc->categories = (1 << DEVICE_CATEGORY_SOUND);
     dc->desc = "Creative Sound Blaster 16";
     dc->vmsd = &vmstate_sb16;
     dc->props = sb16_properties;
hw/block/fdc.c +3 -0
index d32f6ba..529f277 100644
@@ -2249,6 +2249,7 @@ static void isabus_fdc_class_init(ObjectClass *klass, void *data)
     dc->reset = fdctrl_external_reset_isa;
     dc->vmsd = &vmstate_isa_fdc;
     dc->props = isa_fdc_properties;
+    dc->categories = (1 << DEVICE_CATEGORY_STORAGE);
 }
 
 static const TypeInfo isa_fdc_info = {
@@ -2282,6 +2283,7 @@ static void sysbus_fdc_class_init(ObjectClass *klass, void *data)
     dc->reset = fdctrl_external_reset_sysbus;
     dc->vmsd = &vmstate_sysbus_fdc;
     dc->props = sysbus_fdc_properties;
+    dc->categories = (1 << DEVICE_CATEGORY_STORAGE);
 }
 
 static const TypeInfo sysbus_fdc_info = {
@@ -2305,6 +2307,7 @@ static void sun4m_fdc_class_init(ObjectClass *klass, void *data)
     dc->reset = fdctrl_external_reset_sysbus;
     dc->vmsd = &vmstate_sysbus_fdc;
     dc->props = sun4m_fdc_properties;
+    dc->categories = (1 << DEVICE_CATEGORY_STORAGE);
 }
 
 static const TypeInfo sun4m_fdc_info = {
hw/block/nvme.c +1 -0
index f15f04a..9381d93 100644
@@ -866,6 +866,7 @@ static void nvme_class_init(ObjectClass *oc, void *data)
     pc->revision = 1;
     pc->is_express = 1;
 
+    dc->categories = (1 << DEVICE_CATEGORY_STORAGE);
     dc->desc = "Non-Volatile Memory Express";
     dc->props = nvme_props;
     dc->vmsd = &nvme_vmstate;
hw/block/pc_sysfw.c +1 -0
index 0669410..6948c30 100644
@@ -286,6 +286,7 @@ static void pcsysfw_class_init (ObjectClass *klass, void *data)
 {
     DeviceClass *dc = DEVICE_CLASS (klass);
 
+    dc->categories = (1 << DEVICE_CATEGORY_STORAGE);
     dc->desc = "PC System Firmware";
     dc->init = pcsysfw_init;
     dc->props = pcsysfw_properties;
hw/block/pflash_cfi01.c +1 -0
index 2bcd731..a44b5f8 100644
@@ -720,6 +720,7 @@ static void pflash_cfi01_class_init(ObjectClass *klass, void *data)
     dc->realize = pflash_cfi01_realize;
     dc->props = pflash_cfi01_properties;
     dc->vmsd = &vmstate_pflash;
+    dc->categories = (1 << DEVICE_CATEGORY_STORAGE);
 }
 
 
hw/block/virtio-blk.c +1 -0
index cf12469..0692ef1 100644
@@ -704,6 +704,7 @@ static void virtio_blk_class_init(ObjectClass *klass, void *data)
     VirtioDeviceClass *vdc = VIRTIO_DEVICE_CLASS(klass);
     dc->exit = virtio_blk_device_exit;
     dc->props = virtio_blk_properties;
+    dc->categories = (1 << DEVICE_CATEGORY_STORAGE);
     vdc->init = virtio_blk_device_init;
     vdc->get_config = virtio_blk_update_config;
     vdc->set_config = virtio_blk_set_config;
hw/char/imx_serial.c +1 -0
index 69b9ed2..4e001d4 100644
@@ -449,6 +449,7 @@ static void imx_serial_class_init(ObjectClass *klass, void *data)
     k->init = imx_serial_init;
     dc->vmsd = &vmstate_imx_serial;
     dc->reset = imx_serial_reset_at_boot;
+    dc->categories = (1 << DEVICE_CATEGORY_INPUT);
     dc->desc = "i.MX series UART";
     dc->props = imx32_serial_properties;
 }
hw/char/ipack.c +1 -0
index e15540d..274efc9 100644
@@ -74,6 +74,7 @@ static Property ipack_device_props[] = {
 static void ipack_device_class_init(ObjectClass *klass, void *data)
 {
     DeviceClass *k = DEVICE_CLASS(klass);
+    k->categories = (1 << DEVICE_CATEGORY_INPUT);
     k->bus_type = TYPE_IPACK_BUS;
     k->init = ipack_device_dev_init;
     k->exit = ipack_device_dev_exit;
hw/char/ipoctal232.c +1 -0
index c9698a6..7d26cd6 100644
@@ -585,6 +585,7 @@ static void ipoctal_class_init(ObjectClass *klass, void *data)
     ic->mem_read8   = mem_read8;
     ic->mem_write8  = mem_write8;
 
+    dc->categories = (1 << DEVICE_CATEGORY_INPUT);
     dc->desc    = "GE IP-Octal 232 8-channel RS-232 IndustryPack";
     dc->props   = ipoctal_properties;
     dc->vmsd    = &vmstate_ipoctal;
hw/char/parallel.c +1 -0
index ad96ea5..9987fef 100644
@@ -607,6 +607,7 @@ static void parallel_isa_class_initfn(ObjectClass *klass, void *data)
 
     dc->realize = parallel_isa_realizefn;
     dc->props = parallel_isa_properties;
+    dc->categories = (1 << DEVICE_CATEGORY_INPUT);
 }
 
 static const TypeInfo parallel_isa_info = {
hw/char/serial-isa.c +1 -0
index cea8212..3d7643b 100644
@@ -102,6 +102,7 @@ static void serial_isa_class_initfn(ObjectClass *klass, void *data)
     dc->realize = serial_isa_realizefn;
     dc->vmsd = &vmstate_isa_serial;
     dc->props = serial_isa_properties;
+    dc->categories = (1 << DEVICE_CATEGORY_INPUT);
 }
 
 static const TypeInfo serial_isa_info = {
hw/char/serial-pci.c +3 -0
index a17c702..24b2847 100644
@@ -205,6 +205,7 @@ static void serial_pci_class_initfn(ObjectClass *klass, void *data)
     pc->class_id = PCI_CLASS_COMMUNICATION_SERIAL;
     dc->vmsd = &vmstate_pci_serial;
     dc->props = serial_pci_properties;
+    dc->categories = (1 << DEVICE_CATEGORY_INPUT);
 }
 
 static void multi_2x_serial_pci_class_initfn(ObjectClass *klass, void *data)
@@ -219,6 +220,7 @@ static void multi_2x_serial_pci_class_initfn(ObjectClass *klass, void *data)
     pc->class_id = PCI_CLASS_COMMUNICATION_SERIAL;
     dc->vmsd = &vmstate_pci_multi_serial;
     dc->props = multi_2x_serial_pci_properties;
+    dc->categories = (1 << DEVICE_CATEGORY_INPUT);
 }
 
 static void multi_4x_serial_pci_class_initfn(ObjectClass *klass, void *data)
@@ -233,6 +235,7 @@ static void multi_4x_serial_pci_class_initfn(ObjectClass *klass, void *data)
     pc->class_id = PCI_CLASS_COMMUNICATION_SERIAL;
     dc->vmsd = &vmstate_pci_multi_serial;
     dc->props = multi_4x_serial_pci_properties;
+    dc->categories = (1 << DEVICE_CATEGORY_INPUT);
 }
 
 static const TypeInfo serial_pci_info = {
hw/char/tpci200.c +1 -0
index a199e57..35ecae3 100644
@@ -652,6 +652,7 @@ static void tpci200_class_init(ObjectClass *klass, void *data)
     k->class_id = PCI_CLASS_BRIDGE_OTHER;
     k->subsystem_vendor_id = PCI_VENDOR_ID_TEWS;
     k->subsystem_id = 0x300A;
+    dc->categories = (1 << DEVICE_CATEGORY_INPUT);
     dc->desc = "TEWS TPCI200 IndustryPack carrier";
     dc->vmsd = &vmstate_tpci200;
 }
hw/char/virtio-serial-bus.c +2 -0
index cc3d1dd..a8f83fc 100644
@@ -971,6 +971,7 @@ static void virtio_serial_port_class_init(ObjectClass *klass, void *data)
 {
     DeviceClass *k = DEVICE_CLASS(klass);
     k->init = virtser_port_qdev_init;
+    k->categories = (1 << DEVICE_CATEGORY_INPUT);
     k->bus_type = TYPE_VIRTIO_SERIAL_BUS;
     k->exit = virtser_port_qdev_exit;
     k->unplug = qdev_simple_unplug_cb;
@@ -1017,6 +1018,7 @@ static void virtio_serial_class_init(ObjectClass *klass, void *data)
     VirtioDeviceClass *vdc = VIRTIO_DEVICE_CLASS(klass);
     dc->exit = virtio_serial_device_exit;
     dc->props = virtio_serial_properties;
+    dc->categories = (1 << DEVICE_CATEGORY_INPUT);
     vdc->init = virtio_serial_device_init;
     vdc->get_features = get_features;
     vdc->get_config = get_config;
hw/core/sysbus.c +1 -0
index 9004d8c..8b53f49 100644
@@ -256,6 +256,7 @@ static void sysbus_device_class_init(ObjectClass *klass, void *data)
 {
     DeviceClass *k = DEVICE_CLASS(klass);
     k->init = sysbus_device_init;
+    k->categories = (1 << DEVICE_CATEGORY_ASSEMBLY);
     k->bus_type = TYPE_SYSTEM_BUS;
 }
 
hw/display/cirrus_vga.c +2 -0
index a440575..37e01b6 100644
@@ -2937,6 +2937,7 @@ static void isa_cirrus_vga_class_init(ObjectClass *klass, void *data)
     dc->vmsd  = &vmstate_cirrus_vga;
     dc->realize = isa_cirrus_vga_realizefn;
     dc->props = isa_cirrus_vga_properties;
+    dc->categories = (1 << DEVICE_CATEGORY_DISPLAY);
 }
 
 static const TypeInfo isa_cirrus_vga_info = {
@@ -3002,6 +3003,7 @@ static void cirrus_vga_class_init(ObjectClass *klass, void *data)
     k->vendor_id = PCI_VENDOR_ID_CIRRUS;
     k->device_id = CIRRUS_ID_CLGD5446;
     k->class_id = PCI_CLASS_DISPLAY_VGA;
+    dc->categories = (1 << DEVICE_CATEGORY_DISPLAY);
     dc->desc = "Cirrus CLGD 54xx VGA";
     dc->vmsd = &vmstate_pci_cirrus_vga;
     dc->props = pci_vga_cirrus_properties;
hw/display/g364fb.c +1 -0
index 79a0a50..da8ceda 100644
@@ -528,6 +528,7 @@ static void g364fb_sysbus_class_init(ObjectClass *klass, void *data)
     SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
 
     k->init = g364fb_sysbus_init;
+    dc->categories = (1 << DEVICE_CATEGORY_DISPLAY);
     dc->desc = "G364 framebuffer";
     dc->reset = g364fb_sysbus_reset;
     dc->vmsd = &vmstate_g364fb;
hw/display/pl110.c +3 -0
index 60afcf3..a12bfbf 100644
@@ -481,6 +481,7 @@ static void pl110_class_init(ObjectClass *klass, void *data)
     SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
 
     k->init = pl110_init;
+    dc->categories = (1 << DEVICE_CATEGORY_DISPLAY);
     dc->no_user = 1;
     dc->vmsd = &vmstate_pl110;
 }
@@ -498,6 +499,7 @@ static void pl110_versatile_class_init(ObjectClass *klass, void *data)
     SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
 
     k->init = pl110_versatile_init;
+    dc->categories = (1 << DEVICE_CATEGORY_DISPLAY);
     dc->no_user = 1;
     dc->vmsd = &vmstate_pl110;
 }
@@ -515,6 +517,7 @@ static void pl111_class_init(ObjectClass *klass, void *data)
     SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
 
     k->init = pl111_init;
+    dc->categories = (1 << DEVICE_CATEGORY_DISPLAY);
     dc->no_user = 1;
     dc->vmsd = &vmstate_pl110;
 }
hw/display/qxl.c +2 -0
index ddefa06..7ebdf97 100644
@@ -2323,6 +2323,7 @@ static void qxl_primary_class_init(ObjectClass *klass, void *data)
     k->vendor_id = REDHAT_PCI_VENDOR_ID;
     k->device_id = QXL_DEVICE_ID_STABLE;
     k->class_id = PCI_CLASS_DISPLAY_VGA;
+    dc->categories = (1 << DEVICE_CATEGORY_DISPLAY);
     dc->desc = "Spice QXL GPU (primary, vga compatible)";
     dc->reset = qxl_reset_handler;
     dc->vmsd = &qxl_vmstate;
@@ -2345,6 +2346,7 @@ static void qxl_secondary_class_init(ObjectClass *klass, void *data)
     k->vendor_id = REDHAT_PCI_VENDOR_ID;
     k->device_id = QXL_DEVICE_ID_STABLE;
     k->class_id = PCI_CLASS_DISPLAY_OTHER;
+    dc->categories = (1 << DEVICE_CATEGORY_DISPLAY);
     dc->desc = "Spice QXL GPU (secondary)";
     dc->reset = qxl_reset_handler;
     dc->vmsd = &qxl_vmstate;
hw/display/vga-isa.c +1 -0
index 8d560ec..1c5bc9f 100644
@@ -87,6 +87,7 @@ static void vga_isa_class_initfn(ObjectClass *klass, void *data)
     dc->reset = vga_isa_reset;
     dc->vmsd = &vmstate_vga_common;
     dc->props = vga_isa_properties;
+    dc->categories = (1 << DEVICE_CATEGORY_DISPLAY);
 }
 
 static const TypeInfo vga_isa_info = {
hw/display/vga-pci.c +1 -0
index 3e150ab..edf482d 100644
@@ -198,6 +198,7 @@ static void vga_class_init(ObjectClass *klass, void *data)
     k->class_id = PCI_CLASS_DISPLAY_VGA;
     dc->vmsd = &vmstate_vga_pci;
     dc->props = vga_pci_properties;
+    dc->categories = (1 << DEVICE_CATEGORY_DISPLAY);
 }
 
 static const TypeInfo vga_info = {
hw/display/vmware_vga.c +1 -0
index 3536cde..6d6576a 100644
@@ -1306,6 +1306,7 @@ static void vmsvga_class_init(ObjectClass *klass, void *data)
     dc->reset = vmsvga_reset;
     dc->vmsd = &vmstate_vmware_vga;
     dc->props = vga_vmware_properties;
+    dc->categories = (1 << DEVICE_CATEGORY_DISPLAY);
 }
 
 static const TypeInfo vmsvga_info = {
hw/i2c/bitbang_i2c.c +1 -0
index 5f8b972..d033120 100644
@@ -227,6 +227,7 @@ static void gpio_i2c_class_init(ObjectClass *klass, void *data)
     SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
 
     k->init = gpio_i2c_init;
+    dc->categories = (1 << DEVICE_CATEGORY_ASSEMBLY);
     dc->desc = "Virtual GPIO to I2C bridge";
 }
 
hw/i2c/core.c +1 -0
index 22ef3b9..00a87ce 100644
@@ -224,6 +224,7 @@ static void i2c_slave_class_init(ObjectClass *klass, void *data)
 {
     DeviceClass *k = DEVICE_CLASS(klass);
     k->init = i2c_slave_qdev_init;
+    k->categories = (1 << DEVICE_CATEGORY_ASSEMBLY);
     k->bus_type = TYPE_I2C_BUS;
     k->props = i2c_props;
 }
hw/i386/kvm/pci-assign.c +1 -0
index ff33dc8..612b6d9 100644
@@ -1856,6 +1856,7 @@ static void assign_class_init(ObjectClass *klass, void *data)
     dc->props       = assigned_dev_properties;
     dc->vmsd        = &vmstate_assigned_device;
     dc->reset       = reset_assigned_device;
+    dc->categories = (1 << DEVICE_CATEGORY_MISC);
     dc->desc        = "KVM-based PCI passthrough";
 }
 
hw/ide/ahci.c +1 -0
index 419adde..9e4e3c3 100644
@@ -1338,6 +1338,7 @@ static void sysbus_ahci_class_init(ObjectClass *klass, void *data)
     dc->vmsd = &vmstate_sysbus_ahci;
     dc->props = sysbus_ahci_properties;
     dc->reset = sysbus_ahci_reset;
+    dc->categories = (1 << DEVICE_CATEGORY_MANAGEMENT);
 }
 
 static const TypeInfo sysbus_ahci_info = {
hw/ide/ich.c +1 -0
index 4eb5488..017db3b 100644
@@ -160,6 +160,7 @@ static void ich_ahci_class_init(ObjectClass *klass, void *data)
     k->class_id = PCI_CLASS_STORAGE_SATA;
     dc->vmsd = &vmstate_ich9_ahci;
     dc->reset = pci_ich9_reset;
+    dc->categories = (1 << DEVICE_CATEGORY_STORAGE);
 }
 
 static const TypeInfo ich_ahci_info = {
hw/ide/isa.c +1 -0
index 7243c82..c2f57a9 100644
@@ -115,6 +115,7 @@ static void isa_ide_class_initfn(ObjectClass *klass, void *data)
     DeviceClass *dc = DEVICE_CLASS(klass);
 
     dc->realize = isa_ide_realizefn;
+    dc->categories = (1 << DEVICE_CATEGORY_STORAGE);
     dc->fw_name = "ide";
     dc->reset = isa_ide_reset;
     dc->props = isa_ide_properties;
hw/ide/piix.c +3 -0
index 58532fe..b81d525 100644
@@ -248,6 +248,7 @@ static void piix3_ide_class_init(ObjectClass *klass, void *data)
     k->vendor_id = PCI_VENDOR_ID_INTEL;
     k->device_id = PCI_DEVICE_ID_INTEL_82371SB_1;
     k->class_id = PCI_CLASS_STORAGE_IDE;
+    dc->categories = (1 << DEVICE_CATEGORY_STORAGE);
     dc->no_user = 1;
 }
 
@@ -267,6 +268,7 @@ static void piix3_ide_xen_class_init(ObjectClass *klass, void *data)
     k->vendor_id = PCI_VENDOR_ID_INTEL;
     k->device_id = PCI_DEVICE_ID_INTEL_82371SB_1;
     k->class_id = PCI_CLASS_STORAGE_IDE;
+    dc->categories = (1 << DEVICE_CATEGORY_STORAGE);
     dc->no_user = 1;
     dc->unplug = pci_piix3_xen_ide_unplug;
 }
@@ -289,6 +291,7 @@ static void piix4_ide_class_init(ObjectClass *klass, void *data)
     k->vendor_id = PCI_VENDOR_ID_INTEL;
     k->device_id = PCI_DEVICE_ID_INTEL_82371AB;
     k->class_id = PCI_CLASS_STORAGE_IDE;
+    dc->categories = (1 << DEVICE_CATEGORY_STORAGE);
     dc->no_user = 1;
 }
 
hw/ide/qdev.c +1 -0
index 6a272b0..02672c1 100644
@@ -282,6 +282,7 @@ static void ide_device_class_init(ObjectClass *klass, void *data)
 {
     DeviceClass *k = DEVICE_CLASS(klass);
     k->init = ide_qdev_init;
+    k->categories = (1 << DEVICE_CATEGORY_STORAGE);
     k->bus_type = TYPE_IDE_BUS;
     k->props = ide_props;
 }
hw/ide/via.c +1 -0
index 5a83191..b1d86eb 100644
@@ -223,6 +223,7 @@ static void via_ide_class_init(ObjectClass *klass, void *data)
     k->device_id = PCI_DEVICE_ID_VIA_IDE;
     k->revision = 0x06;
     k->class_id = PCI_CLASS_STORAGE_IDE;
+    dc->categories = (1 << DEVICE_CATEGORY_STORAGE);
     dc->no_user = 1;
 }
 
hw/isa/i82378.c +1 -0
index b25ed04..1caf9d9 100644
@@ -261,6 +261,7 @@ static void pci_i82378_class_init(ObjectClass *klass, void *data)
     k->subsystem_vendor_id = 0x0;
     k->subsystem_id = 0x0;
     dc->vmsd = &vmstate_pci_i82378;
+    dc->categories = (1 << DEVICE_CATEGORY_ASSEMBLY);
     dc->props = i82378_properties;
 }
 
hw/isa/isa-bus.c +1 -0
index 9e104eb..3c19a17 100644
@@ -210,6 +210,7 @@ static const TypeInfo isabus_bridge_info = {
 static void isa_device_class_init(ObjectClass *klass, void *data)
 {
     DeviceClass *k = DEVICE_CLASS(klass);
+    k->categories = (1 << DEVICE_CATEGORY_ASSEMBLY);
     k->bus_type = TYPE_ISA_BUS;
 }
 
hw/isa/lpc_ich9.c +1 -0
index d1921aa..45c377f 100644
@@ -600,6 +600,7 @@ static void ich9_lpc_class_init(ObjectClass *klass, void *data)
     DeviceClass *dc = DEVICE_CLASS(klass);
     PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
 
+    dc->categories = (1 << DEVICE_CATEGORY_ASSEMBLY);
     dc->reset = ich9_lpc_reset;
     k->init = ich9_lpc_initfn;
     dc->vmsd = &vmstate_ich9_lpc;
hw/isa/vt82c686.c +3 -0
index 2174eaa..c1654f3 100644
@@ -281,6 +281,7 @@ static void via_ac97_class_init(ObjectClass *klass, void *data)
     k->device_id = PCI_DEVICE_ID_VIA_AC97;
     k->revision = 0x50;
     k->class_id = PCI_CLASS_MULTIMEDIA_AUDIO;
+    dc->categories = (1 << DEVICE_CATEGORY_SOUND);
     dc->desc = "AC97";
 }
 
@@ -322,6 +323,7 @@ static void via_mc97_class_init(ObjectClass *klass, void *data)
     k->device_id = PCI_DEVICE_ID_VIA_MC97;
     k->class_id = PCI_CLASS_COMMUNICATION_OTHER;
     k->revision = 0x30;
+    dc->categories = (1 << DEVICE_CATEGORY_NETWORK);
     dc->desc = "MC97";
 }
 
@@ -401,6 +403,7 @@ static void via_pm_class_init(ObjectClass *klass, void *data)
     k->revision = 0x40;
     dc->desc = "PM";
     dc->vmsd = &vmstate_acpi;
+    dc->categories = (1 << DEVICE_CATEGORY_ASSEMBLY);
     dc->props = via_pm_properties;
 }
 
hw/misc/applesmc.c +1 -0
index bfafa51..a664d0a 100644
@@ -263,6 +263,7 @@ static void qdev_applesmc_class_init(ObjectClass *klass, void *data)
     dc->realize = applesmc_isa_realize;
     dc->reset = qdev_applesmc_isa_reset;
     dc->props = applesmc_isa_properties;
+    dc->categories = (1 << DEVICE_CATEGORY_MANAGEMENT);
 }
 
 static const TypeInfo applesmc_isa_info = {
hw/misc/debugexit.c +1 -0
index d754cf1..d9aa5ac 100644
@@ -58,6 +58,7 @@ static void debug_exit_class_initfn(ObjectClass *klass, void *data)
 
     dc->realize = debug_exit_realizefn;
     dc->props = debug_exit_properties;
+    dc->categories = (1 << DEVICE_CATEGORY_MISC);
 }
 
 static const TypeInfo debug_exit_info = {
hw/misc/ivshmem.c +1 -0
index 4a74856..2e25076 100644
@@ -821,6 +821,7 @@ static void ivshmem_class_init(ObjectClass *klass, void *data)
     k->class_id = PCI_CLASS_MEMORY_RAM;
     dc->reset = ivshmem_reset;
     dc->props = ivshmem_properties;
+    dc->categories = (1 << DEVICE_CATEGORY_MISC);
 }
 
 static const TypeInfo ivshmem_info = {
hw/misc/pc-testdev.c +1 -0
index 5867c70..fd8bf4c 100644
@@ -188,6 +188,7 @@ static void testdev_class_init(ObjectClass *klass, void *data)
 {
     DeviceClass *dc = DEVICE_CLASS(klass);
 
+    dc->categories = (1 << DEVICE_CATEGORY_MISC);
     dc->realize = testdev_realizefn;
 }
 
hw/misc/pci-testdev.c +1 -0
index d69ff33..5743794 100644
@@ -315,6 +315,7 @@ static void pci_testdev_class_init(ObjectClass *klass, void *data)
     k->revision = 0x00;
     k->class_id = PCI_CLASS_OTHERS;
     dc->desc = "PCI Test Device";
+    dc->categories = (1 << DEVICE_CATEGORY_MISC);
     dc->reset = qdev_pci_testdev_reset;
 }
 
hw/misc/sga.c +1 -0
index 08803e7..8fe7d96 100644
@@ -47,6 +47,7 @@ static void sga_class_initfn(ObjectClass *klass, void *data)
 {
     DeviceClass *dc = DEVICE_CLASS(klass);
 
+    dc->categories = (1 << DEVICE_CATEGORY_DISPLAY);
     dc->realize = sga_realizefn;
     dc->desc = "Serial Graphics Adapter";
 }
hw/misc/vfio.c +1 -0
index ad8ce77..2c2134c 100644
@@ -3299,6 +3299,7 @@ static void vfio_pci_dev_class_init(ObjectClass *klass, void *data)
     dc->props = vfio_pci_dev_properties;
     dc->vmsd = &vfio_pci_vmstate;
     dc->desc = "VFIO-based PCI device assignment";
+    dc->categories = (1 << DEVICE_CATEGORY_MISC);
     pdc->init = vfio_initfn;
     pdc->exit = vfio_exitfn;
     pdc->config_read = vfio_pci_read_config;
hw/net/e1000.c +1 -0
index b952d8d..0513c2f 100644
@@ -1400,6 +1400,7 @@ static void e1000_class_init(ObjectClass *klass, void *data)
     k->device_id = E1000_DEVID;
     k->revision = 0x03;
     k->class_id = PCI_CLASS_NETWORK_ETHERNET;
+    dc->categories = (1 << DEVICE_CATEGORY_NETWORK);
     dc->desc = "Intel Gigabit Ethernet";
     dc->reset = qdev_e1000_reset;
     dc->vmsd = &vmstate_e1000;
hw/net/eepro100.c +1 -0
index e0befb2..5e69e94 100644
@@ -2083,6 +2083,7 @@ static void eepro100_class_init(ObjectClass *klass, void *data)
 
     info = eepro100_get_class_by_name(object_class_get_name(klass));
 
+    dc->categories = (1 << DEVICE_CATEGORY_NETWORK);
     dc->props = e100_properties;
     dc->desc = info->desc;
     k->vendor_id = PCI_VENDOR_ID_INTEL;
hw/net/lance.c +1 -0
index 98bcdfc..ded452e 100644
@@ -150,6 +150,7 @@ static void lance_class_init(ObjectClass *klass, void *data)
     SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
 
     k->init = lance_init;
+    dc->categories = (1 << DEVICE_CATEGORY_NETWORK);
     dc->fw_name = "ethernet";
     dc->reset = lance_reset;
     dc->vmsd = &vmstate_lance;
hw/net/mipsnet.c +1 -0
index 9080850..ef9244b 100644
@@ -264,6 +264,7 @@ static void mipsnet_class_init(ObjectClass *klass, void *data)
     SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
 
     k->init = mipsnet_sysbus_init;
+    dc->categories = (1 << DEVICE_CATEGORY_NETWORK);
     dc->desc = "MIPS Simulator network device";
     dc->reset = mipsnet_sysbus_reset;
     dc->vmsd = &vmstate_mipsnet;
hw/net/ne2000-isa.c +1 -0
index e3c8076..4049475 100644
@@ -98,6 +98,7 @@ static void isa_ne2000_class_initfn(ObjectClass *klass, void *data)
 
     dc->realize = isa_ne2000_realizefn;
     dc->props = ne2000_isa_properties;
+    dc->categories = (1 << DEVICE_CATEGORY_NETWORK);
 }
 
 static const TypeInfo ne2000_isa_info = {
hw/net/ne2000.c +1 -0
index 8d43fd9..fd5ba32 100644
@@ -772,6 +772,7 @@ static void ne2000_class_init(ObjectClass *klass, void *data)
     k->class_id = PCI_CLASS_NETWORK_ETHERNET;
     dc->vmsd = &vmstate_pci_ne2000;
     dc->props = ne2000_properties;
+    dc->categories = (1 << DEVICE_CATEGORY_NETWORK);
 }
 
 static const TypeInfo ne2000_info = {
hw/net/opencores_eth.c +1 -0
index 4637557..d7db186 100644
@@ -713,6 +713,7 @@ static void open_eth_class_init(ObjectClass *klass, void *data)
     SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
 
     k->init = sysbus_open_eth_init;
+    dc->categories = (1 << DEVICE_CATEGORY_NETWORK);
     dc->desc = "Opencores 10/100 Mbit Ethernet";
     dc->reset = qdev_open_eth_reset;
     dc->props = open_eth_properties;
hw/net/pcnet-pci.c +1 -0
index 6ef28f7..48d5990 100644
@@ -366,6 +366,7 @@ static void pcnet_class_init(ObjectClass *klass, void *data)
     dc->reset = pci_reset;
     dc->vmsd = &vmstate_pci_pcnet;
     dc->props = pcnet_properties;
+    dc->categories = (1 << DEVICE_CATEGORY_NETWORK);
 }
 
 static const TypeInfo pcnet_info = {
hw/net/rtl8139.c +1 -0
index 6552034..f13d4a3 100644
@@ -3563,6 +3563,7 @@ static void rtl8139_class_init(ObjectClass *klass, void *data)
     dc->reset = rtl8139_reset;
     dc->vmsd = &vmstate_rtl8139;
     dc->props = rtl8139_properties;
+    dc->categories = (1 << DEVICE_CATEGORY_NETWORK);
 }
 
 static const TypeInfo rtl8139_info = {
hw/net/virtio-net.c +1 -0
index 679f50c..98dc928 100644
@@ -1638,6 +1638,7 @@ static void virtio_net_class_init(ObjectClass *klass, void *data)
     VirtioDeviceClass *vdc = VIRTIO_DEVICE_CLASS(klass);
     dc->exit = virtio_net_device_exit;
     dc->props = virtio_net_properties;
+    dc->categories = (1 << DEVICE_CATEGORY_NETWORK);
     vdc->init = virtio_net_device_init;
     vdc->get_config = virtio_net_get_config;
     vdc->set_config = virtio_net_set_config;
hw/net/vmxnet3.c +1 -0
index b39ff08..30a4bc7 100644
@@ -2453,6 +2453,7 @@ static void vmxnet3_class_init(ObjectClass *class, void *data)
     dc->reset = vmxnet3_qdev_reset;
     dc->vmsd = &vmstate_vmxnet3;
     dc->props = vmxnet3_properties;
+    dc->categories = (1 << DEVICE_CATEGORY_NETWORK);
 }
 
 static const TypeInfo vmxnet3_info = {
hw/pci-bridge/i82801b11.c +2 -0
index b98bfb0..b3b74d2 100644
@@ -81,12 +81,14 @@ err_bridge:
 static void i82801b11_bridge_class_init(ObjectClass *klass, void *data)
 {
     PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
+    DeviceClass *dc = DEVICE_CLASS(klass);
 
     k->is_bridge = 1;
     k->vendor_id = PCI_VENDOR_ID_INTEL;
     k->device_id = PCI_DEVICE_ID_INTEL_82801BA_11;
     k->revision = ICH9_D2P_A2_REVISION;
     k->init = i82801b11_bridge_initfn;
+    dc->categories = (1 << DEVICE_CATEGORY_ASSEMBLY);
 }
 
 static const TypeInfo i82801b11_bridge_info = {
hw/pci-bridge/ioh3420.c +1 -0
index bb541eb..490dbe3 100644
@@ -220,6 +220,7 @@ static void ioh3420_class_init(ObjectClass *klass, void *data)
     k->vendor_id = PCI_VENDOR_ID_INTEL;
     k->device_id = PCI_DEVICE_ID_IOH_EPORT;
     k->revision = PCI_DEVICE_ID_IOH_REV;
+    dc->categories = (1 << DEVICE_CATEGORY_ASSEMBLY);
     dc->desc = "Intel IOH device id 3420 PCIE Root Port";
     dc->reset = ioh3420_reset;
     dc->vmsd = &vmstate_ioh3420;
hw/pci-bridge/pci_bridge_dev.c +1 -0
index 5f11323..e906d72 100644
@@ -141,6 +141,7 @@ static void pci_bridge_dev_class_init(ObjectClass *klass, void *data)
     dc->reset = qdev_pci_bridge_dev_reset;
     dc->props = pci_bridge_dev_properties;
     dc->vmsd = &pci_bridge_dev_vmstate;
+    dc->categories = (1 << DEVICE_CATEGORY_ASSEMBLY);
 }
 
 static const TypeInfo pci_bridge_dev_info = {
hw/pci-bridge/xio3130_downstream.c +1 -0
index 1810dd2..2a634b2 100644
@@ -187,6 +187,7 @@ static void xio3130_downstream_class_init(ObjectClass *klass, void *data)
     k->vendor_id = PCI_VENDOR_ID_TI;
     k->device_id = PCI_DEVICE_ID_TI_XIO3130D;
     k->revision = XIO3130_REVISION;
+    dc->categories = (1 << DEVICE_CATEGORY_ASSEMBLY);
     dc->desc = "TI X3130 Downstream Port of PCI Express Switch";
     dc->reset = xio3130_downstream_reset;
     dc->vmsd = &vmstate_xio3130_downstream;
hw/pci-bridge/xio3130_upstream.c +1 -0
index 8e0d97a..6b659a3 100644
@@ -161,6 +161,7 @@ static void xio3130_upstream_class_init(ObjectClass *klass, void *data)
     k->vendor_id = PCI_VENDOR_ID_TI;
     k->device_id = PCI_DEVICE_ID_TI_XIO3130U;
     k->revision = XIO3130_REVISION;
+    dc->categories = (1 << DEVICE_CATEGORY_ASSEMBLY);
     dc->desc = "TI X3130 Upstream Port of PCI Express Switch";
     dc->reset = xio3130_upstream_reset;
     dc->vmsd = &vmstate_xio3130_upstream;
hw/pci-host/apb.c +2 -0
index 3756ce9..f470684 100644
@@ -536,6 +536,7 @@ static void pbm_host_class_init(ObjectClass *klass, void *data)
     SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
 
     k->init = pci_pbm_init_device;
+    dc->categories = (1 << DEVICE_CATEGORY_ASSEMBLY);
     dc->reset = pci_pbm_reset;
 }
 
@@ -558,6 +559,7 @@ static void pbm_pci_bridge_class_init(ObjectClass *klass, void *data)
     k->revision = 0x11;
     k->config_write = pci_bridge_write_config;
     k->is_bridge = 1;
+    dc->categories = (1 << DEVICE_CATEGORY_ASSEMBLY);
     dc->reset = pci_bridge_reset;
     dc->vmsd = &vmstate_pci_device;
 }
hw/pci-host/ppce500.c +1 -0
index 646204e..b1ba043 100644
@@ -407,6 +407,7 @@ static void e500_pcihost_class_init(ObjectClass *klass, void *data)
     SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
 
     k->init = e500_pcihost_initfn;
+    dc->categories = (1 << DEVICE_CATEGORY_ASSEMBLY);
     dc->props = pcihost_properties;
     dc->vmsd = &vmstate_ppce500_pci;
 }
hw/pci-host/prep.c +1 -0
index b41d564..7a527f1 100644
@@ -210,6 +210,7 @@ static void raven_pcihost_class_init(ObjectClass *klass, void *data)
 {
     DeviceClass *dc = DEVICE_CLASS(klass);
 
+    dc->categories = (1 << DEVICE_CATEGORY_ASSEMBLY);
     dc->realize = raven_pcihost_realizefn;
     dc->fw_name = "pci";
     dc->no_user = 1;
hw/pci-host/q35.c +2 -0
index 6b1b3b7..97e7d69 100644
@@ -78,6 +78,7 @@ static void q35_host_class_init(ObjectClass *klass, void *data)
     hc->root_bus_path = q35_host_root_bus_path;
     dc->realize = q35_host_realize;
     dc->props = mch_props;
+    dc->categories = (1 << DEVICE_CATEGORY_ASSEMBLY);
     dc->fw_name = "pci";
 }
 
@@ -306,6 +307,7 @@ static void mch_class_init(ObjectClass *klass, void *data)
     k->init = mch_init;
     k->config_write = mch_write_config;
     dc->reset = mch_reset;
+    dc->categories = (1 << DEVICE_CATEGORY_ASSEMBLY);
     dc->desc = "Host bridge";
     dc->vmsd = &vmstate_mch;
     k->vendor_id = PCI_VENDOR_ID_INTEL;
hw/scsi/esp-pci.c +2 -0
index 2ac21d4..8a0ba95 100644
@@ -392,6 +392,7 @@ static void esp_pci_class_init(ObjectClass *klass, void *data)
     k->device_id = PCI_DEVICE_ID_AMD_SCSI;
     k->revision = 0x10;
     k->class_id = PCI_CLASS_STORAGE_SCSI;
+    dc->categories = (1 << DEVICE_CATEGORY_STORAGE);
     dc->desc = "AMD Am53c974 PCscsi-PCI SCSI adapter";
     dc->reset = esp_pci_hard_reset;
     dc->vmsd = &vmstate_esp_pci_scsi;
@@ -512,6 +513,7 @@ static void dc390_class_init(ObjectClass *klass, void *data)
     k->init = dc390_scsi_init;
     k->config_read = dc390_read_config;
     k->config_write = dc390_write_config;
+    dc->categories = (1 << DEVICE_CATEGORY_STORAGE);
     dc->desc = "Tekram DC-390 SCSI adapter";
 }
 
hw/scsi/esp.c +1 -0
index 94639b8..c4141c4 100644
@@ -720,6 +720,7 @@ static void sysbus_esp_class_init(ObjectClass *klass, void *data)
     dc->realize = sysbus_esp_realize;
     dc->reset = sysbus_esp_hard_reset;
     dc->vmsd = &vmstate_sysbus_esp_scsi;
+    dc->categories = (1 << DEVICE_CATEGORY_STORAGE);
 }
 
 static const TypeInfo sysbus_esp_info = {
hw/scsi/lsi53c895a.c +1 -0
index 776e31a..01df5ba 100644
@@ -2141,6 +2141,7 @@ static void lsi_class_init(ObjectClass *klass, void *data)
     k->subsystem_id = 0x1000;
     dc->reset = lsi_scsi_reset;
     dc->vmsd = &vmstate_lsi_scsi;
+    dc->categories = (1 << DEVICE_CATEGORY_STORAGE);
 }
 
 static const TypeInfo lsi_info = {
hw/scsi/megasas.c +1 -0
index eb52164..6cfbd1b 100644
@@ -2213,6 +2213,7 @@ static void megasas_class_init(ObjectClass *oc, void *data)
     dc->props = megasas_properties;
     dc->reset = megasas_scsi_reset;
     dc->vmsd = &vmstate_megasas;
+    dc->categories = (1 << DEVICE_CATEGORY_STORAGE);
     dc->desc = "LSI MegaRAID SAS 1078";
 }
 
hw/scsi/scsi-bus.c +1 -0
index b5a863a..e73bf33 100644
@@ -1881,6 +1881,7 @@ const VMStateDescription vmstate_scsi_device = {
 static void scsi_device_class_init(ObjectClass *klass, void *data)
 {
     DeviceClass *k = DEVICE_CLASS(klass);
+    k->categories = (1 << DEVICE_CATEGORY_STORAGE);
     k->bus_type = TYPE_SCSI_BUS;
     k->init     = scsi_qdev_init;
     k->unplug   = scsi_qdev_unplug;
hw/scsi/vhost-scsi.c +1 -0
index 785e93f..3d5adeb 100644
@@ -267,6 +267,7 @@ static void vhost_scsi_class_init(ObjectClass *klass, void *data)
     VirtioDeviceClass *vdc = VIRTIO_DEVICE_CLASS(klass);
     dc->exit = vhost_scsi_exit;
     dc->props = vhost_scsi_properties;
+    dc->categories = (1 << DEVICE_CATEGORY_STORAGE);
     vdc->init = vhost_scsi_init;
     vdc->get_features = vhost_scsi_get_features;
     vdc->set_config = vhost_scsi_set_config;
hw/scsi/virtio-scsi.c +3 -0
index 42cb73b..f065c67 100644
@@ -669,8 +669,10 @@ static Property virtio_scsi_properties[] = {
 static void virtio_scsi_common_class_init(ObjectClass *klass, void *data)
 {
     VirtioDeviceClass *vdc = VIRTIO_DEVICE_CLASS(klass);
+    DeviceClass *dc = DEVICE_CLASS(klass);
 
     vdc->get_config = virtio_scsi_get_config;
+    dc->categories = (1 << DEVICE_CATEGORY_STORAGE);
 }
 
 static void virtio_scsi_class_init(ObjectClass *klass, void *data)
@@ -679,6 +681,7 @@ static void virtio_scsi_class_init(ObjectClass *klass, void *data)
     VirtioDeviceClass *vdc = VIRTIO_DEVICE_CLASS(klass);
     dc->exit = virtio_scsi_device_exit;
     dc->props = virtio_scsi_properties;
+    dc->categories = (1 << DEVICE_CATEGORY_STORAGE);
     vdc->init = virtio_scsi_device_init;
     vdc->set_config = virtio_scsi_set_config;
     vdc->get_features = virtio_scsi_get_features;
hw/scsi/vmw_pvscsi.c +1 -0
index e1074e1..2b08464 100644
@@ -1197,6 +1197,7 @@ static void pvscsi_class_init(ObjectClass *klass, void *data)
     dc->reset = pvscsi_reset;
     dc->vmsd = &vmstate_pvscsi;
     dc->props = pvscsi_properties;
+    dc->categories = (1 << DEVICE_CATEGORY_STORAGE);
     k->config_write = pvscsi_write_config;
 }
 
hw/usb/ccid-card-emulated.c +1 -0
index deb6d47..c8886d5 100644
@@ -592,6 +592,7 @@ static void emulated_class_initfn(ObjectClass *klass, void *data)
     cc->exitfn = emulated_exitfn;
     cc->get_atr = emulated_get_atr;
     cc->apdu_from_guest = emulated_apdu_from_guest;
+    dc->categories = (1 << DEVICE_CATEGORY_INPUT);
     dc->desc = "emulated smartcard";
     dc->props = emulated_card_properties;
 }
hw/usb/ccid-card-passthru.c +1 -0
index 5f01ff1..afc3ebe 100644
@@ -392,6 +392,7 @@ static void passthru_class_initfn(ObjectClass *klass, void *data)
     cc->exitfn = passthru_exitfn;
     cc->get_atr = passthru_get_atr;
     cc->apdu_from_guest = passthru_apdu_from_guest;
+    dc->categories = (1 << DEVICE_CATEGORY_INPUT);
     dc->desc = "passthrough smartcard";
     dc->vmsd = &passthru_vmstate;
     dc->props = passthru_card_properties;
hw/usb/dev-audio.c +1 -0
index 04933a9..6a381b8 100644
@@ -673,6 +673,7 @@ static void usb_audio_class_init(ObjectClass *klass, void *data)
 
     dc->vmsd          = &vmstate_usb_audio;
     dc->props         = usb_audio_properties;
+    dc->categories    = (1 << DEVICE_CATEGORY_SOUND);
     k->product_desc   = "QEMU USB Audio Interface";
     k->usb_desc       = &desc_audio;
     k->init           = usb_audio_initfn;
hw/usb/dev-bluetooth.c +1 -0
index 68cc1d4..b6d39ab 100644
@@ -553,6 +553,7 @@ static void usb_bt_class_initfn(ObjectClass *klass, void *data)
     uc->handle_data    = usb_bt_handle_data;
     uc->handle_destroy = usb_bt_handle_destroy;
     dc->vmsd = &vmstate_usb_bt;
+    dc->categories = (1 << DEVICE_CATEGORY_NETWORK);
 }
 
 static const TypeInfo bt_info = {
hw/usb/dev-hid.c +3 -0
index 31f3cde..bb4fc1d 100644
@@ -658,6 +658,7 @@ static void usb_tablet_class_initfn(ObjectClass *klass, void *data)
     uc->product_desc   = "QEMU USB Tablet";
     dc->vmsd = &vmstate_usb_ptr;
     dc->props = usb_tablet_properties;
+    dc->categories = (1 << DEVICE_CATEGORY_MISC);
 }
 
 static const TypeInfo usb_tablet_info = {
@@ -677,6 +678,7 @@ static void usb_mouse_class_initfn(ObjectClass *klass, void *data)
     uc->product_desc   = "QEMU USB Mouse";
     uc->usb_desc       = &desc_mouse;
     dc->vmsd = &vmstate_usb_ptr;
+    dc->categories = (1 << DEVICE_CATEGORY_INPUT);
 }
 
 static const TypeInfo usb_mouse_info = {
@@ -696,6 +698,7 @@ static void usb_keyboard_class_initfn(ObjectClass *klass, void *data)
     uc->product_desc   = "QEMU USB Keyboard";
     uc->usb_desc       = &desc_keyboard;
     dc->vmsd = &vmstate_usb_kbd;
+    dc->categories = (1 << DEVICE_CATEGORY_INPUT);
 }
 
 static const TypeInfo usb_keyboard_info = {
hw/usb/dev-hub.c +1 -0
index 0b71abd..91f44ca 100644
@@ -574,6 +574,7 @@ static void usb_hub_class_initfn(ObjectClass *klass, void *data)
     uc->handle_control = usb_hub_handle_control;
     uc->handle_data    = usb_hub_handle_data;
     uc->handle_destroy = usb_hub_handle_destroy;
+    dc->categories = (1 << DEVICE_CATEGORY_ASSEMBLY);
     dc->fw_name = "hub";
     dc->vmsd = &vmstate_usb_hub;
 }
hw/usb/dev-network.c +1 -0
index 5473ac2..020e26f 100644
@@ -1429,6 +1429,7 @@ static void usb_net_class_initfn(ObjectClass *klass, void *data)
     uc->handle_control = usb_net_handle_control;
     uc->handle_data    = usb_net_handle_data;
     uc->handle_destroy = usb_net_handle_destroy;
+    dc->categories = (1 << DEVICE_CATEGORY_NETWORK);
     dc->fw_name = "network";
     dc->vmsd = &vmstate_usb_net;
     dc->props = net_properties;
hw/usb/dev-serial.c +2 -0
index 2fc8a3b..50f7e3d 100644
@@ -590,6 +590,7 @@ static void usb_serial_class_initfn(ObjectClass *klass, void *data)
     uc->handle_data    = usb_serial_handle_data;
     dc->vmsd = &vmstate_usb_serial;
     dc->props = serial_properties;
+    dc->categories = (1 << DEVICE_CATEGORY_INPUT);
 }
 
 static const TypeInfo serial_info = {
@@ -617,6 +618,7 @@ static void usb_braille_class_initfn(ObjectClass *klass, void *data)
     uc->handle_data    = usb_serial_handle_data;
     dc->vmsd = &vmstate_usb_serial;
     dc->props = braille_properties;
+    dc->categories = (1 << DEVICE_CATEGORY_INPUT);
 }
 
 static const TypeInfo braille_info = {
hw/usb/dev-smartcard-reader.c +2 -0
index b33eb25..def6bae 100644
@@ -1446,9 +1446,11 @@ static void ccid_class_initfn(ObjectClass *klass, void *data)
     uc->handle_control = ccid_handle_control;
     uc->handle_data    = ccid_handle_data;
     uc->handle_destroy = ccid_handle_destroy;
+    dc->categories = (1 << DEVICE_CATEGORY_MISC);
     dc->desc = "CCID Rev 1.1 smartcard reader";
     dc->vmsd = &ccid_vmstate;
     dc->props = ccid_properties;
+    dc->categories = (1 << DEVICE_CATEGORY_INPUT);
 }
 
 static const TypeInfo ccid_info = {
hw/usb/dev-storage.c +1 -0
index 1954811..808e21c 100644
@@ -746,6 +746,7 @@ static void usb_msd_class_initfn_common(ObjectClass *klass)
     uc->handle_reset   = usb_msd_handle_reset;
     uc->handle_control = usb_msd_handle_control;
     uc->handle_data    = usb_msd_handle_data;
+    dc->categories = (1 << DEVICE_CATEGORY_STORAGE);
     dc->fw_name = "storage";
     dc->vmsd = &vmstate_usb_msd;
 }
hw/usb/dev-uas.c +1 -0
index 6efab62..33353dc 100644
@@ -916,6 +916,7 @@ static void usb_uas_class_initfn(ObjectClass *klass, void *data)
     uc->handle_control = usb_uas_handle_control;
     uc->handle_data    = usb_uas_handle_data;
     uc->handle_destroy = usb_uas_handle_destroy;
+    dc->categories = (1 << DEVICE_CATEGORY_STORAGE);
     dc->fw_name = "storage";
     dc->vmsd = &vmstate_usb_uas;
 }
hw/usb/dev-wacom.c +1 -0
index 3be5cde..b8dcb69 100644
@@ -362,6 +362,7 @@ static void usb_wacom_class_init(ObjectClass *klass, void *data)
     uc->handle_control = usb_wacom_handle_control;
     uc->handle_data    = usb_wacom_handle_data;
     uc->handle_destroy = usb_wacom_handle_destroy;
+    dc->categories = (1 << DEVICE_CATEGORY_INPUT);
     dc->desc = "QEMU PenPartner Tablet";
     dc->vmsd = &vmstate_usb_wacom;
 }
hw/usb/hcd-ehci-pci.c +2 -0
index 5d229bc..2759e3a 100644
@@ -140,11 +140,13 @@ static const TypeInfo ehci_pci_type_info = {
 static void ehci_data_class_init(ObjectClass *klass, void *data)
 {
     PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
+    DeviceClass *dc = DEVICE_CLASS(klass);
     EHCIPCIInfo *i = data;
 
     k->vendor_id = i->vendor_id;
     k->device_id = i->device_id;
     k->revision = i->revision;
+    dc->categories = (1 << DEVICE_CATEGORY_MANAGEMENT);
 }
 
 static struct EHCIPCIInfo ehci_pci_info[] = {
hw/usb/hcd-ehci-sysbus.c +8 -0
index 54147b5..0a05c62 100644
@@ -85,7 +85,9 @@ static const TypeInfo ehci_type_info = {
 static void ehci_xlnx_class_init(ObjectClass *oc, void *data)
 {
     SysBusEHCIClass *sec = SYS_BUS_EHCI_CLASS(oc);
+    DeviceClass *dc = DEVICE_CLASS(oc);
 
+    dc->categories = (1 << DEVICE_CATEGORY_MANAGEMENT);
     sec->capsbase = 0x100;
     sec->opregbase = 0x140;
 }
@@ -99,9 +101,11 @@ static const TypeInfo ehci_xlnx_type_info = {
 static void ehci_exynos4210_class_init(ObjectClass *oc, void *data)
 {
     SysBusEHCIClass *sec = SYS_BUS_EHCI_CLASS(oc);
+    DeviceClass *dc = DEVICE_CLASS(oc);
 
     sec->capsbase = 0x0;
     sec->opregbase = 0x10;
+    dc->categories = (1 << DEVICE_CATEGORY_MANAGEMENT);
 }
 
 static const TypeInfo ehci_exynos4210_type_info = {
@@ -113,9 +117,11 @@ static const TypeInfo ehci_exynos4210_type_info = {
 static void ehci_tegra2_class_init(ObjectClass *oc, void *data)
 {
     SysBusEHCIClass *sec = SYS_BUS_EHCI_CLASS(oc);
+    DeviceClass *dc = DEVICE_CLASS(oc);
 
     sec->capsbase = 0x100;
     sec->opregbase = 0x140;
+    dc->categories = (1 << DEVICE_CATEGORY_MANAGEMENT);
 }
 
 static const TypeInfo ehci_tegra2_type_info = {
@@ -183,11 +189,13 @@ static void fusbh200_ehci_init(Object *obj)
 static void fusbh200_ehci_class_init(ObjectClass *oc, void *data)
 {
     SysBusEHCIClass *sec = SYS_BUS_EHCI_CLASS(oc);
+    DeviceClass *dc = DEVICE_CLASS(oc);
 
     sec->capsbase = 0x0;
     sec->opregbase = 0x10;
     sec->portscbase = 0x20;
     sec->portnr = 1;
+    dc->categories = (1 << DEVICE_CATEGORY_MANAGEMENT);
 }
 
 static const TypeInfo ehci_fusbh200_type_info = {
hw/usb/hcd-ohci.c +2 -0
index 2bab8ff..18c82f6 100644
@@ -1917,6 +1917,7 @@ static void ohci_pci_class_init(ObjectClass *klass, void *data)
     k->device_id = PCI_DEVICE_ID_APPLE_IPID_USB;
     k->class_id = PCI_CLASS_SERIAL_USB;
     k->no_hotplug = 1;
+    dc->categories = (1 << DEVICE_CATEGORY_MANAGEMENT);
     dc->desc = "Apple USB Controller";
     dc->props = ohci_pci_properties;
 }
@@ -1939,6 +1940,7 @@ static void ohci_sysbus_class_init(ObjectClass *klass, void *data)
     DeviceClass *dc = DEVICE_CLASS(klass);
 
     dc->realize = ohci_realize_pxa;
+    dc->categories = (1 << DEVICE_CATEGORY_MANAGEMENT);
     dc->desc = "OHCI USB Controller";
     dc->props = ohci_sysbus_properties;
 }
hw/usb/hcd-uhci.c +1 -0
index 066072e..be920a4 100644
@@ -1315,6 +1315,7 @@ static void uhci_class_init(ObjectClass *klass, void *data)
     k->no_hotplug = 1;
     dc->vmsd = &vmstate_uhci;
     dc->props = uhci_properties;
+    dc->categories = (1 << DEVICE_CATEGORY_MANAGEMENT);
     u->info = *info;
 }
 
hw/usb/hcd-xhci.c +1 -0
index 9ba3e3e..d388a80 100644
@@ -3591,6 +3591,7 @@ static void xhci_class_init(ObjectClass *klass, void *data)
     dc->vmsd    = &vmstate_xhci;
     dc->props   = xhci_properties;
     dc->reset   = xhci_reset;
+    dc->categories = (1 << DEVICE_CATEGORY_MANAGEMENT);
     k->init         = usb_xhci_initfn;
     k->vendor_id    = PCI_VENDOR_ID_NEC;
     k->device_id    = PCI_DEVICE_ID_NEC_UPD720200;
hw/usb/host-libusb.c +1 -0
index e2f3cc8..6b7cebf 100644
@@ -1351,6 +1351,7 @@ static void usb_host_class_initfn(ObjectClass *klass, void *data)
     uc->flush_ep_queue = usb_host_flush_ep_queue;
     dc->vmsd = &vmstate_usb_host;
     dc->props = usb_host_dev_properties;
+    dc->categories = (1 << DEVICE_CATEGORY_ASSEMBLY);
 }
 
 static TypeInfo usb_host_dev_info = {
hw/usb/host-linux.c +1 -0
index ca09a89..85633d5 100644
@@ -1530,6 +1530,7 @@ static void usb_host_class_initfn(ObjectClass *klass, void *data)
     uc->handle_destroy = usb_host_handle_destroy;
     dc->vmsd = &vmstate_usb_host;
     dc->props = usb_host_dev_properties;
+    dc->categories = (1 << DEVICE_CATEGORY_ASSEMBLY);
 }
 
 static const TypeInfo usb_host_dev_info = {
hw/usb/redirect.c +1 -0
index a594e95..3445d4b 100644
@@ -2362,6 +2362,7 @@ static void usbredir_class_initfn(ObjectClass *klass, void *data)
     uc->ep_stopped     = usbredir_ep_stopped;
     dc->vmsd           = &usbredir_vmstate;
     dc->props          = usbredir_properties;
+    dc->categories = (1 << DEVICE_CATEGORY_MISC);
 }
 
 static const TypeInfo usbredir_dev_info = {
hw/virtio/virtio-balloon.c +1 -0
index 3fa72a9..88e9b73 100644
@@ -392,6 +392,7 @@ static void virtio_balloon_class_init(ObjectClass *klass, void *data)
     VirtioDeviceClass *vdc = VIRTIO_DEVICE_CLASS(klass);
     dc->exit = virtio_balloon_device_exit;
     dc->props = virtio_balloon_properties;
+    dc->categories = (1 << DEVICE_CATEGORY_MISC);
     vdc->init = virtio_balloon_device_init;
     vdc->get_config = virtio_balloon_get_config;
     vdc->set_config = virtio_balloon_set_config;
hw/virtio/virtio-mmio.c +1 -0
index 54d6679..4c73bd4 100644
@@ -370,6 +370,7 @@ static void virtio_mmio_class_init(ObjectClass *klass, void *data)
 
     dc->realize = virtio_mmio_realizefn;
     dc->reset = virtio_mmio_reset;
+    dc->categories = (1 << DEVICE_CATEGORY_MISC);
 }
 
 static const TypeInfo virtio_mmio_info = {
hw/virtio/virtio-pci.c +8 -0
index c38cfd1..d5d83ba 100644
@@ -911,6 +911,7 @@ static void virtio_9p_pci_class_init(ObjectClass *klass, void *data)
     pcidev_k->device_id = PCI_DEVICE_ID_VIRTIO_9P;
     pcidev_k->revision = VIRTIO_PCI_ABI_VERSION;
     pcidev_k->class_id = 0x2;
+    dc->categories = (1 << DEVICE_CATEGORY_STORAGE);
     dc->props = virtio_9p_pci_properties;
 }
 
@@ -1065,6 +1066,7 @@ static void virtio_blk_pci_class_init(ObjectClass *klass, void *data)
     VirtioPCIClass *k = VIRTIO_PCI_CLASS(klass);
     PCIDeviceClass *pcidev_k = PCI_DEVICE_CLASS(klass);
 
+    dc->categories = (1 << DEVICE_CATEGORY_STORAGE);
     dc->props = virtio_blk_pci_properties;
     k->init = virtio_blk_pci_init;
     pcidev_k->vendor_id = PCI_VENDOR_ID_REDHAT_QUMRANET;
@@ -1135,6 +1137,7 @@ static void virtio_scsi_pci_class_init(ObjectClass *klass, void *data)
     VirtioPCIClass *k = VIRTIO_PCI_CLASS(klass);
     PCIDeviceClass *pcidev_k = PCI_DEVICE_CLASS(klass);
     k->init = virtio_scsi_pci_init_pci;
+    dc->categories = (1 << DEVICE_CATEGORY_STORAGE);
     dc->props = virtio_scsi_pci_properties;
     pcidev_k->vendor_id = PCI_VENDOR_ID_REDHAT_QUMRANET;
     pcidev_k->device_id = PCI_DEVICE_ID_VIRTIO_SCSI;
@@ -1191,6 +1194,7 @@ static void vhost_scsi_pci_class_init(ObjectClass *klass, void *data)
     VirtioPCIClass *k = VIRTIO_PCI_CLASS(klass);
     PCIDeviceClass *pcidev_k = PCI_DEVICE_CLASS(klass);
     k->init = vhost_scsi_pci_init_pci;
+    dc->categories = (1 << DEVICE_CATEGORY_STORAGE);
     dc->props = vhost_scsi_pci_properties;
     pcidev_k->vendor_id = PCI_VENDOR_ID_REDHAT_QUMRANET;
     pcidev_k->device_id = PCI_DEVICE_ID_VIRTIO_SCSI;
@@ -1271,6 +1275,7 @@ static void virtio_balloon_pci_class_init(ObjectClass *klass, void *data)
     VirtioPCIClass *k = VIRTIO_PCI_CLASS(klass);
     PCIDeviceClass *pcidev_k = PCI_DEVICE_CLASS(klass);
     k->init = virtio_balloon_pci_init;
+    dc->categories = (1 << DEVICE_CATEGORY_MISC);
     dc->props = virtio_balloon_pci_properties;
     pcidev_k->vendor_id = PCI_VENDOR_ID_REDHAT_QUMRANET;
     pcidev_k->device_id = PCI_DEVICE_ID_VIRTIO_BALLOON;
@@ -1356,6 +1361,7 @@ static void virtio_serial_pci_class_init(ObjectClass *klass, void *data)
     VirtioPCIClass *k = VIRTIO_PCI_CLASS(klass);
     PCIDeviceClass *pcidev_k = PCI_DEVICE_CLASS(klass);
     k->init = virtio_serial_pci_init;
+    dc->categories = (1 << DEVICE_CATEGORY_INPUT);
     dc->props = virtio_serial_pci_properties;
     pcidev_k->vendor_id = PCI_VENDOR_ID_REDHAT_QUMRANET;
     pcidev_k->device_id = PCI_DEVICE_ID_VIRTIO_CONSOLE;
@@ -1417,6 +1423,7 @@ static void virtio_net_pci_class_init(ObjectClass *klass, void *data)
     k->device_id = PCI_DEVICE_ID_VIRTIO_NET;
     k->revision = VIRTIO_PCI_ABI_VERSION;
     k->class_id = PCI_CLASS_NETWORK_ETHERNET;
+    dc->categories = (1 << DEVICE_CATEGORY_NETWORK);
     dc->props = virtio_net_properties;
     vpciklass->init = virtio_net_pci_init;
 }
@@ -1468,6 +1475,7 @@ static void virtio_rng_pci_class_init(ObjectClass *klass, void *data)
     PCIDeviceClass *pcidev_k = PCI_DEVICE_CLASS(klass);
 
     k->init = virtio_rng_pci_init;
+    dc->categories = (1 << DEVICE_CATEGORY_MISC);
     dc->props = virtio_rng_pci_properties;
 
     pcidev_k->vendor_id = PCI_VENDOR_ID_REDHAT_QUMRANET;
hw/virtio/virtio-rng.c +1 -0
index cb787c7..79ca067 100644
@@ -207,6 +207,7 @@ static void virtio_rng_class_init(ObjectClass *klass, void *data)
     VirtioDeviceClass *vdc = VIRTIO_DEVICE_CLASS(klass);
     dc->exit = virtio_rng_device_exit;
     dc->props = virtio_rng_properties;
+    dc->categories = (1 << DEVICE_CATEGORY_MISC);
     vdc->init = virtio_rng_device_init;
     vdc->get_features = get_features;
 }
hw/watchdog/wdt_i6300esb.c +1 -0
index 85aebc2..875726b 100644
@@ -451,6 +451,7 @@ static void i6300esb_class_init(ObjectClass *klass, void *data)
     k->class_id = PCI_CLASS_SYSTEM_OTHER;
     dc->reset = i6300esb_reset;
     dc->vmsd = &vmstate_i6300esb;
+    dc->categories = (1 << DEVICE_CATEGORY_MISC);
 }
 
 static const TypeInfo i6300esb_info = {
hw/xen/xen_platform.c +1 -0
index 6a8ba7e..9710e08 100644
@@ -428,6 +428,7 @@ static void xen_platform_class_init(ObjectClass *klass, void *data)
     k->subsystem_vendor_id = PCI_VENDOR_ID_XEN;
     k->subsystem_id = PCI_DEVICE_ID_XEN_PLATFORM;
     k->revision = 1;
+    dc->categories = (1 << DEVICE_CATEGORY_MISC);
     dc->desc = "XEN platform pci device";
     dc->reset = platform_reset;
     dc->vmsd = &vmstate_xen_platform;
hw/xen/xen_pt.c +1 -0
index d7ee774..3058ca0 100644
@@ -829,6 +829,7 @@ static void xen_pci_passthrough_class_init(ObjectClass *klass, void *data)
     k->exit = xen_pt_unregister_device;
     k->config_read = xen_pt_pci_read_config;
     k->config_write = xen_pt_pci_write_config;
+    dc->categories = (1 << DEVICE_CATEGORY_MISC);
     dc->desc = "Assign an host PCI device with Xen";
     dc->props = xen_pci_passthrough_properties;
 };
Signature · 1 line
1.8.3.1
#2 lore raw

Re: [Qemu-devel] [PATCH 1/2] qemu-help: Sort devices by logical functionality

In reply to Marcel Apfelbaum
Quoted 20 lines · Marcel Apfelbaum

Categorize devices that appear as output to "-device ?" command by logical functionality. Sort the devices by logical categories before showing them to user.

The sort is done by functionality rather than alphabetical.

---
Changes from RFC
Made category a bitmap to support multifunction PCI devices

 include/hw/qdev-core.h | 15 ++++++++++++
 qdev-monitor.c         | 62 ++++++++++++++++++++++++++++++++++++++++++++++++--
 2 files changed, 75 insertions(+), 2 deletions(-)
include/hw/qdev-core.h +0 -0
index 7fbffcb..9130f97 100644

include/hw/qdev-core.h enum { · line 20

Quoted 4 lines
include/hw/qdev-core.h +1 -0
@@ -17,6 +17,19 @@ enum {
 #define DEVICE_CLASS(klass) OBJECT_CLASS_CHECK(DeviceClass, (klass), TYPE_DEVICE)
 #define DEVICE_GET_CLASS(obj) OBJECT_GET_CLASS(DeviceClass, (obj), TYPE_DEVICE)
 
+#define MAX_DEVICE_CATEGORY 8

make this the last entry in the enum, also rename DEVICE_CATEGORY_MAX.
This way you won't have to change it manually each time you add a category.

include/hw/qdev-core.h enum { · line 32

Quoted 12 lines
include/hw/qdev-core.h +12 -0
+
+typedef enum DeviceCategory {
+    DEVICE_CATEGORY_ASSEMBLY,
+    DEVICE_CATEGORY_MANAGEMENT,
+    DEVICE_CATEGORY_STORAGE,
+    DEVICE_CATEGORY_NETWORK,
+    DEVICE_CATEGORY_INPUT,
+    DEVICE_CATEGORY_DISPLAY,
+    DEVICE_CATEGORY_SOUND,
+    DEVICE_CATEGORY_MISC,
+} DeviceCategory;
+

I think it's nasty that all users need to shift.

One option is to name the enum fields with _SHIFT or _BIT suffix, and define macros
#define DEVICE_CATEGORY_ASSEMBLY (1 << DEVICE_CATEGORY_ASSEMBLY_SHIFT) Then we don't need to have this shift everywhere these
are used.

Another is to use set_bit to set bits.
I think I prefer this last variant.

include/hw/qdev-core.h typedef struct DeviceClass { · line 97

Quoted 9 lines
include/hw/qdev-core.h +2 -0
 typedef int (*qdev_initfn)(DeviceState *dev);
 typedef int (*qdev_event)(DeviceState *dev);
 typedef void (*qdev_resetfn)(DeviceState *dev);
@@ -80,6 +93,8 @@ typedef struct DeviceClass {
     ObjectClass parent_class;
     /*< public >*/
 
+    /* DeviceCategory bitmap */
+    unsigned int categories;

So why not use DECLARE_BITMAP?
You will also be able to use test_bit instead of
shifting everywhere.

Quoted 12 lines
include/hw/qdev-core.h +0 -0
     const char *fw_name;
     const char *desc;
     Property *props;
qdev-monitor.c +1 -0
index e54dbc2..2e6d14e 100644
@@ -51,6 +51,18 @@ static const QDevAlias qdev_alias_table[] = {
     { }
 };
 
+/* Category names corresponding to DeviceCategory values */

qdev-monitor.c static const QDevAlias qdev_alias_table[] = { · line 64

Quoted 10 lines
qdev-monitor.c +10 -0
+static const char *qdev_category_names[] = {
+    "Assembly",
+    "Management",
+    "Storage",
+    "Network",
+    "Input",
+    "Display",
+    "Sound",
+    "Misc",
+};

Offsets here correspond to specific enums.
Maybe make this explicit?

qdev-monitor.c static const QDevAlias qdev_alias_table[] = { · line 66

Quoted 2 lines
qdev-monitor.c +2 -0
+static const char *qdev_category_names[] = {
+    .[DEVICE_CATEGORY_ASSEMBLY] = "Assembly",

etc.

Also, when adding a new category we'll need to add a new entry here.
Maybe put both arrays together in the header so it's harder to miss, and add a comment about it?

qdev-monitor.c static bool qdev_class_has_alias(DeviceClass *dc) · line 94

Quoted 13 lines
qdev-monitor.c +6 -0
+
 static const char *qdev_class_get_alias(DeviceClass *dc)
 {
     const char *typename = object_class_get_name(OBJECT_CLASS(dc));
@@ -75,11 +87,20 @@ static bool qdev_class_has_alias(DeviceClass *dc)
     return (qdev_class_get_alias(dc) != NULL);
 }
 
+typedef struct PrintDevInfoData {
+    bool *show_no_user;
+    DeviceCategory *category;
+} PrintDevInfoData ;
+

Why pointer to bool/category? Cleaner to pass it by instance I think.

Quoted 33 lines
qdev-monitor.c +17 -1
 static void qdev_print_devinfo(ObjectClass *klass, void *opaque)
 {
     DeviceClass *dc;
-    bool *show_no_user = opaque;
+    PrintDevInfoData *data = opaque;
+    bool *show_no_user;
+    DeviceCategory category;
 
+    show_no_user = data ? data->show_no_user : NULL;
+    category = data && data->category ? *data->category : 0;
     dc = (DeviceClass *)object_class_dynamic_cast(klass, TYPE_DEVICE);
 
     if (!dc || (show_no_user && !*show_no_user && dc->no_user)) {
@@ -93,6 +114,18 @@ static void qdev_print_devinfo(ObjectClass *klass, void *opaque)
     if (qdev_class_has_alias(dc)) {
         error_printf(", alias \"%s\"", qdev_class_get_alias(dc));
     }
+    if (dc->categories) {
+        if (dc->categories & (1 << category)) {
+            error_printf(", category \"%s\"", qdev_category_names[category]);
+        } else {
+            error_printf(", categories");
+            for (category = 0; category < MAX_DEVICE_CATEGORY; ++category) {
+                if (dc->categories & (1 << category)) {
+                    error_printf(" \"%s\"", qdev_category_names[category]);
+                }
+            }
+        }
+    }
     if (dc->desc) {
         error_printf(", desc \"%s\"", dc->desc);
     }

qdev-monitor.c static const char *find_typename_by_alias(const char *alias) · line 175

Quoted 4 lines
qdev-monitor.c +1 -0
@@ -139,6 +172,23 @@ static const char *find_typename_by_alias(const char *alias)
     return NULL;
 }
 
+static GSList *qdev_get_devices_by_category(unsigned long categories)

In practice this gets a single category right? So just pass the bit number, makes it more consistent.

qdev-monitor.c static const char *find_typename_by_alias(const char *alias) · line 183

Quoted 8 lines
qdev-monitor.c +8 -0
+{
+    DeviceClass *dc;
+    GSList *list, *curr, *ret_list = NULL;
+
+    list = object_class_get_list(TYPE_DEVICE, false);
+    for (curr = list; curr; curr = g_slist_next(curr)) {
+        dc = (DeviceClass *)object_class_dynamic_cast(curr->data, TYPE_DEVICE);
+        if ((dc->categories & categories) == categories) {

I don't see where you would want to print only
devices that match a mask exactly.

With a single category,

        if (dc->categories & categories)

is equivalent and easier to understand.

Quoted 12 lines
qdev-monitor.c +8 -0
+            ret_list = g_slist_append(ret_list, dc);
+        }
+    }
+    g_slist_free(list);
+
+    return ret_list;
+}
+
 int qdev_device_help(QemuOpts *opts)
 {
     const char *driver;

qdev-monitor.c int qdev_device_help(QemuOpts *opts) · line 203

Quoted 7 lines
qdev-monitor.c +3 -1
@@ -148,7 +198,15 @@ int qdev_device_help(QemuOpts *opts)
     driver = qemu_opt_get(opts, "driver");
     if (driver && is_help_option(driver)) {
         bool show_no_user = false;
-        object_class_foreach(qdev_print_devinfo, TYPE_DEVICE, false, &show_no_user);
+        DeviceCategory category;
+        PrintDevInfoData data = { &show_no_user, &category };
+

So just drop show_no_user and category local vars, and use data.show_no_user data.category.

Quoted 12 lines
qdev-monitor.c +6 -0
+        for (category = 0; category < MAX_DEVICE_CATEGORY; ++category) {
+            GSList *list = qdev_get_devices_by_category(1 << category);
+            g_slist_foreach(list, (GFunc)qdev_print_devinfo, &data);
+            g_slist_free(list);
+        }
+
         return 1;
     }
 
Signature · 1 line
1.8.3.1
#4 lore raw
In reply to Marcel Apfelbaum
Quoted 9 lines · Marcel Apfelbaum

Running qemu with "-device ?" option returns ~145 lines. It is hard to manage understanding the output.

Theses patches aim to partially solve the problem by dividing the devices into logical categories like "Network/Display/..." and sorting them by it.

Categories:
Assembly - hosts/hubs/...
Management - controllers

Looks good to me.
Sent some minor suggestions for improving the code.

Quoted 125 lines

...
(All others are self explanatory)

Changes from RFC patch:
Made category a bitmap to support multifunction PCI devices. Assigned all devices to their category.

Marcel Apfelbaum (2):
qemu-help: Sort devices by logical functionality
devices: Associate devices to their logical category

 hw/9pfs/virtio-9p-device.c         |  1 +
 hw/audio/ac97.c                    |  1 +
 hw/audio/adlib.c                   |  1 +
 hw/audio/cs4231a.c                 |  1 +
 hw/audio/es1370.c                  |  1 +
 hw/audio/gus.c                     |  1 +
 hw/audio/hda-codec.c               |  3 ++
 hw/audio/intel-hda.c               |  3 ++
 hw/audio/pcspk.c                   |  1 +
 hw/audio/pl041.c                   |  1 +
 hw/audio/sb16.c                    |  1 +
 hw/block/fdc.c                     |  3 ++
 hw/block/nvme.c                    |  1 +
 hw/block/pc_sysfw.c                |  1 +
 hw/block/pflash_cfi01.c            |  1 +
 hw/block/virtio-blk.c              |  1 +
 hw/char/imx_serial.c               |  1 +
 hw/char/ipack.c                    |  1 +
 hw/char/ipoctal232.c               |  1 +
 hw/char/parallel.c                 |  1 +
 hw/char/serial-isa.c               |  1 +
 hw/char/serial-pci.c               |  3 ++
 hw/char/tpci200.c                  |  1 +
 hw/char/virtio-serial-bus.c        |  2 ++
 hw/core/sysbus.c                   |  1 +
 hw/display/cirrus_vga.c            |  2 ++
 hw/display/g364fb.c                |  1 +
 hw/display/pl110.c                 |  3 ++
 hw/display/qxl.c                   |  2 ++
 hw/display/vga-isa.c               |  1 +
 hw/display/vga-pci.c               |  1 +
 hw/display/vmware_vga.c            |  1 +
 hw/i2c/bitbang_i2c.c               |  1 +
 hw/i2c/core.c                      |  1 +
 hw/i386/kvm/pci-assign.c           |  1 +
 hw/ide/ahci.c                      |  1 +
 hw/ide/ich.c                       |  1 +
 hw/ide/isa.c                       |  1 +
 hw/ide/piix.c                      |  3 ++
 hw/ide/qdev.c                      |  1 +
 hw/ide/via.c                       |  1 +
 hw/isa/i82378.c                    |  1 +
 hw/isa/isa-bus.c                   |  1 +
 hw/isa/lpc_ich9.c                  |  1 +
 hw/isa/vt82c686.c                  |  3 ++
 hw/misc/applesmc.c                 |  1 +
 hw/misc/debugexit.c                |  1 +
 hw/misc/ivshmem.c                  |  1 +
 hw/misc/pc-testdev.c               |  1 +
 hw/misc/pci-testdev.c              |  1 +
 hw/misc/sga.c                      |  1 +
 hw/misc/vfio.c                     |  1 +
 hw/net/e1000.c                     |  1 +
 hw/net/eepro100.c                  |  1 +
 hw/net/lance.c                     |  1 +
 hw/net/mipsnet.c                   |  1 +
 hw/net/ne2000-isa.c                |  1 +
 hw/net/ne2000.c                    |  1 +
 hw/net/opencores_eth.c             |  1 +
 hw/net/pcnet-pci.c                 |  1 +
 hw/net/rtl8139.c                   |  1 +
 hw/net/virtio-net.c                |  1 +
 hw/net/vmxnet3.c                   |  1 +
 hw/pci-bridge/i82801b11.c          |  2 ++
 hw/pci-bridge/ioh3420.c            |  1 +
 hw/pci-bridge/pci_bridge_dev.c     |  1 +
 hw/pci-bridge/xio3130_downstream.c |  1 +
 hw/pci-bridge/xio3130_upstream.c   |  1 +
 hw/pci-host/apb.c                  |  2 ++
 hw/pci-host/ppce500.c              |  1 +
 hw/pci-host/prep.c                 |  1 +
 hw/pci-host/q35.c                  |  2 ++
 hw/scsi/esp-pci.c                  |  2 ++
 hw/scsi/esp.c                      |  1 +
 hw/scsi/lsi53c895a.c               |  1 +
 hw/scsi/megasas.c                  |  1 +
 hw/scsi/scsi-bus.c                 |  1 +
 hw/scsi/vhost-scsi.c               |  1 +
 hw/scsi/virtio-scsi.c              |  3 ++
 hw/scsi/vmw_pvscsi.c               |  1 +
 hw/usb/ccid-card-emulated.c        |  1 +
 hw/usb/ccid-card-passthru.c        |  1 +
 hw/usb/dev-audio.c                 |  1 +
 hw/usb/dev-bluetooth.c             |  1 +
 hw/usb/dev-hid.c                   |  3 ++
 hw/usb/dev-hub.c                   |  1 +
 hw/usb/dev-network.c               |  1 +
 hw/usb/dev-serial.c                |  2 ++
 hw/usb/dev-smartcard-reader.c      |  2 ++
 hw/usb/dev-storage.c               |  1 +
 hw/usb/dev-uas.c                   |  1 +
 hw/usb/dev-wacom.c                 |  1 +
 hw/usb/hcd-ehci-pci.c              |  2 ++
 hw/usb/hcd-ehci-sysbus.c           |  8 +++++
 hw/usb/hcd-ohci.c                  |  2 ++
 hw/usb/hcd-uhci.c                  |  1 +
 hw/usb/hcd-xhci.c                  |  1 +
 hw/usb/host-libusb.c               |  1 +
 hw/usb/host-linux.c                |  1 +
 hw/usb/redirect.c                  |  1 +
 hw/virtio/virtio-balloon.c         |  1 +
 hw/virtio/virtio-mmio.c            |  1 +
 hw/virtio/virtio-pci.c             |  8 +++++
 hw/virtio/virtio-rng.c             |  1 +
 hw/watchdog/wdt_i6300esb.c         |  1 +
 hw/xen/xen_platform.c              |  1 +
 hw/xen/xen_pt.c                    |  1 +
 include/hw/qdev-core.h             | 15 +++++++++
 qdev-monitor.c                     | 63 ++++++++++++++++++++++++++++++++++++--
 109 files changed, 226 insertions(+), 2 deletions(-)
Signature · 1 line
1.8.3.1
#5 lore raw
In reply to Marcel Apfelbaum

Il 28/07/2013 11:14, Marcel Apfelbaum ha scritto:

Quoted 2 lines

Categories:
Assembly - hosts/hubs/...

A lot of these seem to fit in a "bridge" category.

I'm not sure why usbhost is in the assembly category though. Also, why is this the default category for isa and i2c devices?

Quoted 1 line

Management - controllers

AHCI is storage.

applesmc is something like a microcontroller ("misc"?).

Everything else in this category is USB host controllers, I think it deserves a special category since USB devices are generally somewhat self-explanatory (hubs too).

Paolo

#6 lore raw
Quoted 5 lines · Paolo Bonzini

Il 28/07/2013 11:14, Marcel Apfelbaum ha scritto:

Quoted 2 lines

Categories:
Assembly - hosts/hubs/...

A lot of these seem to fit in a "bridge" category.

I wanted to group in a category as much as possible having in mind the user shall "grep" by category to find devices. My goal is a top category with devices that are not nodes and are used as a way to combine other devices.

Quoted 3 lines

I'm not sure why usbhost is in the assembly category though. Also, why is this the default category for isa and i2c devices?

The same argument as above. I am looking for top devices and not for their type

Quoted 4 lines
Quoted 2 lines

Management - controllers

AHCI is storage.

Thanks, it looked like management to me.
Devices in management category shall control other devices. It looked like a fit for me.

Quoted 2 lines

applesmc is something like a microcontroller ("misc"?).

Thanks, I'll move to misc

Quoted 4 lines

Everything else in this category is USB host controllers, I think it deserves a special category since USB devices are generally somewhat self-explanatory (hubs too).

I didn't want to include the "USB" keyword, because the user will be lost when filtering by this word. The goal is to help the user to concentrate on a specific "category". Maybe USB-Controller ?

Quoted 2 lines

Paolo

Thanks for the review!
Marcel

#7 lore raw

Il 29/07/2013 10:00, Marcel Apfelbaum ha scritto:

Quoted 11 lines · Paolo Bonzini
Quoted 5 lines

Il 28/07/2013 11:14, Marcel Apfelbaum ha scritto:

Quoted 2 lines

Categories:
Assembly - hosts/hubs/...

A lot of these seem to fit in a "bridge" category.

I wanted to group in a category as much as possible having in mind the user shall "grep" by category to find devices. My goal is a top category with devices that are not nodes and are used as a way to combine other devices.

Quoted 1 line
Quoted 4 lines
Quoted 2 lines

I'm not sure why usbhost is in the assembly category though. Also, why is this the default category for isa and i2c devices?

The same argument as above. I am looking for top devices and not for their type

USB host is a leaf device. As to ISA and I2C, which devices exactly are using the default you're setting here? Are they really bridge- or controller-type device?

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

Management - controllers

AHCI is storage.

Thanks, it looked like management to me.
Devices in management category shall control other devices. It looked like a fit for me.

Yeah, it does, but then the same is true for all SCSI HBAs.

Quoted 9 lines
Quoted 1 line

applesmc is something like a microcontroller ("misc"?).

Thanks, I'll move to misc

Quoted 4 lines

Everything else in this category is USB host controllers, I think it deserves a special category since USB devices are generally somewhat self-explanatory (hubs too).

I didn't want to include the "USB" keyword, because the user will be lost when filtering by this word. The goal is to help the user to concentrate on a specific "category". Maybe USB-Controller ?

Maybe two categories (USB | Controller)? There is also difference between storage controllers and storage devices (i.e. disks).

I think assembly and management can be merged into a single "controller/hub/bridge" category. You can then use multiple categories for HBAs, for AHCI, etc.

Paolo

#8 lore raw
Quoted 12 lines · Paolo Bonzini

Il 29/07/2013 10:00, Marcel Apfelbaum ha scritto:

Quoted 11 lines · Paolo Bonzini
Quoted 5 lines

Il 28/07/2013 11:14, Marcel Apfelbaum ha scritto:

Quoted 2 lines

Categories:
Assembly - hosts/hubs/...

A lot of these seem to fit in a "bridge" category.

I wanted to group in a category as much as possible having in mind the user shall "grep" by category to find devices. My goal is a top category with devices that are not nodes and are used as a way to combine other devices.

Quoted 1 line
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

I'm not sure why usbhost is in the assembly category though. Also, why is this the default category for isa and i2c devices?

The same argument as above. I am looking for top devices and not for their type

USB host is a leaf device. As to ISA and I2C, which devices exactly are using the default you're setting here? Are they really bridge- or controller-type device?

After moving the devices you specified from "Management" to their correct category, all the remaining devices were usb, so I renamed the category to USB (Management is empty, so removed) Regarding the ISA devices, I spread them between categories:
name "isa-ide", bus ISA, categories "Storage"
name "ne2k_isa", bus ISA, categories "Network"
name "isa-parallel", bus ISA, categories "Input"
name "isa-serial", bus ISA, categories "Input"
name "isa-cirrus-vga", bus ISA, categories "Display" name "isa-vga", bus ISA, categories "Display"
name "isa-applesmc", bus ISA, categories "Misc"
name "isa-debugcon", bus ISA, categories "Misc"
name "isa-debug-exit", bus ISA, categories "Misc" Regarding the I2C device, I moved it to the misc Category, I was misled by the name. Thanks

Quoted 20 lines
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

Management - controllers

AHCI is storage.

Thanks, it looked like management to me.
Devices in management category shall control other devices. It looked like a fit for me.

Yeah, it does, but then the same is true for all SCSI HBAs.

Quoted 9 lines
Quoted 1 line

applesmc is something like a microcontroller ("misc"?).

Thanks, I'll move to misc

Quoted 4 lines

Everything else in this category is USB host controllers, I think it deserves a special category since USB devices are generally somewhat self-explanatory (hubs too).

I didn't want to include the "USB" keyword, because the user will be lost when filtering by this word. The goal is to help the user to concentrate on a specific "category". Maybe USB-Controller ?

Quoted 6 lines

Maybe two categories (USB | Controller)? There is also difference between storage controllers and storage devices (i.e. disks).

I think assembly and management can be merged into a single "controller/hub/bridge" category. You can then use multiple categories for HBAs, for AHCI, etc.

As mentioned above , the "Management" category disappear, so Assembly includes should be now controller/hub/bridge

I'll release a version soon.
Thanks!

Quoted 2 lines

Paolo