• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 _UAPI_VDUSE_H_
20 #define _UAPI_VDUSE_H_
21 #include <linux/types.h>
22 #define VDUSE_BASE 0x81
23 #define VDUSE_API_VERSION 0
24 #define VDUSE_GET_API_VERSION _IOR(VDUSE_BASE, 0x00, __u64)
25 #define VDUSE_SET_API_VERSION _IOW(VDUSE_BASE, 0x01, __u64)
26 struct vduse_dev_config {
27 #define VDUSE_NAME_MAX 256
28   char name[VDUSE_NAME_MAX];
29   __u32 vendor_id;
30   __u32 device_id;
31   __u64 features;
32   __u32 vq_num;
33   __u32 vq_align;
34   __u32 reserved[13];
35   __u32 config_size;
36   __u8 config[];
37 };
38 #define VDUSE_CREATE_DEV _IOW(VDUSE_BASE, 0x02, struct vduse_dev_config)
39 #define VDUSE_DESTROY_DEV _IOW(VDUSE_BASE, 0x03, char[VDUSE_NAME_MAX])
40 struct vduse_iotlb_entry {
41   __u64 offset;
42   __u64 start;
43   __u64 last;
44 #define VDUSE_ACCESS_RO 0x1
45 #define VDUSE_ACCESS_WO 0x2
46 #define VDUSE_ACCESS_RW 0x3
47   __u8 perm;
48 };
49 #define VDUSE_IOTLB_GET_FD _IOWR(VDUSE_BASE, 0x10, struct vduse_iotlb_entry)
50 #define VDUSE_DEV_GET_FEATURES _IOR(VDUSE_BASE, 0x11, __u64)
51 struct vduse_config_data {
52   __u32 offset;
53   __u32 length;
54   __u8 buffer[];
55 };
56 #define VDUSE_DEV_SET_CONFIG _IOW(VDUSE_BASE, 0x12, struct vduse_config_data)
57 #define VDUSE_DEV_INJECT_CONFIG_IRQ _IO(VDUSE_BASE, 0x13)
58 struct vduse_vq_config {
59   __u32 index;
60   __u16 max_size;
61   __u16 reserved[13];
62 };
63 #define VDUSE_VQ_SETUP _IOW(VDUSE_BASE, 0x14, struct vduse_vq_config)
64 struct vduse_vq_state_split {
65   __u16 avail_index;
66 };
67 struct vduse_vq_state_packed {
68   __u16 last_avail_counter;
69   __u16 last_avail_idx;
70   __u16 last_used_counter;
71   __u16 last_used_idx;
72 };
73 struct vduse_vq_info {
74   __u32 index;
75   __u32 num;
76   __u64 desc_addr;
77   __u64 driver_addr;
78   __u64 device_addr;
79   union {
80     struct vduse_vq_state_split split;
81     struct vduse_vq_state_packed packed;
82   };
83   __u8 ready;
84 };
85 #define VDUSE_VQ_GET_INFO _IOWR(VDUSE_BASE, 0x15, struct vduse_vq_info)
86 struct vduse_vq_eventfd {
87   __u32 index;
88 #define VDUSE_EVENTFD_DEASSIGN - 1
89   int fd;
90 };
91 #define VDUSE_VQ_SETUP_KICKFD _IOW(VDUSE_BASE, 0x16, struct vduse_vq_eventfd)
92 #define VDUSE_VQ_INJECT_IRQ _IOW(VDUSE_BASE, 0x17, __u32)
93 enum vduse_req_type {
94   VDUSE_GET_VQ_STATE,
95   VDUSE_SET_STATUS,
96   VDUSE_UPDATE_IOTLB,
97 };
98 struct vduse_vq_state {
99   __u32 index;
100   union {
101     struct vduse_vq_state_split split;
102     struct vduse_vq_state_packed packed;
103   };
104 };
105 struct vduse_dev_status {
106   __u8 status;
107 };
108 struct vduse_iova_range {
109   __u64 start;
110   __u64 last;
111 };
112 struct vduse_dev_request {
113   __u32 type;
114   __u32 request_id;
115   __u32 reserved[4];
116   union {
117     struct vduse_vq_state vq_state;
118     struct vduse_dev_status s;
119     struct vduse_iova_range iova;
120     __u32 padding[32];
121   };
122 };
123 struct vduse_dev_response {
124   __u32 request_id;
125 #define VDUSE_REQ_RESULT_OK 0x00
126 #define VDUSE_REQ_RESULT_FAILED 0x01
127   __u32 result;
128   __u32 reserved[4];
129   union {
130     struct vduse_vq_state vq_state;
131     __u32 padding[32];
132   };
133 };
134 #endif
135