qemu-devel
[Top][All Lists]
Advanced

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

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


From: Alexey Kardashevskiy
Subject: Re: [Qemu-devel] [PATCH] usb-ohci: add vmstate descriptor
Date: Sun, 13 Apr 2014 13:55:10 +1000
User-agent: Mozilla/5.0 (X11; Linux i686 on x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0

On 04/13/2014 01:09 PM, Alexey Kardashevskiy wrote:
> On 03/24/2014 08:26 PM, Peter Maydell wrote:
>> 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.
> 
> What is a "third" vmstate? I was going to use VMSTATE_STRUCT_ARRAY.

Never mind, got it.


-- 
Alexey



reply via email to

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