1
2
3
4
5
6
7
8
9
10
11
12
13#ifndef QEMU_PCIE_SRIOV_H
14#define QEMU_PCIE_SRIOV_H
15
16#include "hw/pci/pci.h"
17
18struct PCIESriovPF {
19 uint16_t num_vfs;
20 uint8_t vf_bar_type[PCI_NUM_REGIONS];
21 const char *vfname;
22 PCIDevice **vf;
23};
24
25struct PCIESriovVF {
26 PCIDevice *pf;
27 uint16_t vf_number;
28};
29
30void pcie_sriov_pf_init(PCIDevice *dev, uint16_t offset,
31 const char *vfname, uint16_t vf_dev_id,
32 uint16_t init_vfs, uint16_t total_vfs,
33 uint16_t vf_offset, uint16_t vf_stride);
34void pcie_sriov_pf_exit(PCIDevice *dev);
35
36
37void pcie_sriov_pf_init_vf_bar(PCIDevice *dev, int region_num,
38 uint8_t type, dma_addr_t size);
39
40
41void pcie_sriov_vf_register_bar(PCIDevice *dev, int region_num,
42 MemoryRegion *memory);
43
44
45
46
47
48
49#define SRIOV_SUP_PGSIZE_MINREQ 0x553
50
51
52
53
54
55void pcie_sriov_pf_add_sup_pgsize(PCIDevice *dev, uint16_t opt_sup_pgsize);
56
57
58void pcie_sriov_config_write(PCIDevice *dev, uint32_t address,
59 uint32_t val, int len);
60
61
62void pcie_sriov_pf_disable_vfs(PCIDevice *dev);
63
64
65uint16_t pcie_sriov_vf_number(PCIDevice *dev);
66
67
68
69
70
71PCIDevice *pcie_sriov_get_pf(PCIDevice *dev);
72
73
74
75
76
77PCIDevice *pcie_sriov_get_vf_at_index(PCIDevice *dev, int n);
78
79
80uint16_t pcie_sriov_num_vfs(PCIDevice *dev);
81
82#endif
83