blob: f0b6d6b41df94542414bfb1c7bdf6e139cb88215 [file] [log] [blame]
Christopher Ferris2abfa9e2021-11-01 16:26:06 -07001/****************************************************************************
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)
26struct 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])
40struct 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)
51struct 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)
58struct 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)
64struct vduse_vq_state_split {
65 __u16 avail_index;
66};
67struct 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};
73struct 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)
86struct 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)
Christopher Ferris7447a1c2022-10-04 18:24:44 -070093struct vduse_iova_umem {
94 __u64 uaddr;
95 __u64 iova;
96 __u64 size;
97 __u64 reserved[3];
98};
99#define VDUSE_IOTLB_REG_UMEM _IOW(VDUSE_BASE, 0x18, struct vduse_iova_umem)
100#define VDUSE_IOTLB_DEREG_UMEM _IOW(VDUSE_BASE, 0x19, struct vduse_iova_umem)
101struct vduse_iova_info {
102 __u64 start;
103 __u64 last;
104#define VDUSE_IOVA_CAP_UMEM (1 << 0)
105 __u64 capability;
106 __u64 reserved[3];
107};
108#define VDUSE_IOTLB_GET_INFO _IOWR(VDUSE_BASE, 0x1a, struct vduse_iova_info)
Christopher Ferris2abfa9e2021-11-01 16:26:06 -0700109enum vduse_req_type {
110 VDUSE_GET_VQ_STATE,
111 VDUSE_SET_STATUS,
112 VDUSE_UPDATE_IOTLB,
113};
114struct vduse_vq_state {
115 __u32 index;
116 union {
117 struct vduse_vq_state_split split;
118 struct vduse_vq_state_packed packed;
119 };
120};
121struct vduse_dev_status {
122 __u8 status;
123};
124struct vduse_iova_range {
125 __u64 start;
126 __u64 last;
127};
128struct vduse_dev_request {
129 __u32 type;
130 __u32 request_id;
131 __u32 reserved[4];
132 union {
133 struct vduse_vq_state vq_state;
134 struct vduse_dev_status s;
135 struct vduse_iova_range iova;
136 __u32 padding[32];
137 };
138};
139struct vduse_dev_response {
140 __u32 request_id;
141#define VDUSE_REQ_RESULT_OK 0x00
142#define VDUSE_REQ_RESULT_FAILED 0x01
143 __u32 result;
144 __u32 reserved[4];
145 union {
146 struct vduse_vq_state vq_state;
147 __u32 padding[32];
148 };
149};
150#endif