virtio/vhost: Add support for KVM in-kernel MSI injection
[qemu-kvm.git] / hw / virtio-pci.h
blob8d28d4b7897fd4bd470a31b82f2b217c96619bc7
1 /*
2 * Virtio PCI Bindings
4 * Copyright IBM, Corp. 2007
5 * Copyright (c) 2009 CodeSourcery
7 * Authors:
8 * Anthony Liguori <aliguori@us.ibm.com>
9 * Paul Brook <paul@codesourcery.com>
11 * This work is licensed under the terms of the GNU GPL, version 2. See
12 * the COPYING file in the top-level directory.
15 #ifndef QEMU_VIRTIO_PCI_H
16 #define QEMU_VIRTIO_PCI_H
18 #include "virtio-net.h"
19 #include "virtio-serial.h"
20 #include "virtio-scsi.h"
22 /* Performance improves when virtqueue kick processing is decoupled from the
23 * vcpu thread using ioeventfd for some devices. */
24 #define VIRTIO_PCI_FLAG_USE_IOEVENTFD_BIT 1
25 #define VIRTIO_PCI_FLAG_USE_IOEVENTFD (1 << VIRTIO_PCI_FLAG_USE_IOEVENTFD_BIT)
27 typedef struct {
28 int virq;
29 unsigned int users;
30 } VirtIOIRQFD;
32 typedef struct {
33 PCIDevice pci_dev;
34 VirtIODevice *vdev;
35 MemoryRegion bar;
36 MemoryRegion msix_bar;
37 uint32_t flags;
38 uint32_t class_code;
39 uint32_t nvectors;
40 BlockConf block;
41 char *block_serial;
42 NICConf nic;
43 uint32_t host_features;
44 #ifdef CONFIG_LINUX
45 V9fsConf fsconf;
46 #endif
47 virtio_serial_conf serial;
48 virtio_net_conf net;
49 VirtIOSCSIConf scsi;
50 bool ioeventfd_disabled;
51 bool ioeventfd_started;
52 VirtIOIRQFD *vector_irqfd;
53 } VirtIOPCIProxy;
55 void virtio_init_pci(VirtIOPCIProxy *proxy, VirtIODevice *vdev);
56 void virtio_pci_reset(DeviceState *d);
58 /* Virtio ABI version, if we increment this, we break the guest driver. */
59 #define VIRTIO_PCI_ABI_VERSION 0
61 #endif