xref: /qemu/include/hw/virtio/vhost-user-blk.h (revision 38e245a42ca81c47d477314c3cfabfcb3d3cec11)
100343e4bSChangpeng Liu /*
200343e4bSChangpeng Liu  * vhost-user-blk host device
300343e4bSChangpeng Liu  * Copyright(C) 2017 Intel Corporation.
400343e4bSChangpeng Liu  *
500343e4bSChangpeng Liu  * Authors:
600343e4bSChangpeng Liu  *  Changpeng Liu <changpeng.liu@intel.com>
700343e4bSChangpeng Liu  *
800343e4bSChangpeng Liu  * Based on vhost-scsi.h, Copyright IBM, Corp. 2011
900343e4bSChangpeng Liu  *
1000343e4bSChangpeng Liu  * This work is licensed under the terms of the GNU LGPL, version 2 or later.
1100343e4bSChangpeng Liu  * See the COPYING.LIB file in the top-level directory.
1200343e4bSChangpeng Liu  *
1300343e4bSChangpeng Liu  */
1400343e4bSChangpeng Liu 
1500343e4bSChangpeng Liu #ifndef VHOST_USER_BLK_H
1600343e4bSChangpeng Liu #define VHOST_USER_BLK_H
1700343e4bSChangpeng Liu 
1800343e4bSChangpeng Liu #include "standard-headers/linux/virtio_blk.h"
1900343e4bSChangpeng Liu #include "hw/block/block.h"
2000343e4bSChangpeng Liu #include "chardev/char-fe.h"
2100343e4bSChangpeng Liu #include "hw/virtio/vhost.h"
224d0cf552STiwei Bie #include "hw/virtio/vhost-user.h"
2300343e4bSChangpeng Liu 
2400343e4bSChangpeng Liu #define TYPE_VHOST_USER_BLK "vhost-user-blk"
2500343e4bSChangpeng Liu #define VHOST_USER_BLK(obj) \
2600343e4bSChangpeng Liu         OBJECT_CHECK(VHostUserBlk, (obj), TYPE_VHOST_USER_BLK)
2700343e4bSChangpeng Liu 
2800343e4bSChangpeng Liu typedef struct VHostUserBlk {
2900343e4bSChangpeng Liu     VirtIODevice parent_obj;
3000343e4bSChangpeng Liu     CharBackend chardev;
3100343e4bSChangpeng Liu     int32_t bootindex;
3200343e4bSChangpeng Liu     struct virtio_blk_config blkcfg;
3300343e4bSChangpeng Liu     uint16_t num_queues;
3400343e4bSChangpeng Liu     uint32_t queue_size;
3500343e4bSChangpeng Liu     uint32_t config_wce;
3600343e4bSChangpeng Liu     struct vhost_dev dev;
37a1fe0b8fSXie Yongji     struct vhost_inflight *inflight;
380b99f224SMarc-André Lureau     VhostUserState vhost_user;
39*38e245a4SPan Nengyuan     struct vhost_virtqueue *vhost_vqs;
40*38e245a4SPan Nengyuan     VirtQueue **virtqs;
4177542d43SXie Yongji     guint watch;
4277542d43SXie Yongji     bool connected;
4300343e4bSChangpeng Liu } VHostUserBlk;
4400343e4bSChangpeng Liu 
4500343e4bSChangpeng Liu #endif
46