Commit 6fadb021 authored by Yishai Hadas's avatar Yishai Hadas Committed by Leon Romanovsky
Browse files

vfio/mlx5: Implement vfio_pci driver for mlx5 devices

This patch adds support for vfio_pci driver for mlx5 devices.

It uses vfio_pci_core to register to the VFIO subsystem and then
implements the mlx5 specific logic in the migration area.

The migration implementation follows the definition from uapi/vfio.h and
uses the mlx5 VF->PF command channel to achieve it.

This patch implements the suspend/resume flows.

Link: https://lore.kernel.org/all/20220224142024.147653-14-yishaih@nvidia.com


Reviewed-by: default avatarAlex Williamson <alex.williamson@redhat.com>
Signed-off-by: default avatarYishai Hadas <yishaih@nvidia.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
Signed-off-by: default avatarLeon Romanovsky <leonro@nvidia.com>
parent f1d98f34
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -20320,6 +20320,12 @@ L: kvm@vger.kernel.org
S:	Maintained
F:	drivers/vfio/platform/
VFIO MLX5 PCI DRIVER
M:	Yishai Hadas <yishaih@nvidia.com>
L:	kvm@vger.kernel.org
S:	Maintained
F:	drivers/vfio/pci/mlx5/
VGA_SWITCHEROO
R:	Lukas Wunner <lukas@wunner.de>
S:	Maintained
+3 −0
Original line number Diff line number Diff line
@@ -43,4 +43,7 @@ config VFIO_PCI_IGD

	  To enable Intel IGD assignment through vfio-pci, say Y.
endif

source "drivers/vfio/pci/mlx5/Kconfig"

endif
+2 −0
Original line number Diff line number Diff line
@@ -7,3 +7,5 @@ obj-$(CONFIG_VFIO_PCI_CORE) += vfio-pci-core.o
vfio-pci-y := vfio_pci.o
vfio-pci-$(CONFIG_VFIO_PCI_IGD) += vfio_pci_igd.o
obj-$(CONFIG_VFIO_PCI) += vfio-pci.o

obj-$(CONFIG_MLX5_VFIO_PCI)           += mlx5/
+10 −0
Original line number Diff line number Diff line
# SPDX-License-Identifier: GPL-2.0-only
config MLX5_VFIO_PCI
	tristate "VFIO support for MLX5 PCI devices"
	depends on MLX5_CORE
	depends on VFIO_PCI_CORE
	help
	  This provides migration support for MLX5 devices using the VFIO
	  framework.

	  If you don't know what to do here, say N.
+4 −0
Original line number Diff line number Diff line
# SPDX-License-Identifier: GPL-2.0-only
obj-$(CONFIG_MLX5_VFIO_PCI) += mlx5-vfio-pci.o
mlx5-vfio-pci-y := main.o cmd.o
Loading