xref: /aosp_15_r20/prebuilts/build-tools/sysroots/i686-unknown-linux-musl/include/linux/vduse.h (revision cda5da8d549138a6648c5ee6d7a49cf8f4a657be)
1*cda5da8dSAndroid Build Coastguard Worker /*
2*cda5da8dSAndroid Build Coastguard Worker  * This file is auto-generated. Modifications will be lost.
3*cda5da8dSAndroid Build Coastguard Worker  *
4*cda5da8dSAndroid Build Coastguard Worker  * See https://android.googlesource.com/platform/bionic/+/master/libc/kernel/
5*cda5da8dSAndroid Build Coastguard Worker  * for more information.
6*cda5da8dSAndroid Build Coastguard Worker  */
7*cda5da8dSAndroid Build Coastguard Worker #ifndef _UAPI_VDUSE_H_
8*cda5da8dSAndroid Build Coastguard Worker #define _UAPI_VDUSE_H_
9*cda5da8dSAndroid Build Coastguard Worker #include <linux/types.h>
10*cda5da8dSAndroid Build Coastguard Worker #define VDUSE_BASE 0x81
11*cda5da8dSAndroid Build Coastguard Worker #define VDUSE_API_VERSION 0
12*cda5da8dSAndroid Build Coastguard Worker #define VDUSE_GET_API_VERSION _IOR(VDUSE_BASE, 0x00, __u64)
13*cda5da8dSAndroid Build Coastguard Worker #define VDUSE_SET_API_VERSION _IOW(VDUSE_BASE, 0x01, __u64)
14*cda5da8dSAndroid Build Coastguard Worker struct vduse_dev_config {
15*cda5da8dSAndroid Build Coastguard Worker #define VDUSE_NAME_MAX 256
16*cda5da8dSAndroid Build Coastguard Worker   char name[VDUSE_NAME_MAX];
17*cda5da8dSAndroid Build Coastguard Worker   __u32 vendor_id;
18*cda5da8dSAndroid Build Coastguard Worker   __u32 device_id;
19*cda5da8dSAndroid Build Coastguard Worker   __u64 features;
20*cda5da8dSAndroid Build Coastguard Worker   __u32 vq_num;
21*cda5da8dSAndroid Build Coastguard Worker   __u32 vq_align;
22*cda5da8dSAndroid Build Coastguard Worker   __u32 reserved[13];
23*cda5da8dSAndroid Build Coastguard Worker   __u32 config_size;
24*cda5da8dSAndroid Build Coastguard Worker   __u8 config[];
25*cda5da8dSAndroid Build Coastguard Worker };
26*cda5da8dSAndroid Build Coastguard Worker #define VDUSE_CREATE_DEV _IOW(VDUSE_BASE, 0x02, struct vduse_dev_config)
27*cda5da8dSAndroid Build Coastguard Worker #define VDUSE_DESTROY_DEV _IOW(VDUSE_BASE, 0x03, char[VDUSE_NAME_MAX])
28*cda5da8dSAndroid Build Coastguard Worker struct vduse_iotlb_entry {
29*cda5da8dSAndroid Build Coastguard Worker   __u64 offset;
30*cda5da8dSAndroid Build Coastguard Worker   __u64 start;
31*cda5da8dSAndroid Build Coastguard Worker   __u64 last;
32*cda5da8dSAndroid Build Coastguard Worker #define VDUSE_ACCESS_RO 0x1
33*cda5da8dSAndroid Build Coastguard Worker #define VDUSE_ACCESS_WO 0x2
34*cda5da8dSAndroid Build Coastguard Worker #define VDUSE_ACCESS_RW 0x3
35*cda5da8dSAndroid Build Coastguard Worker   __u8 perm;
36*cda5da8dSAndroid Build Coastguard Worker };
37*cda5da8dSAndroid Build Coastguard Worker #define VDUSE_IOTLB_GET_FD _IOWR(VDUSE_BASE, 0x10, struct vduse_iotlb_entry)
38*cda5da8dSAndroid Build Coastguard Worker #define VDUSE_DEV_GET_FEATURES _IOR(VDUSE_BASE, 0x11, __u64)
39*cda5da8dSAndroid Build Coastguard Worker struct vduse_config_data {
40*cda5da8dSAndroid Build Coastguard Worker   __u32 offset;
41*cda5da8dSAndroid Build Coastguard Worker   __u32 length;
42*cda5da8dSAndroid Build Coastguard Worker   __u8 buffer[];
43*cda5da8dSAndroid Build Coastguard Worker };
44*cda5da8dSAndroid Build Coastguard Worker #define VDUSE_DEV_SET_CONFIG _IOW(VDUSE_BASE, 0x12, struct vduse_config_data)
45*cda5da8dSAndroid Build Coastguard Worker #define VDUSE_DEV_INJECT_CONFIG_IRQ _IO(VDUSE_BASE, 0x13)
46*cda5da8dSAndroid Build Coastguard Worker struct vduse_vq_config {
47*cda5da8dSAndroid Build Coastguard Worker   __u32 index;
48*cda5da8dSAndroid Build Coastguard Worker   __u16 max_size;
49*cda5da8dSAndroid Build Coastguard Worker   __u16 reserved[13];
50*cda5da8dSAndroid Build Coastguard Worker };
51*cda5da8dSAndroid Build Coastguard Worker #define VDUSE_VQ_SETUP _IOW(VDUSE_BASE, 0x14, struct vduse_vq_config)
52*cda5da8dSAndroid Build Coastguard Worker struct vduse_vq_state_split {
53*cda5da8dSAndroid Build Coastguard Worker   __u16 avail_index;
54*cda5da8dSAndroid Build Coastguard Worker };
55*cda5da8dSAndroid Build Coastguard Worker struct vduse_vq_state_packed {
56*cda5da8dSAndroid Build Coastguard Worker   __u16 last_avail_counter;
57*cda5da8dSAndroid Build Coastguard Worker   __u16 last_avail_idx;
58*cda5da8dSAndroid Build Coastguard Worker   __u16 last_used_counter;
59*cda5da8dSAndroid Build Coastguard Worker   __u16 last_used_idx;
60*cda5da8dSAndroid Build Coastguard Worker };
61*cda5da8dSAndroid Build Coastguard Worker struct vduse_vq_info {
62*cda5da8dSAndroid Build Coastguard Worker   __u32 index;
63*cda5da8dSAndroid Build Coastguard Worker   __u32 num;
64*cda5da8dSAndroid Build Coastguard Worker   __u64 desc_addr;
65*cda5da8dSAndroid Build Coastguard Worker   __u64 driver_addr;
66*cda5da8dSAndroid Build Coastguard Worker   __u64 device_addr;
67*cda5da8dSAndroid Build Coastguard Worker   union {
68*cda5da8dSAndroid Build Coastguard Worker     struct vduse_vq_state_split split;
69*cda5da8dSAndroid Build Coastguard Worker     struct vduse_vq_state_packed packed;
70*cda5da8dSAndroid Build Coastguard Worker   };
71*cda5da8dSAndroid Build Coastguard Worker   __u8 ready;
72*cda5da8dSAndroid Build Coastguard Worker };
73*cda5da8dSAndroid Build Coastguard Worker #define VDUSE_VQ_GET_INFO _IOWR(VDUSE_BASE, 0x15, struct vduse_vq_info)
74*cda5da8dSAndroid Build Coastguard Worker struct vduse_vq_eventfd {
75*cda5da8dSAndroid Build Coastguard Worker   __u32 index;
76*cda5da8dSAndroid Build Coastguard Worker #define VDUSE_EVENTFD_DEASSIGN - 1
77*cda5da8dSAndroid Build Coastguard Worker   int fd;
78*cda5da8dSAndroid Build Coastguard Worker };
79*cda5da8dSAndroid Build Coastguard Worker #define VDUSE_VQ_SETUP_KICKFD _IOW(VDUSE_BASE, 0x16, struct vduse_vq_eventfd)
80*cda5da8dSAndroid Build Coastguard Worker #define VDUSE_VQ_INJECT_IRQ _IOW(VDUSE_BASE, 0x17, __u32)
81*cda5da8dSAndroid Build Coastguard Worker struct vduse_iova_umem {
82*cda5da8dSAndroid Build Coastguard Worker   __u64 uaddr;
83*cda5da8dSAndroid Build Coastguard Worker   __u64 iova;
84*cda5da8dSAndroid Build Coastguard Worker   __u64 size;
85*cda5da8dSAndroid Build Coastguard Worker   __u64 reserved[3];
86*cda5da8dSAndroid Build Coastguard Worker };
87*cda5da8dSAndroid Build Coastguard Worker #define VDUSE_IOTLB_REG_UMEM _IOW(VDUSE_BASE, 0x18, struct vduse_iova_umem)
88*cda5da8dSAndroid Build Coastguard Worker #define VDUSE_IOTLB_DEREG_UMEM _IOW(VDUSE_BASE, 0x19, struct vduse_iova_umem)
89*cda5da8dSAndroid Build Coastguard Worker struct vduse_iova_info {
90*cda5da8dSAndroid Build Coastguard Worker   __u64 start;
91*cda5da8dSAndroid Build Coastguard Worker   __u64 last;
92*cda5da8dSAndroid Build Coastguard Worker #define VDUSE_IOVA_CAP_UMEM (1 << 0)
93*cda5da8dSAndroid Build Coastguard Worker   __u64 capability;
94*cda5da8dSAndroid Build Coastguard Worker   __u64 reserved[3];
95*cda5da8dSAndroid Build Coastguard Worker };
96*cda5da8dSAndroid Build Coastguard Worker #define VDUSE_IOTLB_GET_INFO _IOWR(VDUSE_BASE, 0x1a, struct vduse_iova_info)
97*cda5da8dSAndroid Build Coastguard Worker enum vduse_req_type {
98*cda5da8dSAndroid Build Coastguard Worker   VDUSE_GET_VQ_STATE,
99*cda5da8dSAndroid Build Coastguard Worker   VDUSE_SET_STATUS,
100*cda5da8dSAndroid Build Coastguard Worker   VDUSE_UPDATE_IOTLB,
101*cda5da8dSAndroid Build Coastguard Worker };
102*cda5da8dSAndroid Build Coastguard Worker struct vduse_vq_state {
103*cda5da8dSAndroid Build Coastguard Worker   __u32 index;
104*cda5da8dSAndroid Build Coastguard Worker   union {
105*cda5da8dSAndroid Build Coastguard Worker     struct vduse_vq_state_split split;
106*cda5da8dSAndroid Build Coastguard Worker     struct vduse_vq_state_packed packed;
107*cda5da8dSAndroid Build Coastguard Worker   };
108*cda5da8dSAndroid Build Coastguard Worker };
109*cda5da8dSAndroid Build Coastguard Worker struct vduse_dev_status {
110*cda5da8dSAndroid Build Coastguard Worker   __u8 status;
111*cda5da8dSAndroid Build Coastguard Worker };
112*cda5da8dSAndroid Build Coastguard Worker struct vduse_iova_range {
113*cda5da8dSAndroid Build Coastguard Worker   __u64 start;
114*cda5da8dSAndroid Build Coastguard Worker   __u64 last;
115*cda5da8dSAndroid Build Coastguard Worker };
116*cda5da8dSAndroid Build Coastguard Worker struct vduse_dev_request {
117*cda5da8dSAndroid Build Coastguard Worker   __u32 type;
118*cda5da8dSAndroid Build Coastguard Worker   __u32 request_id;
119*cda5da8dSAndroid Build Coastguard Worker   __u32 reserved[4];
120*cda5da8dSAndroid Build Coastguard Worker   union {
121*cda5da8dSAndroid Build Coastguard Worker     struct vduse_vq_state vq_state;
122*cda5da8dSAndroid Build Coastguard Worker     struct vduse_dev_status s;
123*cda5da8dSAndroid Build Coastguard Worker     struct vduse_iova_range iova;
124*cda5da8dSAndroid Build Coastguard Worker     __u32 padding[32];
125*cda5da8dSAndroid Build Coastguard Worker   };
126*cda5da8dSAndroid Build Coastguard Worker };
127*cda5da8dSAndroid Build Coastguard Worker struct vduse_dev_response {
128*cda5da8dSAndroid Build Coastguard Worker   __u32 request_id;
129*cda5da8dSAndroid Build Coastguard Worker #define VDUSE_REQ_RESULT_OK 0x00
130*cda5da8dSAndroid Build Coastguard Worker #define VDUSE_REQ_RESULT_FAILED 0x01
131*cda5da8dSAndroid Build Coastguard Worker   __u32 result;
132*cda5da8dSAndroid Build Coastguard Worker   __u32 reserved[4];
133*cda5da8dSAndroid Build Coastguard Worker   union {
134*cda5da8dSAndroid Build Coastguard Worker     struct vduse_vq_state vq_state;
135*cda5da8dSAndroid Build Coastguard Worker     __u32 padding[32];
136*cda5da8dSAndroid Build Coastguard Worker   };
137*cda5da8dSAndroid Build Coastguard Worker };
138*cda5da8dSAndroid Build Coastguard Worker #endif
139