| Tim Windelschmidt | f69d84b | 2024-07-03 20:32:19 +0200 | [diff] [blame] | 1 | From 9aee9f1af189d9026c06609386f5f034d08b73e1 Mon Sep 17 00:00:00 2001 |
| 2 | From: Tim Windelschmidt <tim@monogon.tech> |
| 3 | Date: Thu, 4 Jul 2024 22:47:00 +0200 |
| 4 | Subject: [PATCH] update VFIO enum names |
| 5 | |
| 6 | --- |
| 7 | hw/vfio/common.c | 8 ++++---- |
| 8 | hw/vfio/migration.c | 27 +++++++++++++++------------ |
| 9 | 2 files changed, 19 insertions(+), 16 deletions(-) |
| 10 | |
| 11 | diff --git a/hw/vfio/common.c b/hw/vfio/common.c |
| 12 | index 6ff1daa763..2ad5a3346b 100644 |
| 13 | --- a/hw/vfio/common.c |
| 14 | +++ b/hw/vfio/common.c |
| 15 | @@ -329,9 +329,9 @@ static bool vfio_devices_all_saving(VFIOContainer *container) |
| 16 | return false; |
| 17 | } |
| 18 | |
| 19 | - if (migration->device_state & VFIO_DEVICE_STATE_SAVING) { |
| 20 | + if (migration->device_state & VFIO_DEVICE_STATE_V1_SAVING) { |
| 21 | if ((vbasedev->pre_copy_dirty_page_tracking == ON_OFF_AUTO_OFF) |
| 22 | - && (migration->device_state & VFIO_DEVICE_STATE_RUNNING)) { |
| 23 | + && (migration->device_state & VFIO_DEVICE_STATE_V1_RUNNING)) { |
| 24 | return false; |
| 25 | } |
| 26 | continue; |
| 27 | @@ -361,8 +361,8 @@ static bool vfio_devices_all_running_and_saving(VFIOContainer *container) |
| 28 | return false; |
| 29 | } |
| 30 | |
| 31 | - if ((migration->device_state & VFIO_DEVICE_STATE_SAVING) && |
| 32 | - (migration->device_state & VFIO_DEVICE_STATE_RUNNING)) { |
| 33 | + if ((migration->device_state & VFIO_DEVICE_STATE_V1_SAVING) && |
| 34 | + (migration->device_state & VFIO_DEVICE_STATE_V1_RUNNING)) { |
| 35 | continue; |
| 36 | } else { |
| 37 | return false; |
| 38 | diff --git a/hw/vfio/migration.c b/hw/vfio/migration.c |
| 39 | index 00daa50ed8..a56b7d6a7a 100644 |
| 40 | --- a/hw/vfio/migration.c |
| 41 | +++ b/hw/vfio/migration.c |
| 42 | @@ -405,7 +405,7 @@ static int vfio_set_dirty_page_tracking(VFIODevice *vbasedev, bool start) |
| 43 | }; |
| 44 | |
| 45 | if (start) { |
| 46 | - if (migration->device_state & VFIO_DEVICE_STATE_SAVING) { |
| 47 | + if (migration->device_state & VFIO_DEVICE_STATE_V1_SAVING) { |
| 48 | dirty.flags = VFIO_IOMMU_DIRTY_PAGES_FLAG_START; |
| 49 | } else { |
| 50 | return -EINVAL; |
| 51 | @@ -463,7 +463,7 @@ static int vfio_save_setup(QEMUFile *f, void *opaque) |
| 52 | } |
| 53 | |
| 54 | ret = vfio_migration_set_state(vbasedev, VFIO_DEVICE_STATE_MASK, |
| 55 | - VFIO_DEVICE_STATE_SAVING); |
| 56 | + VFIO_DEVICE_STATE_V1_SAVING); |
| 57 | if (ret) { |
| 58 | error_report("%s: Failed to set state SAVING", vbasedev->name); |
| 59 | return ret; |
| 60 | @@ -567,8 +567,8 @@ static int vfio_save_complete_precopy(QEMUFile *f, void *opaque) |
| 61 | uint64_t data_size; |
| 62 | int ret; |
| 63 | |
| 64 | - ret = vfio_migration_set_state(vbasedev, ~VFIO_DEVICE_STATE_RUNNING, |
| 65 | - VFIO_DEVICE_STATE_SAVING); |
| 66 | + ret = vfio_migration_set_state(vbasedev, ~VFIO_DEVICE_STATE_V1_RUNNING, |
| 67 | + VFIO_DEVICE_STATE_V1_SAVING); |
| 68 | if (ret) { |
| 69 | error_report("%s: Failed to set state STOP and SAVING", |
| 70 | vbasedev->name); |
| 71 | @@ -610,7 +610,7 @@ static int vfio_save_complete_precopy(QEMUFile *f, void *opaque) |
| 72 | return ret; |
| 73 | } |
| 74 | |
| 75 | - ret = vfio_migration_set_state(vbasedev, ~VFIO_DEVICE_STATE_SAVING, 0); |
| 76 | + ret = vfio_migration_set_state(vbasedev, ~VFIO_DEVICE_STATE_V1_SAVING, 0); |
| 77 | if (ret) { |
| 78 | error_report("%s: Failed to set state STOPPED", vbasedev->name); |
| 79 | return ret; |
| 80 | @@ -637,7 +637,7 @@ static int vfio_load_setup(QEMUFile *f, void *opaque) |
| 81 | } |
| 82 | |
| 83 | ret = vfio_migration_set_state(vbasedev, ~VFIO_DEVICE_STATE_MASK, |
| 84 | - VFIO_DEVICE_STATE_RESUMING); |
| 85 | + VFIO_DEVICE_STATE_V1_RESUMING); |
| 86 | if (ret) { |
| 87 | error_report("%s: Failed to set state RESUMING", vbasedev->name); |
| 88 | if (migration->region.mmaps) { |
| 89 | @@ -748,13 +748,13 @@ static void vfio_vmstate_change(void *opaque, int running, RunState state) |
| 90 | * In both the above cases, set _RUNNING bit. |
| 91 | */ |
| 92 | mask = ~VFIO_DEVICE_STATE_MASK; |
| 93 | - value = VFIO_DEVICE_STATE_RUNNING; |
| 94 | + value = VFIO_DEVICE_STATE_V1_RUNNING; |
| 95 | } else { |
| 96 | /* |
| 97 | * Here device state could be either _RUNNING or _SAVING|_RUNNING. Reset |
| 98 | * _RUNNING bit |
| 99 | */ |
| 100 | - mask = ~VFIO_DEVICE_STATE_RUNNING; |
| 101 | + mask = ~VFIO_DEVICE_STATE_V1_RUNNING; |
| 102 | value = 0; |
| 103 | } |
| 104 | |
| 105 | @@ -790,8 +790,9 @@ static void vfio_migration_state_notifier(Notifier *notifier, void *data) |
| 106 | case MIGRATION_STATUS_FAILED: |
| 107 | bytes_transferred = 0; |
| 108 | ret = vfio_migration_set_state(vbasedev, |
| 109 | - ~(VFIO_DEVICE_STATE_SAVING | VFIO_DEVICE_STATE_RESUMING), |
| 110 | - VFIO_DEVICE_STATE_RUNNING); |
| 111 | + ~(VFIO_DEVICE_STATE_V1_SAVING | |
| 112 | + VFIO_DEVICE_STATE_V1_RESUMING), |
| 113 | + VFIO_DEVICE_STATE_V1_RUNNING); |
| 114 | if (ret) { |
| 115 | error_report("%s: Failed to set state RUNNING", vbasedev->name); |
| 116 | } |
| 117 | @@ -886,8 +887,10 @@ int vfio_migration_probe(VFIODevice *vbasedev, Error **errp) |
| 118 | goto add_blocker; |
| 119 | } |
| 120 | |
| 121 | - ret = vfio_get_dev_region_info(vbasedev, VFIO_REGION_TYPE_MIGRATION, |
| 122 | - VFIO_REGION_SUBTYPE_MIGRATION, &info); |
| 123 | + ret = vfio_get_dev_region_info(vbasedev, |
| 124 | + VFIO_REGION_TYPE_MIGRATION_DEPRECATED, |
| 125 | + VFIO_REGION_SUBTYPE_MIGRATION_DEPRECATED, |
| 126 | + &info); |
| 127 | if (ret) { |
| 128 | goto add_blocker; |
| 129 | } |
| 130 | -- |
| 131 | 2.44.1 |
| 132 | |