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>
---
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 080046e3f5..7b1e12fb69 100644
--- a/hw/vfio/common.c
+++ b/hw/vfio/common.c
@@ -380,7 +380,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;
}
--
2.27.0
On 4/4/22 20:17, Matthew Rosato wrote:
> 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>
> ---
> hw/vfio/common.c | 2 +-
> hw/vfio/migration.c | 19 +++++++++++--------
> 2 files changed, 12 insertions(+), 9 deletions(-)
I do not understand why you need this patch in this series.
Shouldn't it be separate?
>
> diff --git a/hw/vfio/common.c b/hw/vfio/common.c
> index 080046e3f5..7b1e12fb69 100644
> --- a/hw/vfio/common.c
> +++ b/hw/vfio/common.c
> @@ -380,7 +380,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;
> }
>
--
Pierre Morel
IBM Lab Boeblingen
On 4/12/22 11:50 AM, Pierre Morel wrote:
>
>
> On 4/4/22 20:17, Matthew Rosato wrote:
>> 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>
>> ---
>> hw/vfio/common.c | 2 +-
>> hw/vfio/migration.c | 19 +++++++++++--------
>> 2 files changed, 12 insertions(+), 9 deletions(-)
>
>
> I do not understand why you need this patch in this series.
> Shouldn't it be separate?
This patch is included because of the patch 1 kernel header sync, which
pulls in uapi headers from kernel version 5.18-rc1 + my unmerged kernel
uapi changes.
This patch is unnecessary without a header sync (and in fact would break
QEMU compile), and is unrelated to the rest of the series -- but QEMU
will not compile without it once you update linux uapi headers to
5.18-rc1 (or greater) due to the v1 uapi for vfio migration being
deprecated [1]. This means that ANY series that does a linux header
sync starting from here on will need something like this patch to go
along with the header sync (or a series that replaces v1 usage with v2?).
If this patch looks good it could be included whenever a header sync is
next needed, doesn't necessarily have to be with this series.
[1] https://www.spinics.net/lists/kernel/msg4288200.html
>
>>
>> diff --git a/hw/vfio/common.c b/hw/vfio/common.c
>> index 080046e3f5..7b1e12fb69 100644
>> --- a/hw/vfio/common.c
>> +++ b/hw/vfio/common.c
>> @@ -380,7 +380,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;
>> }
>>
>
On 4/12/22 18:07, Matthew Rosato wrote: > On 4/12/22 11:50 AM, Pierre Morel wrote: >> >> >> On 4/4/22 20:17, Matthew Rosato wrote: >>> 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> >>> --- >>> hw/vfio/common.c | 2 +- >>> hw/vfio/migration.c | 19 +++++++++++-------- >>> 2 files changed, 12 insertions(+), 9 deletions(-) >> >> >> I do not understand why you need this patch in this series. >> Shouldn't it be separate? > > This patch is included because of the patch 1 kernel header sync, which > pulls in uapi headers from kernel version 5.18-rc1 + my unmerged kernel > uapi changes. > > This patch is unnecessary without a header sync (and in fact would break > QEMU compile), and is unrelated to the rest of the series -- but QEMU > will not compile without it once you update linux uapi headers to > 5.18-rc1 (or greater) due to the v1 uapi for vfio migration being > deprecated [1]. This means that ANY series that does a linux header > sync starting from here on will need something like this patch to go > along with the header sync (or a series that replaces v1 usage with v2?). > > If this patch looks good it could be included whenever a header sync is > next needed, doesn't necessarily have to be with this series. > > [1] https://www.spinics.net/lists/kernel/msg4288200.html > arrg, seems I will need it too then. Thanks, Pierre -- Pierre Morel IBM Lab Boeblingen
© 2016 - 2026 Red Hat, Inc.