xref: /openbmc/linux/drivers/vfio/pci/mlx5/cmd.h (revision 7a2f6f61)
1 /* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
2 /*
3  * Copyright (c) 2021-2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
4  */
5 
6 #ifndef MLX5_VFIO_CMD_H
7 #define MLX5_VFIO_CMD_H
8 
9 #include <linux/kernel.h>
10 #include <linux/mlx5/driver.h>
11 
12 struct mlx5_vf_migration_file {
13 	struct file *filp;
14 	struct mutex lock;
15 	bool disabled;
16 
17 	struct sg_append_table table;
18 	size_t total_length;
19 	size_t allocated_length;
20 
21 	/* Optimize mlx5vf_get_migration_page() for sequential access */
22 	struct scatterlist *last_offset_sg;
23 	unsigned int sg_last_entry;
24 	unsigned long last_offset;
25 };
26 
27 int mlx5vf_cmd_suspend_vhca(struct pci_dev *pdev, u16 vhca_id, u16 op_mod);
28 int mlx5vf_cmd_resume_vhca(struct pci_dev *pdev, u16 vhca_id, u16 op_mod);
29 int mlx5vf_cmd_query_vhca_migration_state(struct pci_dev *pdev, u16 vhca_id,
30 					  size_t *state_size);
31 int mlx5vf_cmd_get_vhca_id(struct pci_dev *pdev, u16 function_id, u16 *vhca_id);
32 int mlx5vf_cmd_save_vhca_state(struct pci_dev *pdev, u16 vhca_id,
33 			       struct mlx5_vf_migration_file *migf);
34 int mlx5vf_cmd_load_vhca_state(struct pci_dev *pdev, u16 vhca_id,
35 			       struct mlx5_vf_migration_file *migf);
36 #endif /* MLX5_VFIO_CMD_H */
37