Merge remote-tracking branch 'remotes/palmer/tags/riscv-for-master-4.1-sf1-v3' into...
[qemu/ar7.git] / include / sysemu / vhost-user-backend.h
blob9abf8f06a1b966482bdd60e8452b71195bf5776f
1 /*
2 * QEMU vhost-user backend
4 * Copyright (C) 2018 Red Hat Inc
6 * Authors:
7 * Marc-André Lureau <marcandre.lureau@redhat.com>
9 * This work is licensed under the terms of the GNU GPL, version 2 or later.
10 * See the COPYING file in the top-level directory.
12 #ifndef QEMU_VHOST_USER_BACKEND_H
13 #define QEMU_VHOST_USER_BACKEND_H
15 #include "qom/object.h"
16 #include "exec/memory.h"
17 #include "qemu/option.h"
18 #include "qemu/bitmap.h"
19 #include "hw/virtio/vhost.h"
20 #include "hw/virtio/vhost-user.h"
21 #include "chardev/char-fe.h"
22 #include "io/channel.h"
24 #define TYPE_VHOST_USER_BACKEND "vhost-user-backend"
25 #define VHOST_USER_BACKEND(obj) \
26 OBJECT_CHECK(VhostUserBackend, (obj), TYPE_VHOST_USER_BACKEND)
27 #define VHOST_USER_BACKEND_GET_CLASS(obj) \
28 OBJECT_GET_CLASS(VhostUserBackendClass, (obj), TYPE_VHOST_USER_BACKEND)
29 #define VHOST_USER_BACKEND_CLASS(klass) \
30 OBJECT_CLASS_CHECK(VhostUserBackendClass, (klass), TYPE_VHOST_USER_BACKEND)
32 typedef struct VhostUserBackend VhostUserBackend;
33 typedef struct VhostUserBackendClass VhostUserBackendClass;
35 struct VhostUserBackendClass {
36 ObjectClass parent_class;
39 struct VhostUserBackend {
40 /* private */
41 Object parent;
43 char *chr_name;
44 CharBackend chr;
45 VhostUserState vhost_user;
46 struct vhost_dev dev;
47 VirtIODevice *vdev;
48 bool started;
49 bool completed;
52 int vhost_user_backend_dev_init(VhostUserBackend *b, VirtIODevice *vdev,
53 unsigned nvqs, Error **errp);
54 void vhost_user_backend_start(VhostUserBackend *b);
55 void vhost_user_backend_stop(VhostUserBackend *b);
57 #endif