root / hw / vhost.h @ cde844fa
History | View | Annotate | Download (1.4 kB)
1 |
#ifndef VHOST_H
|
---|---|
2 |
#define VHOST_H
|
3 |
|
4 |
#include "hw/hw.h" |
5 |
#include "hw/virtio.h" |
6 |
|
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;
|
20 |
}; |
21 |
|
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)
|
26 |
|
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;
|
42 |
}; |
43 |
|
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); |
49 |
int vhost_dev_enable_notifiers(struct vhost_dev *hdev, VirtIODevice *vdev); |
50 |
void vhost_dev_disable_notifiers(struct vhost_dev *hdev, VirtIODevice *vdev); |
51 |
|
52 |
#endif
|