From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=43686 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PNptu-0000Xs-Co for qemu-devel@nongnu.org; Wed, 01 Dec 2010 11:51:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PNpts-0002bz-Pc for qemu-devel@nongnu.org; Wed, 01 Dec 2010 11:51:26 -0500 Received: from mx1.redhat.com ([209.132.183.28]:38649) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PNpts-0002aN-IS for qemu-devel@nongnu.org; Wed, 01 Dec 2010 11:51:24 -0500 Message-Id: <20101201164743.090538903@redhat.com> Date: Wed, 01 Dec 2010 14:47:07 -0200 From: Marcelo Tosatti References: <20101201164704.729398122@redhat.com> Content-Disposition: inline; filename=usb-uhci-save Subject: [Qemu-devel] [patch 3/3] UHCI: Substate section for migration of remote wakeup feature List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Paul Brook , Marcelo Tosatti , Gerd Hoffmann , Juan Quintela Use a subsection to migrate remote wakeup feature only when used by the guest. Signed-off-by: Marcelo Tosatti Index: qemu-kvm/hw/usb-uhci.c =================================================================== --- qemu-kvm.orig/hw/usb-uhci.c +++ qemu-kvm/hw/usb-uhci.c @@ -363,6 +363,39 @@ static void uhci_pre_save(void *opaque) uhci_async_cancel_all(s); } +static bool uhci_port_wakeup_state_needed(void *opaque) +{ + UHCIPort *port = opaque; + + if (port->port.dev) { + return port->port.dev->remote_wakeup; + } + + return false; +} + +static int uhci_port_wakeup_post_load(void *opaque, int version_id) +{ + UHCIPort *port = opaque; + + if (port->port.dev) { + port->port.dev->remote_wakeup = 1; + } + + return 0; +} + +const VMStateDescription vmstate_uhci_wakeup_state = { + .name = "uhci port/wakeup", + .version_id = 1, + .minimum_version_id = 1, + .minimum_version_id_old = 1, + .post_load = uhci_port_wakeup_post_load, + .fields = (VMStateField []) { + VMSTATE_END_OF_LIST() + } +}; + static const VMStateDescription vmstate_uhci_port = { .name = "uhci port", .version_id = 1, @@ -371,6 +404,14 @@ static const VMStateDescription vmstate_ .fields = (VMStateField []) { VMSTATE_UINT16(ctrl, UHCIPort), VMSTATE_END_OF_LIST() + }, + .subsections = (VMStateSubsection []) { + { + .vmsd = &vmstate_uhci_wakeup_state, + .needed = uhci_port_wakeup_state_needed, + }, { + /* empty */ + } } };