1 #ifndef KVM__VIRTIO_PCI_H
2 #define KVM__VIRTIO_PCI_H
6 #include <linux/types.h>
8 #define VIRTIO_PCI_MAX_VQ 3
12 struct virtio_pci_ops
{
13 void (*set_config
)(struct kvm
*kvm
, void *dev
, u8 data
, u32 offset
);
14 u8 (*get_config
)(struct kvm
*kvm
, void *dev
, u32 offset
);
16 u32 (*get_host_features
)(struct kvm
*kvm
, void *dev
);
17 void (*set_guest_features
)(struct kvm
*kvm
, void *dev
, u32 features
);
19 int (*init_vq
)(struct kvm
*kvm
, void *dev
, u32 vq
, u32 pfn
);
20 int (*notify_vq
)(struct kvm
*kvm
, void *dev
, u32 vq
);
21 int (*get_pfn_vq
)(struct kvm
*kvm
, void *dev
, u32 vq
);
22 int (*get_size_vq
)(struct kvm
*kvm
, void *dev
, u32 vq
);
25 struct virtio_pci_ioevent_param
{
26 struct virtio_pci
*vpci
;
31 struct pci_device_header pci_hdr
;
32 struct virtio_pci_ops ops
;
42 u32 vq_vector
[VIRTIO_PCI_MAX_VQ
];
43 u32 gsis
[VIRTIO_PCI_MAX_VQ
];
47 struct msix_table msix_table
[VIRTIO_PCI_MAX_VQ
+ 1];
51 struct virtio_pci_ioevent_param ioeventfds
[VIRTIO_PCI_MAX_VQ
];
54 int virtio_pci__init(struct kvm
*kvm
, struct virtio_pci
*vpci
, void *dev
,
55 int device_id
, int subsys_id
);
56 int virtio_pci__signal_vq(struct kvm
*kvm
, struct virtio_pci
*vpci
, u32 vq
);
57 int virtio_pci__signal_config(struct kvm
*kvm
, struct virtio_pci
*vpci
);