Fix integer overflow in block migration bandwidth calculation
[qemu/cris-port.git] / hw / vhost.h
blobc8c595a147d48f36b67795d4f33d735005d5a7ca
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;
41 bool force;
44 int vhost_dev_init(struct vhost_dev *hdev, int devfd, bool force);
45 void vhost_dev_cleanup(struct vhost_dev *hdev);
46 bool vhost_dev_query(struct vhost_dev *hdev, VirtIODevice *vdev);
47 int vhost_dev_start(struct vhost_dev *hdev, VirtIODevice *vdev);
48 void vhost_dev_stop(struct vhost_dev *hdev, VirtIODevice *vdev);
50 #endif