]>
Commit | Line | Data |
---|---|---|
d5970055 MT |
1 | #ifndef VHOST_H |
2 | #define VHOST_H | |
3 | ||
4 | #include "hw/hw.h" | |
5 | #include "hw/virtio.h" | |
04097f7c | 6 | #include "memory.h" |
d5970055 MT |
7 | |
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; | |
21 | }; | |
22 | ||
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) | |
27 | ||
28 | struct vhost_memory; | |
29 | struct vhost_dev { | |
04097f7c | 30 | MemoryListener memory_listener; |
d5970055 MT |
31 | int control; |
32 | struct vhost_memory *mem; | |
2817b260 AK |
33 | int n_mem_sections; |
34 | MemoryRegionSection *mem_sections; | |
d5970055 MT |
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; | |
5430a28f | 44 | bool force; |
d5970055 MT |
45 | }; |
46 | ||
1241ed94 SH |
47 | int vhost_dev_init(struct vhost_dev *hdev, int devfd, const char *devpath, |
48 | bool force); | |
d5970055 | 49 | void vhost_dev_cleanup(struct vhost_dev *hdev); |
5430a28f | 50 | bool vhost_dev_query(struct vhost_dev *hdev, VirtIODevice *vdev); |
d5970055 MT |
51 | int vhost_dev_start(struct vhost_dev *hdev, VirtIODevice *vdev); |
52 | void vhost_dev_stop(struct vhost_dev *hdev, VirtIODevice *vdev); | |
b0b3db79 MT |
53 | int vhost_dev_enable_notifiers(struct vhost_dev *hdev, VirtIODevice *vdev); |
54 | void vhost_dev_disable_notifiers(struct vhost_dev *hdev, VirtIODevice *vdev); | |
d5970055 MT |
55 | |
56 | #endif |