[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] usb-ohci: add vmstate descriptor

From: Peter Maydell
Subject: Re: [Qemu-devel] [PATCH] usb-ohci: add vmstate descriptor
Date: Mon, 24 Mar 2014 09:26:49 +0000

On 24 March 2014 05:53, Alexey Kardashevskiy <address@hidden> wrote:
> On 03/23/2014 08:23 AM, Peter Maydell wrote:
>> Oops, I hadn't noticed that; this patch is incorrect, then, because
>> vmstate_ohci needs to include a line for the OHCIState, and we
>> need a second vmstate struct for the OHCIState.

> Sorry but what is incorrect in the patch? I can understand that it is
> incomplete as it is missing OHCI-specific bits from the OHCIState state and
> I can do that but I need some hints what is really necessary. So far the
> USB device was able to recover, only PCI bits were really needed. Thanks.

As I say above, you're not saving all the state. You need to include
a line for the OHCIState which refers to a second vmstate struct
to save and load the information in the OHCIState. Compare the
EHCI save/load for an example.

You need to save everything which isn't constant (ie a device
property or a reference to another part of the model). So for
OHCIState you don't need to save irq, mem, as, num_ports
or bus (the first 6 struct members), or localmem_base.
It looks like you don't need to save USBPacket or USBPort
fields, since the other USB controllers don't (though I'm not
sure why not -- Gerd, do you know why this is OK?).
You do need to save everything else. Use a third vmstate for
'struct OHCIPort' so you can handle the arrays of those structs
in OHCIState.

The idea is that after migration the device should be in
exactly the same state as before, as far as the guest can
tell. Your patch relies on the guest OS being able to cope
with it being in the wrong state (probably by figuring out it's
broken and resetting it, or perhaps you only tested migration
when the device was pretty much idle).

-- PMM

reply via email to

[Prev in Thread] Current Thread [Next in Thread]