Skip to content

Commit 384a530

Browse files
Yishai Hadasawilliam
authored andcommitted
vfio/virtio: Enable support for virtio-block live migration
With a functional and tested backend for virtio-block live migration, add the virtio-block device ID to the pci_device_id table. Currently, the driver supports legacy IO functionality only for virtio-net, and it is accounted for in specific parts of the code. To enforce this limitation, an explicit check for virtio-net, has been added in virtiovf_support_legacy_io(). Once a backend implements legacy IO functionality for virtio-block, the necessary support will be added to the driver, and this additional check should be removed. The module description was updated accordingly. Reviewed-by: Kevin Tian <kevin.tian@intel.com> Signed-off-by: Yishai Hadas <yishaih@nvidia.com> Link: https://lore.kernel.org/r/20250302162723.82578-1-yishaih@nvidia.com Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
1 parent 0fd0684 commit 384a530

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

drivers/vfio/pci/virtio/Kconfig

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# SPDX-License-Identifier: GPL-2.0-only
22
config VIRTIO_VFIO_PCI
3-
tristate "VFIO support for VIRTIO NET PCI VF devices"
3+
tristate "VFIO support for VIRTIO PCI VF devices"
44
depends on VIRTIO_PCI
55
select VFIO_PCI_CORE
66
help
7-
This provides migration support for VIRTIO NET PCI VF devices
8-
using the VFIO framework. Migration support requires the
7+
This provides migration support for VIRTIO NET and BLOCK PCI VF
8+
devices using the VFIO framework. Migration support requires the
99
SR-IOV PF device to support specific VIRTIO extensions,
1010
otherwise this driver provides no additional functionality
1111
beyond vfio-pci.

drivers/vfio/pci/virtio/legacy_io.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,9 @@ static bool virtiovf_bar0_exists(struct pci_dev *pdev)
382382

383383
bool virtiovf_support_legacy_io(struct pci_dev *pdev)
384384
{
385-
return virtio_pci_admin_has_legacy_io(pdev) && !virtiovf_bar0_exists(pdev);
385+
/* For now, the legacy IO functionality is supported only for virtio-net */
386+
return pdev->device == 0x1041 && virtio_pci_admin_has_legacy_io(pdev) &&
387+
!virtiovf_bar0_exists(pdev);
386388
}
387389

388390
int virtiovf_init_legacy_io(struct virtiovf_pci_core_device *virtvdev)

drivers/vfio/pci/virtio/main.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,9 @@ static void virtiovf_pci_remove(struct pci_dev *pdev)
187187
}
188188

189189
static const struct pci_device_id virtiovf_pci_table[] = {
190-
/* Only virtio-net is supported/tested so far */
190+
/* Only virtio-net and virtio-block are supported/tested so far */
191191
{ PCI_DRIVER_OVERRIDE_DEVICE_VFIO(PCI_VENDOR_ID_REDHAT_QUMRANET, 0x1041) },
192+
{ PCI_DRIVER_OVERRIDE_DEVICE_VFIO(PCI_VENDOR_ID_REDHAT_QUMRANET, 0x1042) },
192193
{}
193194
};
194195

@@ -221,4 +222,4 @@ module_pci_driver(virtiovf_pci_driver);
221222
MODULE_LICENSE("GPL");
222223
MODULE_AUTHOR("Yishai Hadas <yishaih@nvidia.com>");
223224
MODULE_DESCRIPTION(
224-
"VIRTIO VFIO PCI - User Level meta-driver for VIRTIO NET devices");
225+
"VIRTIO VFIO PCI - User Level meta-driver for VIRTIO NET and BLOCK devices");

0 commit comments

Comments
 (0)