1 /*
2  * Vhost-user GPIO virtio device
3  *
4  * Copyright (c) 2021 Viresh Kumar <viresh.kumar@linaro.org>
5  *
6  * SPDX-License-Identifier: GPL-2.0-or-later
7  */
8 
9 #ifndef _QEMU_VHOST_USER_GPIO_H
10 #define _QEMU_VHOST_USER_GPIO_H
11 
12 #include "hw/virtio/virtio.h"
13 #include "hw/virtio/vhost.h"
14 #include "hw/virtio/vhost-user.h"
15 #include "standard-headers/linux/virtio_gpio.h"
16 #include "chardev/char-fe.h"
17 
18 #define TYPE_VHOST_USER_GPIO "vhost-user-gpio-device"
19 OBJECT_DECLARE_SIMPLE_TYPE(VHostUserGPIO, VHOST_USER_GPIO);
20 
21 struct VHostUserGPIO {
22     /*< private >*/
23     VirtIODevice parent_obj;
24     CharBackend chardev;
25     struct virtio_gpio_config config;
26     struct vhost_virtqueue *vhost_vq;
27     struct vhost_dev vhost_dev;
28     VhostUserState vhost_user;
29     VirtQueue *command_vq;
30     VirtQueue *interrupt_vq;
31     /**
32      * There are at least two steps of initialization of the
33      * vhost-user device. The first is a "connect" step and
34      * second is a "start" step. Make a separation between
35      * those initialization phases by using two fields.
36      *
37      * @connected: see vu_gpio_connect()/vu_gpio_disconnect()
38      * @started_vu: see vu_gpio_start()/vu_gpio_stop()
39      */
40     bool connected;
41     bool started_vu;
42     /*< public >*/
43 };
44 
45 #endif /* _QEMU_VHOST_USER_GPIO_H */
46