diff options
author | Gerd Hoffmann <kraxel@redhat.com> | 2010-12-10 14:20:46 +0100 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2011-01-24 17:21:34 +0100 |
commit | c1ecb40a6124b80f1e346e38a1975e82da6507ca (patch) | |
tree | 78c5bab3c9793daaeb67809c976224b4485a2826 /hw/hw.h | |
parent | 9892088b52da05c3944e84982922fa984e048044 (diff) |
usb core: add migration support
Yes, seriously. There is no migration support at all for usb devices.
They loose state, especially the device address, and stop responding
because of that. Oops.
Luckily there is so much broken usb hardware out there that the guest
usually just kicks the device hard (via port reset and
reinitialization), then continues without a hitch. So we got away with
that in a surprising high number of cases.
The arrival of remote wakeup (which enables autosuspend support) changes
that picture though. The usb devices also forget that it they are
supposed to wakeup, so they don't do that. The host also doesn't notice
the device stopped working in case it suspended the device and thus
expects it waking up instead of polling it. Result is that your mouse
is dead.
Lets start fixing that. Add a vmstate struct for USBDevice.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'hw/hw.h')
-rw-r--r-- | hw/hw.h | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -587,6 +587,16 @@ extern const VMStateDescription vmstate_i2c_slave; .offset = vmstate_offset_value(_state, _field, i2c_slave), \ } +extern const VMStateDescription vmstate_usb_device; + +#define VMSTATE_USB_DEVICE(_field, _state) { \ + .name = (stringify(_field)), \ + .size = sizeof(USBDevice), \ + .vmsd = &vmstate_usb_device, \ + .flags = VMS_STRUCT, \ + .offset = vmstate_offset_value(_state, _field, USBDevice), \ +} + #define vmstate_offset_macaddr(_state, _field) \ vmstate_offset_array(_state, _field.a, uint8_t, \ sizeof(typeof_field(_state, _field))) |