virtio-rng: hardware random number generator device
[qemu.git] / hw / virtio-pci.h
1 /*
2 * Virtio PCI Bindings
3 *
4 * Copyright IBM, Corp. 2007
5 * Copyright (c) 2009 CodeSourcery
6 *
7 * Authors:
8 * Anthony Liguori <aliguori@us.ibm.com>
9 * Paul Brook <paul@codesourcery.com>
10 *
11 * This work is licensed under the terms of the GNU GPL, version 2. See
12 * the COPYING file in the top-level directory.
13 */
14
15 #ifndef QEMU_VIRTIO_PCI_H
16 #define QEMU_VIRTIO_PCI_H
17
18 #include "virtio-blk.h"
19 #include "virtio-net.h"
20 #include "virtio-rng.h"
21 #include "virtio-serial.h"
22 #include "virtio-scsi.h"
23
24 /* Performance improves when virtqueue kick processing is decoupled from the
25 * vcpu thread using ioeventfd for some devices. */
26 #define VIRTIO_PCI_FLAG_USE_IOEVENTFD_BIT 1
27 #define VIRTIO_PCI_FLAG_USE_IOEVENTFD (1 << VIRTIO_PCI_FLAG_USE_IOEVENTFD_BIT)
28
29 typedef struct {
30 int virq;
31 unsigned int users;
32 } VirtIOIRQFD;
33
34 typedef struct {
35 PCIDevice pci_dev;
36 VirtIODevice *vdev;
37 MemoryRegion bar;
38 uint32_t flags;
39 uint32_t class_code;
40 uint32_t nvectors;
41 VirtIOBlkConf blk;
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 VirtIORNGConf rng;
51 bool ioeventfd_disabled;
52 bool ioeventfd_started;
53 VirtIOIRQFD *vector_irqfd;
54 } VirtIOPCIProxy;
55
56 void virtio_init_pci(VirtIOPCIProxy *proxy, VirtIODevice *vdev);
57 void virtio_pci_reset(DeviceState *d);
58
59 /* Virtio ABI version, if we increment this, we break the guest driver. */
60 #define VIRTIO_PCI_ABI_VERSION 0
61
62 #endif