Message ID | 1438043577-28636-3-git-send-email-marcandre.lureau@redhat.com |
---|---|
State | New |
Headers | show |
On 28/07/2015 02:32, Marc-André Lureau wrote: > From: Marc-André Lureau <marcandre.lureau@gmail.com> > > ivshmem is going to use MSIX state conditionally. > > Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> > --- > include/hw/pci/msix.h | 16 ++++++++++------ > 1 file changed, 10 insertions(+), 6 deletions(-) > > diff --git a/include/hw/pci/msix.h b/include/hw/pci/msix.h > index 954d82b..72e5f93 100644 > --- a/include/hw/pci/msix.h > +++ b/include/hw/pci/msix.h > @@ -46,12 +46,16 @@ 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), \ > +#define VMSTATE_MSIX_TEST(_field, _state, _test) { \ > + .name = (stringify(_field)), \ > + .size = sizeof(PCIDevice), \ > + .vmsd = &vmstate_msix, \ > + .flags = VMS_STRUCT, \ > + .offset = vmstate_offset_value(_state, _field, PCIDevice), \ > + .field_exists = (_test) \ > } > > +#define VMSTATE_MSIX(_f, _s) \ > + VMSTATE_MSIX_TEST(_f, _s, NULL) > + > #endif > Why can't it be saved unconditionally? Paolo
Hi
On Wed, Jul 29, 2015 at 9:41 AM, Paolo Bonzini <pbonzini@redhat.com> wrote:
> Why can't it be saved unconditionally?
It can, it's just that in some case (msi=0) it's unused.
On 29/07/2015 10:28, Marc-André Lureau wrote: >> Why can't it be saved unconditionally? > > It can, it's just that in some case (msi=0) it's unused. I think what we've been doing (e.g. hw/scsi/megasas.c) is to just always save it. Paolo
Hi On Wed, Jul 29, 2015 at 10:31 AM, Paolo Bonzini <pbonzini@redhat.com> wrote: > I think what we've been doing (e.g. hw/scsi/megasas.c) is to just always > save it. I don't mind, I guess I just wanted to have a similar dump as the existing save(): if (ivshmem_has_feature(proxy, IVSHMEM_MSI)) { msix_save(pci_dev, f); ...
On 29/07/2015 12:14, Marc-André Lureau wrote: > I don't mind, I guess I just wanted to have a similar dump as the > existing save(): > > if (ivshmem_has_feature(proxy, IVSHMEM_MSI)) { > msix_save(pci_dev, f); Ah, okay then. Paolo
diff --git a/include/hw/pci/msix.h b/include/hw/pci/msix.h index 954d82b..72e5f93 100644 --- a/include/hw/pci/msix.h +++ b/include/hw/pci/msix.h @@ -46,12 +46,16 @@ 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), \ +#define VMSTATE_MSIX_TEST(_field, _state, _test) { \ + .name = (stringify(_field)), \ + .size = sizeof(PCIDevice), \ + .vmsd = &vmstate_msix, \ + .flags = VMS_STRUCT, \ + .offset = vmstate_offset_value(_state, _field, PCIDevice), \ + .field_exists = (_test) \ } +#define VMSTATE_MSIX(_f, _s) \ + VMSTATE_MSIX_TEST(_f, _s, NULL) + #endif