6 #include "exec/memory.h"
8 /* Generic structures common for any vhost based device. */
9 struct vhost_virtqueue {
16 unsigned long long used_phys;
19 unsigned long long ring_phys;
21 EventNotifier masked_notifier;
24 typedef unsigned long vhost_log_chunk_t;
25 #define VHOST_LOG_PAGE 0x1000
26 #define VHOST_LOG_BITS (8 * sizeof(vhost_log_chunk_t))
27 #define VHOST_LOG_CHUNK (VHOST_LOG_PAGE * VHOST_LOG_BITS)
31 MemoryListener memory_listener;
33 struct vhost_memory *mem;
35 MemoryRegionSection *mem_sections;
36 struct vhost_virtqueue *vqs;
38 /* the first virtuque which would be used by this vhost dev */
40 unsigned long long features;
41 unsigned long long acked_features;
42 unsigned long long backend_features;
45 vhost_log_chunk_t *log;
46 unsigned long long log_size;
50 int vhost_dev_init(struct vhost_dev *hdev, int devfd, const char *devpath,
52 void vhost_dev_cleanup(struct vhost_dev *hdev);
53 bool vhost_dev_query(struct vhost_dev *hdev, VirtIODevice *vdev);
54 int vhost_dev_start(struct vhost_dev *hdev, VirtIODevice *vdev);
55 void vhost_dev_stop(struct vhost_dev *hdev, VirtIODevice *vdev);
56 int vhost_dev_enable_notifiers(struct vhost_dev *hdev, VirtIODevice *vdev);
57 void vhost_dev_disable_notifiers(struct vhost_dev *hdev, VirtIODevice *vdev);
59 /* Test and clear masked event pending status.
60 * Should be called after unmask to avoid losing events.
62 bool vhost_virtqueue_pending(struct vhost_dev *hdev, int n);
64 /* Mask/unmask events from this vq.
66 void vhost_virtqueue_mask(struct vhost_dev *hdev, VirtIODevice *vdev, int n,