1 /* 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" 25 typedef struct VhostUserBackend VhostUserBackend; 26 typedef struct VhostUserBackendClass VhostUserBackendClass; 27 DECLARE_OBJ_CHECKERS(VhostUserBackend, VhostUserBackendClass, 28 VHOST_USER_BACKEND, TYPE_VHOST_USER_BACKEND) 29 30 31 struct VhostUserBackendClass { 32 ObjectClass parent_class; 33 }; 34 35 struct VhostUserBackend { 36 /* private */ 37 Object parent; 38 39 char *chr_name; 40 CharBackend chr; 41 VhostUserState vhost_user; 42 struct vhost_dev dev; 43 VirtIODevice *vdev; 44 bool started; 45 bool completed; 46 }; 47 48 int vhost_user_backend_dev_init(VhostUserBackend *b, VirtIODevice *vdev, 49 unsigned nvqs, Error **errp); 50 void vhost_user_backend_start(VhostUserBackend *b); 51 void vhost_user_backend_stop(VhostUserBackend *b); 52 53 #endif 54