pci: add VMSTATE_MSIX
Using a trick cut+pasted from vmstate_scsi_device to wind up msix_save and msix_load. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Acked-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
parent
45ec267160
commit
340b50c759
@ -569,3 +569,36 @@ void msix_unset_vector_notifiers(PCIDevice *dev)
|
||||
dev->msix_vector_release_notifier = NULL;
|
||||
dev->msix_vector_poll_notifier = NULL;
|
||||
}
|
||||
|
||||
static void put_msix_state(QEMUFile *f, void *pv, size_t size)
|
||||
{
|
||||
msix_save(pv, f);
|
||||
}
|
||||
|
||||
static int get_msix_state(QEMUFile *f, void *pv, size_t size)
|
||||
{
|
||||
msix_load(pv, f);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static VMStateInfo vmstate_info_msix = {
|
||||
.name = "msix state",
|
||||
.get = get_msix_state,
|
||||
.put = put_msix_state,
|
||||
};
|
||||
|
||||
const VMStateDescription vmstate_msix = {
|
||||
.name = "msix",
|
||||
.fields = (VMStateField[]) {
|
||||
{
|
||||
.name = "msix",
|
||||
.version_id = 0,
|
||||
.field_exists = NULL,
|
||||
.size = 0, /* ouch */
|
||||
.info = &vmstate_info_msix,
|
||||
.flags = VMS_SINGLE,
|
||||
.offset = 0,
|
||||
},
|
||||
VMSTATE_END_OF_LIST()
|
||||
}
|
||||
};
|
||||
|
@ -43,4 +43,15 @@ int msix_set_vector_notifiers(PCIDevice *dev,
|
||||
MSIVectorReleaseNotifier release_notifier,
|
||||
MSIVectorPollNotifier poll_notifier);
|
||||
void msix_unset_vector_notifiers(PCIDevice *dev);
|
||||
|
||||
extern const VMStateDescription vmstate_msix;
|
||||
|
||||
#define VMSTATE_MSIX(_field, _state) { \
|
||||
.name = (stringify(_field)), \
|
||||
.size = sizeof(PCIDevice), \
|
||||
.vmsd = &vmstate_msix, \
|
||||
.flags = VMS_STRUCT, \
|
||||
.offset = vmstate_offset_value(_state, _field, PCIDevice), \
|
||||
}
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user