summaryrefslogtreecommitdiff
path: root/drivers/vfio/pci/pds/vfio_dev.h
blob: 53ba1dd3cb92abe2499588bc8eb29d173887642a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright(c) 2023 Advanced Micro Devices, Inc. */

#ifndef _VFIO_DEV_H_
#define _VFIO_DEV_H_

#include <linux/pci.h>
#include <linux/vfio_pci_core.h>

#include "lm.h"

struct pds_vfio_pci_device {
	struct vfio_pci_core_device vfio_coredev;

	struct pds_vfio_lm_file *save_file;
	struct pds_vfio_lm_file *restore_file;
	struct mutex state_mutex; /* protect migration state */
	enum vfio_device_mig_state state;
	spinlock_t reset_lock; /* protect reset_done flow */
	u8 deferred_reset;

	int vf_id;
	u16 client_id;
};

const struct vfio_device_ops *pds_vfio_ops_info(void);
struct pds_vfio_pci_device *pds_vfio_pci_drvdata(struct pci_dev *pdev);
void pds_vfio_reset(struct pds_vfio_pci_device *pds_vfio);

struct pci_dev *pds_vfio_to_pci_dev(struct pds_vfio_pci_device *pds_vfio);
struct device *pds_vfio_to_dev(struct pds_vfio_pci_device *pds_vfio);

#endif /* _VFIO_DEV_H_ */