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
10struct 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
33struct 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; /* supported device features */
39 u64 negotiated_features; /* negotiated features */
40 u8 vdpa_index; /* rsvd for future subdevice use */
41 u8 num_vqs; /* num vqs in use */
42 u8 mac[ETH_ALEN]; /* mac selected when the device was added */
43 struct vdpa_callback config_cb;
44 struct notifier_block nb;
45};
46
47#define PDS_VDPA_PACKED_INVERT_IDX 0x8000
48
49void pds_vdpa_release_irqs(struct pds_vdpa_device *pdsv);
50int pds_vdpa_get_mgmt_info(struct pds_vdpa_aux *vdpa_aux);
51#endif /* _VDPA_DEV_H_ */
52

source code of linux/drivers/vdpa/pds/vdpa_dev.h