root / hw / virtio / virtio-pci.h @ 47b43a1f
History | View | Annotate | Download (3.8 kB)
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 "hw/pci/msi.h" |
19 |
#include "hw/virtio/virtio-blk.h" |
20 |
#include "hw/virtio/virtio-net.h" |
21 |
#include "hw/virtio/virtio-rng.h" |
22 |
#include "hw/virtio/virtio-serial.h" |
23 |
#include "hw/virtio/virtio-scsi.h" |
24 |
#include "hw/virtio/virtio-balloon.h" |
25 |
#include "hw/virtio/virtio-bus.h" |
26 |
#include "hw/virtio/virtio-9p.h" |
27 |
|
28 |
typedef struct VirtIOPCIProxy VirtIOPCIProxy; |
29 |
typedef struct VirtIOBlkPCI VirtIOBlkPCI; |
30 |
typedef struct VirtIOSCSIPCI VirtIOSCSIPCI; |
31 |
typedef struct VirtIOBalloonPCI VirtIOBalloonPCI; |
32 |
|
33 |
/* virtio-pci-bus */
|
34 |
|
35 |
typedef struct VirtioBusState VirtioPCIBusState; |
36 |
typedef struct VirtioBusClass VirtioPCIBusClass; |
37 |
|
38 |
#define TYPE_VIRTIO_PCI_BUS "virtio-pci-bus" |
39 |
#define VIRTIO_PCI_BUS(obj) \
|
40 |
OBJECT_CHECK(VirtioPCIBusState, (obj), TYPE_VIRTIO_PCI_BUS) |
41 |
#define VIRTIO_PCI_BUS_GET_CLASS(obj) \
|
42 |
OBJECT_GET_CLASS(VirtioPCIBusClass, obj, TYPE_VIRTIO_PCI_BUS) |
43 |
#define VIRTIO_PCI_BUS_CLASS(klass) \
|
44 |
OBJECT_CLASS_CHECK(VirtioPCIBusClass, klass, TYPE_VIRTIO_PCI_BUS) |
45 |
|
46 |
/* Performance improves when virtqueue kick processing is decoupled from the
|
47 |
* vcpu thread using ioeventfd for some devices. */
|
48 |
#define VIRTIO_PCI_FLAG_USE_IOEVENTFD_BIT 1 |
49 |
#define VIRTIO_PCI_FLAG_USE_IOEVENTFD (1 << VIRTIO_PCI_FLAG_USE_IOEVENTFD_BIT) |
50 |
|
51 |
typedef struct { |
52 |
MSIMessage msg; |
53 |
int virq;
|
54 |
unsigned int users; |
55 |
} VirtIOIRQFD; |
56 |
|
57 |
/*
|
58 |
* virtio-pci: This is the PCIDevice which has a virtio-pci-bus.
|
59 |
*/
|
60 |
#define TYPE_VIRTIO_PCI "virtio-pci" |
61 |
#define VIRTIO_PCI_GET_CLASS(obj) \
|
62 |
OBJECT_GET_CLASS(VirtioPCIClass, obj, TYPE_VIRTIO_PCI) |
63 |
#define VIRTIO_PCI_CLASS(klass) \
|
64 |
OBJECT_CLASS_CHECK(VirtioPCIClass, klass, TYPE_VIRTIO_PCI) |
65 |
#define VIRTIO_PCI(obj) \
|
66 |
OBJECT_CHECK(VirtIOPCIProxy, (obj), TYPE_VIRTIO_PCI) |
67 |
|
68 |
typedef struct VirtioPCIClass { |
69 |
PCIDeviceClass parent_class; |
70 |
int (*init)(VirtIOPCIProxy *vpci_dev);
|
71 |
} VirtioPCIClass; |
72 |
|
73 |
struct VirtIOPCIProxy {
|
74 |
PCIDevice pci_dev; |
75 |
VirtIODevice *vdev; |
76 |
MemoryRegion bar; |
77 |
uint32_t flags; |
78 |
uint32_t class_code; |
79 |
uint32_t nvectors; |
80 |
NICConf nic; |
81 |
uint32_t host_features; |
82 |
#ifdef CONFIG_VIRTFS
|
83 |
V9fsConf fsconf; |
84 |
#endif
|
85 |
virtio_serial_conf serial; |
86 |
virtio_net_conf net; |
87 |
VirtIORNGConf rng; |
88 |
bool ioeventfd_disabled;
|
89 |
bool ioeventfd_started;
|
90 |
VirtIOIRQFD *vector_irqfd; |
91 |
int nvqs_with_notifiers;
|
92 |
VirtioBusState bus; |
93 |
}; |
94 |
|
95 |
|
96 |
/*
|
97 |
* virtio-scsi-pci: This extends VirtioPCIProxy.
|
98 |
*/
|
99 |
#define TYPE_VIRTIO_SCSI_PCI "virtio-scsi-pci" |
100 |
#define VIRTIO_SCSI_PCI(obj) \
|
101 |
OBJECT_CHECK(VirtIOSCSIPCI, (obj), TYPE_VIRTIO_SCSI_PCI) |
102 |
|
103 |
struct VirtIOSCSIPCI {
|
104 |
VirtIOPCIProxy parent_obj; |
105 |
VirtIOSCSI vdev; |
106 |
}; |
107 |
|
108 |
/*
|
109 |
* virtio-blk-pci: This extends VirtioPCIProxy.
|
110 |
*/
|
111 |
#define TYPE_VIRTIO_BLK_PCI "virtio-blk-pci" |
112 |
#define VIRTIO_BLK_PCI(obj) \
|
113 |
OBJECT_CHECK(VirtIOBlkPCI, (obj), TYPE_VIRTIO_BLK_PCI) |
114 |
|
115 |
struct VirtIOBlkPCI {
|
116 |
VirtIOPCIProxy parent_obj; |
117 |
VirtIOBlock vdev; |
118 |
VirtIOBlkConf blk; |
119 |
}; |
120 |
|
121 |
/*
|
122 |
* virtio-balloon-pci: This extends VirtioPCIProxy.
|
123 |
*/
|
124 |
#define TYPE_VIRTIO_BALLOON_PCI "virtio-balloon-pci" |
125 |
#define VIRTIO_BALLOON_PCI(obj) \
|
126 |
OBJECT_CHECK(VirtIOBalloonPCI, (obj), TYPE_VIRTIO_BALLOON_PCI) |
127 |
|
128 |
struct VirtIOBalloonPCI {
|
129 |
VirtIOPCIProxy parent_obj; |
130 |
VirtIOBalloon vdev; |
131 |
}; |
132 |
|
133 |
void virtio_init_pci(VirtIOPCIProxy *proxy, VirtIODevice *vdev);
|
134 |
void virtio_pci_bus_new(VirtioBusState *bus, VirtIOPCIProxy *dev);
|
135 |
|
136 |
/* Virtio ABI version, if we increment this, we break the guest driver. */
|
137 |
#define VIRTIO_PCI_ABI_VERSION 0 |
138 |
|
139 |
#endif
|