thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone

Blame SOURCES/kvm-devices-Associate-devices-to-their-logical-category.patch

218e99
From 2fecbf68b60416c352ded3ea496028b477cce6b4 Mon Sep 17 00:00:00 2001
218e99
From: Kevin Wolf <kwolf@redhat.com>
218e99
Date: Wed, 6 Nov 2013 14:41:09 +0100
218e99
Subject: [PATCH 33/81] devices: Associate devices to their logical category
218e99
218e99
RH-Author: Kevin Wolf <kwolf@redhat.com>
218e99
Message-id: <1383748882-22831-5-git-send-email-kwolf@redhat.com>
218e99
Patchwork-id: 55530
218e99
O-Subject: [RHEL-7.0 qemu-kvm PATCH v2 04/17] devices: Associate devices to their logical category
218e99
Bugzilla: 1001216
218e99
RH-Acked-by: Marcel Apfelbaum <marcel.a@redhat.com>
218e99
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
218e99
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
218e99
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
218e99
218e99
From: Marcel Apfelbaum <marcel.a@redhat.com>
218e99
218e99
The category will be used to sort the devices displayed in
218e99
the command line help.
218e99
218e99
Signed-off-by: Marcel Apfelbaum <marcel.a@redhat.com>
218e99
Message-id: 1375107465-25767-4-git-send-email-marcel.a@redhat.com
218e99
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
218e99
(cherry picked from commit 125ee0ed9cad04307498ac2b7b0d51ad8a807360)
218e99
218e99
Conflicts:
218e99
	hw/audio/adlib.c
218e99
	hw/audio/cs4231a.c
218e99
	hw/audio/gus.c
218e99
	hw/audio/pcspk.c
218e99
	hw/audio/sb16.c
218e99
	hw/block/nvme.c
218e99
	hw/misc/pc-testdev.c
218e99
	hw/misc/sga.c
218e99
	hw/pci-bridge/i82801b11.c
218e99
	hw/usb/hcd-ehci-sysbus.c
218e99
	hw/usb/hcd-ohci.c
218e99
	hw/virtio/virtio-mmio.c
218e99
218e99
Trivial conflicts in
218e99
218e99
* ISA devices because we don't have commit db895a1 "isa: Use realizefn
218e99
  for ISADevice"
218e99
218e99
* i82801b11.c because we backported commit 4965b7f out of order, as
218e99
  commit ccf2798
218e99
218e99
* hcd-ehci-sysbus because we don't have commit 20c5704 "usb/hcd-ehci:
218e99
  Add Tegra2 SysBus EHCI device" and commit 4e3d8b4 "usb/hcd-ehci: Add
218e99
  Faraday FUSBH200 support"
218e99
218e99
* hcd-ohci.c because we don't have commit 457215e "ohci: Use QOM
218e99
  realize for OHCI"
218e99
218e99
* nvme.c and virtio-mmio.c because we don't have them
218e99
Signed-off-by: Markus Armbruster <armbru@redhat.com>
218e99
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
218e99
---
218e99
 hw/9pfs/virtio-9p-device.c         | 1 +
218e99
 hw/audio/ac97.c                    | 1 +
218e99
 hw/audio/adlib.c                   | 1 +
218e99
 hw/audio/cs4231a.c                 | 1 +
218e99
 hw/audio/es1370.c                  | 1 +
218e99
 hw/audio/gus.c                     | 1 +
218e99
 hw/audio/hda-codec.c               | 3 +++
218e99
 hw/audio/intel-hda.c               | 3 +++
218e99
 hw/audio/pcspk.c                   | 1 +
218e99
 hw/audio/pl041.c                   | 1 +
218e99
 hw/audio/sb16.c                    | 1 +
218e99
 hw/block/fdc.c                     | 3 +++
218e99
 hw/block/pc_sysfw.c                | 1 +
218e99
 hw/block/pflash_cfi01.c            | 1 +
218e99
 hw/block/virtio-blk.c              | 1 +
218e99
 hw/char/debugcon.c                 | 1 +
218e99
 hw/char/imx_serial.c               | 1 +
218e99
 hw/char/ipack.c                    | 1 +
218e99
 hw/char/ipoctal232.c               | 1 +
218e99
 hw/char/parallel.c                 | 1 +
218e99
 hw/char/serial-isa.c               | 1 +
218e99
 hw/char/serial-pci.c               | 3 +++
218e99
 hw/char/tpci200.c                  | 1 +
218e99
 hw/char/virtio-serial-bus.c        | 2 ++
218e99
 hw/cpu/icc_bus.c                   | 8 ++++++++
218e99
 hw/display/cirrus_vga.c            | 2 ++
218e99
 hw/display/g364fb.c                | 1 +
218e99
 hw/display/pl110.c                 | 3 +++
218e99
 hw/display/qxl.c                   | 2 ++
218e99
 hw/display/vga-isa.c               | 1 +
218e99
 hw/display/vga-pci.c               | 1 +
218e99
 hw/display/vmware_vga.c            | 1 +
218e99
 hw/i2c/bitbang_i2c.c               | 1 +
218e99
 hw/i2c/core.c                      | 1 +
218e99
 hw/i386/kvm/pci-assign.c           | 1 +
218e99
 hw/ide/ahci.c                      | 1 +
218e99
 hw/ide/ich.c                       | 1 +
218e99
 hw/ide/isa.c                       | 1 +
218e99
 hw/ide/piix.c                      | 3 +++
218e99
 hw/ide/qdev.c                      | 1 +
218e99
 hw/ide/via.c                       | 1 +
218e99
 hw/isa/i82378.c                    | 1 +
218e99
 hw/isa/lpc_ich9.c                  | 1 +
218e99
 hw/isa/vt82c686.c                  | 3 +++
218e99
 hw/misc/applesmc.c                 | 1 +
218e99
 hw/misc/debugexit.c                | 1 +
218e99
 hw/misc/ivshmem.c                  | 1 +
218e99
 hw/misc/pc-testdev.c               | 2 ++
218e99
 hw/misc/pci-testdev.c              | 1 +
218e99
 hw/misc/sga.c                      | 1 +
218e99
 hw/misc/vfio.c                     | 1 +
218e99
 hw/net/e1000.c                     | 1 +
218e99
 hw/net/eepro100.c                  | 1 +
218e99
 hw/net/lance.c                     | 1 +
218e99
 hw/net/mipsnet.c                   | 1 +
218e99
 hw/net/ne2000-isa.c                | 1 +
218e99
 hw/net/ne2000.c                    | 1 +
218e99
 hw/net/opencores_eth.c             | 1 +
218e99
 hw/net/pcnet-pci.c                 | 1 +
218e99
 hw/net/rtl8139.c                   | 1 +
218e99
 hw/net/virtio-net.c                | 1 +
218e99
 hw/net/vmxnet3.c                   | 1 +
218e99
 hw/pci-bridge/i82801b11.c          | 2 ++
218e99
 hw/pci-bridge/ioh3420.c            | 1 +
218e99
 hw/pci-bridge/pci_bridge_dev.c     | 1 +
218e99
 hw/pci-bridge/xio3130_downstream.c | 1 +
218e99
 hw/pci-bridge/xio3130_upstream.c   | 1 +
218e99
 hw/pci-host/apb.c                  | 2 ++
218e99
 hw/pci-host/ppce500.c              | 1 +
218e99
 hw/pci-host/prep.c                 | 1 +
218e99
 hw/pci-host/q35.c                  | 2 ++
218e99
 hw/scsi/esp-pci.c                  | 2 ++
218e99
 hw/scsi/esp.c                      | 1 +
218e99
 hw/scsi/lsi53c895a.c               | 1 +
218e99
 hw/scsi/megasas.c                  | 1 +
218e99
 hw/scsi/scsi-bus.c                 | 1 +
218e99
 hw/scsi/vhost-scsi.c               | 1 +
218e99
 hw/scsi/virtio-scsi.c              | 3 +++
218e99
 hw/scsi/vmw_pvscsi.c               | 1 +
218e99
 hw/usb/ccid-card-emulated.c        | 1 +
218e99
 hw/usb/ccid-card-passthru.c        | 1 +
218e99
 hw/usb/dev-audio.c                 | 1 +
218e99
 hw/usb/dev-bluetooth.c             | 1 +
218e99
 hw/usb/dev-hid.c                   | 3 +++
218e99
 hw/usb/dev-hub.c                   | 1 +
218e99
 hw/usb/dev-network.c               | 1 +
218e99
 hw/usb/dev-serial.c                | 2 ++
218e99
 hw/usb/dev-smartcard-reader.c      | 1 +
218e99
 hw/usb/dev-storage.c               | 1 +
218e99
 hw/usb/dev-uas.c                   | 1 +
218e99
 hw/usb/dev-wacom.c                 | 1 +
218e99
 hw/usb/hcd-ehci-pci.c              | 2 ++
218e99
 hw/usb/hcd-ehci-sysbus.c           | 5 +++++
218e99
 hw/usb/hcd-ohci.c                  | 2 ++
218e99
 hw/usb/hcd-uhci.c                  | 1 +
218e99
 hw/usb/hcd-xhci.c                  | 1 +
218e99
 hw/usb/host-libusb.c               | 1 +
218e99
 hw/usb/redirect.c                  | 1 +
218e99
 hw/virtio/virtio-balloon.c         | 1 +
218e99
 hw/virtio/virtio-pci.c             | 8 ++++++++
218e99
 hw/virtio/virtio-rng.c             | 1 +
218e99
 hw/watchdog/wdt_i6300esb.c         | 1 +
218e99
 hw/watchdog/wdt_ib700.c            | 1 +
218e99
 hw/xen/xen_platform.c              | 1 +
218e99
 hw/xen/xen_pt.c                    | 1 +
218e99
 105 files changed, 152 insertions(+)
218e99
218e99
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
218e99
---
218e99
 hw/9pfs/virtio-9p-device.c         |    1 +
218e99
 hw/audio/ac97.c                    |    1 +
218e99
 hw/audio/adlib.c                   |    1 +
218e99
 hw/audio/cs4231a.c                 |    1 +
218e99
 hw/audio/es1370.c                  |    1 +
218e99
 hw/audio/gus.c                     |    1 +
218e99
 hw/audio/hda-codec.c               |    3 +++
218e99
 hw/audio/intel-hda.c               |    3 +++
218e99
 hw/audio/pcspk.c                   |    1 +
218e99
 hw/audio/pl041.c                   |    1 +
218e99
 hw/audio/sb16.c                    |    1 +
218e99
 hw/block/fdc.c                     |    3 +++
218e99
 hw/block/pc_sysfw.c                |    1 +
218e99
 hw/block/pflash_cfi01.c            |    1 +
218e99
 hw/block/virtio-blk.c              |    1 +
218e99
 hw/char/debugcon.c                 |    1 +
218e99
 hw/char/imx_serial.c               |    1 +
218e99
 hw/char/ipack.c                    |    1 +
218e99
 hw/char/ipoctal232.c               |    1 +
218e99
 hw/char/parallel.c                 |    1 +
218e99
 hw/char/serial-isa.c               |    1 +
218e99
 hw/char/serial-pci.c               |    3 +++
218e99
 hw/char/tpci200.c                  |    1 +
218e99
 hw/char/virtio-serial-bus.c        |    2 ++
218e99
 hw/cpu/icc_bus.c                   |    8 ++++++++
218e99
 hw/display/cirrus_vga.c            |    2 ++
218e99
 hw/display/g364fb.c                |    1 +
218e99
 hw/display/pl110.c                 |    3 +++
218e99
 hw/display/qxl.c                   |    2 ++
218e99
 hw/display/vga-isa.c               |    1 +
218e99
 hw/display/vga-pci.c               |    1 +
218e99
 hw/display/vmware_vga.c            |    1 +
218e99
 hw/i2c/bitbang_i2c.c               |    1 +
218e99
 hw/i2c/core.c                      |    1 +
218e99
 hw/i386/kvm/pci-assign.c           |    1 +
218e99
 hw/ide/ahci.c                      |    1 +
218e99
 hw/ide/ich.c                       |    1 +
218e99
 hw/ide/isa.c                       |    1 +
218e99
 hw/ide/piix.c                      |    3 +++
218e99
 hw/ide/qdev.c                      |    1 +
218e99
 hw/ide/via.c                       |    1 +
218e99
 hw/isa/i82378.c                    |    1 +
218e99
 hw/isa/lpc_ich9.c                  |    1 +
218e99
 hw/isa/vt82c686.c                  |    3 +++
218e99
 hw/misc/applesmc.c                 |    1 +
218e99
 hw/misc/debugexit.c                |    1 +
218e99
 hw/misc/ivshmem.c                  |    1 +
218e99
 hw/misc/pc-testdev.c               |    2 ++
218e99
 hw/misc/pci-testdev.c              |    1 +
218e99
 hw/misc/sga.c                      |    1 +
218e99
 hw/misc/vfio.c                     |    1 +
218e99
 hw/net/e1000.c                     |    1 +
218e99
 hw/net/eepro100.c                  |    1 +
218e99
 hw/net/lance.c                     |    1 +
218e99
 hw/net/mipsnet.c                   |    1 +
218e99
 hw/net/ne2000-isa.c                |    1 +
218e99
 hw/net/ne2000.c                    |    1 +
218e99
 hw/net/opencores_eth.c             |    1 +
218e99
 hw/net/pcnet-pci.c                 |    1 +
218e99
 hw/net/rtl8139.c                   |    1 +
218e99
 hw/net/virtio-net.c                |    1 +
218e99
 hw/net/vmxnet3.c                   |    1 +
218e99
 hw/pci-bridge/i82801b11.c          |    2 ++
218e99
 hw/pci-bridge/ioh3420.c            |    1 +
218e99
 hw/pci-bridge/pci_bridge_dev.c     |    1 +
218e99
 hw/pci-bridge/xio3130_downstream.c |    1 +
218e99
 hw/pci-bridge/xio3130_upstream.c   |    1 +
218e99
 hw/pci-host/apb.c                  |    2 ++
218e99
 hw/pci-host/ppce500.c              |    1 +
218e99
 hw/pci-host/prep.c                 |    1 +
218e99
 hw/pci-host/q35.c                  |    2 ++
218e99
 hw/scsi/esp-pci.c                  |    2 ++
218e99
 hw/scsi/esp.c                      |    1 +
218e99
 hw/scsi/lsi53c895a.c               |    1 +
218e99
 hw/scsi/megasas.c                  |    1 +
218e99
 hw/scsi/scsi-bus.c                 |    1 +
218e99
 hw/scsi/vhost-scsi.c               |    1 +
218e99
 hw/scsi/virtio-scsi.c              |    3 +++
218e99
 hw/scsi/vmw_pvscsi.c               |    1 +
218e99
 hw/usb/ccid-card-emulated.c        |    1 +
218e99
 hw/usb/ccid-card-passthru.c        |    1 +
218e99
 hw/usb/dev-audio.c                 |    1 +
218e99
 hw/usb/dev-bluetooth.c             |    1 +
218e99
 hw/usb/dev-hid.c                   |    3 +++
218e99
 hw/usb/dev-hub.c                   |    1 +
218e99
 hw/usb/dev-network.c               |    1 +
218e99
 hw/usb/dev-serial.c                |    2 ++
218e99
 hw/usb/dev-smartcard-reader.c      |    1 +
218e99
 hw/usb/dev-storage.c               |    1 +
218e99
 hw/usb/dev-uas.c                   |    1 +
218e99
 hw/usb/dev-wacom.c                 |    1 +
218e99
 hw/usb/hcd-ehci-pci.c              |    2 ++
218e99
 hw/usb/hcd-ehci-sysbus.c           |    5 +++++
218e99
 hw/usb/hcd-ohci.c                  |    2 ++
218e99
 hw/usb/hcd-uhci.c                  |    1 +
218e99
 hw/usb/hcd-xhci.c                  |    1 +
218e99
 hw/usb/host-libusb.c               |    1 +
218e99
 hw/usb/redirect.c                  |    1 +
218e99
 hw/virtio/virtio-balloon.c         |    1 +
218e99
 hw/virtio/virtio-pci.c             |    8 ++++++++
218e99
 hw/virtio/virtio-rng.c             |    1 +
218e99
 hw/watchdog/wdt_i6300esb.c         |    1 +
218e99
 hw/watchdog/wdt_ib700.c            |    1 +
218e99
 hw/xen/xen_platform.c              |    1 +
218e99
 hw/xen/xen_pt.c                    |    1 +
218e99
 105 files changed, 152 insertions(+), 0 deletions(-)
218e99
218e99
diff --git a/hw/9pfs/virtio-9p-device.c b/hw/9pfs/virtio-9p-device.c
218e99
index dc6f4e4..69d781d 100644
218e99
--- a/hw/9pfs/virtio-9p-device.c
218e99
+++ b/hw/9pfs/virtio-9p-device.c
218e99
@@ -141,6 +141,7 @@ static void virtio_9p_class_init(ObjectClass *klass, void *data)
218e99
     DeviceClass *dc = DEVICE_CLASS(klass);
218e99
     VirtioDeviceClass *vdc = VIRTIO_DEVICE_CLASS(klass);
218e99
     dc->props = virtio_9p_properties;
218e99
+    set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
218e99
     vdc->init = virtio_9p_device_init;
218e99
     vdc->get_features = virtio_9p_get_features;
218e99
     vdc->get_config = virtio_9p_get_config;
218e99
diff --git a/hw/audio/ac97.c b/hw/audio/ac97.c
218e99
index baf138b..8455a96 100644
218e99
--- a/hw/audio/ac97.c
218e99
+++ b/hw/audio/ac97.c
218e99
@@ -1418,6 +1418,7 @@ static void ac97_class_init (ObjectClass *klass, void *data)
218e99
     k->device_id = PCI_DEVICE_ID_INTEL_82801AA_5;
218e99
     k->revision = 0x01;
218e99
     k->class_id = PCI_CLASS_MULTIMEDIA_AUDIO;
218e99
+    set_bit(DEVICE_CATEGORY_SOUND, dc->categories);
218e99
     dc->desc = "Intel 82801AA AC97 Audio";
218e99
     dc->vmsd = &vmstate_ac97;
218e99
     dc->props = ac97_properties;
218e99
diff --git a/hw/audio/adlib.c b/hw/audio/adlib.c
218e99
index fc20857..46934c7 100644
218e99
--- a/hw/audio/adlib.c
218e99
+++ b/hw/audio/adlib.c
218e99
@@ -361,6 +361,7 @@ static void adlib_class_initfn (ObjectClass *klass, void *data)
218e99
     DeviceClass *dc = DEVICE_CLASS (klass);
218e99
     ISADeviceClass *ic = ISA_DEVICE_CLASS (klass);
218e99
     ic->init = Adlib_initfn;
218e99
+    set_bit(DEVICE_CATEGORY_SOUND, dc->categories);
218e99
     dc->desc = ADLIB_DESC;
218e99
     dc->props = adlib_properties;
218e99
 }
218e99
diff --git a/hw/audio/cs4231a.c b/hw/audio/cs4231a.c
218e99
index cc605e5..c970722 100644
218e99
--- a/hw/audio/cs4231a.c
218e99
+++ b/hw/audio/cs4231a.c
218e99
@@ -677,6 +677,7 @@ static void cs4231a_class_initfn (ObjectClass *klass, void *data)
218e99
     DeviceClass *dc = DEVICE_CLASS (klass);
218e99
     ISADeviceClass *ic = ISA_DEVICE_CLASS (klass);
218e99
     ic->init = cs4231a_initfn;
218e99
+    set_bit(DEVICE_CATEGORY_SOUND, dc->categories);
218e99
     dc->desc = "Crystal Semiconductor CS4231A";
218e99
     dc->vmsd = &vmstate_cs4231a;
218e99
     dc->props = cs4231a_properties;
218e99
diff --git a/hw/audio/es1370.c b/hw/audio/es1370.c
218e99
index c1cd169..8678e1e 100644
218e99
--- a/hw/audio/es1370.c
218e99
+++ b/hw/audio/es1370.c
218e99
@@ -1069,6 +1069,7 @@ static void es1370_class_init (ObjectClass *klass, void *data)
218e99
     k->class_id = PCI_CLASS_MULTIMEDIA_AUDIO;
218e99
     k->subsystem_vendor_id = 0x4942;
218e99
     k->subsystem_id = 0x4c4c;
218e99
+    set_bit(DEVICE_CATEGORY_SOUND, dc->categories);
218e99
     dc->desc = "ENSONIQ AudioPCI ES1370";
218e99
     dc->vmsd = &vmstate_es1370;
218e99
 }
218e99
diff --git a/hw/audio/gus.c b/hw/audio/gus.c
218e99
index a91921c..3cafca5 100644
218e99
--- a/hw/audio/gus.c
218e99
+++ b/hw/audio/gus.c
218e99
@@ -312,6 +312,7 @@ static void gus_class_initfn (ObjectClass *klass, void *data)
218e99
     DeviceClass *dc = DEVICE_CLASS (klass);
218e99
     ISADeviceClass *ic = ISA_DEVICE_CLASS (klass);
218e99
     ic->init = gus_initfn;
218e99
+    set_bit(DEVICE_CATEGORY_SOUND, dc->categories);
218e99
     dc->desc = "Gravis Ultrasound GF1";
218e99
     dc->vmsd = &vmstate_gus;
218e99
     dc->props = gus_properties;
218e99
diff --git a/hw/audio/hda-codec.c b/hw/audio/hda-codec.c
218e99
index 94c472c..07a43bf 100644
218e99
--- a/hw/audio/hda-codec.c
218e99
+++ b/hw/audio/hda-codec.c
218e99
@@ -638,6 +638,7 @@ static void hda_audio_output_class_init(ObjectClass *klass, void *data)
218e99
     k->exit = hda_audio_exit;
218e99
     k->command = hda_audio_command;
218e99
     k->stream = hda_audio_stream;
218e99
+    set_bit(DEVICE_CATEGORY_SOUND, dc->categories);
218e99
     dc->desc = "HDA Audio Codec, output-only (line-out)";
218e99
     dc->vmsd = &vmstate_hda_audio;
218e99
     dc->props = hda_audio_properties;
218e99
@@ -659,6 +660,7 @@ static void hda_audio_duplex_class_init(ObjectClass *klass, void *data)
218e99
     k->exit = hda_audio_exit;
218e99
     k->command = hda_audio_command;
218e99
     k->stream = hda_audio_stream;
218e99
+    set_bit(DEVICE_CATEGORY_SOUND, dc->categories);
218e99
     dc->desc = "HDA Audio Codec, duplex (line-out, line-in)";
218e99
     dc->vmsd = &vmstate_hda_audio;
218e99
     dc->props = hda_audio_properties;
218e99
@@ -680,6 +682,7 @@ static void hda_audio_micro_class_init(ObjectClass *klass, void *data)
218e99
     k->exit = hda_audio_exit;
218e99
     k->command = hda_audio_command;
218e99
     k->stream = hda_audio_stream;
218e99
+    set_bit(DEVICE_CATEGORY_SOUND, dc->categories);
218e99
     dc->desc = "HDA Audio Codec, duplex (speaker, microphone)";
218e99
     dc->vmsd = &vmstate_hda_audio;
218e99
     dc->props = hda_audio_properties;
218e99
diff --git a/hw/audio/intel-hda.c b/hw/audio/intel-hda.c
218e99
index 1016af0..e747342 100644
218e99
--- a/hw/audio/intel-hda.c
218e99
+++ b/hw/audio/intel-hda.c
218e99
@@ -1254,6 +1254,7 @@ static void intel_hda_class_init_ich6(ObjectClass *klass, void *data)
218e99
     intel_hda_class_init_common(klass);
218e99
     k->device_id = 0x2668;
218e99
     k->revision = 1;
218e99
+    set_bit(DEVICE_CATEGORY_SOUND, dc->categories);
218e99
     dc->desc = "Intel HD Audio Controller (ich6)";
218e99
 }
218e99
 
218e99
@@ -1265,6 +1266,7 @@ static void intel_hda_class_init_ich9(ObjectClass *klass, void *data)
218e99
     intel_hda_class_init_common(klass);
218e99
     k->device_id = 0x293e;
218e99
     k->revision = 3;
218e99
+    set_bit(DEVICE_CATEGORY_SOUND, dc->categories);
218e99
     dc->desc = "Intel HD Audio Controller (ich9)";
218e99
 }
218e99
 
218e99
@@ -1287,6 +1289,7 @@ static void hda_codec_device_class_init(ObjectClass *klass, void *data)
218e99
     DeviceClass *k = DEVICE_CLASS(klass);
218e99
     k->init = hda_codec_dev_init;
218e99
     k->exit = hda_codec_dev_exit;
218e99
+    set_bit(DEVICE_CATEGORY_SOUND, k->categories);
218e99
     k->bus_type = TYPE_HDA_BUS;
218e99
     k->props = hda_props;
218e99
 }
218e99
diff --git a/hw/audio/pcspk.c b/hw/audio/pcspk.c
218e99
index 3a7285f..4e03bc9 100644
218e99
--- a/hw/audio/pcspk.c
218e99
+++ b/hw/audio/pcspk.c
218e99
@@ -187,6 +187,7 @@ static void pcspk_class_initfn(ObjectClass *klass, void *data)
218e99
     ISADeviceClass *ic = ISA_DEVICE_CLASS(klass);
218e99
 
218e99
     ic->init = pcspk_initfn;
218e99
+    set_bit(DEVICE_CATEGORY_SOUND, dc->categories);
218e99
     dc->no_user = 1;
218e99
     dc->props = pcspk_properties;
218e99
 }
218e99
diff --git a/hw/audio/pl041.c b/hw/audio/pl041.c
218e99
index 653ab4f..9b11cc9 100644
218e99
--- a/hw/audio/pl041.c
218e99
+++ b/hw/audio/pl041.c
218e99
@@ -626,6 +626,7 @@ static void pl041_device_class_init(ObjectClass *klass, void *data)
218e99
     SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
218e99
 
218e99
     k->init = pl041_init;
218e99
+    set_bit(DEVICE_CATEGORY_SOUND, dc->categories);
218e99
     dc->no_user = 1;
218e99
     dc->reset = pl041_device_reset;
218e99
     dc->vmsd = &vmstate_pl041;
218e99
diff --git a/hw/audio/sb16.c b/hw/audio/sb16.c
218e99
index 6ddc0ac..277bde1 100644
218e99
--- a/hw/audio/sb16.c
218e99
+++ b/hw/audio/sb16.c
218e99
@@ -1406,6 +1406,7 @@ static void sb16_class_initfn (ObjectClass *klass, void *data)
218e99
     DeviceClass *dc = DEVICE_CLASS (klass);
218e99
     ISADeviceClass *ic = ISA_DEVICE_CLASS (klass);
218e99
     ic->init = sb16_initfn;
218e99
+    set_bit(DEVICE_CATEGORY_SOUND, dc->categories);
218e99
     dc->desc = "Creative Sound Blaster 16";
218e99
     dc->vmsd = &vmstate_sb16;
218e99
     dc->props = sb16_properties;
218e99
diff --git a/hw/block/fdc.c b/hw/block/fdc.c
218e99
index 0888652..e292f4c 100644
218e99
--- a/hw/block/fdc.c
218e99
+++ b/hw/block/fdc.c
218e99
@@ -2210,6 +2210,7 @@ static void isabus_fdc_class_init(ObjectClass *klass, void *data)
218e99
     dc->reset = fdctrl_external_reset_isa;
218e99
     dc->vmsd = &vmstate_isa_fdc;
218e99
     dc->props = isa_fdc_properties;
218e99
+    set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
218e99
 }
218e99
 
218e99
 static const TypeInfo isa_fdc_info = {
218e99
@@ -2244,6 +2245,7 @@ static void sysbus_fdc_class_init(ObjectClass *klass, void *data)
218e99
     dc->reset = fdctrl_external_reset_sysbus;
218e99
     dc->vmsd = &vmstate_sysbus_fdc;
218e99
     dc->props = sysbus_fdc_properties;
218e99
+    set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
218e99
 }
218e99
 
218e99
 static const TypeInfo sysbus_fdc_info = {
218e99
@@ -2267,6 +2269,7 @@ static void sun4m_fdc_class_init(ObjectClass *klass, void *data)
218e99
     dc->reset = fdctrl_external_reset_sysbus;
218e99
     dc->vmsd = &vmstate_sysbus_fdc;
218e99
     dc->props = sun4m_fdc_properties;
218e99
+    set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
218e99
 }
218e99
 
218e99
 static const TypeInfo sun4m_fdc_info = {
218e99
diff --git a/hw/block/pc_sysfw.c b/hw/block/pc_sysfw.c
218e99
index 4e3e6b6..0bc5b7a 100644
218e99
--- a/hw/block/pc_sysfw.c
218e99
+++ b/hw/block/pc_sysfw.c
218e99
@@ -268,6 +268,7 @@ static void pcsysfw_class_init (ObjectClass *klass, void *data)
218e99
 {
218e99
     DeviceClass *dc = DEVICE_CLASS (klass);
218e99
 
218e99
+    set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
218e99
     dc->desc = "PC System Firmware";
218e99
     dc->init = pcsysfw_init;
218e99
     dc->props = pcsysfw_properties;
218e99
diff --git a/hw/block/pflash_cfi01.c b/hw/block/pflash_cfi01.c
218e99
index 3ff20e0..0bbb1a3 100644
218e99
--- a/hw/block/pflash_cfi01.c
218e99
+++ b/hw/block/pflash_cfi01.c
218e99
@@ -715,6 +715,7 @@ static void pflash_cfi01_class_init(ObjectClass *klass, void *data)
218e99
     k->init = pflash_cfi01_init;
218e99
     dc->props = pflash_cfi01_properties;
218e99
     dc->vmsd = &vmstate_pflash;
218e99
+    set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
218e99
 }
218e99
 
218e99
 
218e99
diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c
218e99
index ce1a523..9fe622d 100644
218e99
--- a/hw/block/virtio-blk.c
218e99
+++ b/hw/block/virtio-blk.c
218e99
@@ -756,6 +756,7 @@ static void virtio_blk_class_init(ObjectClass *klass, void *data)
218e99
     VirtioDeviceClass *vdc = VIRTIO_DEVICE_CLASS(klass);
218e99
     dc->exit = virtio_blk_device_exit;
218e99
     dc->props = virtio_blk_properties;
218e99
+    set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
218e99
     vdc->init = virtio_blk_device_init;
218e99
     vdc->get_config = virtio_blk_update_config;
218e99
     vdc->set_config = virtio_blk_set_config;
218e99
diff --git a/hw/char/debugcon.c b/hw/char/debugcon.c
218e99
index 02c9577..b974889 100644
218e99
--- a/hw/char/debugcon.c
218e99
+++ b/hw/char/debugcon.c
218e99
@@ -117,6 +117,7 @@ static void debugcon_isa_class_initfn(ObjectClass *klass, void *data)
218e99
     ISADeviceClass *ic = ISA_DEVICE_CLASS(klass);
218e99
     ic->init = debugcon_isa_initfn;
218e99
     dc->props = debugcon_isa_properties;
218e99
+    set_bit(DEVICE_CATEGORY_MISC, dc->categories);
218e99
 }
218e99
 
218e99
 static const TypeInfo debugcon_isa_info = {
218e99
diff --git a/hw/char/imx_serial.c b/hw/char/imx_serial.c
218e99
index 2a2c230..a11b9c2 100644
218e99
--- a/hw/char/imx_serial.c
218e99
+++ b/hw/char/imx_serial.c
218e99
@@ -448,6 +448,7 @@ static void imx_serial_class_init(ObjectClass *klass, void *data)
218e99
     k->init = imx_serial_init;
218e99
     dc->vmsd = &vmstate_imx_serial;
218e99
     dc->reset = imx_serial_reset_at_boot;
218e99
+    set_bit(DEVICE_CATEGORY_INPUT, dc->categories);
218e99
     dc->desc = "i.MX series UART";
218e99
     dc->props = imx32_serial_properties;
218e99
 }
218e99
diff --git a/hw/char/ipack.c b/hw/char/ipack.c
218e99
index e15540d..f890471 100644
218e99
--- a/hw/char/ipack.c
218e99
+++ b/hw/char/ipack.c
218e99
@@ -74,6 +74,7 @@ static Property ipack_device_props[] = {
218e99
 static void ipack_device_class_init(ObjectClass *klass, void *data)
218e99
 {
218e99
     DeviceClass *k = DEVICE_CLASS(klass);
218e99
+    set_bit(DEVICE_CATEGORY_INPUT, k->categories);
218e99
     k->bus_type = TYPE_IPACK_BUS;
218e99
     k->init = ipack_device_dev_init;
218e99
     k->exit = ipack_device_dev_exit;
218e99
diff --git a/hw/char/ipoctal232.c b/hw/char/ipoctal232.c
218e99
index c9698a6..88e2cca 100644
218e99
--- a/hw/char/ipoctal232.c
218e99
+++ b/hw/char/ipoctal232.c
218e99
@@ -585,6 +585,7 @@ static void ipoctal_class_init(ObjectClass *klass, void *data)
218e99
     ic->mem_read8   = mem_read8;
218e99
     ic->mem_write8  = mem_write8;
218e99
 
218e99
+    set_bit(DEVICE_CATEGORY_INPUT, dc->categories);
218e99
     dc->desc    = "GE IP-Octal 232 8-channel RS-232 IndustryPack";
218e99
     dc->props   = ipoctal_properties;
218e99
     dc->vmsd    = &vmstate_ipoctal;
218e99
diff --git a/hw/char/parallel.c b/hw/char/parallel.c
218e99
index 8e48284..046e453 100644
218e99
--- a/hw/char/parallel.c
218e99
+++ b/hw/char/parallel.c
218e99
@@ -602,6 +602,7 @@ static void parallel_isa_class_initfn(ObjectClass *klass, void *data)
218e99
     ISADeviceClass *ic = ISA_DEVICE_CLASS(klass);
218e99
     ic->init = parallel_isa_initfn;
218e99
     dc->props = parallel_isa_properties;
218e99
+    set_bit(DEVICE_CATEGORY_INPUT, dc->categories);
218e99
 }
218e99
 
218e99
 static const TypeInfo parallel_isa_info = {
218e99
diff --git a/hw/char/serial-isa.c b/hw/char/serial-isa.c
218e99
index 342b4cc..cc00544 100644
218e99
--- a/hw/char/serial-isa.c
218e99
+++ b/hw/char/serial-isa.c
218e99
@@ -100,6 +100,7 @@ static void serial_isa_class_initfn(ObjectClass *klass, void *data)
218e99
     ic->init = serial_isa_initfn;
218e99
     dc->vmsd = &vmstate_isa_serial;
218e99
     dc->props = serial_isa_properties;
218e99
+    set_bit(DEVICE_CATEGORY_INPUT, dc->categories);
218e99
 }
218e99
 
218e99
 static const TypeInfo serial_isa_info = {
218e99
diff --git a/hw/char/serial-pci.c b/hw/char/serial-pci.c
218e99
index 2138e35..77fec01 100644
218e99
--- a/hw/char/serial-pci.c
218e99
+++ b/hw/char/serial-pci.c
218e99
@@ -191,6 +191,7 @@ static void serial_pci_class_initfn(ObjectClass *klass, void *data)
218e99
     pc->class_id = PCI_CLASS_COMMUNICATION_SERIAL;
218e99
     dc->vmsd = &vmstate_pci_serial;
218e99
     dc->props = serial_pci_properties;
218e99
+    set_bit(DEVICE_CATEGORY_INPUT, dc->categories);
218e99
 }
218e99
 
218e99
 static void multi_2x_serial_pci_class_initfn(ObjectClass *klass, void *data)
218e99
@@ -205,6 +206,7 @@ static void multi_2x_serial_pci_class_initfn(ObjectClass *klass, void *data)
218e99
     pc->class_id = PCI_CLASS_COMMUNICATION_SERIAL;
218e99
     dc->vmsd = &vmstate_pci_multi_serial;
218e99
     dc->props = multi_2x_serial_pci_properties;
218e99
+    set_bit(DEVICE_CATEGORY_INPUT, dc->categories);
218e99
 }
218e99
 
218e99
 static void multi_4x_serial_pci_class_initfn(ObjectClass *klass, void *data)
218e99
@@ -219,6 +221,7 @@ static void multi_4x_serial_pci_class_initfn(ObjectClass *klass, void *data)
218e99
     pc->class_id = PCI_CLASS_COMMUNICATION_SERIAL;
218e99
     dc->vmsd = &vmstate_pci_multi_serial;
218e99
     dc->props = multi_4x_serial_pci_properties;
218e99
+    set_bit(DEVICE_CATEGORY_INPUT, dc->categories);
218e99
 }
218e99
 
218e99
 static const TypeInfo serial_pci_info = {
218e99
diff --git a/hw/char/tpci200.c b/hw/char/tpci200.c
218e99
index 0170602..cc6a963 100644
218e99
--- a/hw/char/tpci200.c
218e99
+++ b/hw/char/tpci200.c
218e99
@@ -652,6 +652,7 @@ static void tpci200_class_init(ObjectClass *klass, void *data)
218e99
     k->class_id = PCI_CLASS_BRIDGE_OTHER;
218e99
     k->subsystem_vendor_id = PCI_VENDOR_ID_TEWS;
218e99
     k->subsystem_id = 0x300A;
218e99
+    set_bit(DEVICE_CATEGORY_INPUT, dc->categories);
218e99
     dc->desc = "TEWS TPCI200 IndustryPack carrier";
218e99
     dc->vmsd = &vmstate_tpci200;
218e99
 }
218e99
diff --git a/hw/char/virtio-serial-bus.c b/hw/char/virtio-serial-bus.c
218e99
index cc3d1dd..da417c7 100644
218e99
--- a/hw/char/virtio-serial-bus.c
218e99
+++ b/hw/char/virtio-serial-bus.c
218e99
@@ -971,6 +971,7 @@ static void virtio_serial_port_class_init(ObjectClass *klass, void *data)
218e99
 {
218e99
     DeviceClass *k = DEVICE_CLASS(klass);
218e99
     k->init = virtser_port_qdev_init;
218e99
+    set_bit(DEVICE_CATEGORY_INPUT, k->categories);
218e99
     k->bus_type = TYPE_VIRTIO_SERIAL_BUS;
218e99
     k->exit = virtser_port_qdev_exit;
218e99
     k->unplug = qdev_simple_unplug_cb;
218e99
@@ -1017,6 +1018,7 @@ static void virtio_serial_class_init(ObjectClass *klass, void *data)
218e99
     VirtioDeviceClass *vdc = VIRTIO_DEVICE_CLASS(klass);
218e99
     dc->exit = virtio_serial_device_exit;
218e99
     dc->props = virtio_serial_properties;
218e99
+    set_bit(DEVICE_CATEGORY_INPUT, dc->categories);
218e99
     vdc->init = virtio_serial_device_init;
218e99
     vdc->get_features = get_features;
218e99
     vdc->get_config = get_config;
218e99
diff --git a/hw/cpu/icc_bus.c b/hw/cpu/icc_bus.c
218e99
index 73a1dc9..4df814b 100644
218e99
--- a/hw/cpu/icc_bus.c
218e99
+++ b/hw/cpu/icc_bus.c
218e99
@@ -101,11 +101,19 @@ static void icc_bridge_init(Object *obj)
218e99
     s->icc_bus.apic_address_space = &s->apic_container;
218e99
 }
218e99
 
218e99
+static void icc_bridge_class_init(ObjectClass *oc, void *data)
218e99
+{
218e99
+    DeviceClass *dc = DEVICE_CLASS(oc);
218e99
+
218e99
+    set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories);
218e99
+}
218e99
+
218e99
 static const TypeInfo icc_bridge_info = {
218e99
     .name  = TYPE_ICC_BRIDGE,
218e99
     .parent = TYPE_SYS_BUS_DEVICE,
218e99
     .instance_init  = icc_bridge_init,
218e99
     .instance_size  = sizeof(ICCBridgeState),
218e99
+    .class_init = icc_bridge_class_init,
218e99
 };
218e99
 
218e99
 
218e99
diff --git a/hw/display/cirrus_vga.c b/hw/display/cirrus_vga.c
218e99
index fa8eae2..a7634ba 100644
218e99
--- a/hw/display/cirrus_vga.c
218e99
+++ b/hw/display/cirrus_vga.c
218e99
@@ -2936,6 +2936,7 @@ static void isa_cirrus_vga_class_init(ObjectClass *klass, void *data)
218e99
     dc->vmsd  = &vmstate_cirrus_vga;
218e99
     k->init   = vga_initfn;
218e99
     dc->props = isa_cirrus_vga_properties;
218e99
+    set_bit(DEVICE_CATEGORY_DISPLAY, dc->categories);
218e99
 }
218e99
 
218e99
 static const TypeInfo isa_cirrus_vga_info = {
218e99
@@ -3001,6 +3002,7 @@ static void cirrus_vga_class_init(ObjectClass *klass, void *data)
218e99
     k->vendor_id = PCI_VENDOR_ID_CIRRUS;
218e99
     k->device_id = CIRRUS_ID_CLGD5446;
218e99
     k->class_id = PCI_CLASS_DISPLAY_VGA;
218e99
+    set_bit(DEVICE_CATEGORY_DISPLAY, dc->categories);
218e99
     dc->desc = "Cirrus CLGD 54xx VGA";
218e99
     dc->vmsd = &vmstate_pci_cirrus_vga;
218e99
     dc->props = pci_vga_cirrus_properties;
218e99
diff --git a/hw/display/g364fb.c b/hw/display/g364fb.c
218e99
index 2a4047e..2b974ca 100644
218e99
--- a/hw/display/g364fb.c
218e99
+++ b/hw/display/g364fb.c
218e99
@@ -528,6 +528,7 @@ static void g364fb_sysbus_class_init(ObjectClass *klass, void *data)
218e99
     SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
218e99
 
218e99
     k->init = g364fb_sysbus_init;
218e99
+    set_bit(DEVICE_CATEGORY_DISPLAY, dc->categories);
218e99
     dc->desc = "G364 framebuffer";
218e99
     dc->reset = g364fb_sysbus_reset;
218e99
     dc->vmsd = &vmstate_g364fb;
218e99
diff --git a/hw/display/pl110.c b/hw/display/pl110.c
218e99
index f259955..b45a7be 100644
218e99
--- a/hw/display/pl110.c
218e99
+++ b/hw/display/pl110.c
218e99
@@ -481,6 +481,7 @@ static void pl110_class_init(ObjectClass *klass, void *data)
218e99
     SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
218e99
 
218e99
     k->init = pl110_init;
218e99
+    set_bit(DEVICE_CATEGORY_DISPLAY, dc->categories);
218e99
     dc->no_user = 1;
218e99
     dc->vmsd = &vmstate_pl110;
218e99
 }
218e99
@@ -498,6 +499,7 @@ static void pl110_versatile_class_init(ObjectClass *klass, void *data)
218e99
     SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
218e99
 
218e99
     k->init = pl110_versatile_init;
218e99
+    set_bit(DEVICE_CATEGORY_DISPLAY, dc->categories);
218e99
     dc->no_user = 1;
218e99
     dc->vmsd = &vmstate_pl110;
218e99
 }
218e99
@@ -515,6 +517,7 @@ static void pl111_class_init(ObjectClass *klass, void *data)
218e99
     SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
218e99
 
218e99
     k->init = pl111_init;
218e99
+    set_bit(DEVICE_CATEGORY_DISPLAY, dc->categories);
218e99
     dc->no_user = 1;
218e99
     dc->vmsd = &vmstate_pl110;
218e99
 }
218e99
diff --git a/hw/display/qxl.c b/hw/display/qxl.c
218e99
index 937a402..ea985d2 100644
218e99
--- a/hw/display/qxl.c
218e99
+++ b/hw/display/qxl.c
218e99
@@ -2317,6 +2317,7 @@ static void qxl_primary_class_init(ObjectClass *klass, void *data)
218e99
     k->vendor_id = REDHAT_PCI_VENDOR_ID;
218e99
     k->device_id = QXL_DEVICE_ID_STABLE;
218e99
     k->class_id = PCI_CLASS_DISPLAY_VGA;
218e99
+    set_bit(DEVICE_CATEGORY_DISPLAY, dc->categories);
218e99
     dc->desc = "Spice QXL GPU (primary, vga compatible)";
218e99
     dc->reset = qxl_reset_handler;
218e99
     dc->vmsd = &qxl_vmstate;
218e99
@@ -2339,6 +2340,7 @@ static void qxl_secondary_class_init(ObjectClass *klass, void *data)
218e99
     k->vendor_id = REDHAT_PCI_VENDOR_ID;
218e99
     k->device_id = QXL_DEVICE_ID_STABLE;
218e99
     k->class_id = PCI_CLASS_DISPLAY_OTHER;
218e99
+    set_bit(DEVICE_CATEGORY_DISPLAY, dc->categories);
218e99
     dc->desc = "Spice QXL GPU (secondary)";
218e99
     dc->reset = qxl_reset_handler;
218e99
     dc->vmsd = &qxl_vmstate;
218e99
diff --git a/hw/display/vga-isa.c b/hw/display/vga-isa.c
218e99
index 2f34ee3..775b800 100644
218e99
--- a/hw/display/vga-isa.c
218e99
+++ b/hw/display/vga-isa.c
218e99
@@ -88,6 +88,7 @@ static void vga_isa_class_initfn(ObjectClass *klass, void *data)
218e99
     dc->reset = vga_isa_reset;
218e99
     dc->vmsd = &vmstate_vga_common;
218e99
     dc->props = vga_isa_properties;
218e99
+    set_bit(DEVICE_CATEGORY_DISPLAY, dc->categories);
218e99
 }
218e99
 
218e99
 static const TypeInfo vga_isa_info = {
218e99
diff --git a/hw/display/vga-pci.c b/hw/display/vga-pci.c
218e99
index cea8db7..21aa4bf 100644
218e99
--- a/hw/display/vga-pci.c
218e99
+++ b/hw/display/vga-pci.c
218e99
@@ -197,6 +197,7 @@ static void vga_class_init(ObjectClass *klass, void *data)
218e99
     k->class_id = PCI_CLASS_DISPLAY_VGA;
218e99
     dc->vmsd = &vmstate_vga_pci;
218e99
     dc->props = vga_pci_properties;
218e99
+    set_bit(DEVICE_CATEGORY_DISPLAY, dc->categories);
218e99
 }
218e99
 
218e99
 static const TypeInfo vga_info = {
218e99
diff --git a/hw/display/vmware_vga.c b/hw/display/vmware_vga.c
218e99
index fd3569d..df76aec 100644
218e99
--- a/hw/display/vmware_vga.c
218e99
+++ b/hw/display/vmware_vga.c
218e99
@@ -1296,6 +1296,7 @@ static void vmsvga_class_init(ObjectClass *klass, void *data)
218e99
     dc->reset = vmsvga_reset;
218e99
     dc->vmsd = &vmstate_vmware_vga;
218e99
     dc->props = vga_vmware_properties;
218e99
+    set_bit(DEVICE_CATEGORY_DISPLAY, dc->categories);
218e99
 }
218e99
 
218e99
 static const TypeInfo vmsvga_info = {
218e99
diff --git a/hw/i2c/bitbang_i2c.c b/hw/i2c/bitbang_i2c.c
218e99
index 854b8e1..f5e4836 100644
218e99
--- a/hw/i2c/bitbang_i2c.c
218e99
+++ b/hw/i2c/bitbang_i2c.c
218e99
@@ -227,6 +227,7 @@ static void gpio_i2c_class_init(ObjectClass *klass, void *data)
218e99
     SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
218e99
 
218e99
     k->init = gpio_i2c_init;
218e99
+    set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories);
218e99
     dc->desc = "Virtual GPIO to I2C bridge";
218e99
 }
218e99
 
218e99
diff --git a/hw/i2c/core.c b/hw/i2c/core.c
218e99
index 0c4fc1d..ef3b000 100644
218e99
--- a/hw/i2c/core.c
218e99
+++ b/hw/i2c/core.c
218e99
@@ -224,6 +224,7 @@ static void i2c_slave_class_init(ObjectClass *klass, void *data)
218e99
 {
218e99
     DeviceClass *k = DEVICE_CLASS(klass);
218e99
     k->init = i2c_slave_qdev_init;
218e99
+    set_bit(DEVICE_CATEGORY_MISC, k->categories);
218e99
     k->bus_type = TYPE_I2C_BUS;
218e99
     k->props = i2c_props;
218e99
 }
218e99
diff --git a/hw/i386/kvm/pci-assign.c b/hw/i386/kvm/pci-assign.c
218e99
index c1e08ec..1684f8c 100644
218e99
--- a/hw/i386/kvm/pci-assign.c
218e99
+++ b/hw/i386/kvm/pci-assign.c
218e99
@@ -1835,6 +1835,7 @@ static void assign_class_init(ObjectClass *klass, void *data)
218e99
     dc->props       = assigned_dev_properties;
218e99
     dc->vmsd        = &vmstate_assigned_device;
218e99
     dc->reset       = reset_assigned_device;
218e99
+    set_bit(DEVICE_CATEGORY_MISC, dc->categories);
218e99
     dc->desc        = "KVM-based PCI passthrough";
218e99
 }
218e99
 
218e99
diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c
218e99
index ade9f64..011e796 100644
218e99
--- a/hw/ide/ahci.c
218e99
+++ b/hw/ide/ahci.c
218e99
@@ -1326,6 +1326,7 @@ static void sysbus_ahci_class_init(ObjectClass *klass, void *data)
218e99
     dc->vmsd = &vmstate_sysbus_ahci;
218e99
     dc->props = sysbus_ahci_properties;
218e99
     dc->reset = sysbus_ahci_reset;
218e99
+    set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
218e99
 }
218e99
 
218e99
 static const TypeInfo sysbus_ahci_info = {
218e99
diff --git a/hw/ide/ich.c b/hw/ide/ich.c
218e99
index ed1f1a2..4d53564 100644
218e99
--- a/hw/ide/ich.c
218e99
+++ b/hw/ide/ich.c
218e99
@@ -160,6 +160,7 @@ static void ich_ahci_class_init(ObjectClass *klass, void *data)
218e99
     k->class_id = PCI_CLASS_STORAGE_SATA;
218e99
     dc->vmsd = &vmstate_ich9_ahci;
218e99
     dc->reset = pci_ich9_reset;
218e99
+    set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
218e99
 }
218e99
 
218e99
 static const TypeInfo ich_ahci_info = {
218e99
diff --git a/hw/ide/isa.c b/hw/ide/isa.c
218e99
index 369a7fa..2a14260 100644
218e99
--- a/hw/ide/isa.c
218e99
+++ b/hw/ide/isa.c
218e99
@@ -118,6 +118,7 @@ static void isa_ide_class_initfn(ObjectClass *klass, void *data)
218e99
     dc->fw_name = "ide";
218e99
     dc->reset = isa_ide_reset;
218e99
     dc->props = isa_ide_properties;
218e99
+    set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
218e99
 }
218e99
 
218e99
 static const TypeInfo isa_ide_info = {
218e99
diff --git a/hw/ide/piix.c b/hw/ide/piix.c
218e99
index bf2856f..8d4bf2f 100644
218e99
--- a/hw/ide/piix.c
218e99
+++ b/hw/ide/piix.c
218e99
@@ -248,6 +248,7 @@ static void piix3_ide_class_init(ObjectClass *klass, void *data)
218e99
     k->vendor_id = PCI_VENDOR_ID_INTEL;
218e99
     k->device_id = PCI_DEVICE_ID_INTEL_82371SB_1;
218e99
     k->class_id = PCI_CLASS_STORAGE_IDE;
218e99
+    set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
218e99
     dc->no_user = 1;
218e99
 }
218e99
 
218e99
@@ -267,6 +268,7 @@ static void piix3_ide_xen_class_init(ObjectClass *klass, void *data)
218e99
     k->vendor_id = PCI_VENDOR_ID_INTEL;
218e99
     k->device_id = PCI_DEVICE_ID_INTEL_82371SB_1;
218e99
     k->class_id = PCI_CLASS_STORAGE_IDE;
218e99
+    set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
218e99
     dc->no_user = 1;
218e99
     dc->unplug = pci_piix3_xen_ide_unplug;
218e99
 }
218e99
@@ -289,6 +291,7 @@ static void piix4_ide_class_init(ObjectClass *klass, void *data)
218e99
     k->vendor_id = PCI_VENDOR_ID_INTEL;
218e99
     k->device_id = PCI_DEVICE_ID_INTEL_82371AB;
218e99
     k->class_id = PCI_CLASS_STORAGE_IDE;
218e99
+    set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
218e99
     dc->no_user = 1;
218e99
 }
218e99
 
218e99
diff --git a/hw/ide/qdev.c b/hw/ide/qdev.c
218e99
index 6a272b0..1d84e15 100644
218e99
--- a/hw/ide/qdev.c
218e99
+++ b/hw/ide/qdev.c
218e99
@@ -282,6 +282,7 @@ static void ide_device_class_init(ObjectClass *klass, void *data)
218e99
 {
218e99
     DeviceClass *k = DEVICE_CLASS(klass);
218e99
     k->init = ide_qdev_init;
218e99
+    set_bit(DEVICE_CATEGORY_STORAGE, k->categories);
218e99
     k->bus_type = TYPE_IDE_BUS;
218e99
     k->props = ide_props;
218e99
 }
218e99
diff --git a/hw/ide/via.c b/hw/ide/via.c
218e99
index 5fe053c..30dedd8 100644
218e99
--- a/hw/ide/via.c
218e99
+++ b/hw/ide/via.c
218e99
@@ -223,6 +223,7 @@ static void via_ide_class_init(ObjectClass *klass, void *data)
218e99
     k->device_id = PCI_DEVICE_ID_VIA_IDE;
218e99
     k->revision = 0x06;
218e99
     k->class_id = PCI_CLASS_STORAGE_IDE;
218e99
+    set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
218e99
     dc->no_user = 1;
218e99
 }
218e99
 
218e99
diff --git a/hw/isa/i82378.c b/hw/isa/i82378.c
218e99
index cced9af..3c62519 100644
218e99
--- a/hw/isa/i82378.c
218e99
+++ b/hw/isa/i82378.c
218e99
@@ -259,6 +259,7 @@ static void pci_i82378_class_init(ObjectClass *klass, void *data)
218e99
     k->subsystem_vendor_id = 0x0;
218e99
     k->subsystem_id = 0x0;
218e99
     dc->vmsd = &vmstate_pci_i82378;
218e99
+    set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories);
218e99
     dc->props = i82378_properties;
218e99
 }
218e99
 
218e99
diff --git a/hw/isa/lpc_ich9.c b/hw/isa/lpc_ich9.c
218e99
index 667e882..2760dce 100644
218e99
--- a/hw/isa/lpc_ich9.c
218e99
+++ b/hw/isa/lpc_ich9.c
218e99
@@ -599,6 +599,7 @@ static void ich9_lpc_class_init(ObjectClass *klass, void *data)
218e99
     DeviceClass *dc = DEVICE_CLASS(klass);
218e99
     PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
218e99
 
218e99
+    set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories);
218e99
     dc->reset = ich9_lpc_reset;
218e99
     k->init = ich9_lpc_initfn;
218e99
     dc->vmsd = &vmstate_ich9_lpc;
218e99
diff --git a/hw/isa/vt82c686.c b/hw/isa/vt82c686.c
218e99
index 5261927..79057a6 100644
218e99
--- a/hw/isa/vt82c686.c
218e99
+++ b/hw/isa/vt82c686.c
218e99
@@ -279,6 +279,7 @@ static void via_ac97_class_init(ObjectClass *klass, void *data)
218e99
     k->device_id = PCI_DEVICE_ID_VIA_AC97;
218e99
     k->revision = 0x50;
218e99
     k->class_id = PCI_CLASS_MULTIMEDIA_AUDIO;
218e99
+    set_bit(DEVICE_CATEGORY_SOUND, dc->categories);
218e99
     dc->desc = "AC97";
218e99
 }
218e99
 
218e99
@@ -320,6 +321,7 @@ static void via_mc97_class_init(ObjectClass *klass, void *data)
218e99
     k->device_id = PCI_DEVICE_ID_VIA_MC97;
218e99
     k->class_id = PCI_CLASS_COMMUNICATION_OTHER;
218e99
     k->revision = 0x30;
218e99
+    set_bit(DEVICE_CATEGORY_NETWORK, dc->categories);
218e99
     dc->desc = "MC97";
218e99
 }
218e99
 
218e99
@@ -399,6 +401,7 @@ static void via_pm_class_init(ObjectClass *klass, void *data)
218e99
     k->revision = 0x40;
218e99
     dc->desc = "PM";
218e99
     dc->vmsd = &vmstate_acpi;
218e99
+    set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories);
218e99
     dc->props = via_pm_properties;
218e99
 }
218e99
 
218e99
diff --git a/hw/misc/applesmc.c b/hw/misc/applesmc.c
218e99
index 78904a8..69f3cd0 100644
218e99
--- a/hw/misc/applesmc.c
218e99
+++ b/hw/misc/applesmc.c
218e99
@@ -239,6 +239,7 @@ static void qdev_applesmc_class_init(ObjectClass *klass, void *data)
218e99
     ic->init = applesmc_isa_init;
218e99
     dc->reset = qdev_applesmc_isa_reset;
218e99
     dc->props = applesmc_isa_properties;
218e99
+    set_bit(DEVICE_CATEGORY_MISC, dc->categories);
218e99
 }
218e99
 
218e99
 static const TypeInfo applesmc_isa_info = {
218e99
diff --git a/hw/misc/debugexit.c b/hw/misc/debugexit.c
218e99
index 59bed5b..9fd72ec 100644
218e99
--- a/hw/misc/debugexit.c
218e99
+++ b/hw/misc/debugexit.c
218e99
@@ -58,6 +58,7 @@ static void debug_exit_class_initfn(ObjectClass *klass, void *data)
218e99
     ISADeviceClass *ic = ISA_DEVICE_CLASS(klass);
218e99
     ic->init = debug_exit_initfn;
218e99
     dc->props = debug_exit_properties;
218e99
+    set_bit(DEVICE_CATEGORY_MISC, dc->categories);
218e99
 }
218e99
 
218e99
 static const TypeInfo debug_exit_info = {
218e99
diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c
218e99
index 5658f73..5acef7a 100644
218e99
--- a/hw/misc/ivshmem.c
218e99
+++ b/hw/misc/ivshmem.c
218e99
@@ -810,6 +810,7 @@ static void ivshmem_class_init(ObjectClass *klass, void *data)
218e99
     k->class_id = PCI_CLASS_MEMORY_RAM;
218e99
     dc->reset = ivshmem_reset;
218e99
     dc->props = ivshmem_properties;
218e99
+    set_bit(DEVICE_CATEGORY_MISC, dc->categories);
218e99
 }
218e99
 
218e99
 static const TypeInfo ivshmem_info = {
218e99
diff --git a/hw/misc/pc-testdev.c b/hw/misc/pc-testdev.c
218e99
index 32df175..cae8d70 100644
218e99
--- a/hw/misc/pc-testdev.c
218e99
+++ b/hw/misc/pc-testdev.c
218e99
@@ -167,9 +167,11 @@ static int init_test_device(ISADevice *isa)
218e99
 
218e99
 static void testdev_class_init(ObjectClass *klass, void *data)
218e99
 {
218e99
+    DeviceClass *dc = DEVICE_CLASS(klass);
218e99
     ISADeviceClass *k = ISA_DEVICE_CLASS(klass);
218e99
 
218e99
     k->init = init_test_device;
218e99
+    set_bit(DEVICE_CATEGORY_MISC, dc->categories);
218e99
 }
218e99
 
218e99
 static const TypeInfo testdev_info = {
218e99
diff --git a/hw/misc/pci-testdev.c b/hw/misc/pci-testdev.c
218e99
index 71ce5a3..b11bc5f 100644
218e99
--- a/hw/misc/pci-testdev.c
218e99
+++ b/hw/misc/pci-testdev.c
218e99
@@ -307,6 +307,7 @@ static void pci_testdev_class_init(ObjectClass *klass, void *data)
218e99
     k->revision = 0x00;
218e99
     k->class_id = PCI_CLASS_OTHERS;
218e99
     dc->desc = "PCI Test Device";
218e99
+    set_bit(DEVICE_CATEGORY_MISC, dc->categories);
218e99
     dc->reset = qdev_pci_testdev_reset;
218e99
 }
218e99
 
218e99
diff --git a/hw/misc/sga.c b/hw/misc/sga.c
218e99
index c842190..5ea124b 100644
218e99
--- a/hw/misc/sga.c
218e99
+++ b/hw/misc/sga.c
218e99
@@ -49,6 +49,7 @@ static void sga_class_initfn(ObjectClass *klass, void *data)
218e99
     DeviceClass *dc = DEVICE_CLASS(klass);
218e99
     ISADeviceClass *ic = ISA_DEVICE_CLASS(klass);
218e99
     ic->init = sga_initfn;
218e99
+    set_bit(DEVICE_CATEGORY_DISPLAY, dc->categories);
218e99
     dc->desc = "Serial Graphics Adapter";
218e99
 }
218e99
 
218e99
diff --git a/hw/misc/vfio.c b/hw/misc/vfio.c
218e99
index f8fef8c..a966c58 100644
218e99
--- a/hw/misc/vfio.c
218e99
+++ b/hw/misc/vfio.c
218e99
@@ -3309,6 +3309,7 @@ static void vfio_pci_dev_class_init(ObjectClass *klass, void *data)
218e99
     dc->props = vfio_pci_dev_properties;
218e99
     dc->vmsd = &vfio_pci_vmstate;
218e99
     dc->desc = "VFIO-based PCI device assignment";
218e99
+    set_bit(DEVICE_CATEGORY_MISC, dc->categories);
218e99
     pdc->init = vfio_initfn;
218e99
     pdc->exit = vfio_exitfn;
218e99
     pdc->config_read = vfio_pci_read_config;
218e99
diff --git a/hw/net/e1000.c b/hw/net/e1000.c
218e99
index 76df2f3..a813523 100644
218e99
--- a/hw/net/e1000.c
218e99
+++ b/hw/net/e1000.c
218e99
@@ -1393,6 +1393,7 @@ static void e1000_class_init(ObjectClass *klass, void *data)
218e99
     k->device_id = E1000_DEVID;
218e99
     k->revision = 0x03;
218e99
     k->class_id = PCI_CLASS_NETWORK_ETHERNET;
218e99
+    set_bit(DEVICE_CATEGORY_NETWORK, dc->categories);
218e99
     dc->desc = "Intel Gigabit Ethernet";
218e99
     dc->reset = qdev_e1000_reset;
218e99
     dc->vmsd = &vmstate_e1000;
218e99
diff --git a/hw/net/eepro100.c b/hw/net/eepro100.c
218e99
index b69cc60..5190f88 100644
218e99
--- a/hw/net/eepro100.c
218e99
+++ b/hw/net/eepro100.c
218e99
@@ -2083,6 +2083,7 @@ static void eepro100_class_init(ObjectClass *klass, void *data)
218e99
 
218e99
     info = eepro100_get_class_by_name(object_class_get_name(klass));
218e99
 
218e99
+    set_bit(DEVICE_CATEGORY_NETWORK, dc->categories);
218e99
     dc->props = e100_properties;
218e99
     dc->desc = info->desc;
218e99
     k->vendor_id = PCI_VENDOR_ID_INTEL;
218e99
diff --git a/hw/net/lance.c b/hw/net/lance.c
218e99
index 187497c..90641e7 100644
218e99
--- a/hw/net/lance.c
218e99
+++ b/hw/net/lance.c
218e99
@@ -149,6 +149,7 @@ static void lance_class_init(ObjectClass *klass, void *data)
218e99
     SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
218e99
 
218e99
     k->init = lance_init;
218e99
+    set_bit(DEVICE_CATEGORY_NETWORK, dc->categories);
218e99
     dc->fw_name = "ethernet";
218e99
     dc->reset = lance_reset;
218e99
     dc->vmsd = &vmstate_lance;
218e99
diff --git a/hw/net/mipsnet.c b/hw/net/mipsnet.c
218e99
index ac6193a..52cb4ff 100644
218e99
--- a/hw/net/mipsnet.c
218e99
+++ b/hw/net/mipsnet.c
218e99
@@ -263,6 +263,7 @@ static void mipsnet_class_init(ObjectClass *klass, void *data)
218e99
     SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
218e99
 
218e99
     k->init = mipsnet_sysbus_init;
218e99
+    set_bit(DEVICE_CATEGORY_NETWORK, dc->categories);
218e99
     dc->desc = "MIPS Simulator network device";
218e99
     dc->reset = mipsnet_sysbus_reset;
218e99
     dc->vmsd = &vmstate_mipsnet;
218e99
diff --git a/hw/net/ne2000-isa.c b/hw/net/ne2000-isa.c
218e99
index f8e610c..877a6b1 100644
218e99
--- a/hw/net/ne2000-isa.c
218e99
+++ b/hw/net/ne2000-isa.c
218e99
@@ -99,6 +99,7 @@ static void isa_ne2000_class_initfn(ObjectClass *klass, void *data)
218e99
     ISADeviceClass *ic = ISA_DEVICE_CLASS(klass);
218e99
     ic->init = isa_ne2000_initfn;
218e99
     dc->props = ne2000_isa_properties;
218e99
+    set_bit(DEVICE_CATEGORY_NETWORK, dc->categories);
218e99
 }
218e99
 
218e99
 static const TypeInfo ne2000_isa_info = {
218e99
diff --git a/hw/net/ne2000.c b/hw/net/ne2000.c
218e99
index 94d6110..b401cb8 100644
218e99
--- a/hw/net/ne2000.c
218e99
+++ b/hw/net/ne2000.c
218e99
@@ -772,6 +772,7 @@ static void ne2000_class_init(ObjectClass *klass, void *data)
218e99
     k->class_id = PCI_CLASS_NETWORK_ETHERNET;
218e99
     dc->vmsd = &vmstate_pci_ne2000;
218e99
     dc->props = ne2000_properties;
218e99
+    set_bit(DEVICE_CATEGORY_NETWORK, dc->categories);
218e99
 }
218e99
 
218e99
 static const TypeInfo ne2000_info = {
218e99
diff --git a/hw/net/opencores_eth.c b/hw/net/opencores_eth.c
218e99
index be64bf2..7491718 100644
218e99
--- a/hw/net/opencores_eth.c
218e99
+++ b/hw/net/opencores_eth.c
218e99
@@ -713,6 +713,7 @@ static void open_eth_class_init(ObjectClass *klass, void *data)
218e99
     SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
218e99
 
218e99
     k->init = sysbus_open_eth_init;
218e99
+    set_bit(DEVICE_CATEGORY_NETWORK, dc->categories);
218e99
     dc->desc = "Opencores 10/100 Mbit Ethernet";
218e99
     dc->reset = qdev_open_eth_reset;
218e99
     dc->props = open_eth_properties;
218e99
diff --git a/hw/net/pcnet-pci.c b/hw/net/pcnet-pci.c
218e99
index e07f388..befc6ce 100644
218e99
--- a/hw/net/pcnet-pci.c
218e99
+++ b/hw/net/pcnet-pci.c
218e99
@@ -359,6 +359,7 @@ static void pcnet_class_init(ObjectClass *klass, void *data)
218e99
     dc->reset = pci_reset;
218e99
     dc->vmsd = &vmstate_pci_pcnet;
218e99
     dc->props = pcnet_properties;
218e99
+    set_bit(DEVICE_CATEGORY_NETWORK, dc->categories);
218e99
 }
218e99
 
218e99
 static const TypeInfo pcnet_info = {
218e99
diff --git a/hw/net/rtl8139.c b/hw/net/rtl8139.c
218e99
index 1e5a679..8f20ef4 100644
218e99
--- a/hw/net/rtl8139.c
218e99
+++ b/hw/net/rtl8139.c
218e99
@@ -3541,6 +3541,7 @@ static void rtl8139_class_init(ObjectClass *klass, void *data)
218e99
     dc->reset = rtl8139_reset;
218e99
     dc->vmsd = &vmstate_rtl8139;
218e99
     dc->props = rtl8139_properties;
218e99
+    set_bit(DEVICE_CATEGORY_NETWORK, dc->categories);
218e99
 }
218e99
 
218e99
 static const TypeInfo rtl8139_info = {
218e99
diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
218e99
index bed0822..9ebcdfe 100644
218e99
--- a/hw/net/virtio-net.c
218e99
+++ b/hw/net/virtio-net.c
218e99
@@ -1448,6 +1448,7 @@ static void virtio_net_class_init(ObjectClass *klass, void *data)
218e99
     VirtioDeviceClass *vdc = VIRTIO_DEVICE_CLASS(klass);
218e99
     dc->exit = virtio_net_device_exit;
218e99
     dc->props = virtio_net_properties;
218e99
+    set_bit(DEVICE_CATEGORY_NETWORK, dc->categories);
218e99
     vdc->init = virtio_net_device_init;
218e99
     vdc->get_config = virtio_net_get_config;
218e99
     vdc->set_config = virtio_net_set_config;
218e99
diff --git a/hw/net/vmxnet3.c b/hw/net/vmxnet3.c
218e99
index 4c575e5..d43284a 100644
218e99
--- a/hw/net/vmxnet3.c
218e99
+++ b/hw/net/vmxnet3.c
218e99
@@ -2453,6 +2453,7 @@ static void vmxnet3_class_init(ObjectClass *class, void *data)
218e99
     dc->reset = vmxnet3_qdev_reset;
218e99
     dc->vmsd = &vmstate_vmxnet3;
218e99
     dc->props = vmxnet3_properties;
218e99
+    set_bit(DEVICE_CATEGORY_NETWORK, dc->categories);
218e99
 }
218e99
 
218e99
 static const TypeInfo vmxnet3_info = {
218e99
diff --git a/hw/pci-bridge/i82801b11.c b/hw/pci-bridge/i82801b11.c
218e99
index 0841531..21b3225 100644
218e99
--- a/hw/pci-bridge/i82801b11.c
218e99
+++ b/hw/pci-bridge/i82801b11.c
218e99
@@ -81,6 +81,7 @@ err_bridge:
218e99
 static void i82801b11_bridge_class_init(ObjectClass *klass, void *data)
218e99
 {
218e99
     PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
218e99
+    DeviceClass *dc = DEVICE_CLASS(klass);
218e99
 
218e99
     k->is_bridge = 1;
218e99
     k->vendor_id = PCI_VENDOR_ID_INTEL;
218e99
@@ -88,6 +89,7 @@ static void i82801b11_bridge_class_init(ObjectClass *klass, void *data)
218e99
     k->revision = ICH9_D2P_A2_REVISION;
218e99
     k->init = i82801b11_bridge_initfn;
218e99
     k->config_write = pci_bridge_write_config;
218e99
+    set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories);
218e99
 }
218e99
 
218e99
 static const TypeInfo i82801b11_bridge_info = {
218e99
diff --git a/hw/pci-bridge/ioh3420.c b/hw/pci-bridge/ioh3420.c
218e99
index bb541eb..47122c5 100644
218e99
--- a/hw/pci-bridge/ioh3420.c
218e99
+++ b/hw/pci-bridge/ioh3420.c
218e99
@@ -220,6 +220,7 @@ static void ioh3420_class_init(ObjectClass *klass, void *data)
218e99
     k->vendor_id = PCI_VENDOR_ID_INTEL;
218e99
     k->device_id = PCI_DEVICE_ID_IOH_EPORT;
218e99
     k->revision = PCI_DEVICE_ID_IOH_REV;
218e99
+    set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories);
218e99
     dc->desc = "Intel IOH device id 3420 PCIE Root Port";
218e99
     dc->reset = ioh3420_reset;
218e99
     dc->vmsd = &vmstate_ioh3420;
218e99
diff --git a/hw/pci-bridge/pci_bridge_dev.c b/hw/pci-bridge/pci_bridge_dev.c
218e99
index 971b432..43f94fc 100644
218e99
--- a/hw/pci-bridge/pci_bridge_dev.c
218e99
+++ b/hw/pci-bridge/pci_bridge_dev.c
218e99
@@ -141,6 +141,7 @@ static void pci_bridge_dev_class_init(ObjectClass *klass, void *data)
218e99
     dc->reset = qdev_pci_bridge_dev_reset;
218e99
     dc->props = pci_bridge_dev_properties;
218e99
     dc->vmsd = &pci_bridge_dev_vmstate;
218e99
+    set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories);
218e99
 }
218e99
 
218e99
 static const TypeInfo pci_bridge_dev_info = {
218e99
diff --git a/hw/pci-bridge/xio3130_downstream.c b/hw/pci-bridge/xio3130_downstream.c
218e99
index 1810dd2..33eff37 100644
218e99
--- a/hw/pci-bridge/xio3130_downstream.c
218e99
+++ b/hw/pci-bridge/xio3130_downstream.c
218e99
@@ -187,6 +187,7 @@ static void xio3130_downstream_class_init(ObjectClass *klass, void *data)
218e99
     k->vendor_id = PCI_VENDOR_ID_TI;
218e99
     k->device_id = PCI_DEVICE_ID_TI_XIO3130D;
218e99
     k->revision = XIO3130_REVISION;
218e99
+    set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories);
218e99
     dc->desc = "TI X3130 Downstream Port of PCI Express Switch";
218e99
     dc->reset = xio3130_downstream_reset;
218e99
     dc->vmsd = &vmstate_xio3130_downstream;
218e99
diff --git a/hw/pci-bridge/xio3130_upstream.c b/hw/pci-bridge/xio3130_upstream.c
218e99
index 8e0d97a..e9969a9 100644
218e99
--- a/hw/pci-bridge/xio3130_upstream.c
218e99
+++ b/hw/pci-bridge/xio3130_upstream.c
218e99
@@ -161,6 +161,7 @@ static void xio3130_upstream_class_init(ObjectClass *klass, void *data)
218e99
     k->vendor_id = PCI_VENDOR_ID_TI;
218e99
     k->device_id = PCI_DEVICE_ID_TI_XIO3130U;
218e99
     k->revision = XIO3130_REVISION;
218e99
+    set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories);
218e99
     dc->desc = "TI X3130 Upstream Port of PCI Express Switch";
218e99
     dc->reset = xio3130_upstream_reset;
218e99
     dc->vmsd = &vmstate_xio3130_upstream;
218e99
diff --git a/hw/pci-host/apb.c b/hw/pci-host/apb.c
218e99
index e099655..5ac7556 100644
218e99
--- a/hw/pci-host/apb.c
218e99
+++ b/hw/pci-host/apb.c
218e99
@@ -577,6 +577,7 @@ static void pbm_host_class_init(ObjectClass *klass, void *data)
218e99
     SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
218e99
 
218e99
     k->init = pci_pbm_init_device;
218e99
+    set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories);
218e99
     dc->reset = pci_pbm_reset;
218e99
 }
218e99
 
218e99
@@ -599,6 +600,7 @@ static void pbm_pci_bridge_class_init(ObjectClass *klass, void *data)
218e99
     k->revision = 0x11;
218e99
     k->config_write = pci_bridge_write_config;
218e99
     k->is_bridge = 1;
218e99
+    set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories);
218e99
     dc->reset = pci_bridge_reset;
218e99
     dc->vmsd = &vmstate_pci_device;
218e99
 }
218e99
diff --git a/hw/pci-host/ppce500.c b/hw/pci-host/ppce500.c
218e99
index 5e7ad94..0d0a001 100644
218e99
--- a/hw/pci-host/ppce500.c
218e99
+++ b/hw/pci-host/ppce500.c
218e99
@@ -407,6 +407,7 @@ static void e500_pcihost_class_init(ObjectClass *klass, void *data)
218e99
     SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
218e99
 
218e99
     k->init = e500_pcihost_initfn;
218e99
+    set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories);
218e99
     dc->props = pcihost_properties;
218e99
     dc->vmsd = &vmstate_ppce500_pci;
218e99
 }
218e99
diff --git a/hw/pci-host/prep.c b/hw/pci-host/prep.c
218e99
index 6130253..8c4e6eb 100644
218e99
--- a/hw/pci-host/prep.c
218e99
+++ b/hw/pci-host/prep.c
218e99
@@ -210,6 +210,7 @@ static void raven_pcihost_class_init(ObjectClass *klass, void *data)
218e99
 {
218e99
     DeviceClass *dc = DEVICE_CLASS(klass);
218e99
 
218e99
+    set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories);
218e99
     dc->realize = raven_pcihost_realizefn;
218e99
     dc->fw_name = "pci";
218e99
     dc->no_user = 1;
218e99
diff --git a/hw/pci-host/q35.c b/hw/pci-host/q35.c
218e99
index 24df6b5..5f8e7ff 100644
218e99
--- a/hw/pci-host/q35.c
218e99
+++ b/hw/pci-host/q35.c
218e99
@@ -76,6 +76,7 @@ static void q35_host_class_init(ObjectClass *klass, void *data)
218e99
 
218e99
     k->init = q35_host_init;
218e99
     dc->props = mch_props;
218e99
+    set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories);
218e99
     dc->fw_name = "pci";
218e99
 }
218e99
 
218e99
@@ -287,6 +288,7 @@ static void mch_class_init(ObjectClass *klass, void *data)
218e99
     k->init = mch_init;
218e99
     k->config_write = mch_write_config;
218e99
     dc->reset = mch_reset;
218e99
+    set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories);
218e99
     dc->desc = "Host bridge";
218e99
     dc->vmsd = &vmstate_mch;
218e99
     k->vendor_id = PCI_VENDOR_ID_INTEL;
218e99
diff --git a/hw/scsi/esp-pci.c b/hw/scsi/esp-pci.c
218e99
index 029789a..0be165f 100644
218e99
--- a/hw/scsi/esp-pci.c
218e99
+++ b/hw/scsi/esp-pci.c
218e99
@@ -379,6 +379,7 @@ static void esp_pci_class_init(ObjectClass *klass, void *data)
218e99
     k->device_id = PCI_DEVICE_ID_AMD_SCSI;
218e99
     k->revision = 0x10;
218e99
     k->class_id = PCI_CLASS_STORAGE_SCSI;
218e99
+    set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
218e99
     dc->desc = "AMD Am53c974 PCscsi-PCI SCSI adapter";
218e99
     dc->reset = esp_pci_hard_reset;
218e99
     dc->vmsd = &vmstate_esp_pci_scsi;
218e99
@@ -499,6 +500,7 @@ static void dc390_class_init(ObjectClass *klass, void *data)
218e99
     k->init = dc390_scsi_init;
218e99
     k->config_read = dc390_read_config;
218e99
     k->config_write = dc390_write_config;
218e99
+    set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
218e99
     dc->desc = "Tekram DC-390 SCSI adapter";
218e99
 }
218e99
 
218e99
diff --git a/hw/scsi/esp.c b/hw/scsi/esp.c
218e99
index 0c81a50..a1a7279 100644
218e99
--- a/hw/scsi/esp.c
218e99
+++ b/hw/scsi/esp.c
218e99
@@ -710,6 +710,7 @@ static void sysbus_esp_class_init(ObjectClass *klass, void *data)
218e99
     k->init = sysbus_esp_init;
218e99
     dc->reset = sysbus_esp_hard_reset;
218e99
     dc->vmsd = &vmstate_sysbus_esp_scsi;
218e99
+    set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
218e99
 }
218e99
 
218e99
 static const TypeInfo sysbus_esp_info = {
218e99
diff --git a/hw/scsi/lsi53c895a.c b/hw/scsi/lsi53c895a.c
218e99
index 22b8e98..2e322d7 100644
218e99
--- a/hw/scsi/lsi53c895a.c
218e99
+++ b/hw/scsi/lsi53c895a.c
218e99
@@ -2119,6 +2119,7 @@ static void lsi_class_init(ObjectClass *klass, void *data)
218e99
     k->subsystem_id = 0x1000;
218e99
     dc->reset = lsi_scsi_reset;
218e99
     dc->vmsd = &vmstate_lsi_scsi;
218e99
+    set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
218e99
 }
218e99
 
218e99
 static const TypeInfo lsi_info = {
218e99
diff --git a/hw/scsi/megasas.c b/hw/scsi/megasas.c
218e99
index 27288b9..d916a81 100644
218e99
--- a/hw/scsi/megasas.c
218e99
+++ b/hw/scsi/megasas.c
218e99
@@ -2198,6 +2198,7 @@ static void megasas_class_init(ObjectClass *oc, void *data)
218e99
     dc->props = megasas_properties;
218e99
     dc->reset = megasas_scsi_reset;
218e99
     dc->vmsd = &vmstate_megasas;
218e99
+    set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
218e99
     dc->desc = "LSI MegaRAID SAS 1078";
218e99
 }
218e99
 
218e99
diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c
218e99
index 0885d9d..18a0399 100644
218e99
--- a/hw/scsi/scsi-bus.c
218e99
+++ b/hw/scsi/scsi-bus.c
218e99
@@ -1865,6 +1865,7 @@ const VMStateDescription vmstate_scsi_device = {
218e99
 static void scsi_device_class_init(ObjectClass *klass, void *data)
218e99
 {
218e99
     DeviceClass *k = DEVICE_CLASS(klass);
218e99
+    set_bit(DEVICE_CATEGORY_STORAGE, k->categories);
218e99
     k->bus_type = TYPE_SCSI_BUS;
218e99
     k->init     = scsi_qdev_init;
218e99
     k->unplug   = scsi_qdev_unplug;
218e99
diff --git a/hw/scsi/vhost-scsi.c b/hw/scsi/vhost-scsi.c
218e99
index 785e93f..9e770fb 100644
218e99
--- a/hw/scsi/vhost-scsi.c
218e99
+++ b/hw/scsi/vhost-scsi.c
218e99
@@ -267,6 +267,7 @@ static void vhost_scsi_class_init(ObjectClass *klass, void *data)
218e99
     VirtioDeviceClass *vdc = VIRTIO_DEVICE_CLASS(klass);
218e99
     dc->exit = vhost_scsi_exit;
218e99
     dc->props = vhost_scsi_properties;
218e99
+    set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
218e99
     vdc->init = vhost_scsi_init;
218e99
     vdc->get_features = vhost_scsi_get_features;
218e99
     vdc->set_config = vhost_scsi_set_config;
218e99
diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c
218e99
index 4074088..038cd83 100644
218e99
--- a/hw/scsi/virtio-scsi.c
218e99
+++ b/hw/scsi/virtio-scsi.c
218e99
@@ -662,8 +662,10 @@ static Property virtio_scsi_properties[] = {
218e99
 static void virtio_scsi_common_class_init(ObjectClass *klass, void *data)
218e99
 {
218e99
     VirtioDeviceClass *vdc = VIRTIO_DEVICE_CLASS(klass);
218e99
+    DeviceClass *dc = DEVICE_CLASS(klass);
218e99
 
218e99
     vdc->get_config = virtio_scsi_get_config;
218e99
+    set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
218e99
 }
218e99
 
218e99
 static void virtio_scsi_class_init(ObjectClass *klass, void *data)
218e99
@@ -672,6 +674,7 @@ static void virtio_scsi_class_init(ObjectClass *klass, void *data)
218e99
     VirtioDeviceClass *vdc = VIRTIO_DEVICE_CLASS(klass);
218e99
     dc->exit = virtio_scsi_device_exit;
218e99
     dc->props = virtio_scsi_properties;
218e99
+    set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
218e99
     vdc->init = virtio_scsi_device_init;
218e99
     vdc->set_config = virtio_scsi_set_config;
218e99
     vdc->get_features = virtio_scsi_get_features;
218e99
diff --git a/hw/scsi/vmw_pvscsi.c b/hw/scsi/vmw_pvscsi.c
218e99
index 48d12f4..8600a18 100644
218e99
--- a/hw/scsi/vmw_pvscsi.c
218e99
+++ b/hw/scsi/vmw_pvscsi.c
218e99
@@ -1197,6 +1197,7 @@ static void pvscsi_class_init(ObjectClass *klass, void *data)
218e99
     dc->reset = pvscsi_reset;
218e99
     dc->vmsd = &vmstate_pvscsi;
218e99
     dc->props = pvscsi_properties;
218e99
+    set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
218e99
     k->config_write = pvscsi_write_config;
218e99
 }
218e99
 
218e99
diff --git a/hw/usb/ccid-card-emulated.c b/hw/usb/ccid-card-emulated.c
218e99
index deb6d47..aa913df 100644
218e99
--- a/hw/usb/ccid-card-emulated.c
218e99
+++ b/hw/usb/ccid-card-emulated.c
218e99
@@ -592,6 +592,7 @@ static void emulated_class_initfn(ObjectClass *klass, void *data)
218e99
     cc->exitfn = emulated_exitfn;
218e99
     cc->get_atr = emulated_get_atr;
218e99
     cc->apdu_from_guest = emulated_apdu_from_guest;
218e99
+    set_bit(DEVICE_CATEGORY_INPUT, dc->categories);
218e99
     dc->desc = "emulated smartcard";
218e99
     dc->props = emulated_card_properties;
218e99
 }
218e99
diff --git a/hw/usb/ccid-card-passthru.c b/hw/usb/ccid-card-passthru.c
218e99
index 01c7e6f..c1d20c0 100644
218e99
--- a/hw/usb/ccid-card-passthru.c
218e99
+++ b/hw/usb/ccid-card-passthru.c
218e99
@@ -392,6 +392,7 @@ static void passthru_class_initfn(ObjectClass *klass, void *data)
218e99
     cc->exitfn = passthru_exitfn;
218e99
     cc->get_atr = passthru_get_atr;
218e99
     cc->apdu_from_guest = passthru_apdu_from_guest;
218e99
+    set_bit(DEVICE_CATEGORY_INPUT, dc->categories);
218e99
     dc->desc = "passthrough smartcard";
218e99
     dc->vmsd = &passthru_vmstate;
218e99
     dc->props = passthru_card_properties;
218e99
diff --git a/hw/usb/dev-audio.c b/hw/usb/dev-audio.c
218e99
index 04933a9..c5420eb 100644
218e99
--- a/hw/usb/dev-audio.c
218e99
+++ b/hw/usb/dev-audio.c
218e99
@@ -673,6 +673,7 @@ static void usb_audio_class_init(ObjectClass *klass, void *data)
218e99
 
218e99
     dc->vmsd          = &vmstate_usb_audio;
218e99
     dc->props         = usb_audio_properties;
218e99
+    set_bit(DEVICE_CATEGORY_SOUND, dc->categories);
218e99
     k->product_desc   = "QEMU USB Audio Interface";
218e99
     k->usb_desc       = &desc_audio;
218e99
     k->init           = usb_audio_initfn;
218e99
diff --git a/hw/usb/dev-bluetooth.c b/hw/usb/dev-bluetooth.c
218e99
index 786e30e..7f292b1 100644
218e99
--- a/hw/usb/dev-bluetooth.c
218e99
+++ b/hw/usb/dev-bluetooth.c
218e99
@@ -560,6 +560,7 @@ static void usb_bt_class_initfn(ObjectClass *klass, void *data)
218e99
     uc->handle_data    = usb_bt_handle_data;
218e99
     uc->handle_destroy = usb_bt_handle_destroy;
218e99
     dc->vmsd = &vmstate_usb_bt;
218e99
+    set_bit(DEVICE_CATEGORY_NETWORK, dc->categories);
218e99
 }
218e99
 
218e99
 static const TypeInfo bt_info = {
218e99
diff --git a/hw/usb/dev-hid.c b/hw/usb/dev-hid.c
218e99
index 31f3cde..66c6331 100644
218e99
--- a/hw/usb/dev-hid.c
218e99
+++ b/hw/usb/dev-hid.c
218e99
@@ -658,6 +658,7 @@ static void usb_tablet_class_initfn(ObjectClass *klass, void *data)
218e99
     uc->product_desc   = "QEMU USB Tablet";
218e99
     dc->vmsd = &vmstate_usb_ptr;
218e99
     dc->props = usb_tablet_properties;
218e99
+    set_bit(DEVICE_CATEGORY_MISC, dc->categories);
218e99
 }
218e99
 
218e99
 static const TypeInfo usb_tablet_info = {
218e99
@@ -677,6 +678,7 @@ static void usb_mouse_class_initfn(ObjectClass *klass, void *data)
218e99
     uc->product_desc   = "QEMU USB Mouse";
218e99
     uc->usb_desc       = &desc_mouse;
218e99
     dc->vmsd = &vmstate_usb_ptr;
218e99
+    set_bit(DEVICE_CATEGORY_INPUT, dc->categories);
218e99
 }
218e99
 
218e99
 static const TypeInfo usb_mouse_info = {
218e99
@@ -696,6 +698,7 @@ static void usb_keyboard_class_initfn(ObjectClass *klass, void *data)
218e99
     uc->product_desc   = "QEMU USB Keyboard";
218e99
     uc->usb_desc       = &desc_keyboard;
218e99
     dc->vmsd = &vmstate_usb_kbd;
218e99
+    set_bit(DEVICE_CATEGORY_INPUT, dc->categories);
218e99
 }
218e99
 
218e99
 static const TypeInfo usb_keyboard_info = {
218e99
diff --git a/hw/usb/dev-hub.c b/hw/usb/dev-hub.c
218e99
index a5f092b..4188a3c 100644
218e99
--- a/hw/usb/dev-hub.c
218e99
+++ b/hw/usb/dev-hub.c
218e99
@@ -570,6 +570,7 @@ static void usb_hub_class_initfn(ObjectClass *klass, void *data)
218e99
     uc->handle_control = usb_hub_handle_control;
218e99
     uc->handle_data    = usb_hub_handle_data;
218e99
     uc->handle_destroy = usb_hub_handle_destroy;
218e99
+    set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories);
218e99
     dc->fw_name = "hub";
218e99
     dc->vmsd = &vmstate_usb_hub;
218e99
 }
218e99
diff --git a/hw/usb/dev-network.c b/hw/usb/dev-network.c
218e99
index 5473ac2..660d774 100644
218e99
--- a/hw/usb/dev-network.c
218e99
+++ b/hw/usb/dev-network.c
218e99
@@ -1429,6 +1429,7 @@ static void usb_net_class_initfn(ObjectClass *klass, void *data)
218e99
     uc->handle_control = usb_net_handle_control;
218e99
     uc->handle_data    = usb_net_handle_data;
218e99
     uc->handle_destroy = usb_net_handle_destroy;
218e99
+    set_bit(DEVICE_CATEGORY_NETWORK, dc->categories);
218e99
     dc->fw_name = "network";
218e99
     dc->vmsd = &vmstate_usb_net;
218e99
     dc->props = net_properties;
218e99
diff --git a/hw/usb/dev-serial.c b/hw/usb/dev-serial.c
218e99
index 2fc8a3b..0b150d4 100644
218e99
--- a/hw/usb/dev-serial.c
218e99
+++ b/hw/usb/dev-serial.c
218e99
@@ -590,6 +590,7 @@ static void usb_serial_class_initfn(ObjectClass *klass, void *data)
218e99
     uc->handle_data    = usb_serial_handle_data;
218e99
     dc->vmsd = &vmstate_usb_serial;
218e99
     dc->props = serial_properties;
218e99
+    set_bit(DEVICE_CATEGORY_INPUT, dc->categories);
218e99
 }
218e99
 
218e99
 static const TypeInfo serial_info = {
218e99
@@ -617,6 +618,7 @@ static void usb_braille_class_initfn(ObjectClass *klass, void *data)
218e99
     uc->handle_data    = usb_serial_handle_data;
218e99
     dc->vmsd = &vmstate_usb_serial;
218e99
     dc->props = braille_properties;
218e99
+    set_bit(DEVICE_CATEGORY_INPUT, dc->categories);
218e99
 }
218e99
 
218e99
 static const TypeInfo braille_info = {
218e99
diff --git a/hw/usb/dev-smartcard-reader.c b/hw/usb/dev-smartcard-reader.c
218e99
index 125cc2c..c1acf70 100644
218e99
--- a/hw/usb/dev-smartcard-reader.c
218e99
+++ b/hw/usb/dev-smartcard-reader.c
218e99
@@ -1449,6 +1449,7 @@ static void ccid_class_initfn(ObjectClass *klass, void *data)
218e99
     dc->desc = "CCID Rev 1.1 smartcard reader";
218e99
     dc->vmsd = &ccid_vmstate;
218e99
     dc->props = ccid_properties;
218e99
+    set_bit(DEVICE_CATEGORY_INPUT, dc->categories);
218e99
 }
218e99
 
218e99
 static const TypeInfo ccid_info = {
218e99
diff --git a/hw/usb/dev-storage.c b/hw/usb/dev-storage.c
218e99
index fe914ab..44a0e34 100644
218e99
--- a/hw/usb/dev-storage.c
218e99
+++ b/hw/usb/dev-storage.c
218e99
@@ -744,6 +744,7 @@ static void usb_msd_class_initfn_common(ObjectClass *klass)
218e99
     uc->handle_reset   = usb_msd_handle_reset;
218e99
     uc->handle_control = usb_msd_handle_control;
218e99
     uc->handle_data    = usb_msd_handle_data;
218e99
+    set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
218e99
     dc->fw_name = "storage";
218e99
     dc->vmsd = &vmstate_usb_msd;
218e99
 }
218e99
diff --git a/hw/usb/dev-uas.c b/hw/usb/dev-uas.c
218e99
index 6efab62..63ad12e 100644
218e99
--- a/hw/usb/dev-uas.c
218e99
+++ b/hw/usb/dev-uas.c
218e99
@@ -916,6 +916,7 @@ static void usb_uas_class_initfn(ObjectClass *klass, void *data)
218e99
     uc->handle_control = usb_uas_handle_control;
218e99
     uc->handle_data    = usb_uas_handle_data;
218e99
     uc->handle_destroy = usb_uas_handle_destroy;
218e99
+    set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
218e99
     dc->fw_name = "storage";
218e99
     dc->vmsd = &vmstate_usb_uas;
218e99
 }
218e99
diff --git a/hw/usb/dev-wacom.c b/hw/usb/dev-wacom.c
218e99
index 3be5cde..1b09235 100644
218e99
--- a/hw/usb/dev-wacom.c
218e99
+++ b/hw/usb/dev-wacom.c
218e99
@@ -362,6 +362,7 @@ static void usb_wacom_class_init(ObjectClass *klass, void *data)
218e99
     uc->handle_control = usb_wacom_handle_control;
218e99
     uc->handle_data    = usb_wacom_handle_data;
218e99
     uc->handle_destroy = usb_wacom_handle_destroy;
218e99
+    set_bit(DEVICE_CATEGORY_INPUT, dc->categories);
218e99
     dc->desc = "QEMU PenPartner Tablet";
218e99
     dc->vmsd = &vmstate_usb_wacom;
218e99
 }
218e99
diff --git a/hw/usb/hcd-ehci-pci.c b/hw/usb/hcd-ehci-pci.c
218e99
index 0eb7826..2f9aa0e 100644
218e99
--- a/hw/usb/hcd-ehci-pci.c
218e99
+++ b/hw/usb/hcd-ehci-pci.c
218e99
@@ -129,11 +129,13 @@ static const TypeInfo ehci_pci_type_info = {
218e99
 static void ehci_data_class_init(ObjectClass *klass, void *data)
218e99
 {
218e99
     PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
218e99
+    DeviceClass *dc = DEVICE_CLASS(klass);
218e99
     EHCIPCIInfo *i = data;
218e99
 
218e99
     k->vendor_id = i->vendor_id;
218e99
     k->device_id = i->device_id;
218e99
     k->revision = i->revision;
218e99
+    set_bit(DEVICE_CATEGORY_USB, dc->categories);
218e99
 }
218e99
 
218e99
 static struct EHCIPCIInfo ehci_pci_info[] = {
218e99
diff --git a/hw/usb/hcd-ehci-sysbus.c b/hw/usb/hcd-ehci-sysbus.c
218e99
index b68a66a..b0b25d4 100644
218e99
--- a/hw/usb/hcd-ehci-sysbus.c
218e99
+++ b/hw/usb/hcd-ehci-sysbus.c
218e99
@@ -56,6 +56,7 @@ static void ehci_sysbus_class_init(ObjectClass *klass, void *data)
218e99
     k->init = usb_ehci_sysbus_initfn;
218e99
     dc->vmsd = &vmstate_ehci_sysbus;
218e99
     dc->props = ehci_sysbus_properties;
218e99
+    set_bit(DEVICE_CATEGORY_USB, dc->categories);
218e99
 }
218e99
 
218e99
 static const TypeInfo ehci_type_info = {
218e99
@@ -70,7 +71,9 @@ static const TypeInfo ehci_type_info = {
218e99
 static void ehci_xlnx_class_init(ObjectClass *oc, void *data)
218e99
 {
218e99
     SysBusEHCIClass *sec = SYS_BUS_EHCI_CLASS(oc);
218e99
+    DeviceClass *dc = DEVICE_CLASS(oc);
218e99
 
218e99
+    set_bit(DEVICE_CATEGORY_USB, dc->categories);
218e99
     sec->capsbase = 0x100;
218e99
     sec->opregbase = 0x140;
218e99
 }
218e99
@@ -84,9 +87,11 @@ static const TypeInfo ehci_xlnx_type_info = {
218e99
 static void ehci_exynos4210_class_init(ObjectClass *oc, void *data)
218e99
 {
218e99
     SysBusEHCIClass *sec = SYS_BUS_EHCI_CLASS(oc);
218e99
+    DeviceClass *dc = DEVICE_CLASS(oc);
218e99
 
218e99
     sec->capsbase = 0x0;
218e99
     sec->opregbase = 0x10;
218e99
+    set_bit(DEVICE_CATEGORY_USB, dc->categories);
218e99
 }
218e99
 
218e99
 static const TypeInfo ehci_exynos4210_type_info = {
218e99
diff --git a/hw/usb/hcd-ohci.c b/hw/usb/hcd-ohci.c
218e99
index 51241cd..c8d1420 100644
218e99
--- a/hw/usb/hcd-ohci.c
218e99
+++ b/hw/usb/hcd-ohci.c
218e99
@@ -1906,6 +1906,7 @@ static void ohci_pci_class_init(ObjectClass *klass, void *data)
218e99
     k->device_id = PCI_DEVICE_ID_APPLE_IPID_USB;
218e99
     k->class_id = PCI_CLASS_SERIAL_USB;
218e99
     k->no_hotplug = 1;
218e99
+    set_bit(DEVICE_CATEGORY_USB, dc->categories);
218e99
     dc->desc = "Apple USB Controller";
218e99
     dc->props = ohci_pci_properties;
218e99
 }
218e99
@@ -1929,6 +1930,7 @@ static void ohci_sysbus_class_init(ObjectClass *klass, void *data)
218e99
     SysBusDeviceClass *sbc = SYS_BUS_DEVICE_CLASS(klass);
218e99
 
218e99
     sbc->init = ohci_init_pxa;
218e99
+    set_bit(DEVICE_CATEGORY_USB, dc->categories);
218e99
     dc->desc = "OHCI USB Controller";
218e99
     dc->props = ohci_sysbus_properties;
218e99
 }
218e99
diff --git a/hw/usb/hcd-uhci.c b/hw/usb/hcd-uhci.c
218e99
index c85b203..4fc3410 100644
218e99
--- a/hw/usb/hcd-uhci.c
218e99
+++ b/hw/usb/hcd-uhci.c
218e99
@@ -1313,6 +1313,7 @@ static void uhci_class_init(ObjectClass *klass, void *data)
218e99
     k->no_hotplug = 1;
218e99
     dc->vmsd = &vmstate_uhci;
218e99
     dc->props = uhci_properties;
218e99
+    set_bit(DEVICE_CATEGORY_USB, dc->categories);
218e99
     u->info = *info;
218e99
 }
218e99
 
218e99
diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c
218e99
index 0061cbe..9d7315f 100644
218e99
--- a/hw/usb/hcd-xhci.c
218e99
+++ b/hw/usb/hcd-xhci.c
218e99
@@ -3611,6 +3611,7 @@ static void xhci_class_init(ObjectClass *klass, void *data)
218e99
     dc->vmsd    = &vmstate_xhci;
218e99
     dc->props   = xhci_properties;
218e99
     dc->reset   = xhci_reset;
218e99
+    set_bit(DEVICE_CATEGORY_USB, dc->categories);
218e99
     k->init         = usb_xhci_initfn;
218e99
     k->vendor_id    = PCI_VENDOR_ID_NEC;
218e99
     k->device_id    = PCI_DEVICE_ID_NEC_UPD720200;
218e99
diff --git a/hw/usb/host-libusb.c b/hw/usb/host-libusb.c
218e99
index e2f3cc8..f660770 100644
218e99
--- a/hw/usb/host-libusb.c
218e99
+++ b/hw/usb/host-libusb.c
218e99
@@ -1351,6 +1351,7 @@ static void usb_host_class_initfn(ObjectClass *klass, void *data)
218e99
     uc->flush_ep_queue = usb_host_flush_ep_queue;
218e99
     dc->vmsd = &vmstate_usb_host;
218e99
     dc->props = usb_host_dev_properties;
218e99
+    set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories);
218e99
 }
218e99
 
218e99
 static TypeInfo usb_host_dev_info = {
218e99
diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c
218e99
index a594e95..8b8c010 100644
218e99
--- a/hw/usb/redirect.c
218e99
+++ b/hw/usb/redirect.c
218e99
@@ -2362,6 +2362,7 @@ static void usbredir_class_initfn(ObjectClass *klass, void *data)
218e99
     uc->ep_stopped     = usbredir_ep_stopped;
218e99
     dc->vmsd           = &usbredir_vmstate;
218e99
     dc->props          = usbredir_properties;
218e99
+    set_bit(DEVICE_CATEGORY_MISC, dc->categories);
218e99
 }
218e99
 
218e99
 static const TypeInfo usbredir_dev_info = {
218e99
diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c
218e99
index d669756..85661f6 100644
218e99
--- a/hw/virtio/virtio-balloon.c
218e99
+++ b/hw/virtio/virtio-balloon.c
218e99
@@ -391,6 +391,7 @@ static void virtio_balloon_class_init(ObjectClass *klass, void *data)
218e99
     VirtioDeviceClass *vdc = VIRTIO_DEVICE_CLASS(klass);
218e99
     dc->exit = virtio_balloon_device_exit;
218e99
     dc->props = virtio_balloon_properties;
218e99
+    set_bit(DEVICE_CATEGORY_MISC, dc->categories);
218e99
     vdc->init = virtio_balloon_device_init;
218e99
     vdc->get_config = virtio_balloon_get_config;
218e99
     vdc->set_config = virtio_balloon_set_config;
218e99
diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c
218e99
index d82f6ff..ba8848f 100644
218e99
--- a/hw/virtio/virtio-pci.c
218e99
+++ b/hw/virtio/virtio-pci.c
218e99
@@ -917,6 +917,7 @@ static void virtio_9p_pci_class_init(ObjectClass *klass, void *data)
218e99
     pcidev_k->device_id = PCI_DEVICE_ID_VIRTIO_9P;
218e99
     pcidev_k->revision = VIRTIO_PCI_ABI_VERSION;
218e99
     pcidev_k->class_id = 0x2;
218e99
+    set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
218e99
     dc->props = virtio_9p_pci_properties;
218e99
 }
218e99
 
218e99
@@ -1071,6 +1072,7 @@ static void virtio_blk_pci_class_init(ObjectClass *klass, void *data)
218e99
     VirtioPCIClass *k = VIRTIO_PCI_CLASS(klass);
218e99
     PCIDeviceClass *pcidev_k = PCI_DEVICE_CLASS(klass);
218e99
 
218e99
+    set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
218e99
     dc->props = virtio_blk_pci_properties;
218e99
     k->init = virtio_blk_pci_init;
218e99
     pcidev_k->vendor_id = PCI_VENDOR_ID_REDHAT_QUMRANET;
218e99
@@ -1141,6 +1143,7 @@ static void virtio_scsi_pci_class_init(ObjectClass *klass, void *data)
218e99
     VirtioPCIClass *k = VIRTIO_PCI_CLASS(klass);
218e99
     PCIDeviceClass *pcidev_k = PCI_DEVICE_CLASS(klass);
218e99
     k->init = virtio_scsi_pci_init_pci;
218e99
+    set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
218e99
     dc->props = virtio_scsi_pci_properties;
218e99
     pcidev_k->vendor_id = PCI_VENDOR_ID_REDHAT_QUMRANET;
218e99
     pcidev_k->device_id = PCI_DEVICE_ID_VIRTIO_SCSI;
218e99
@@ -1197,6 +1200,7 @@ static void vhost_scsi_pci_class_init(ObjectClass *klass, void *data)
218e99
     VirtioPCIClass *k = VIRTIO_PCI_CLASS(klass);
218e99
     PCIDeviceClass *pcidev_k = PCI_DEVICE_CLASS(klass);
218e99
     k->init = vhost_scsi_pci_init_pci;
218e99
+    set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
218e99
     dc->props = vhost_scsi_pci_properties;
218e99
     pcidev_k->vendor_id = PCI_VENDOR_ID_REDHAT_QUMRANET;
218e99
     pcidev_k->device_id = PCI_DEVICE_ID_VIRTIO_SCSI;
218e99
@@ -1277,6 +1281,7 @@ static void virtio_balloon_pci_class_init(ObjectClass *klass, void *data)
218e99
     VirtioPCIClass *k = VIRTIO_PCI_CLASS(klass);
218e99
     PCIDeviceClass *pcidev_k = PCI_DEVICE_CLASS(klass);
218e99
     k->init = virtio_balloon_pci_init;
218e99
+    set_bit(DEVICE_CATEGORY_MISC, dc->categories);
218e99
     dc->props = virtio_balloon_pci_properties;
218e99
     pcidev_k->vendor_id = PCI_VENDOR_ID_REDHAT_QUMRANET;
218e99
     pcidev_k->device_id = PCI_DEVICE_ID_VIRTIO_BALLOON;
218e99
@@ -1362,6 +1367,7 @@ static void virtio_serial_pci_class_init(ObjectClass *klass, void *data)
218e99
     VirtioPCIClass *k = VIRTIO_PCI_CLASS(klass);
218e99
     PCIDeviceClass *pcidev_k = PCI_DEVICE_CLASS(klass);
218e99
     k->init = virtio_serial_pci_init;
218e99
+    set_bit(DEVICE_CATEGORY_INPUT, dc->categories);
218e99
     dc->props = virtio_serial_pci_properties;
218e99
     pcidev_k->vendor_id = PCI_VENDOR_ID_REDHAT_QUMRANET;
218e99
     pcidev_k->device_id = PCI_DEVICE_ID_VIRTIO_CONSOLE;
218e99
@@ -1423,6 +1429,7 @@ static void virtio_net_pci_class_init(ObjectClass *klass, void *data)
218e99
     k->device_id = PCI_DEVICE_ID_VIRTIO_NET;
218e99
     k->revision = VIRTIO_PCI_ABI_VERSION;
218e99
     k->class_id = PCI_CLASS_NETWORK_ETHERNET;
218e99
+    set_bit(DEVICE_CATEGORY_NETWORK, dc->categories);
218e99
     dc->props = virtio_net_properties;
218e99
     vpciklass->init = virtio_net_pci_init;
218e99
 }
218e99
@@ -1474,6 +1481,7 @@ static void virtio_rng_pci_class_init(ObjectClass *klass, void *data)
218e99
     PCIDeviceClass *pcidev_k = PCI_DEVICE_CLASS(klass);
218e99
 
218e99
     k->init = virtio_rng_pci_init;
218e99
+    set_bit(DEVICE_CATEGORY_MISC, dc->categories);
218e99
     dc->props = virtio_rng_pci_properties;
218e99
 
218e99
     pcidev_k->vendor_id = PCI_VENDOR_ID_REDHAT_QUMRANET;
218e99
diff --git a/hw/virtio/virtio-rng.c b/hw/virtio/virtio-rng.c
218e99
index cb787c7..bac8421 100644
218e99
--- a/hw/virtio/virtio-rng.c
218e99
+++ b/hw/virtio/virtio-rng.c
218e99
@@ -207,6 +207,7 @@ static void virtio_rng_class_init(ObjectClass *klass, void *data)
218e99
     VirtioDeviceClass *vdc = VIRTIO_DEVICE_CLASS(klass);
218e99
     dc->exit = virtio_rng_device_exit;
218e99
     dc->props = virtio_rng_properties;
218e99
+    set_bit(DEVICE_CATEGORY_MISC, dc->categories);
218e99
     vdc->init = virtio_rng_device_init;
218e99
     vdc->get_features = get_features;
218e99
 }
218e99
diff --git a/hw/watchdog/wdt_i6300esb.c b/hw/watchdog/wdt_i6300esb.c
218e99
index 05af0b1..a2ace52 100644
218e99
--- a/hw/watchdog/wdt_i6300esb.c
218e99
+++ b/hw/watchdog/wdt_i6300esb.c
218e99
@@ -450,6 +450,7 @@ static void i6300esb_class_init(ObjectClass *klass, void *data)
218e99
     k->class_id = PCI_CLASS_SYSTEM_OTHER;
218e99
     dc->reset = i6300esb_reset;
218e99
     dc->vmsd = &vmstate_i6300esb;
218e99
+    set_bit(DEVICE_CATEGORY_MISC, dc->categories);
218e99
 }
218e99
 
218e99
 static const TypeInfo i6300esb_info = {
218e99
diff --git a/hw/watchdog/wdt_ib700.c b/hw/watchdog/wdt_ib700.c
218e99
index 6b8e33a..ac88cec 100644
218e99
--- a/hw/watchdog/wdt_ib700.c
218e99
+++ b/hw/watchdog/wdt_ib700.c
218e99
@@ -131,6 +131,7 @@ static void wdt_ib700_class_init(ObjectClass *klass, void *data)
218e99
     ic->init = wdt_ib700_init;
218e99
     dc->reset = wdt_ib700_reset;
218e99
     dc->vmsd = &vmstate_ib700;
218e99
+    set_bit(DEVICE_CATEGORY_MISC, dc->categories);
218e99
 }
218e99
 
218e99
 static const TypeInfo wdt_ib700_info = {
218e99
diff --git a/hw/xen/xen_platform.c b/hw/xen/xen_platform.c
218e99
index b6c6793..bb9d0cd 100644
218e99
--- a/hw/xen/xen_platform.c
218e99
+++ b/hw/xen/xen_platform.c
218e99
@@ -414,6 +414,7 @@ static void xen_platform_class_init(ObjectClass *klass, void *data)
218e99
     k->subsystem_vendor_id = PCI_VENDOR_ID_XEN;
218e99
     k->subsystem_id = PCI_DEVICE_ID_XEN_PLATFORM;
218e99
     k->revision = 1;
218e99
+    set_bit(DEVICE_CATEGORY_MISC, dc->categories);
218e99
     dc->desc = "XEN platform pci device";
218e99
     dc->reset = platform_reset;
218e99
     dc->vmsd = &vmstate_xen_platform;
218e99
diff --git a/hw/xen/xen_pt.c b/hw/xen/xen_pt.c
218e99
index c199818..8ba577c 100644
218e99
--- a/hw/xen/xen_pt.c
218e99
+++ b/hw/xen/xen_pt.c
218e99
@@ -825,6 +825,7 @@ static void xen_pci_passthrough_class_init(ObjectClass *klass, void *data)
218e99
     k->exit = xen_pt_unregister_device;
218e99
     k->config_read = xen_pt_pci_read_config;
218e99
     k->config_write = xen_pt_pci_write_config;
218e99
+    set_bit(DEVICE_CATEGORY_MISC, dc->categories);
218e99
     dc->desc = "Assign an host PCI device with Xen";
218e99
     dc->props = xen_pci_passthrough_properties;
218e99
 };
218e99
-- 
218e99
1.7.1
218e99