etrax: Update ethernet mgm-ctrl reg on writes
[qemu/agraf.git] / hw / vhost.h
blob86dd834dbef74c4f952c91f5692f66d2333e85f4
1 #ifndef VHOST_H
2 #define VHOST_H
4 #include "hw/hw.h"
5 #include "hw/virtio.h"
7 /* Generic structures common for any vhost based device. */
8 struct vhost_virtqueue {
9 int kick;
10 int call;
11 void *desc;
12 void *avail;
13 void *used;
14 int num;
15 unsigned long long used_phys;
16 unsigned used_size;
17 void *ring;
18 unsigned long long ring_phys;
19 unsigned ring_size;
22 typedef unsigned long vhost_log_chunk_t;
23 #define VHOST_LOG_PAGE 0x1000
24 #define VHOST_LOG_BITS (8 * sizeof(vhost_log_chunk_t))
25 #define VHOST_LOG_CHUNK (VHOST_LOG_PAGE * VHOST_LOG_BITS)
27 struct vhost_memory;
28 struct vhost_dev {
29 CPUPhysMemoryClient client;
30 int control;
31 struct vhost_memory *mem;
32 struct vhost_virtqueue *vqs;
33 int nvqs;
34 unsigned long long features;
35 unsigned long long acked_features;
36 unsigned long long backend_features;
37 bool started;
38 bool log_enabled;
39 vhost_log_chunk_t *log;
40 unsigned long long log_size;
43 int vhost_dev_init(struct vhost_dev *hdev, int devfd);
44 void vhost_dev_cleanup(struct vhost_dev *hdev);
45 int vhost_dev_start(struct vhost_dev *hdev, VirtIODevice *vdev);
46 void vhost_dev_stop(struct vhost_dev *hdev, VirtIODevice *vdev);
48 #endif