trace: [stderr] Port to generic event information and new control interface
[qemu.git] / hw / virtio-pci.h
blobbfe7a8e1ca045c04071e1826e2d3b39e7088d51e
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 "hw/pci/msi.h"
19 #include "hw/virtio-blk.h"
20 #include "hw/virtio-net.h"
21 #include "hw/virtio-rng.h"
22 #include "hw/virtio-serial.h"
23 #include "hw/virtio-scsi.h"
24 #include "hw/virtio-bus.h"
25 #include "hw/9pfs/virtio-9p-device.h"
27 typedef struct VirtIOPCIProxy VirtIOPCIProxy;
28 typedef struct VirtIOBlkPCI VirtIOBlkPCI;
29 typedef struct VirtIOSCSIPCI VirtIOSCSIPCI;
31 /* virtio-pci-bus */
33 typedef struct VirtioBusState VirtioPCIBusState;
34 typedef struct VirtioBusClass VirtioPCIBusClass;
36 #define TYPE_VIRTIO_PCI_BUS "virtio-pci-bus"
37 #define VIRTIO_PCI_BUS(obj) \
38 OBJECT_CHECK(VirtioPCIBusState, (obj), TYPE_VIRTIO_PCI_BUS)
39 #define VIRTIO_PCI_BUS_GET_CLASS(obj) \
40 OBJECT_GET_CLASS(VirtioPCIBusClass, obj, TYPE_VIRTIO_PCI_BUS)
41 #define VIRTIO_PCI_BUS_CLASS(klass) \
42 OBJECT_CLASS_CHECK(VirtioPCIBusClass, klass, TYPE_VIRTIO_PCI_BUS)
44 /* Performance improves when virtqueue kick processing is decoupled from the
45 * vcpu thread using ioeventfd for some devices. */
46 #define VIRTIO_PCI_FLAG_USE_IOEVENTFD_BIT 1
47 #define VIRTIO_PCI_FLAG_USE_IOEVENTFD (1 << VIRTIO_PCI_FLAG_USE_IOEVENTFD_BIT)
49 typedef struct {
50 MSIMessage msg;
51 int virq;
52 unsigned int users;
53 } VirtIOIRQFD;
56 * virtio-pci: This is the PCIDevice which has a virtio-pci-bus.
58 #define TYPE_VIRTIO_PCI "virtio-pci"
59 #define VIRTIO_PCI_GET_CLASS(obj) \
60 OBJECT_GET_CLASS(VirtioPCIClass, obj, TYPE_VIRTIO_PCI)
61 #define VIRTIO_PCI_CLASS(klass) \
62 OBJECT_CLASS_CHECK(VirtioPCIClass, klass, TYPE_VIRTIO_PCI)
63 #define VIRTIO_PCI(obj) \
64 OBJECT_CHECK(VirtIOPCIProxy, (obj), TYPE_VIRTIO_PCI)
66 typedef struct VirtioPCIClass {
67 PCIDeviceClass parent_class;
68 int (*init)(VirtIOPCIProxy *vpci_dev);
69 } VirtioPCIClass;
71 struct VirtIOPCIProxy {
72 PCIDevice pci_dev;
73 VirtIODevice *vdev;
74 MemoryRegion bar;
75 uint32_t flags;
76 uint32_t class_code;
77 uint32_t nvectors;
78 NICConf nic;
79 uint32_t host_features;
80 #ifdef CONFIG_VIRTFS
81 V9fsConf fsconf;
82 #endif
83 virtio_serial_conf serial;
84 virtio_net_conf net;
85 VirtIORNGConf rng;
86 bool ioeventfd_disabled;
87 bool ioeventfd_started;
88 VirtIOIRQFD *vector_irqfd;
89 int nvqs_with_notifiers;
90 VirtioBusState bus;
95 * virtio-scsi-pci: This extends VirtioPCIProxy.
97 #define TYPE_VIRTIO_SCSI_PCI "virtio-scsi-pci"
98 #define VIRTIO_SCSI_PCI(obj) \
99 OBJECT_CHECK(VirtIOSCSIPCI, (obj), TYPE_VIRTIO_SCSI_PCI)
101 struct VirtIOSCSIPCI {
102 VirtIOPCIProxy parent_obj;
103 VirtIOSCSI vdev;
107 * virtio-blk-pci: This extends VirtioPCIProxy.
109 #define TYPE_VIRTIO_BLK_PCI "virtio-blk-pci"
110 #define VIRTIO_BLK_PCI(obj) \
111 OBJECT_CHECK(VirtIOBlkPCI, (obj), TYPE_VIRTIO_BLK_PCI)
113 struct VirtIOBlkPCI {
114 VirtIOPCIProxy parent_obj;
115 VirtIOBlock vdev;
116 VirtIOBlkConf blk;
119 void virtio_init_pci(VirtIOPCIProxy *proxy, VirtIODevice *vdev);
120 void virtio_pci_bus_new(VirtioBusState *bus, VirtIOPCIProxy *dev);
122 /* Virtio ABI version, if we increment this, we break the guest driver. */
123 #define VIRTIO_PCI_ABI_VERSION 0
125 #endif