1 #ifndef KVM__VIRTIO_PCI_H 2 #define KVM__VIRTIO_PCI_H 3 4 #include "kvm/pci.h" 5 #include "kvm/virtio-trans.h" 6 7 #include <linux/types.h> 8 9 #define VIRTIO_PCI_MAX_VQ 3 10 #define VIRTIO_PCI_MAX_CONFIG 1 11 12 struct kvm; 13 14 struct virtio_pci_ioevent_param { 15 struct virtio_trans *vtrans; 16 u32 vq; 17 }; 18 19 struct virtio_pci { 20 struct pci_device_header pci_hdr; 21 void *dev; 22 23 u16 base_addr; 24 u8 status; 25 u8 isr; 26 27 /* MSI-X */ 28 u16 config_vector; 29 u32 config_gsi; 30 u32 vq_vector[VIRTIO_PCI_MAX_VQ]; 31 u32 gsis[VIRTIO_PCI_MAX_VQ]; 32 u32 msix_io_block; 33 u64 msix_pba; 34 struct msix_table msix_table[VIRTIO_PCI_MAX_VQ + VIRTIO_PCI_MAX_CONFIG]; 35 36 /* virtio queue */ 37 u16 queue_selector; 38 struct virtio_pci_ioevent_param ioeventfds[VIRTIO_PCI_MAX_VQ]; 39 }; 40 41 int virtio_pci__init(struct kvm *kvm, struct virtio_trans *vtrans, void *dev, 42 int device_id, int subsys_id, int class); 43 int virtio_pci__exit(struct kvm *kvm, struct virtio_trans *vtrans); 44 int virtio_pci__signal_vq(struct kvm *kvm, struct virtio_trans *vtrans, u32 vq); 45 int virtio_pci__signal_config(struct kvm *kvm, struct virtio_trans *vtrans); 46 47 struct virtio_trans_ops *virtio_pci__get_trans_ops(void); 48 49 #endif 50