0001
0002 #ifndef _LINUX_VHOST_TYPES_H
0003 #define _LINUX_VHOST_TYPES_H
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 #include <linux/types.h>
0015 #include <linux/compiler.h>
0016 #include <linux/virtio_config.h>
0017 #include <linux/virtio_ring.h>
0018
0019 struct vhost_vring_state {
0020 unsigned int index;
0021 unsigned int num;
0022 };
0023
0024 struct vhost_vring_file {
0025 unsigned int index;
0026 int fd;
0027
0028 };
0029
0030 struct vhost_vring_addr {
0031 unsigned int index;
0032
0033 unsigned int flags;
0034
0035
0036 #define VHOST_VRING_F_LOG 0
0037
0038
0039 __u64 desc_user_addr;
0040
0041 __u64 used_user_addr;
0042
0043 __u64 avail_user_addr;
0044
0045
0046
0047 __u64 log_guest_addr;
0048 };
0049
0050
0051 struct vhost_iotlb_msg {
0052 __u64 iova;
0053 __u64 size;
0054 __u64 uaddr;
0055 #define VHOST_ACCESS_RO 0x1
0056 #define VHOST_ACCESS_WO 0x2
0057 #define VHOST_ACCESS_RW 0x3
0058 __u8 perm;
0059 #define VHOST_IOTLB_MISS 1
0060 #define VHOST_IOTLB_UPDATE 2
0061 #define VHOST_IOTLB_INVALIDATE 3
0062 #define VHOST_IOTLB_ACCESS_FAIL 4
0063
0064
0065
0066
0067
0068
0069
0070
0071
0072 #define VHOST_IOTLB_BATCH_BEGIN 5
0073 #define VHOST_IOTLB_BATCH_END 6
0074 __u8 type;
0075 };
0076
0077 #define VHOST_IOTLB_MSG 0x1
0078 #define VHOST_IOTLB_MSG_V2 0x2
0079
0080 struct vhost_msg {
0081 int type;
0082 union {
0083 struct vhost_iotlb_msg iotlb;
0084 __u8 padding[64];
0085 };
0086 };
0087
0088 struct vhost_msg_v2 {
0089 __u32 type;
0090 __u32 asid;
0091 union {
0092 struct vhost_iotlb_msg iotlb;
0093 __u8 padding[64];
0094 };
0095 };
0096
0097 struct vhost_memory_region {
0098 __u64 guest_phys_addr;
0099 __u64 memory_size;
0100 __u64 userspace_addr;
0101 __u64 flags_padding;
0102 };
0103
0104
0105 #define VHOST_PAGE_SIZE 0x1000
0106
0107 struct vhost_memory {
0108 __u32 nregions;
0109 __u32 padding;
0110 struct vhost_memory_region regions[];
0111 };
0112
0113
0114
0115
0116
0117
0118
0119
0120
0121
0122
0123
0124 #define VHOST_SCSI_ABI_VERSION 1
0125
0126 struct vhost_scsi_target {
0127 int abi_version;
0128 char vhost_wwpn[224];
0129 unsigned short vhost_tpgt;
0130 unsigned short reserved;
0131 };
0132
0133
0134
0135 struct vhost_vdpa_config {
0136 __u32 off;
0137 __u32 len;
0138 __u8 buf[];
0139 };
0140
0141
0142
0143
0144
0145 struct vhost_vdpa_iova_range {
0146 __u64 first;
0147 __u64 last;
0148 };
0149
0150
0151
0152 #define VHOST_F_LOG_ALL 26
0153
0154 #define VHOST_NET_F_VIRTIO_NET_HDR 27
0155
0156
0157 #define VHOST_BACKEND_F_IOTLB_MSG_V2 0x1
0158
0159 #define VHOST_BACKEND_F_IOTLB_BATCH 0x2
0160
0161
0162
0163 #define VHOST_BACKEND_F_IOTLB_ASID 0x3
0164
0165 #define VHOST_BACKEND_F_SUSPEND 0x4
0166
0167 #endif