#include <linux/device.h>
#include <linux/eventfd.h>
#include <linux/file.h>
#include <linux/hisi_acc_qm.h>
#include <linux/interrupt.h>
#include <linux/module.h>
#include <linux/pci.h>
#include <linux/vfio.h>
#include <linux/vfio_pci_core.h>
#include <linux/anon_inodes.h>
#include "hisi_acc_vfio_pci.h"
static int qm_wait_dev_not_ready(struct hisi_qm *qm)
{ … }
static u32 qm_check_reg_state(struct hisi_qm *qm, u32 regs)
{ … }
static int qm_read_regs(struct hisi_qm *qm, u32 reg_addr,
u32 *data, u8 nums)
{ … }
static int qm_write_regs(struct hisi_qm *qm, u32 reg,
u32 *data, u8 nums)
{ … }
static int qm_get_vft(struct hisi_qm *qm, u32 *base)
{ … }
static int qm_get_sqc(struct hisi_qm *qm, u64 *addr)
{ … }
static int qm_get_cqc(struct hisi_qm *qm, u64 *addr)
{ … }
static int qm_get_regs(struct hisi_qm *qm, struct acc_vf_data *vf_data)
{ … }
static int qm_set_regs(struct hisi_qm *qm, struct acc_vf_data *vf_data)
{ … }
static void qm_db(struct hisi_qm *qm, u16 qn, u8 cmd,
u16 index, u8 priority)
{ … }
static int pf_qm_get_qp_num(struct hisi_qm *qm, int vf_id, u32 *rbase)
{ … }
static void qm_dev_cmd_init(struct hisi_qm *qm)
{ … }
static int vf_qm_cache_wb(struct hisi_qm *qm)
{ … }
static void vf_qm_fun_reset(struct hisi_qm *qm)
{ … }
static int vf_qm_func_stop(struct hisi_qm *qm)
{ … }
static int vf_qm_check_match(struct hisi_acc_vf_core_device *hisi_acc_vdev,
struct hisi_acc_vf_migration_file *migf)
{ … }
static int vf_qm_get_match_data(struct hisi_acc_vf_core_device *hisi_acc_vdev,
struct acc_vf_data *vf_data)
{ … }
static int vf_qm_load_data(struct hisi_acc_vf_core_device *hisi_acc_vdev,
struct hisi_acc_vf_migration_file *migf)
{ … }
static int vf_qm_state_save(struct hisi_acc_vf_core_device *hisi_acc_vdev,
struct hisi_acc_vf_migration_file *migf)
{ … }
static struct hisi_acc_vf_core_device *hisi_acc_drvdata(struct pci_dev *pdev)
{ … }
static int
hisi_acc_check_int_state(struct hisi_acc_vf_core_device *hisi_acc_vdev)
{ … }
static void hisi_acc_vf_disable_fd(struct hisi_acc_vf_migration_file *migf)
{ … }
static void hisi_acc_vf_disable_fds(struct hisi_acc_vf_core_device *hisi_acc_vdev)
{ … }
static void hisi_acc_vf_reset(struct hisi_acc_vf_core_device *hisi_acc_vdev)
{ … }
static void hisi_acc_vf_start_device(struct hisi_acc_vf_core_device *hisi_acc_vdev)
{ … }
static int hisi_acc_vf_load_state(struct hisi_acc_vf_core_device *hisi_acc_vdev)
{ … }
static int hisi_acc_vf_release_file(struct inode *inode, struct file *filp)
{ … }
static ssize_t hisi_acc_vf_resume_write(struct file *filp, const char __user *buf,
size_t len, loff_t *pos)
{ … }
static const struct file_operations hisi_acc_vf_resume_fops = …;
static struct hisi_acc_vf_migration_file *
hisi_acc_vf_pci_resume(struct hisi_acc_vf_core_device *hisi_acc_vdev)
{ … }
static long hisi_acc_vf_precopy_ioctl(struct file *filp,
unsigned int cmd, unsigned long arg)
{ … }
static ssize_t hisi_acc_vf_save_read(struct file *filp, char __user *buf, size_t len,
loff_t *pos)
{ … }
static const struct file_operations hisi_acc_vf_save_fops = …;
static struct hisi_acc_vf_migration_file *
hisi_acc_open_saving_migf(struct hisi_acc_vf_core_device *hisi_acc_vdev)
{ … }
static struct hisi_acc_vf_migration_file *
hisi_acc_vf_pre_copy(struct hisi_acc_vf_core_device *hisi_acc_vdev)
{ … }
static struct hisi_acc_vf_migration_file *
hisi_acc_vf_stop_copy(struct hisi_acc_vf_core_device *hisi_acc_vdev, bool open)
{ … }
static int hisi_acc_vf_stop_device(struct hisi_acc_vf_core_device *hisi_acc_vdev)
{ … }
static struct file *
hisi_acc_vf_set_device_state(struct hisi_acc_vf_core_device *hisi_acc_vdev,
u32 new)
{ … }
static struct file *
hisi_acc_vfio_pci_set_device_state(struct vfio_device *vdev,
enum vfio_device_mig_state new_state)
{ … }
static int
hisi_acc_vfio_pci_get_data_size(struct vfio_device *vdev,
unsigned long *stop_copy_length)
{ … }
static int
hisi_acc_vfio_pci_get_device_state(struct vfio_device *vdev,
enum vfio_device_mig_state *curr_state)
{ … }
static void hisi_acc_vf_pci_aer_reset_done(struct pci_dev *pdev)
{ … }
static int hisi_acc_vf_qm_init(struct hisi_acc_vf_core_device *hisi_acc_vdev)
{ … }
static struct hisi_qm *hisi_acc_get_pf_qm(struct pci_dev *pdev)
{ … }
static int hisi_acc_pci_rw_access_check(struct vfio_device *core_vdev,
size_t count, loff_t *ppos,
size_t *new_count)
{ … }
static int hisi_acc_vfio_pci_mmap(struct vfio_device *core_vdev,
struct vm_area_struct *vma)
{ … }
static ssize_t hisi_acc_vfio_pci_write(struct vfio_device *core_vdev,
const char __user *buf, size_t count,
loff_t *ppos)
{ … }
static ssize_t hisi_acc_vfio_pci_read(struct vfio_device *core_vdev,
char __user *buf, size_t count,
loff_t *ppos)
{ … }
static long hisi_acc_vfio_pci_ioctl(struct vfio_device *core_vdev, unsigned int cmd,
unsigned long arg)
{ … }
static int hisi_acc_vfio_pci_open_device(struct vfio_device *core_vdev)
{ … }
static void hisi_acc_vfio_pci_close_device(struct vfio_device *core_vdev)
{ … }
static const struct vfio_migration_ops hisi_acc_vfio_pci_migrn_state_ops = …;
static int hisi_acc_vfio_pci_migrn_init_dev(struct vfio_device *core_vdev)
{ … }
static const struct vfio_device_ops hisi_acc_vfio_pci_migrn_ops = …;
static const struct vfio_device_ops hisi_acc_vfio_pci_ops = …;
static int hisi_acc_vfio_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
{ … }
static void hisi_acc_vfio_pci_remove(struct pci_dev *pdev)
{ … }
static const struct pci_device_id hisi_acc_vfio_pci_table[] = …;
MODULE_DEVICE_TABLE(pci, hisi_acc_vfio_pci_table);
static const struct pci_error_handlers hisi_acc_vf_err_handlers = …;
static struct pci_driver hisi_acc_vfio_pci_driver = …;
module_pci_driver(…) …;
MODULE_LICENSE(…) …;
MODULE_AUTHOR(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;