[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 06/10] vfio: Move the saving of the config space to the right plac
From: |
Alex Williamson |
Subject: |
[PULL 06/10] vfio: Move the saving of the config space to the right place in VFIO migration |
Date: |
Tue, 16 Mar 2021 11:07:10 -0600 |
User-agent: |
StGit/0.23 |
From: Shenming Lu <lushenming@huawei.com>
On ARM64 the VFIO SET_IRQS ioctl is dependent on the VM interrupt
setup, if the restoring of the VFIO PCI device config space is
before the VGIC, an error might occur in the kernel.
So we move the saving of the config space to the non-iterable
process, thus it will be called after the VGIC according to
their priorities.
As for the possible dependence of the device specific migration
data on it's config space, we can let the vendor driver to
include any config info it needs in its own data stream.
Signed-off-by: Shenming Lu <lushenming@huawei.com>
Reviewed-by: Kirti Wankhede <kwankhede@nvidia.com>
Message-Id: <20210310030233.1133-2-lushenming@huawei.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
---
hw/vfio/migration.c | 25 +++++++++++++++----------
1 file changed, 15 insertions(+), 10 deletions(-)
diff --git a/hw/vfio/migration.c b/hw/vfio/migration.c
index 134bdccc4f8b..003786f3cd9a 100644
--- a/hw/vfio/migration.c
+++ b/hw/vfio/migration.c
@@ -575,11 +575,6 @@ static int vfio_save_complete_precopy(QEMUFile *f, void
*opaque)
return ret;
}
- ret = vfio_save_device_config_state(f, opaque);
- if (ret) {
- return ret;
- }
-
ret = vfio_update_pending(vbasedev);
if (ret) {
return ret;
@@ -620,6 +615,19 @@ static int vfio_save_complete_precopy(QEMUFile *f, void
*opaque)
return ret;
}
+static void vfio_save_state(QEMUFile *f, void *opaque)
+{
+ VFIODevice *vbasedev = opaque;
+ int ret;
+
+ ret = vfio_save_device_config_state(f, opaque);
+ if (ret) {
+ error_report("%s: Failed to save device config space",
+ vbasedev->name);
+ qemu_file_set_error(f, ret);
+ }
+}
+
static int vfio_load_setup(QEMUFile *f, void *opaque)
{
VFIODevice *vbasedev = opaque;
@@ -670,11 +678,7 @@ static int vfio_load_state(QEMUFile *f, void *opaque, int
version_id)
switch (data) {
case VFIO_MIG_FLAG_DEV_CONFIG_STATE:
{
- ret = vfio_load_device_config_state(f, opaque);
- if (ret) {
- return ret;
- }
- break;
+ return vfio_load_device_config_state(f, opaque);
}
case VFIO_MIG_FLAG_DEV_SETUP_STATE:
{
@@ -720,6 +724,7 @@ static SaveVMHandlers savevm_vfio_handlers = {
.save_live_pending = vfio_save_pending,
.save_live_iterate = vfio_save_iterate,
.save_live_complete_precopy = vfio_save_complete_precopy,
+ .save_state = vfio_save_state,
.load_setup = vfio_load_setup,
.load_cleanup = vfio_load_cleanup,
.load_state = vfio_load_state,
- [PULL 00/10] VFIO updates for QEMU 6.0, Alex Williamson, 2021/03/16
- [PULL 01/10] vfio: Fix vfio_listener_log_sync function name typo, Alex Williamson, 2021/03/16
- [PULL 02/10] hw/vfio/pci-quirks: Replace the word 'blacklist', Alex Williamson, 2021/03/16
- [PULL 03/10] MAINTAINERS: Cover docs/igd-assign.txt in VFIO section, Alex Williamson, 2021/03/16
- [PULL 04/10] vfio: Do not register any IOMMU_NOTIFIER_DEVIOTLB_UNMAP notifier, Alex Williamson, 2021/03/16
- [PULL 05/10] spapr_iommu: Fix vhost integration regression, Alex Williamson, 2021/03/16
- [PULL 06/10] vfio: Move the saving of the config space to the right place in VFIO migration,
Alex Williamson <=
- [PULL 07/10] vfio: Set the priority of the VFIO VM state change handler explicitly, Alex Williamson, 2021/03/16
- [PULL 08/10] vfio: Avoid disabling and enabling vectors repeatedly in VFIO migration, Alex Williamson, 2021/03/16
- [PULL 09/10] vfio: Support host translation granule size, Alex Williamson, 2021/03/16
- [PULL 10/10] vfio/migrate: Move switch of dirty tracking into vfio_memory_listener, Alex Williamson, 2021/03/16
- Re: [PULL 00/10] VFIO updates for QEMU 6.0, Peter Maydell, 2021/03/17