]>
Commit | Line | Data |
---|---|---|
9fe1ebeb AK |
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 | ||
cf7c3f0c | 18 | #include "hw/pci/msi.h" |
12c5674b | 19 | #include "virtio-blk.h" |
9fe1ebeb | 20 | #include "virtio-net.h" |
16c915ba | 21 | #include "virtio-rng.h" |
9fe1ebeb | 22 | #include "virtio-serial.h" |
973abc7f | 23 | #include "virtio-scsi.h" |
0a2acf5e KF |
24 | #include "virtio-bus.h" |
25 | ||
085bccb7 KF |
26 | typedef struct VirtIOPCIProxy VirtIOPCIProxy; |
27 | ||
0a2acf5e KF |
28 | /* virtio-pci-bus */ |
29 | ||
30 | typedef struct VirtioBusState VirtioPCIBusState; | |
31 | typedef struct VirtioBusClass VirtioPCIBusClass; | |
32 | ||
33 | #define TYPE_VIRTIO_PCI_BUS "virtio-pci-bus" | |
34 | #define VIRTIO_PCI_BUS(obj) \ | |
35 | OBJECT_CHECK(VirtioPCIBusState, (obj), TYPE_VIRTIO_PCI_BUS) | |
36 | #define VIRTIO_PCI_BUS_GET_CLASS(obj) \ | |
37 | OBJECT_GET_CLASS(VirtioPCIBusClass, obj, TYPE_VIRTIO_PCI_BUS) | |
38 | #define VIRTIO_PCI_BUS_CLASS(klass) \ | |
39 | OBJECT_CLASS_CHECK(VirtioPCIBusClass, klass, TYPE_VIRTIO_PCI_BUS) | |
9fe1ebeb | 40 | |
5745e38a AK |
41 | /* Performance improves when virtqueue kick processing is decoupled from the |
42 | * vcpu thread using ioeventfd for some devices. */ | |
43 | #define VIRTIO_PCI_FLAG_USE_IOEVENTFD_BIT 1 | |
44 | #define VIRTIO_PCI_FLAG_USE_IOEVENTFD (1 << VIRTIO_PCI_FLAG_USE_IOEVENTFD_BIT) | |
45 | ||
7d37d351 | 46 | typedef struct { |
774345f9 | 47 | MSIMessage msg; |
7d37d351 JK |
48 | int virq; |
49 | unsigned int users; | |
50 | } VirtIOIRQFD; | |
51 | ||
085bccb7 KF |
52 | /* |
53 | * virtio-pci: This is the PCIDevice which has a virtio-pci-bus. | |
54 | */ | |
55 | #define TYPE_VIRTIO_PCI "virtio-pci" | |
56 | #define VIRTIO_PCI_GET_CLASS(obj) \ | |
57 | OBJECT_GET_CLASS(VirtioPCIClass, obj, TYPE_VIRTIO_PCI) | |
58 | #define VIRTIO_PCI_CLASS(klass) \ | |
59 | OBJECT_CLASS_CHECK(VirtioPCIClass, klass, TYPE_VIRTIO_PCI) | |
60 | #define VIRTIO_PCI(obj) \ | |
61 | OBJECT_CHECK(VirtIOPCIProxy, (obj), TYPE_VIRTIO_PCI) | |
62 | ||
63 | typedef struct VirtioPCIClass { | |
64 | PCIDeviceClass parent_class; | |
65 | int (*init)(VirtIOPCIProxy *vpci_dev); | |
66 | } VirtioPCIClass; | |
67 | ||
68 | struct VirtIOPCIProxy { | |
9fe1ebeb AK |
69 | PCIDevice pci_dev; |
70 | VirtIODevice *vdev; | |
da146d0a | 71 | MemoryRegion bar; |
9fe1ebeb | 72 | uint32_t flags; |
9fe1ebeb AK |
73 | uint32_t class_code; |
74 | uint32_t nvectors; | |
12c5674b | 75 | VirtIOBlkConf blk; |
9fe1ebeb AK |
76 | NICConf nic; |
77 | uint32_t host_features; | |
78 | #ifdef CONFIG_LINUX | |
79 | V9fsConf fsconf; | |
80 | #endif | |
81 | virtio_serial_conf serial; | |
82 | virtio_net_conf net; | |
973abc7f | 83 | VirtIOSCSIConf scsi; |
16c915ba | 84 | VirtIORNGConf rng; |
9fe1ebeb AK |
85 | bool ioeventfd_disabled; |
86 | bool ioeventfd_started; | |
7d37d351 | 87 | VirtIOIRQFD *vector_irqfd; |
2d620f59 | 88 | int nvqs_with_notifiers; |
085bccb7 KF |
89 | VirtioBusState bus; |
90 | }; | |
9fe1ebeb | 91 | |
befeac45 | 92 | void virtio_init_pci(VirtIOPCIProxy *proxy, VirtIODevice *vdev); |
8798d6c9 | 93 | void virtio_pci_reset(DeviceState *d); |
0a2acf5e | 94 | void virtio_pci_bus_new(VirtioBusState *bus, VirtIOPCIProxy *dev); |
befeac45 MT |
95 | |
96 | /* Virtio ABI version, if we increment this, we break the guest driver. */ | |
97 | #define VIRTIO_PCI_ABI_VERSION 0 | |
98 | ||
9fe1ebeb | 99 | #endif |