1 /****************************************************************************
2  ****************************************************************************
3  ***
4  ***   This header was automatically generated from a Linux kernel header
5  ***   of the same name, to make information necessary for userspace to
6  ***   call into the kernel available to libc.  It contains only constants,
7  ***   structures, and macros generated from the original header, and thus,
8  ***   contains no copyrightable information.
9  ***
10  ***   To edit the content of this header, modify the corresponding
11  ***   source file (e.g. under external/kernel-headers/original/) then
12  ***   run bionic/libc/kernel/tools/update_all.py
13  ***
14  ***   Any manual change here will be lost the next time this script will
15  ***   be run. You've been warned!
16  ***
17  ****************************************************************************
18  ****************************************************************************/
19 #ifndef _LINUX_VHOST_TYPES_H
20 #define _LINUX_VHOST_TYPES_H
21 #include <linux/types.h>
22 #include <linux/compiler.h>
23 #include <linux/virtio_config.h>
24 #include <linux/virtio_ring.h>
25 struct vhost_vring_state {
26   unsigned int index;
27   unsigned int num;
28 };
29 struct vhost_vring_file {
30   unsigned int index;
31   int fd;
32 };
33 struct vhost_vring_addr {
34   unsigned int index;
35   unsigned int flags;
36 #define VHOST_VRING_F_LOG 0
37   __u64 desc_user_addr;
38   __u64 used_user_addr;
39   __u64 avail_user_addr;
40   __u64 log_guest_addr;
41 };
42 struct vhost_iotlb_msg {
43   __u64 iova;
44   __u64 size;
45   __u64 uaddr;
46 #define VHOST_ACCESS_RO 0x1
47 #define VHOST_ACCESS_WO 0x2
48 #define VHOST_ACCESS_RW 0x3
49   __u8 perm;
50 #define VHOST_IOTLB_MISS 1
51 #define VHOST_IOTLB_UPDATE 2
52 #define VHOST_IOTLB_INVALIDATE 3
53 #define VHOST_IOTLB_ACCESS_FAIL 4
54 #define VHOST_IOTLB_BATCH_BEGIN 5
55 #define VHOST_IOTLB_BATCH_END 6
56   __u8 type;
57 };
58 #define VHOST_IOTLB_MSG 0x1
59 #define VHOST_IOTLB_MSG_V2 0x2
60 struct vhost_msg {
61   int type;
62   union {
63     struct vhost_iotlb_msg iotlb;
64     __u8 padding[64];
65   };
66 };
67 struct vhost_msg_v2 {
68   __u32 type;
69   __u32 reserved;
70   union {
71     struct vhost_iotlb_msg iotlb;
72     __u8 padding[64];
73   };
74 };
75 struct vhost_memory_region {
76   __u64 guest_phys_addr;
77   __u64 memory_size;
78   __u64 userspace_addr;
79   __u64 flags_padding;
80 };
81 #define VHOST_PAGE_SIZE 0x1000
82 struct vhost_memory {
83   __u32 nregions;
84   __u32 padding;
85   struct vhost_memory_region regions[0];
86 };
87 #define VHOST_SCSI_ABI_VERSION 1
88 struct vhost_scsi_target {
89   int abi_version;
90   char vhost_wwpn[224];
91   unsigned short vhost_tpgt;
92   unsigned short reserved;
93 };
94 struct vhost_vdpa_config {
95   __u32 off;
96   __u32 len;
97   __u8 buf[0];
98 };
99 struct vhost_vdpa_iova_range {
100   __u64 first;
101   __u64 last;
102 };
103 #define VHOST_F_LOG_ALL 26
104 #define VHOST_NET_F_VIRTIO_NET_HDR 27
105 #endif
106