xref: /qemu/include/hw/virtio/vhost-user-blk.h (revision 4d0cf552d3a9585f380e8abdc313e4d416a56aa0)
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 "qemu-common.h"
2000343e4bSChangpeng Liu #include "hw/qdev.h"
2100343e4bSChangpeng Liu #include "hw/block/block.h"
2200343e4bSChangpeng Liu #include "chardev/char-fe.h"
2300343e4bSChangpeng Liu #include "hw/virtio/vhost.h"
24*4d0cf552STiwei Bie #include "hw/virtio/vhost-user.h"
2500343e4bSChangpeng Liu 
2600343e4bSChangpeng Liu #define TYPE_VHOST_USER_BLK "vhost-user-blk"
2700343e4bSChangpeng Liu #define VHOST_USER_BLK(obj) \
2800343e4bSChangpeng Liu         OBJECT_CHECK(VHostUserBlk, (obj), TYPE_VHOST_USER_BLK)
2900343e4bSChangpeng Liu 
3000343e4bSChangpeng Liu typedef struct VHostUserBlk {
3100343e4bSChangpeng Liu     VirtIODevice parent_obj;
3200343e4bSChangpeng Liu     CharBackend chardev;
3300343e4bSChangpeng Liu     int32_t bootindex;
3400343e4bSChangpeng Liu     struct virtio_blk_config blkcfg;
3500343e4bSChangpeng Liu     uint16_t num_queues;
3600343e4bSChangpeng Liu     uint32_t queue_size;
3700343e4bSChangpeng Liu     uint32_t config_wce;
3800343e4bSChangpeng Liu     uint32_t config_ro;
3900343e4bSChangpeng Liu     struct vhost_dev dev;
40*4d0cf552STiwei Bie     VhostUserState *vhost_user;
4100343e4bSChangpeng Liu } VHostUserBlk;
4200343e4bSChangpeng Liu 
4300343e4bSChangpeng Liu #endif
44