xref: /openbmc/linux/drivers/vdpa/pds/vdpa_dev.h (revision 9134211f)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /* Copyright(c) 2023 Advanced Micro Devices, Inc */
3 
4 #ifndef _VDPA_DEV_H_
5 #define _VDPA_DEV_H_
6 
7 #include <linux/pci.h>
8 #include <linux/vdpa.h>
9 
10 struct pds_vdpa_vq_info {
11 	bool ready;
12 	u64 desc_addr;
13 	u64 avail_addr;
14 	u64 used_addr;
15 	u32 q_len;
16 	u16 qid;
17 	int irq;
18 	char irq_name[32];
19 
20 	void __iomem *notify;
21 	dma_addr_t notify_pa;
22 
23 	u64 doorbell;
24 	u16 avail_idx;
25 	u16 used_idx;
26 
27 	struct vdpa_callback event_cb;
28 	struct pds_vdpa_device *pdsv;
29 };
30 
31 #define PDS_VDPA_MAX_QUEUES	65
32 #define PDS_VDPA_MAX_QLEN	32768
33 struct pds_vdpa_device {
34 	struct vdpa_device vdpa_dev;
35 	struct pds_vdpa_aux *vdpa_aux;
36 
37 	struct pds_vdpa_vq_info vqs[PDS_VDPA_MAX_QUEUES];
38 	u64 supported_features;		/* specified device features */
39 	u64 req_features;		/* features requested by vdpa */
40 	u8 vdpa_index;			/* rsvd for future subdevice use */
41 	u8 num_vqs;			/* num vqs in use */
42 	struct vdpa_callback config_cb;
43 	struct notifier_block nb;
44 };
45 
46 #define PDS_VDPA_PACKED_INVERT_IDX	0x8000
47 
48 int pds_vdpa_get_mgmt_info(struct pds_vdpa_aux *vdpa_aux);
49 #endif /* _VDPA_DEV_H_ */
50