blob: 0a0af923251e82df76808ea8a363a95af6673027 [file] [log] [blame]
Colin Cross07a58322022-02-08 19:45:27 -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_IOMMU_H
20#define _UAPI_IOMMU_H
21#include <linux/types.h>
22#define IOMMU_FAULT_PERM_READ (1 << 0)
23#define IOMMU_FAULT_PERM_WRITE (1 << 1)
24#define IOMMU_FAULT_PERM_EXEC (1 << 2)
25#define IOMMU_FAULT_PERM_PRIV (1 << 3)
26enum iommu_fault_type {
27 IOMMU_FAULT_DMA_UNRECOV = 1,
28 IOMMU_FAULT_PAGE_REQ,
29};
30enum iommu_fault_reason {
31 IOMMU_FAULT_REASON_UNKNOWN = 0,
32 IOMMU_FAULT_REASON_PASID_FETCH,
33 IOMMU_FAULT_REASON_BAD_PASID_ENTRY,
34 IOMMU_FAULT_REASON_PASID_INVALID,
35 IOMMU_FAULT_REASON_WALK_EABT,
36 IOMMU_FAULT_REASON_PTE_FETCH,
37 IOMMU_FAULT_REASON_PERMISSION,
38 IOMMU_FAULT_REASON_ACCESS,
39 IOMMU_FAULT_REASON_OOR_ADDRESS,
40};
41struct iommu_fault_unrecoverable {
42 __u32 reason;
43#define IOMMU_FAULT_UNRECOV_PASID_VALID (1 << 0)
44#define IOMMU_FAULT_UNRECOV_ADDR_VALID (1 << 1)
45#define IOMMU_FAULT_UNRECOV_FETCH_ADDR_VALID (1 << 2)
46 __u32 flags;
47 __u32 pasid;
48 __u32 perm;
49 __u64 addr;
50 __u64 fetch_addr;
51};
52struct iommu_fault_page_request {
53#define IOMMU_FAULT_PAGE_REQUEST_PASID_VALID (1 << 0)
54#define IOMMU_FAULT_PAGE_REQUEST_LAST_PAGE (1 << 1)
55#define IOMMU_FAULT_PAGE_REQUEST_PRIV_DATA (1 << 2)
56#define IOMMU_FAULT_PAGE_RESPONSE_NEEDS_PASID (1 << 3)
57 __u32 flags;
58 __u32 pasid;
59 __u32 grpid;
60 __u32 perm;
61 __u64 addr;
62 __u64 private_data[2];
63};
64struct iommu_fault {
65 __u32 type;
66 __u32 padding;
67 union {
68 struct iommu_fault_unrecoverable event;
69 struct iommu_fault_page_request prm;
70 __u8 padding2[56];
71 };
72};
73enum iommu_page_response_code {
74 IOMMU_PAGE_RESP_SUCCESS = 0,
75 IOMMU_PAGE_RESP_INVALID,
76 IOMMU_PAGE_RESP_FAILURE,
77};
78struct iommu_page_response {
79 __u32 argsz;
80#define IOMMU_PAGE_RESP_VERSION_1 1
81 __u32 version;
82#define IOMMU_PAGE_RESP_PASID_VALID (1 << 0)
83 __u32 flags;
84 __u32 pasid;
85 __u32 grpid;
86 __u32 code;
87};
88enum iommu_inv_granularity {
89 IOMMU_INV_GRANU_DOMAIN,
90 IOMMU_INV_GRANU_PASID,
91 IOMMU_INV_GRANU_ADDR,
92 IOMMU_INV_GRANU_NR,
93};
94struct iommu_inv_addr_info {
95#define IOMMU_INV_ADDR_FLAGS_PASID (1 << 0)
96#define IOMMU_INV_ADDR_FLAGS_ARCHID (1 << 1)
97#define IOMMU_INV_ADDR_FLAGS_LEAF (1 << 2)
98 __u32 flags;
99 __u32 archid;
100 __u64 pasid;
101 __u64 addr;
102 __u64 granule_size;
103 __u64 nb_granules;
104};
105struct iommu_inv_pasid_info {
106#define IOMMU_INV_PASID_FLAGS_PASID (1 << 0)
107#define IOMMU_INV_PASID_FLAGS_ARCHID (1 << 1)
108 __u32 flags;
109 __u32 archid;
110 __u64 pasid;
111};
112struct iommu_cache_invalidate_info {
113 __u32 argsz;
114#define IOMMU_CACHE_INVALIDATE_INFO_VERSION_1 1
115 __u32 version;
116#define IOMMU_CACHE_INV_TYPE_IOTLB (1 << 0)
117#define IOMMU_CACHE_INV_TYPE_DEV_IOTLB (1 << 1)
118#define IOMMU_CACHE_INV_TYPE_PASID (1 << 2)
119#define IOMMU_CACHE_INV_TYPE_NR (3)
120 __u8 cache;
121 __u8 granularity;
122 __u8 padding[6];
123 union {
124 struct iommu_inv_pasid_info pasid_info;
125 struct iommu_inv_addr_info addr_info;
126 } granu;
127};
128struct iommu_gpasid_bind_data_vtd {
129#define IOMMU_SVA_VTD_GPASID_SRE (1 << 0)
130#define IOMMU_SVA_VTD_GPASID_EAFE (1 << 1)
131#define IOMMU_SVA_VTD_GPASID_PCD (1 << 2)
132#define IOMMU_SVA_VTD_GPASID_PWT (1 << 3)
133#define IOMMU_SVA_VTD_GPASID_EMTE (1 << 4)
134#define IOMMU_SVA_VTD_GPASID_CD (1 << 5)
135#define IOMMU_SVA_VTD_GPASID_WPE (1 << 6)
136#define IOMMU_SVA_VTD_GPASID_LAST (1 << 7)
137 __u64 flags;
138 __u32 pat;
139 __u32 emt;
140};
141#define IOMMU_SVA_VTD_GPASID_MTS_MASK (IOMMU_SVA_VTD_GPASID_CD | IOMMU_SVA_VTD_GPASID_EMTE | IOMMU_SVA_VTD_GPASID_PCD | IOMMU_SVA_VTD_GPASID_PWT)
142struct iommu_gpasid_bind_data {
143 __u32 argsz;
144#define IOMMU_GPASID_BIND_VERSION_1 1
145 __u32 version;
146#define IOMMU_PASID_FORMAT_INTEL_VTD 1
147#define IOMMU_PASID_FORMAT_LAST 2
148 __u32 format;
149 __u32 addr_width;
150#define IOMMU_SVA_GPASID_VAL (1 << 0)
151 __u64 flags;
152 __u64 gpgd;
153 __u64 hpasid;
154 __u64 gpasid;
155 __u8 padding[8];
156 union {
157 struct iommu_gpasid_bind_data_vtd vtd;
158 } vendor;
159};
160#endif