xref: /openbmc/qemu/include/hw/virtio/vdpa-dev.h (revision bf616ce4)
1 /*
2  * Vhost Vdpa Device
3  *
4  * Copyright (c) Huawei Technologies Co., Ltd. 2022. All Rights Reserved.
5  *
6  * Authors:
7  *   Longpeng <longpeng2@huawei.com>
8  *
9  * Largely based on the "vhost-user-blk.h" implemented by:
10  *   Changpeng Liu <changpeng.liu@intel.com>
11  *
12  * This work is licensed under the terms of the GNU LGPL, version 2 or later.
13  * See the COPYING.LIB file in the top-level directory.
14  */
15 #ifndef _VHOST_VDPA_DEVICE_H
16 #define _VHOST_VDPA_DEVICE_H
17 
18 #include "hw/virtio/vhost.h"
19 #include "hw/virtio/vhost-vdpa.h"
20 #include "qom/object.h"
21 
22 
23 #define TYPE_VHOST_VDPA_DEVICE "vhost-vdpa-device"
24 OBJECT_DECLARE_SIMPLE_TYPE(VhostVdpaDevice, VHOST_VDPA_DEVICE)
25 
26 struct VhostVdpaDevice {
27     VirtIODevice parent_obj;
28     char *vhostdev;
29     int vhostfd;
30     int32_t bootindex;
31     uint32_t vdev_id;
32     uint32_t num_queues;
33     struct vhost_dev dev;
34     struct vhost_vdpa vdpa;
35     VirtQueue **virtqs;
36     uint8_t *config;
37     int config_size;
38     uint16_t queue_size;
39     bool started;
40     int (*post_init)(VhostVdpaDevice *v, Error **errp);
41 };
42 
43 #endif
44