xref: /kvmtool/include/kvm/virtio-pci.h (revision 416b2c2dd82fd1546ab468ad5f55e8ef29ea1e91)
1 /*
2  * Virtio PCI driver
3  *
4  * This module allows virtio devices to be used over a virtual PCI device.
5  * This can be used with QEMU based VMMs like KVM or Xen.
6  *
7  * Copyright IBM Corp. 2007
8  *
9  * Authors:
10  *  Anthony Liguori  <aliguori@us.ibm.com>
11  *
12  * This header is BSD licensed so anyone can use the definitions to implement
13  * compatible drivers/servers.
14  */
15 
16 #ifndef _LINUX_VIRTIO_PCI_H
17 #define _LINUX_VIRTIO_PCI_H
18 
19 /* A 32-bit r/o bitmask of the features supported by the host */
20 #define VIRTIO_PCI_HOST_FEATURES	0
21 
22 /* A 32-bit r/w bitmask of features activated by the guest */
23 #define VIRTIO_PCI_GUEST_FEATURES	4
24 
25 /* A 32-bit r/w PFN for the currently selected queue */
26 #define VIRTIO_PCI_QUEUE_PFN		8
27 
28 /* A 16-bit r/o queue size for the currently selected queue */
29 #define VIRTIO_PCI_QUEUE_NUM		12
30 
31 /* A 16-bit r/w queue selector */
32 #define VIRTIO_PCI_QUEUE_SEL		14
33 
34 /* A 16-bit r/w queue notifier */
35 #define VIRTIO_PCI_QUEUE_NOTIFY		16
36 
37 /* An 8-bit device status register.  */
38 #define VIRTIO_PCI_STATUS		18
39 
40 /* An 8-bit r/o interrupt status register.  Reading the value will return the
41  * current contents of the ISR and will also clear it.  This is effectively
42  * a read-and-acknowledge. */
43 #define VIRTIO_PCI_ISR			19
44 
45 /* MSI-X registers: only enabled if MSI-X is enabled. */
46 /* A 16-bit vector for configuration changes. */
47 #define VIRTIO_MSI_CONFIG_VECTOR        20
48 
49 /* A 16-bit vector for selected queue notifications. */
50 #define VIRTIO_MSI_QUEUE_VECTOR         22
51 
52 /* Vector value used to disable MSI for queue */
53 #define VIRTIO_MSI_NO_VECTOR            0xffff
54 
55 /* Config space size */
56 #define VIRTIO_PCI_CONFIG_NOMSI         20
57 #define VIRTIO_PCI_CONFIG_MSI           24
58 
59 #endif /* _LINUX_VIRTIO_PCI_H */
60