Statistics
| Branch: | Revision:

root / hw / virtio-pci.h @ a1bc20df

History | View | Annotate | Download (1.5 kB)

1 9fe1ebeb Aneesh Kumar K.V
/*
2 9fe1ebeb Aneesh Kumar K.V
 * Virtio PCI Bindings
3 9fe1ebeb Aneesh Kumar K.V
 *
4 9fe1ebeb Aneesh Kumar K.V
 * Copyright IBM, Corp. 2007
5 9fe1ebeb Aneesh Kumar K.V
 * Copyright (c) 2009 CodeSourcery
6 9fe1ebeb Aneesh Kumar K.V
 *
7 9fe1ebeb Aneesh Kumar K.V
 * Authors:
8 9fe1ebeb Aneesh Kumar K.V
 *  Anthony Liguori   <aliguori@us.ibm.com>
9 9fe1ebeb Aneesh Kumar K.V
 *  Paul Brook        <paul@codesourcery.com>
10 9fe1ebeb Aneesh Kumar K.V
 *
11 9fe1ebeb Aneesh Kumar K.V
 * This work is licensed under the terms of the GNU GPL, version 2.  See
12 9fe1ebeb Aneesh Kumar K.V
 * the COPYING file in the top-level directory.
13 9fe1ebeb Aneesh Kumar K.V
 */
14 9fe1ebeb Aneesh Kumar K.V
15 9fe1ebeb Aneesh Kumar K.V
#ifndef QEMU_VIRTIO_PCI_H
16 9fe1ebeb Aneesh Kumar K.V
#define QEMU_VIRTIO_PCI_H
17 9fe1ebeb Aneesh Kumar K.V
18 12c5674b Paolo Bonzini
#include "virtio-blk.h"
19 9fe1ebeb Aneesh Kumar K.V
#include "virtio-net.h"
20 9fe1ebeb Aneesh Kumar K.V
#include "virtio-serial.h"
21 973abc7f Stefan Hajnoczi
#include "virtio-scsi.h"
22 9fe1ebeb Aneesh Kumar K.V
23 5745e38a Aneesh Kumar K.V
/* Performance improves when virtqueue kick processing is decoupled from the
24 5745e38a Aneesh Kumar K.V
 * vcpu thread using ioeventfd for some devices. */
25 5745e38a Aneesh Kumar K.V
#define VIRTIO_PCI_FLAG_USE_IOEVENTFD_BIT 1
26 5745e38a Aneesh Kumar K.V
#define VIRTIO_PCI_FLAG_USE_IOEVENTFD   (1 << VIRTIO_PCI_FLAG_USE_IOEVENTFD_BIT)
27 5745e38a Aneesh Kumar K.V
28 9fe1ebeb Aneesh Kumar K.V
typedef struct {
29 7d37d351 Jan Kiszka
    int virq;
30 7d37d351 Jan Kiszka
    unsigned int users;
31 7d37d351 Jan Kiszka
} VirtIOIRQFD;
32 7d37d351 Jan Kiszka
33 7d37d351 Jan Kiszka
typedef struct {
34 9fe1ebeb Aneesh Kumar K.V
    PCIDevice pci_dev;
35 9fe1ebeb Aneesh Kumar K.V
    VirtIODevice *vdev;
36 da146d0a Avi Kivity
    MemoryRegion bar;
37 9fe1ebeb Aneesh Kumar K.V
    uint32_t flags;
38 9fe1ebeb Aneesh Kumar K.V
    uint32_t class_code;
39 9fe1ebeb Aneesh Kumar K.V
    uint32_t nvectors;
40 12c5674b Paolo Bonzini
    VirtIOBlkConf blk;
41 9fe1ebeb Aneesh Kumar K.V
    NICConf nic;
42 9fe1ebeb Aneesh Kumar K.V
    uint32_t host_features;
43 9fe1ebeb Aneesh Kumar K.V
#ifdef CONFIG_LINUX
44 9fe1ebeb Aneesh Kumar K.V
    V9fsConf fsconf;
45 9fe1ebeb Aneesh Kumar K.V
#endif
46 9fe1ebeb Aneesh Kumar K.V
    virtio_serial_conf serial;
47 9fe1ebeb Aneesh Kumar K.V
    virtio_net_conf net;
48 973abc7f Stefan Hajnoczi
    VirtIOSCSIConf scsi;
49 9fe1ebeb Aneesh Kumar K.V
    bool ioeventfd_disabled;
50 9fe1ebeb Aneesh Kumar K.V
    bool ioeventfd_started;
51 7d37d351 Jan Kiszka
    VirtIOIRQFD *vector_irqfd;
52 9fe1ebeb Aneesh Kumar K.V
} VirtIOPCIProxy;
53 9fe1ebeb Aneesh Kumar K.V
54 befeac45 Michael S. Tsirkin
void virtio_init_pci(VirtIOPCIProxy *proxy, VirtIODevice *vdev);
55 8798d6c9 Aneesh Kumar K.V
void virtio_pci_reset(DeviceState *d);
56 befeac45 Michael S. Tsirkin
57 befeac45 Michael S. Tsirkin
/* Virtio ABI version, if we increment this, we break the guest driver. */
58 befeac45 Michael S. Tsirkin
#define VIRTIO_PCI_ABI_VERSION          0
59 befeac45 Michael S. Tsirkin
60 9fe1ebeb Aneesh Kumar K.V
#endif