drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.h

Source file repositories/reference/linux-study-clean/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.h

File Facts

System
Linux kernel
Corpus path
drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.h
Extension
.h
Size
4234 bytes
Lines
166
Domain
Driver Families
Bucket
drivers/vfio
Inferred role
Driver Families: implementation source
Status
source implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

struct acc_vf_data {
#define QM_MATCH_SIZE offsetofend(struct acc_vf_data, qm_rsv_state)
	/* QM match information */
	u64 acc_magic;
	u32 qp_num;
	u32 dev_id;
	u32 que_iso_cfg;
	u32 qp_base;
	u32 vf_qm_state;
	/* QM reserved match information */
	u16 major_ver;
	u16 minor_ver;
	u32 qm_rsv_state[2];

	/* QM RW regs */
	u32 aeq_int_mask;
	u32 eq_int_mask;
	u32 ifc_int_source;
	u32 ifc_int_mask;
	u32 ifc_int_set;
	u32 page_size;

	/* QM_EQC_DW has 7 regs */
	u32 qm_eqc_dw[7];

	/* QM_AEQC_DW has 7 regs */
	u32 qm_aeqc_dw[7];

	/* QM reserved 5 regs */
	u32 qm_rsv_regs[5];
	u32 padding;
	/* QM memory init information */
	u64 eqe_dma;
	u64 aeqe_dma;
	u64 sqc_dma;
	u64 cqc_dma;
};

struct hisi_acc_vf_migration_file {
	struct file *filp;
	struct mutex lock;
	bool disabled;

	struct hisi_acc_vf_core_device *hisi_acc_vdev;
	struct acc_vf_data vf_data;
	size_t total_length;
};

struct hisi_acc_vf_core_device {
	struct vfio_pci_core_device core_device;
	u8 match_done;
	bool set_reset_flag;
	/*
	 * io_base is only valid when dev_opened is true,
	 * which is protected by open_mutex.
	 */
	bool dev_opened;
	/* Ensure the accuracy of dev_opened operation */
	struct mutex open_mutex;

	/* For migration state */
	struct mutex state_mutex;
	enum vfio_device_mig_state mig_state;
	struct pci_dev *pf_dev;
	struct pci_dev *vf_dev;
	struct hisi_qm *pf_qm;
	struct hisi_qm vf_qm;
	enum hw_drv_mode drv_mode;
	/*
	 * vf_qm_state represents the QM_VF_STATE register value.
	 * It is set by Guest driver for the ACC VF dev indicating
	 * the driver has loaded and configured the dev correctly.
	 */
	u32 vf_qm_state;
	int vf_id;
	struct hisi_acc_vf_migration_file *resuming_migf;
	struct hisi_acc_vf_migration_file *saving_migf;

	/*
	 * It holds migration data corresponding to the last migration
	 * and is used by the debugfs interface to report it.
	 */
	struct hisi_acc_vf_migration_file *debug_migf;
};
#endif /* HISI_ACC_VFIO_PCI_H */

Annotation

Implementation Notes