127ba7b02SViresh Kumar /*
227ba7b02SViresh Kumar  * Vhost-user GPIO virtio device
327ba7b02SViresh Kumar  *
427ba7b02SViresh Kumar  * Copyright (c) 2021 Viresh Kumar <viresh.kumar@linaro.org>
527ba7b02SViresh Kumar  *
627ba7b02SViresh Kumar  * SPDX-License-Identifier: GPL-2.0-or-later
727ba7b02SViresh Kumar  */
827ba7b02SViresh Kumar 
927ba7b02SViresh Kumar #ifndef _QEMU_VHOST_USER_GPIO_H
1027ba7b02SViresh Kumar #define _QEMU_VHOST_USER_GPIO_H
1127ba7b02SViresh Kumar 
1227ba7b02SViresh Kumar #include "hw/virtio/virtio.h"
1327ba7b02SViresh Kumar #include "hw/virtio/vhost.h"
1427ba7b02SViresh Kumar #include "hw/virtio/vhost-user.h"
1527ba7b02SViresh Kumar #include "standard-headers/linux/virtio_gpio.h"
1627ba7b02SViresh Kumar #include "chardev/char-fe.h"
1727ba7b02SViresh Kumar 
1827ba7b02SViresh Kumar #define TYPE_VHOST_USER_GPIO "vhost-user-gpio-device"
1927ba7b02SViresh Kumar OBJECT_DECLARE_SIMPLE_TYPE(VHostUserGPIO, VHOST_USER_GPIO);
2027ba7b02SViresh Kumar 
2127ba7b02SViresh Kumar struct VHostUserGPIO {
2227ba7b02SViresh Kumar     /*< private >*/
2327ba7b02SViresh Kumar     VirtIODevice parent_obj;
2427ba7b02SViresh Kumar     CharBackend chardev;
2527ba7b02SViresh Kumar     struct virtio_gpio_config config;
26*daae36c1SAkihiko Odaki     struct vhost_virtqueue *vhost_vqs;
2727ba7b02SViresh Kumar     struct vhost_dev vhost_dev;
2827ba7b02SViresh Kumar     VhostUserState vhost_user;
2927ba7b02SViresh Kumar     VirtQueue *command_vq;
3027ba7b02SViresh Kumar     VirtQueue *interrupt_vq;
31060f4a94SAlex Bennée     /**
32060f4a94SAlex Bennée      * There are at least two steps of initialization of the
33060f4a94SAlex Bennée      * vhost-user device. The first is a "connect" step and
34060f4a94SAlex Bennée      * second is a "start" step. Make a separation between
35060f4a94SAlex Bennée      * those initialization phases by using two fields.
36060f4a94SAlex Bennée      *
37060f4a94SAlex Bennée      * @connected: see vu_gpio_connect()/vu_gpio_disconnect()
38060f4a94SAlex Bennée      * @started_vu: see vu_gpio_start()/vu_gpio_stop()
39060f4a94SAlex Bennée      */
4027ba7b02SViresh Kumar     bool connected;
41060f4a94SAlex Bennée     bool started_vu;
4227ba7b02SViresh Kumar     /*< public >*/
4327ba7b02SViresh Kumar };
4427ba7b02SViresh Kumar 
4527ba7b02SViresh Kumar #endif /* _QEMU_VHOST_USER_GPIO_H */
46