Skip to content

Commit

Permalink
vfio/mlx5: Implement vfio_pci driver for mlx5 devices
Browse files Browse the repository at this point in the history
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.

issue: 2690413
Change-Id: Ie1e9bdd6dc2a49a487ef35217d5528eebda3e265
Signed-off-by: Yishai Hadas <yishaih@nvidia.com>
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
  • Loading branch information
Yishai Hadas authored and jgunthorpe committed Jan 28, 2022
1 parent e1cebc8 commit 70ccf2d
Show file tree
Hide file tree
Showing 7 changed files with 637 additions and 0 deletions.
6 changes: 6 additions & 0 deletions MAINTAINERS
Expand Up @@ -20260,6 +20260,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
Expand Down
3 changes: 3 additions & 0 deletions drivers/vfio/pci/Kconfig
Expand Up @@ -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 changes: 2 additions & 0 deletions drivers/vfio/pci/Makefile
Expand Up @@ -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 changes: 10 additions & 0 deletions drivers/vfio/pci/mlx5/Kconfig
@@ -0,0 +1,10 @@
# 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 changes: 4 additions & 0 deletions drivers/vfio/pci/mlx5/Makefile
@@ -0,0 +1,4 @@
# SPDX-License-Identifier: GPL-2.0-only
obj-$(CONFIG_MLX5_VFIO_PCI) += mlx5-vfio-pci.o
mlx5-vfio-pci-y := main.o cmd.o

1 change: 1 addition & 0 deletions drivers/vfio/pci/mlx5/cmd.h
Expand Up @@ -13,6 +13,7 @@ struct mlx5_vf_migration_file
{
struct file *filp;
struct mutex lock;
bool disabled;

struct sg_append_table table;
size_t total_length;
Expand Down

0 comments on commit 70ccf2d

Please sign in to comment.