From KVM

qdev Status

qdev is a QEMU-internal API for device configuration and creation. It's the machinery that makes -device and device_add / device_del possible. Devices are being converted to qdev, and qdev evolves along with that. This page tracks how far we got, and what's still left to do.

Host/guest split

  • Drives done
    • Host side: -drive if=none,id=<name>,<parameters>
    • Guest side: -device virtio-blk-pci,drive=<name>
  • Character devices done
    • Host side: -chardev pty,id=<name>
    • Guest side: -device isa-serial,chardev=<name>
  • NICs done
    • Host side: -netdev type=tap,id=<name>,fd=<tapfd>
    • Guest side: -device virtio-net-pci,netdev=<name>
    • Note that -netdev doesn't support VLANs

PC driver conversion status

  • PIC, APIC, CPUs, memory not converted
  • i440FX/PIIX3 done (host bridge, ISA bridge, USB, IDE) except for ACPI (PIIX3 function 3)
  • ISA FDC, PS/2 keyboard & mouse, RTC, serial, parallel done
  • VGA done (all variants, ISA & PCI), but doesn't work, because it needs to be initialized before i440fx_init_memory_mappings() runs.
  • NICs done, but see "default optional devices" below
  • Audio done, except for a few rarely used ISA devices
  • Virtio done, except virtio-console still needs chardev hooked up (Amit's working on it as part of vmchannel)
  • SCSI done
  • USB HID (tablet, mouse, keyboard), storage, hub, host (pass-through), serial, braille done
  • USB net patch posted
  • USB bt (Bluetooth) not converted
  • No way to ensure stable USB addresses
  • IDE disks done, but see "default optional devices" below
  • Watchdogs done
  • Bluetooth not converted
  • Option ROMs done

Default optional devices

QEMU creates a bunch of optional devices (NIC, CD-ROM, VGA, ...). They get automatically suppressed when you specify your own with -device & friends. Except NIC and CD-ROM (ide.1/master) don't. Work-around: suppress all optional devices with -nodefaults.

Configuration file

qdev options (and many others) can be read from a configuration file. -FOO VAR="VAL" becomes

   [FOO]
   VAR = "VAL"

Option -readconfig FILE reads configuration from FILE, and -writeconfig FILE writes the current configuration to FILE. Needs more testing.

Hot plug

device_add / device_del are on par with -device: Any device you can create with -device you can hot-plug with device_add / device_del. As long as it's hot-pluggable, of course.

drive_add is on par with -drive. May still need drive_del.

Still need equivalents to -chardev and future -netdev (what drive_add is to -drive).

Nice to have, perhaps: info config like -writeconfig.

Resources

Gerd's git tree