Red Hat Bugzilla – Bug 871839
qemu-kvm: assertion failed in vmstate_register_with_alias_id()
Last modified: 2013-04-05 06:49:31 EDT
Created attachment 636143 [details]
qemu-kvm died when launched with following cmdline:
# qemu-kvm -M pc -enable-kvm -m 768 -boot c -hda /dev/sdb -smp 2 -sdl -net none \
-device usb-ehci,id=ehci \
-device usb-host,bus=usb.0,hostbus=1,hostport=3 \
*** EHCI support is under development ***
qemu-kvm: savevm.c:1300: vmstate_register_with_alias_id: Assertion `!se->compat || se->instance_id == 0' failed.
I'm trying to pass USB device by physical port as described here:
The crash is absent if qemu is launched without usb.0 device. However, the target isn't reached too--passed device is absent in guest with no errors except ehci development state warning.
Hmm, I think that example from the docs is wrong. -device usb-ehci doesn't appear to set up usb.0 bus, just ehci.0. Granted that assertion is ugly, but upstream qemu.git has a nicer error:
qemu-system-x86_64: -device usb-host,bus=usb.0,hostbus=1,hostport=3: Bus 'usb.0' not found
Gerd, what's missing here?
Indeed, the default usb bus name was changed from 'usb.0' to 'usb-bus.0' at some point, and the docs where not updated accordingly. I'll send a patch upstream to update the docs.
While the assertion isn't exactly friendly, it isn't a big deal for F17, so just closing as UPSTREAM where the docs will soon be fixed.
Just in case, I replaced 'usb.0' to 'usb-bus.0' and now qemu launches fine, but the passed device still isn't passed to guest. Just two root hubs (1.1 and 2.0) are present there.
qemu-kvm -M pc -enable-kvm -m 768 -boot d -cdrom /mnt/sw/pmagic.iso -smp 2 -sdl -net none \
-device usb-ehci,id=ehci \
-device usb-host,bus=usb-bus.0,hostbus=1,hostport=2 \
T: Bus=02 Lev=02 Prnt=02 Port=02 Cnt=02 Dev#= 17 Spd=480 MxCh= 0
D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1
P: Vendor=8564 ProdID=1000 Rev= 1.00
S: Product=Mass Storage Device
C:* #Ifs= 1 Cfg#= 1 Atr=80 MxPwr=100mA
I:* If#= 0 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=usb-storage
E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E: Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
Topology as shown by usbview:
EHCI host controller -> high-speed hub -> device
$ lspci -nn | grep USB
00:1a.0 USB controller [0c03]: Intel Corporation 6 Series/C200 Series Chipset Family USB Enhanced Host Controller #2 [8086:1c2d] (rev 04)
00:1d.0 USB controller [0c03]: Intel Corporation 6 Series/C200 Series Chipset Family USB Enhanced Host Controller #1 [8086:1c26] (rev 04)
hostport=2 is probably the hub not the device. What does 'info usbhost' (qemu monitor) print? Or 'lsusb -t' on the host?
(In reply to comment #5)
Thanks for the hint! I've tried to specify the hub previously (like hostport=1.2), but haven't succeeded. Now seems like the problem was the wrong port number: I used hostport=2 ('Port=02' from /sys/kernel/debug/usb/devices) but 'lsusb -t' shows number 3 for the same device ('Port 3: Dev 14, If 0, Class=Mass Storage, Driver=usbfs, 480M').
Summarizing, device appeared in the guest with 'hostport=1.3'.
Both the topology and port numbering points are good things to mention in the doc too, as for me.