drivers/vdpa/mlx5/core/mlx5_vdpa.h

Source file repositories/reference/linux-study-clean/drivers/vdpa/mlx5/core/mlx5_vdpa.h

File Facts

System
Linux kernel
Corpus path
drivers/vdpa/mlx5/core/mlx5_vdpa.h
Extension
.h
Size
5267 bytes
Lines
188
Domain
Driver Families
Bucket
drivers/vdpa
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 mlx5_vdpa_direct_mr {
	u64 start;
	u64 end;
	u32 perm;
	u32 mr;
	struct sg_table sg_head;
	int log_size;
	int nsg;
	int nent;
	struct list_head list;
	u64 offset;
};

struct mlx5_vdpa_mr {
	u32 mkey;

	/* list of direct MRs descendants of this indirect mr */
	struct list_head head;
	unsigned long num_directs;
	unsigned long num_klms;

	struct vhost_iotlb *iotlb;

	bool user_mr;

	refcount_t refcount;
	struct list_head mr_list;
};

struct mlx5_vdpa_resources {
	u32 pdn;
	struct mlx5_uars_page *uar;
	void __iomem *kick_addr;
	u64 phys_kick_addr;
	u16 uid;
	u32 null_mkey;
	bool valid;
};

struct mlx5_control_vq {
	struct vhost_iotlb *iotlb;
	/* spinlock to synchronize iommu table */
	spinlock_t iommu_lock;
	struct vringh vring;
	bool ready;
	u64 desc_addr;
	u64 device_addr;
	u64 driver_addr;
	struct vdpa_callback event_cb;
	struct vringh_kiov riov;
	struct vringh_kiov wiov;
	unsigned short head;
	unsigned int received_desc;
	unsigned int completed_desc;
};

struct mlx5_vdpa_wq_ent {
	struct work_struct work;
	struct mlx5_vdpa_dev *mvdev;
};

enum {
	MLX5_VDPA_DATAVQ_GROUP,
	MLX5_VDPA_CVQ_GROUP,
	MLX5_VDPA_DATAVQ_DESC_GROUP,
	MLX5_VDPA_NUMVQ_GROUPS
};

enum {
	MLX5_VDPA_NUM_AS = 2
};

struct mlx5_vdpa_mr_resources {
	struct mlx5_vdpa_mr *mr[MLX5_VDPA_NUM_AS];
	unsigned int group2asid[MLX5_VDPA_NUMVQ_GROUPS];

	/* Pre-deletion mr list */
	struct list_head mr_list_head;

	/* Deferred mr list */
	struct list_head mr_gc_list_head;
	struct workqueue_struct *wq_gc;
	struct delayed_work gc_dwork_ent;

	struct mutex lock;

	atomic_t shutdown;
};

struct mlx5_vdpa_dev {

Annotation

Implementation Notes