vfio/migration: Block VFIO migration with postcopy migration
commitbf7ef7a2da3e61dc104f26c679c9465e3fbe7dde
authorAvihai Horon <avihaih@nvidia.com>
Wed, 6 Sep 2023 15:08:52 +0000 (6 18:08 +0300)
committerCédric Le Goater <clg@redhat.com>
Mon, 11 Sep 2023 06:34:06 +0000 (11 08:34 +0200)
tree8ae92216df15dcd7d8a1215c298758fcad122fad
parent08fc4cb51774f763dcc6fd74637aa9e00eb6a0ba
vfio/migration: Block VFIO migration with postcopy migration

VFIO migration is not compatible with postcopy migration. A VFIO device
in the destination can't handle page faults for pages that have not been
sent yet.

Doing such migration will cause the VM to crash in the destination:

qemu-system-x86_64: VFIO_MAP_DMA failed: Bad address
qemu-system-x86_64: vfio_dma_map(0x55a28c7659d0, 0xc0000, 0xb000, 0x7f1b11a00000) = -14 (Bad address)
qemu: hardware error: vfio: DMA mapping failed, unable to continue

To prevent this, block VFIO migration with postcopy migration.

Reported-by: Yanghang Liu <yanghliu@redhat.com>
Signed-off-by: Avihai Horon <avihaih@nvidia.com>
Tested-by: Yanghang Liu <yanghliu@redhat.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Signed-off-by: Cédric Le Goater <clg@redhat.com>
hw/vfio/migration.c