mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 07:43:54 -06:00
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>
This commit is contained in:
parent
9892088b52
commit
c1ecb40a61
3 changed files with 31 additions and 5 deletions
16
hw/usb-bus.c
16
hw/usb-bus.c
|
@ -23,6 +23,22 @@ static struct BusInfo usb_bus_info = {
|
|||
static int next_usb_bus = 0;
|
||||
static QTAILQ_HEAD(, USBBus) busses = QTAILQ_HEAD_INITIALIZER(busses);
|
||||
|
||||
const VMStateDescription vmstate_usb_device = {
|
||||
.name = "USBDevice",
|
||||
.version_id = 1,
|
||||
.minimum_version_id = 1,
|
||||
.fields = (VMStateField []) {
|
||||
VMSTATE_UINT8(addr, USBDevice),
|
||||
VMSTATE_INT32(state, USBDevice),
|
||||
VMSTATE_INT32(remote_wakeup, USBDevice),
|
||||
VMSTATE_INT32(setup_state, USBDevice),
|
||||
VMSTATE_INT32(setup_len, USBDevice),
|
||||
VMSTATE_INT32(setup_index, USBDevice),
|
||||
VMSTATE_UINT8_ARRAY(setup_buf, USBDevice, 8),
|
||||
VMSTATE_END_OF_LIST(),
|
||||
}
|
||||
};
|
||||
|
||||
void usb_bus_new(USBBus *bus, DeviceState *host)
|
||||
{
|
||||
qbus_create_inplace(&bus->qbus, &usb_bus_info, host, NULL);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue