target-i386: Add API to get note's size
[qemu/ar7.git] / hw / vhost.h
blob80e64df860b7bc37b0cd9029e6c1177eb1e1eb6a
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, bool force);
48 void vhost_dev_cleanup(struct vhost_dev *hdev);
49 bool vhost_dev_query(struct vhost_dev *hdev, VirtIODevice *vdev);
50 int vhost_dev_start(struct vhost_dev *hdev, VirtIODevice *vdev);
51 void vhost_dev_stop(struct vhost_dev *hdev, VirtIODevice *vdev);
52 int vhost_dev_enable_notifiers(struct vhost_dev *hdev, VirtIODevice *vdev);
53 void vhost_dev_disable_notifiers(struct vhost_dev *hdev, VirtIODevice *vdev);
55 #endif