xref: /linux/drivers/vfio/pci/pds/vfio_dev.h (revision 4b132aacb0768ac1e652cf517097ea6f237214b9)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* Copyright(c) 2023 Advanced Micro Devices, Inc. */
3 
4 #ifndef _VFIO_DEV_H_
5 #define _VFIO_DEV_H_
6 
7 #include <linux/pci.h>
8 #include <linux/vfio_pci_core.h>
9 
10 #include "dirty.h"
11 #include "lm.h"
12 
13 struct pds_vfio_pci_device {
14 	struct vfio_pci_core_device vfio_coredev;
15 
16 	struct pds_vfio_lm_file *save_file;
17 	struct pds_vfio_lm_file *restore_file;
18 	struct pds_vfio_dirty dirty;
19 	struct mutex state_mutex; /* protect migration state */
20 	enum vfio_device_mig_state state;
21 	struct notifier_block nb;
22 
23 	int vf_id;
24 	u16 client_id;
25 };
26 
27 const struct vfio_device_ops *pds_vfio_ops_info(void);
28 struct pds_vfio_pci_device *pds_vfio_pci_drvdata(struct pci_dev *pdev);
29 void pds_vfio_reset(struct pds_vfio_pci_device *pds_vfio,
30 		    enum vfio_device_mig_state state);
31 
32 struct pci_dev *pds_vfio_to_pci_dev(struct pds_vfio_pci_device *pds_vfio);
33 struct device *pds_vfio_to_dev(struct pds_vfio_pci_device *pds_vfio);
34 
35 #endif /* _VFIO_DEV_H_ */
36