pci_bus.h: tweak include guards
[qemu/ar7.git] / hw / vhost.h
blob0c47229f91b0cb14409e321cc5f3819d7e45bad9
1 #ifndef VHOST_H
2 #define VHOST_H
4 #include "hw/hw.h"
5 #include "hw/virtio.h"
6 #include "memory.h"
8 /* Generic structures common for any vhost based device. */
9 struct vhost_virtqueue {
10 int kick;
11 int call;
12 void *desc;
13 void *avail;
14 void *used;
15 int num;
16 unsigned long long used_phys;
17 unsigned used_size;
18 void *ring;
19 unsigned long long ring_phys;
20 unsigned ring_size;
23 typedef unsigned long vhost_log_chunk_t;
24 #define VHOST_LOG_PAGE 0x1000
25 #define VHOST_LOG_BITS (8 * sizeof(vhost_log_chunk_t))
26 #define VHOST_LOG_CHUNK (VHOST_LOG_PAGE * VHOST_LOG_BITS)
28 struct vhost_memory;
29 struct vhost_dev {
30 MemoryListener memory_listener;
31 int control;
32 struct vhost_memory *mem;
33 int n_mem_sections;
34 MemoryRegionSection *mem_sections;
35 struct vhost_virtqueue *vqs;
36 int nvqs;
37 unsigned long long features;
38 unsigned long long acked_features;
39 unsigned long long backend_features;
40 bool started;
41 bool log_enabled;
42 vhost_log_chunk_t *log;
43 unsigned long long log_size;
44 bool force;
47 int vhost_dev_init(struct vhost_dev *hdev, int devfd, const char *devpath,
48 bool force);
49 void vhost_dev_cleanup(struct vhost_dev *hdev);
50 bool vhost_dev_query(struct vhost_dev *hdev, VirtIODevice *vdev);
51 int vhost_dev_start(struct vhost_dev *hdev, VirtIODevice *vdev);
52 void vhost_dev_stop(struct vhost_dev *hdev, VirtIODevice *vdev);
53 int vhost_dev_enable_notifiers(struct vhost_dev *hdev, VirtIODevice *vdev);
54 void vhost_dev_disable_notifiers(struct vhost_dev *hdev, VirtIODevice *vdev);
56 #endif