summaryrefslogtreecommitdiffstats
path: root/drivers/vfio/pci/pds/vfio_dev.h
blob: e7b01080a1ec3acf255c0a3ee7a330cf40ad3b9f (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
34
35
36
37
38
39
/* 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 "dirty.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 pds_vfio_dirty dirty;
	struct mutex state_mutex; /* protect migration state */
	enum vfio_device_mig_state state;
	struct mutex reset_mutex; /* protect reset_done flow */
	u8 deferred_reset;
	enum vfio_device_mig_state deferred_reset_state;
	struct notifier_block nb;

	int vf_id;
	u16 client_id;
};

void pds_vfio_state_mutex_unlock(struct pds_vfio_pci_device *pds_vfio);

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_ */