Hi,

I'm looking into making NVME device "migratable".
Following previous discussion on 
https://lists.gnu.org/archive/html/qemu-devel/2017-08/msg05091.html, I would 
like to implement the VMStateDescription to save and restore the entire 
controller state, including all the queues.
"NvmeCtrl" defines the queues like this:

    ...
    NvmeSQueue      **sq;
    NvmeCQueue      **cq;
    NvmeSQueue      admin_sq;
    NvmeCQueue      admin_cq;
    ...

typedef struct NvmeCQueue {
    struct NvmeCtrl *ctrl;
    uint8_t     phase;
    ...

My understanding is that I should use VMSTATE_STRUCT to save "admin_sq" and 
"admin_cq", but how do I save/restore the "ctrl" field of "NvmeCQueue"?
And is there a VMSTATE_ macro I could use for handling "sq" and "cq" fields of 
"NvmeCtrl"? These are dynamic allocated arrays of pointers to struct, whose 
size is a device parameter. VMSTATE_STRUCT_VARRAY_ALLOC is close but not 
exactly what I need here.
Is there a simple way to achieve this? Or do I need to use pre_save/post_load 
to convert these into a more "serializable" form? Or create a new VMStateInfo 
customized for this purpose?

I'd appreciate any hint or advice!

Thanks,
Amir


Reply via email to