blob: b7f581593c4f4058885fa7e01c17b0102575515e [file] [log] [blame]
Christopher Ferris8b7fdc92023-02-21 13:36:32 -08001/****************************************************************************
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_IOMMUFD_H
20#define _UAPI_IOMMUFD_H
21#include <linux/types.h>
22#include <linux/ioctl.h>
23#define IOMMUFD_TYPE (';')
24enum {
25 IOMMUFD_CMD_BASE = 0x80,
26 IOMMUFD_CMD_DESTROY = IOMMUFD_CMD_BASE,
27 IOMMUFD_CMD_IOAS_ALLOC,
28 IOMMUFD_CMD_IOAS_ALLOW_IOVAS,
29 IOMMUFD_CMD_IOAS_COPY,
30 IOMMUFD_CMD_IOAS_IOVA_RANGES,
31 IOMMUFD_CMD_IOAS_MAP,
32 IOMMUFD_CMD_IOAS_UNMAP,
33 IOMMUFD_CMD_OPTION,
34 IOMMUFD_CMD_VFIO_IOAS,
35};
36struct iommu_destroy {
37 __u32 size;
38 __u32 id;
39};
40#define IOMMU_DESTROY _IO(IOMMUFD_TYPE, IOMMUFD_CMD_DESTROY)
41struct iommu_ioas_alloc {
42 __u32 size;
43 __u32 flags;
44 __u32 out_ioas_id;
45};
46#define IOMMU_IOAS_ALLOC _IO(IOMMUFD_TYPE, IOMMUFD_CMD_IOAS_ALLOC)
47struct iommu_iova_range {
48 __aligned_u64 start;
49 __aligned_u64 last;
50};
51struct iommu_ioas_iova_ranges {
52 __u32 size;
53 __u32 ioas_id;
54 __u32 num_iovas;
55 __u32 __reserved;
56 __aligned_u64 allowed_iovas;
57 __aligned_u64 out_iova_alignment;
58};
59#define IOMMU_IOAS_IOVA_RANGES _IO(IOMMUFD_TYPE, IOMMUFD_CMD_IOAS_IOVA_RANGES)
60struct iommu_ioas_allow_iovas {
61 __u32 size;
62 __u32 ioas_id;
63 __u32 num_iovas;
64 __u32 __reserved;
65 __aligned_u64 allowed_iovas;
66};
67#define IOMMU_IOAS_ALLOW_IOVAS _IO(IOMMUFD_TYPE, IOMMUFD_CMD_IOAS_ALLOW_IOVAS)
68enum iommufd_ioas_map_flags {
69 IOMMU_IOAS_MAP_FIXED_IOVA = 1 << 0,
70 IOMMU_IOAS_MAP_WRITEABLE = 1 << 1,
71 IOMMU_IOAS_MAP_READABLE = 1 << 2,
72};
73struct iommu_ioas_map {
74 __u32 size;
75 __u32 flags;
76 __u32 ioas_id;
77 __u32 __reserved;
78 __aligned_u64 user_va;
79 __aligned_u64 length;
80 __aligned_u64 iova;
81};
82#define IOMMU_IOAS_MAP _IO(IOMMUFD_TYPE, IOMMUFD_CMD_IOAS_MAP)
83struct iommu_ioas_copy {
84 __u32 size;
85 __u32 flags;
86 __u32 dst_ioas_id;
87 __u32 src_ioas_id;
88 __aligned_u64 length;
89 __aligned_u64 dst_iova;
90 __aligned_u64 src_iova;
91};
92#define IOMMU_IOAS_COPY _IO(IOMMUFD_TYPE, IOMMUFD_CMD_IOAS_COPY)
93struct iommu_ioas_unmap {
94 __u32 size;
95 __u32 ioas_id;
96 __aligned_u64 iova;
97 __aligned_u64 length;
98};
99#define IOMMU_IOAS_UNMAP _IO(IOMMUFD_TYPE, IOMMUFD_CMD_IOAS_UNMAP)
100enum iommufd_option {
101 IOMMU_OPTION_RLIMIT_MODE = 0,
102 IOMMU_OPTION_HUGE_PAGES = 1,
103};
104enum iommufd_option_ops {
105 IOMMU_OPTION_OP_SET = 0,
106 IOMMU_OPTION_OP_GET = 1,
107};
108struct iommu_option {
109 __u32 size;
110 __u32 option_id;
111 __u16 op;
112 __u16 __reserved;
113 __u32 object_id;
114 __aligned_u64 val64;
115};
116#define IOMMU_OPTION _IO(IOMMUFD_TYPE, IOMMUFD_CMD_OPTION)
117enum iommufd_vfio_ioas_op {
118 IOMMU_VFIO_IOAS_GET = 0,
119 IOMMU_VFIO_IOAS_SET = 1,
120 IOMMU_VFIO_IOAS_CLEAR = 2,
121};
122struct iommu_vfio_ioas {
123 __u32 size;
124 __u32 ioas_id;
125 __u16 op;
126 __u16 __reserved;
127};
128#define IOMMU_VFIO_IOAS _IO(IOMMUFD_TYPE, IOMMUFD_CMD_VFIO_IOAS)
129#endif