]> git.proxmox.com Git - mirror_qemu.git/blame - hw/vhost.h
exec: move include files to include/exec/
[mirror_qemu.git] / hw / vhost.h
CommitLineData
d5970055
MT
1#ifndef VHOST_H
2#define VHOST_H
3
4#include "hw/hw.h"
5#include "hw/virtio.h"
022c62cb 6#include "exec/memory.h"
d5970055
MT
7
8/* Generic structures common for any vhost based device. */
9struct 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
23typedef 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
28struct vhost_memory;
29struct 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
47int vhost_dev_init(struct vhost_dev *hdev, int devfd, const char *devpath,
48 bool force);
d5970055 49void vhost_dev_cleanup(struct vhost_dev *hdev);
5430a28f 50bool vhost_dev_query(struct vhost_dev *hdev, VirtIODevice *vdev);
d5970055
MT
51int vhost_dev_start(struct vhost_dev *hdev, VirtIODevice *vdev);
52void vhost_dev_stop(struct vhost_dev *hdev, VirtIODevice *vdev);
b0b3db79
MT
53int vhost_dev_enable_notifiers(struct vhost_dev *hdev, VirtIODevice *vdev);
54void vhost_dev_disable_notifiers(struct vhost_dev *hdev, VirtIODevice *vdev);
d5970055
MT
55
56#endif