lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 13 Oct 2021 12:47:07 +0300
From:   Yishai Hadas <yishaih@...dia.com>
To:     <alex.williamson@...hat.com>, <bhelgaas@...gle.com>,
        <jgg@...dia.com>, <saeedm@...dia.com>
CC:     <linux-pci@...r.kernel.org>, <kvm@...r.kernel.org>,
        <netdev@...r.kernel.org>, <kuba@...nel.org>, <leonro@...dia.com>,
        <kwankhede@...dia.com>, <mgurtovoy@...dia.com>,
        <yishaih@...dia.com>, <maorg@...dia.com>
Subject: [PATCH V1 mlx5-next 13/13] vfio/mlx5: Trap device RESET and update state accordingly

Trap device RESET and update state accordingly, it's done by registering
the matching callbacks.

Signed-off-by: Yishai Hadas <yishaih@...dia.com>
Signed-off-by: Leon Romanovsky <leonro@...dia.com>
---
 drivers/vfio/pci/mlx5/main.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/drivers/vfio/pci/mlx5/main.c b/drivers/vfio/pci/mlx5/main.c
index e36302b444a6..8fe44ed13552 100644
--- a/drivers/vfio/pci/mlx5/main.c
+++ b/drivers/vfio/pci/mlx5/main.c
@@ -613,6 +613,19 @@ static const struct vfio_device_ops mlx5vf_pci_ops = {
 	.match = vfio_pci_core_match,
 };
 
+static void mlx5vf_reset_done(struct vfio_pci_core_device *core_vdev)
+{
+	struct mlx5vf_pci_core_device *mvdev = container_of(
+			core_vdev, struct mlx5vf_pci_core_device,
+			core_device);
+
+	mvdev->vmig.vfio_dev_state = VFIO_DEVICE_STATE_RUNNING;
+}
+
+static const struct vfio_pci_core_device_ops mlx5vf_pci_core_ops = {
+	.reset_done = mlx5vf_reset_done,
+};
+
 static int mlx5vf_pci_probe(struct pci_dev *pdev,
 			    const struct pci_device_id *id)
 {
@@ -629,8 +642,10 @@ static int mlx5vf_pci_probe(struct pci_dev *pdev,
 			mlx5_vf_get_core_dev(pdev);
 
 		if (mdev) {
-			if (MLX5_CAP_GEN(mdev, migration))
+			if (MLX5_CAP_GEN(mdev, migration)) {
 				mvdev->migrate_cap = 1;
+				mvdev->core_device.ops = &mlx5vf_pci_core_ops;
+			}
 			mlx5_vf_put_core_dev(mdev);
 		}
 	}
-- 
2.18.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ