]> git.proxmox.com Git - mirror_qemu.git/blame - hw/virtio-pci.h
hw: include hw header files with full paths
[mirror_qemu.git] / hw / virtio-pci.h
CommitLineData
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"
83c9f4ca
PB
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"
0a2acf5e 26
085bccb7
FK
27typedef struct VirtIOPCIProxy VirtIOPCIProxy;
28
0a2acf5e
FK
29/* virtio-pci-bus */
30
31typedef struct VirtioBusState VirtioPCIBusState;
32typedef struct VirtioBusClass VirtioPCIBusClass;
33
34#define TYPE_VIRTIO_PCI_BUS "virtio-pci-bus"
35#define VIRTIO_PCI_BUS(obj) \
36 OBJECT_CHECK(VirtioPCIBusState, (obj), TYPE_VIRTIO_PCI_BUS)
37#define VIRTIO_PCI_BUS_GET_CLASS(obj) \
38 OBJECT_GET_CLASS(VirtioPCIBusClass, obj, TYPE_VIRTIO_PCI_BUS)
39#define VIRTIO_PCI_BUS_CLASS(klass) \
40 OBJECT_CLASS_CHECK(VirtioPCIBusClass, klass, TYPE_VIRTIO_PCI_BUS)
9fe1ebeb 41
5745e38a
AK
42/* Performance improves when virtqueue kick processing is decoupled from the
43 * vcpu thread using ioeventfd for some devices. */
44#define VIRTIO_PCI_FLAG_USE_IOEVENTFD_BIT 1
45#define VIRTIO_PCI_FLAG_USE_IOEVENTFD (1 << VIRTIO_PCI_FLAG_USE_IOEVENTFD_BIT)
46
7d37d351 47typedef struct {
774345f9 48 MSIMessage msg;
7d37d351
JK
49 int virq;
50 unsigned int users;
51} VirtIOIRQFD;
52
085bccb7
FK
53/*
54 * virtio-pci: This is the PCIDevice which has a virtio-pci-bus.
55 */
56#define TYPE_VIRTIO_PCI "virtio-pci"
57#define VIRTIO_PCI_GET_CLASS(obj) \
58 OBJECT_GET_CLASS(VirtioPCIClass, obj, TYPE_VIRTIO_PCI)
59#define VIRTIO_PCI_CLASS(klass) \
60 OBJECT_CLASS_CHECK(VirtioPCIClass, klass, TYPE_VIRTIO_PCI)
61#define VIRTIO_PCI(obj) \
62 OBJECT_CHECK(VirtIOPCIProxy, (obj), TYPE_VIRTIO_PCI)
63
64typedef struct VirtioPCIClass {
65 PCIDeviceClass parent_class;
66 int (*init)(VirtIOPCIProxy *vpci_dev);
67} VirtioPCIClass;
68
69struct VirtIOPCIProxy {
9fe1ebeb
AK
70 PCIDevice pci_dev;
71 VirtIODevice *vdev;
da146d0a 72 MemoryRegion bar;
9fe1ebeb 73 uint32_t flags;
9fe1ebeb
AK
74 uint32_t class_code;
75 uint32_t nvectors;
12c5674b 76 VirtIOBlkConf blk;
9fe1ebeb
AK
77 NICConf nic;
78 uint32_t host_features;
7e6b14df 79#ifdef CONFIG_VIRTFS
9fe1ebeb
AK
80 V9fsConf fsconf;
81#endif
82 virtio_serial_conf serial;
83 virtio_net_conf net;
973abc7f 84 VirtIOSCSIConf scsi;
16c915ba 85 VirtIORNGConf rng;
9fe1ebeb
AK
86 bool ioeventfd_disabled;
87 bool ioeventfd_started;
7d37d351 88 VirtIOIRQFD *vector_irqfd;
2d620f59 89 int nvqs_with_notifiers;
085bccb7
FK
90 VirtioBusState bus;
91};
9fe1ebeb 92
befeac45 93void virtio_init_pci(VirtIOPCIProxy *proxy, VirtIODevice *vdev);
0a2acf5e 94void 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