blob: 327b0b84f1f8e0708135e26283ecc2889efe0e7a [file] [log] [blame]
Marc-André Lureauf24bb722019-05-03 15:00:31 +02001/*
2 * QEMU vhost-user backend
3 *
4 * Copyright (C) 2018 Red Hat Inc
5 *
6 * Authors:
7 * Marc-André Lureau <marcandre.lureau@redhat.com>
8 *
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.
11 */
12#ifndef QEMU_VHOST_USER_BACKEND_H
13#define QEMU_VHOST_USER_BACKEND_H
14
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"
23
24#define TYPE_VHOST_USER_BACKEND "vhost-user-backend"
Eduardo Habkost30b57072020-09-16 14:25:17 -040025OBJECT_DECLARE_SIMPLE_TYPE(VhostUserBackend,
Eduardo Habkostc734cd42020-09-16 14:25:16 -040026 VHOST_USER_BACKEND)
Marc-André Lureauf24bb722019-05-03 15:00:31 +020027
Marc-André Lureauf24bb722019-05-03 15:00:31 +020028
Marc-André Lureauf24bb722019-05-03 15:00:31 +020029
30struct VhostUserBackend {
31 /* private */
32 Object parent;
33
34 char *chr_name;
35 CharBackend chr;
36 VhostUserState vhost_user;
37 struct vhost_dev dev;
38 VirtIODevice *vdev;
39 bool started;
40 bool completed;
41};
42
43int vhost_user_backend_dev_init(VhostUserBackend *b, VirtIODevice *vdev,
44 unsigned nvqs, Error **errp);
45void vhost_user_backend_start(VhostUserBackend *b);
46void vhost_user_backend_stop(VhostUserBackend *b);
47
48#endif