Message ID | 20220512102942.1134141-3-thuth@redhat.com |
---|---|
State | New |
Headers | show |
Series | [PULL,1/2] linux-headers: Update headers to v5.18-rc6 | expand |
On 5/12/2022 1:29 PM, Thomas Huth wrote: > External email: Use caution opening links or attachments > > > From: Matthew Rosato <mjrosato@linux.ibm.com> > > The v1 uapi is deprecated and will be replaced by v2 at some point; > this patch just tolerates the renaming of uapi fields to reflect > v1 / deprecated status. > > Signed-off-by: Matthew Rosato <mjrosato@linux.ibm.com> > Message-Id: <20220404181726.60291-3-mjrosato@linux.ibm.com> > Signed-off-by: Thomas Huth <thuth@redhat.com> > --- > hw/vfio/common.c | 2 +- > hw/vfio/migration.c | 19 +++++++++++-------- > 2 files changed, 12 insertions(+), 9 deletions(-) > > diff --git a/hw/vfio/common.c b/hw/vfio/common.c > index 159f910421..8e73d3714a 100644 > --- a/hw/vfio/common.c > +++ b/hw/vfio/common.c > @@ -381,7 +381,7 @@ static bool vfio_devices_all_running_and_saving(VFIOContainer *container) > return false; > } > > - if ((migration->device_state & VFIO_DEVICE_STATE_SAVING) && > + if ((migration->device_state & VFIO_DEVICE_STATE_V1_SAVING) && > (migration->device_state & VFIO_DEVICE_STATE_RUNNING)) { Only now I noticed this, but all existing VFIO_DEVICE_STATE_* enums should be changed to their corresponding VFIO_DEVICE_STATE_V1_*. E.g., here VFIO_DEVICE_STATE_RUNNING should be changed as well to VFIO_DEVICE_STATE_V1_RUNNING. I already have a patch that does this. I will send it today as part of the VFIO migration v2 series I am planning to send, so you can just take it. > continue; > } else { > diff --git a/hw/vfio/migration.c b/hw/vfio/migration.c > index ff6b45de6b..e109cee551 100644 > --- a/hw/vfio/migration.c > +++ b/hw/vfio/migration.c > @@ -432,7 +432,7 @@ static int vfio_save_setup(QEMUFile *f, void *opaque) > } > > ret = vfio_migration_set_state(vbasedev, VFIO_DEVICE_STATE_MASK, > - VFIO_DEVICE_STATE_SAVING); > + VFIO_DEVICE_STATE_V1_SAVING); > if (ret) { > error_report("%s: Failed to set state SAVING", vbasedev->name); > return ret; > @@ -532,7 +532,7 @@ static int vfio_save_complete_precopy(QEMUFile *f, void *opaque) > int ret; > > ret = vfio_migration_set_state(vbasedev, ~VFIO_DEVICE_STATE_RUNNING, > - VFIO_DEVICE_STATE_SAVING); > + VFIO_DEVICE_STATE_V1_SAVING); > if (ret) { > error_report("%s: Failed to set state STOP and SAVING", > vbasedev->name); > @@ -569,7 +569,7 @@ static int vfio_save_complete_precopy(QEMUFile *f, void *opaque) > return ret; > } > > - ret = vfio_migration_set_state(vbasedev, ~VFIO_DEVICE_STATE_SAVING, 0); > + ret = vfio_migration_set_state(vbasedev, ~VFIO_DEVICE_STATE_V1_SAVING, 0); > if (ret) { > error_report("%s: Failed to set state STOPPED", vbasedev->name); > return ret; > @@ -730,7 +730,7 @@ static void vfio_vmstate_change(void *opaque, bool running, RunState state) > * start saving data. > */ > if (state == RUN_STATE_SAVE_VM) { > - value = VFIO_DEVICE_STATE_SAVING; > + value = VFIO_DEVICE_STATE_V1_SAVING; > } else { > value = 0; > } > @@ -768,8 +768,9 @@ static void vfio_migration_state_notifier(Notifier *notifier, void *data) > case MIGRATION_STATUS_FAILED: > bytes_transferred = 0; > ret = vfio_migration_set_state(vbasedev, > - ~(VFIO_DEVICE_STATE_SAVING | VFIO_DEVICE_STATE_RESUMING), > - VFIO_DEVICE_STATE_RUNNING); > + ~(VFIO_DEVICE_STATE_V1_SAVING | > + VFIO_DEVICE_STATE_RESUMING), > + VFIO_DEVICE_STATE_RUNNING); > if (ret) { > error_report("%s: Failed to set state RUNNING", vbasedev->name); > } > @@ -864,8 +865,10 @@ int vfio_migration_probe(VFIODevice *vbasedev, Error **errp) > goto add_blocker; > } > > - ret = vfio_get_dev_region_info(vbasedev, VFIO_REGION_TYPE_MIGRATION, > - VFIO_REGION_SUBTYPE_MIGRATION, &info); > + ret = vfio_get_dev_region_info(vbasedev, > + VFIO_REGION_TYPE_MIGRATION_DEPRECATED, > + VFIO_REGION_SUBTYPE_MIGRATION_DEPRECATED, > + &info); > if (ret) { > goto add_blocker; > } > -- > 2.27.0 > >
On 12/05/2022 15.53, Avihai Horon wrote: > > On 5/12/2022 1:29 PM, Thomas Huth wrote: >> External email: Use caution opening links or attachments >> >> >> From: Matthew Rosato <mjrosato@linux.ibm.com> >> >> The v1 uapi is deprecated and will be replaced by v2 at some point; >> this patch just tolerates the renaming of uapi fields to reflect >> v1 / deprecated status. >> >> Signed-off-by: Matthew Rosato <mjrosato@linux.ibm.com> >> Message-Id: <20220404181726.60291-3-mjrosato@linux.ibm.com> >> Signed-off-by: Thomas Huth <thuth@redhat.com> >> --- >> hw/vfio/common.c | 2 +- >> hw/vfio/migration.c | 19 +++++++++++-------- >> 2 files changed, 12 insertions(+), 9 deletions(-) >> >> diff --git a/hw/vfio/common.c b/hw/vfio/common.c >> index 159f910421..8e73d3714a 100644 >> --- a/hw/vfio/common.c >> +++ b/hw/vfio/common.c >> @@ -381,7 +381,7 @@ static bool >> vfio_devices_all_running_and_saving(VFIOContainer *container) >> return false; >> } >> >> - if ((migration->device_state & VFIO_DEVICE_STATE_SAVING) && >> + if ((migration->device_state & VFIO_DEVICE_STATE_V1_SAVING) && >> (migration->device_state & VFIO_DEVICE_STATE_RUNNING)) { > > Only now I noticed this, but all existing VFIO_DEVICE_STATE_* enums should > be changed to their corresponding VFIO_DEVICE_STATE_V1_*. > E.g., here VFIO_DEVICE_STATE_RUNNING should be changed as well to > VFIO_DEVICE_STATE_V1_RUNNING. > > I already have a patch that does this. I will send it today as part of the > VFIO migration v2 series I am planning to send, so you can just take it. Ugh, thanks for noticing! Alex, could you please take care of this in the next days? Seems like the next linux-header updates is really not that trivial anymore due to that ugly vfio macro renaming :-( And I'd prefer if somebody could tackle this who is really more confident in this area. Thomas
diff --git a/hw/vfio/common.c b/hw/vfio/common.c index 159f910421..8e73d3714a 100644 --- a/hw/vfio/common.c +++ b/hw/vfio/common.c @@ -381,7 +381,7 @@ static bool vfio_devices_all_running_and_saving(VFIOContainer *container) return false; } - if ((migration->device_state & VFIO_DEVICE_STATE_SAVING) && + if ((migration->device_state & VFIO_DEVICE_STATE_V1_SAVING) && (migration->device_state & VFIO_DEVICE_STATE_RUNNING)) { continue; } else { diff --git a/hw/vfio/migration.c b/hw/vfio/migration.c index ff6b45de6b..e109cee551 100644 --- a/hw/vfio/migration.c +++ b/hw/vfio/migration.c @@ -432,7 +432,7 @@ static int vfio_save_setup(QEMUFile *f, void *opaque) } ret = vfio_migration_set_state(vbasedev, VFIO_DEVICE_STATE_MASK, - VFIO_DEVICE_STATE_SAVING); + VFIO_DEVICE_STATE_V1_SAVING); if (ret) { error_report("%s: Failed to set state SAVING", vbasedev->name); return ret; @@ -532,7 +532,7 @@ static int vfio_save_complete_precopy(QEMUFile *f, void *opaque) int ret; ret = vfio_migration_set_state(vbasedev, ~VFIO_DEVICE_STATE_RUNNING, - VFIO_DEVICE_STATE_SAVING); + VFIO_DEVICE_STATE_V1_SAVING); if (ret) { error_report("%s: Failed to set state STOP and SAVING", vbasedev->name); @@ -569,7 +569,7 @@ static int vfio_save_complete_precopy(QEMUFile *f, void *opaque) return ret; } - ret = vfio_migration_set_state(vbasedev, ~VFIO_DEVICE_STATE_SAVING, 0); + ret = vfio_migration_set_state(vbasedev, ~VFIO_DEVICE_STATE_V1_SAVING, 0); if (ret) { error_report("%s: Failed to set state STOPPED", vbasedev->name); return ret; @@ -730,7 +730,7 @@ static void vfio_vmstate_change(void *opaque, bool running, RunState state) * start saving data. */ if (state == RUN_STATE_SAVE_VM) { - value = VFIO_DEVICE_STATE_SAVING; + value = VFIO_DEVICE_STATE_V1_SAVING; } else { value = 0; } @@ -768,8 +768,9 @@ static void vfio_migration_state_notifier(Notifier *notifier, void *data) case MIGRATION_STATUS_FAILED: bytes_transferred = 0; ret = vfio_migration_set_state(vbasedev, - ~(VFIO_DEVICE_STATE_SAVING | VFIO_DEVICE_STATE_RESUMING), - VFIO_DEVICE_STATE_RUNNING); + ~(VFIO_DEVICE_STATE_V1_SAVING | + VFIO_DEVICE_STATE_RESUMING), + VFIO_DEVICE_STATE_RUNNING); if (ret) { error_report("%s: Failed to set state RUNNING", vbasedev->name); } @@ -864,8 +865,10 @@ int vfio_migration_probe(VFIODevice *vbasedev, Error **errp) goto add_blocker; } - ret = vfio_get_dev_region_info(vbasedev, VFIO_REGION_TYPE_MIGRATION, - VFIO_REGION_SUBTYPE_MIGRATION, &info); + ret = vfio_get_dev_region_info(vbasedev, + VFIO_REGION_TYPE_MIGRATION_DEPRECATED, + VFIO_REGION_SUBTYPE_MIGRATION_DEPRECATED, + &info); if (ret) { goto add_blocker; }