Merge tag 'pull-loongarch-20241016' of https://gitlab.com/gaosong/qemu into staging
[qemu/armbru.git] / include / hw / virtio / vhost-user-blk.h
blobea085ee1ed9b10bffef27ecaf4e146aad946497f
1 /*
2 * vhost-user-blk host device
3 * Copyright(C) 2017 Intel Corporation.
5 * Authors:
6 * Changpeng Liu <changpeng.liu@intel.com>
8 * Based on vhost-scsi.h, Copyright IBM, Corp. 2011
10 * This work is licensed under the terms of the GNU LGPL, version 2 or later.
11 * See the COPYING.LIB file in the top-level directory.
15 #ifndef VHOST_USER_BLK_H
16 #define VHOST_USER_BLK_H
18 #include "standard-headers/linux/virtio_blk.h"
19 #include "hw/block/block.h"
20 #include "chardev/char-fe.h"
21 #include "hw/virtio/vhost.h"
22 #include "hw/virtio/vhost-user.h"
23 #include "qom/object.h"
25 #define TYPE_VHOST_USER_BLK "vhost-user-blk"
26 OBJECT_DECLARE_SIMPLE_TYPE(VHostUserBlk, VHOST_USER_BLK)
28 #define VHOST_USER_BLK_AUTO_NUM_QUEUES UINT16_MAX
30 struct VHostUserBlk {
31 VirtIODevice parent_obj;
32 CharBackend chardev;
33 int32_t bootindex;
34 struct virtio_blk_config blkcfg;
35 uint16_t num_queues;
36 uint32_t queue_size;
37 struct vhost_dev dev;
38 struct vhost_inflight *inflight;
39 VhostUserState vhost_user;
40 struct vhost_virtqueue *vhost_vqs;
41 VirtQueue **virtqs;
44 * There are at least two steps of initialization of the
45 * vhost-user device. The first is a "connect" step and
46 * second is a "start" step. Make a separation between
47 * those initialization phases by using two fields.
49 /* vhost_user_blk_connect/vhost_user_blk_disconnect */
50 bool connected;
51 /* vhost_user_blk_start/vhost_user_blk_stop */
52 bool started_vu;
55 #endif