1 /* 2 * Vhost-user generic virtio device 3 * 4 * Copyright (c) 2023 Linaro Ltd 5 * 6 * SPDX-License-Identifier: GPL-2.0-or-later 7 */ 8 9 #ifndef QEMU_VHOST_USER_DEVICE_H 10 #define QEMU_VHOST_USER_DEVICE_H 11 12 #include "hw/virtio/vhost.h" 13 #include "hw/virtio/vhost-user.h" 14 15 #define TYPE_VHOST_USER_BASE "vhost-user-base" 16 17 OBJECT_DECLARE_TYPE(VHostUserBase, VHostUserBaseClass, VHOST_USER_BASE) 18 19 struct VHostUserBase { 20 VirtIODevice parent; 21 /* Properties */ 22 CharBackend chardev; 23 uint16_t virtio_id; 24 uint32_t num_vqs; 25 uint32_t config_size; 26 /* State tracking */ 27 VhostUserState vhost_user; 28 struct vhost_virtqueue *vhost_vq; 29 struct vhost_dev vhost_dev; 30 GPtrArray *vqs; 31 bool connected; 32 }; 33 34 /* needed so we can use the base realize after specialisation 35 tweaks */ 36 struct VHostUserBaseClass { 37 /*< private >*/ 38 VirtioDeviceClass parent_class; 39 /*< public >*/ 40 DeviceRealize parent_realize; 41 }; 42 43 /* shared for the benefit of the derived pci class */ 44 #define TYPE_VHOST_USER_DEVICE "vhost-user-device" 45 46 #endif /* QEMU_VHOST_USER_DEVICE_H */ 47