aboutsummaryrefslogtreecommitdiff
path: root/libc/kernel/uapi/linux/iommu.h
blob: 54452c382ee899f88f4af3f512d815190201ad28 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
/****************************************************************************
 ****************************************************************************
 ***
 ***   This header was automatically generated from a Linux kernel header
 ***   of the same name, to make information necessary for userspace to
 ***   call into the kernel available to libc.  It contains only constants,
 ***   structures, and macros generated from the original header, and thus,
 ***   contains no copyrightable information.
 ***
 ***   To edit the content of this header, modify the corresponding
 ***   source file (e.g. under external/kernel-headers/original/) then
 ***   run bionic/libc/kernel/tools/update_all.py
 ***
 ***   Any manual change here will be lost the next time this script will
 ***   be run. You've been warned!
 ***
 ****************************************************************************
 ****************************************************************************/
#ifndef _UAPI_IOMMU_H
#define _UAPI_IOMMU_H
#include <linux/types.h>
#define IOMMU_FAULT_PERM_READ (1 << 0)
#define IOMMU_FAULT_PERM_WRITE (1 << 1)
#define IOMMU_FAULT_PERM_EXEC (1 << 2)
#define IOMMU_FAULT_PERM_PRIV (1 << 3)
enum iommu_fault_type {
  IOMMU_FAULT_DMA_UNRECOV = 1,
  IOMMU_FAULT_PAGE_REQ,
};
enum iommu_fault_reason {
  IOMMU_FAULT_REASON_UNKNOWN = 0,
  IOMMU_FAULT_REASON_PASID_FETCH,
  IOMMU_FAULT_REASON_BAD_PASID_ENTRY,
  IOMMU_FAULT_REASON_PASID_INVALID,
  IOMMU_FAULT_REASON_WALK_EABT,
  IOMMU_FAULT_REASON_PTE_FETCH,
  IOMMU_FAULT_REASON_PERMISSION,
  IOMMU_FAULT_REASON_ACCESS,
  IOMMU_FAULT_REASON_OOR_ADDRESS,
};
struct iommu_fault_unrecoverable {
  __u32 reason;
#define IOMMU_FAULT_UNRECOV_PASID_VALID (1 << 0)
#define IOMMU_FAULT_UNRECOV_ADDR_VALID (1 << 1)
#define IOMMU_FAULT_UNRECOV_FETCH_ADDR_VALID (1 << 2)
  __u32 flags;
  __u32 pasid;
  __u32 perm;
  __u64 addr;
  __u64 fetch_addr;
};
struct iommu_fault_page_request {
#define IOMMU_FAULT_PAGE_REQUEST_PASID_VALID (1 << 0)
#define IOMMU_FAULT_PAGE_REQUEST_LAST_PAGE (1 << 1)
#define IOMMU_FAULT_PAGE_REQUEST_PRIV_DATA (1 << 2)
  __u32 flags;
  __u32 pasid;
  __u32 grpid;
  __u32 perm;
  __u64 addr;
  __u64 private_data[2];
};
struct iommu_fault {
  __u32 type;
  __u32 padding;
  union {
    struct iommu_fault_unrecoverable event;
    struct iommu_fault_page_request prm;
    __u8 padding2[56];
  };
};
enum iommu_page_response_code {
  IOMMU_PAGE_RESP_SUCCESS = 0,
  IOMMU_PAGE_RESP_INVALID,
  IOMMU_PAGE_RESP_FAILURE,
};
struct iommu_page_response {
#define IOMMU_PAGE_RESP_VERSION_1 1
  __u32 version;
#define IOMMU_PAGE_RESP_PASID_VALID (1 << 0)
  __u32 flags;
  __u32 pasid;
  __u32 grpid;
  __u32 code;
};
enum iommu_inv_granularity {
  IOMMU_INV_GRANU_DOMAIN,
  IOMMU_INV_GRANU_PASID,
  IOMMU_INV_GRANU_ADDR,
  IOMMU_INV_GRANU_NR,
};
struct iommu_inv_addr_info {
#define IOMMU_INV_ADDR_FLAGS_PASID (1 << 0)
#define IOMMU_INV_ADDR_FLAGS_ARCHID (1 << 1)
#define IOMMU_INV_ADDR_FLAGS_LEAF (1 << 2)
  __u32 flags;
  __u32 archid;
  __u64 pasid;
  __u64 addr;
  __u64 granule_size;
  __u64 nb_granules;
};
struct iommu_inv_pasid_info {
#define IOMMU_INV_PASID_FLAGS_PASID (1 << 0)
#define IOMMU_INV_PASID_FLAGS_ARCHID (1 << 1)
  __u32 flags;
  __u32 archid;
  __u64 pasid;
};
struct iommu_cache_invalidate_info {
#define IOMMU_CACHE_INVALIDATE_INFO_VERSION_1 1
  __u32 version;
#define IOMMU_CACHE_INV_TYPE_IOTLB (1 << 0)
#define IOMMU_CACHE_INV_TYPE_DEV_IOTLB (1 << 1)
#define IOMMU_CACHE_INV_TYPE_PASID (1 << 2)
#define IOMMU_CACHE_INV_TYPE_NR (3)
  __u8 cache;
  __u8 granularity;
  __u8 padding[2];
  union {
    struct iommu_inv_pasid_info pasid_info;
    struct iommu_inv_addr_info addr_info;
  };
};
struct iommu_gpasid_bind_data_vtd {
#define IOMMU_SVA_VTD_GPASID_SRE (1 << 0)
#define IOMMU_SVA_VTD_GPASID_EAFE (1 << 1)
#define IOMMU_SVA_VTD_GPASID_PCD (1 << 2)
#define IOMMU_SVA_VTD_GPASID_PWT (1 << 3)
#define IOMMU_SVA_VTD_GPASID_EMTE (1 << 4)
#define IOMMU_SVA_VTD_GPASID_CD (1 << 5)
  __u64 flags;
  __u32 pat;
  __u32 emt;
};
struct iommu_gpasid_bind_data {
#define IOMMU_GPASID_BIND_VERSION_1 1
  __u32 version;
#define IOMMU_PASID_FORMAT_INTEL_VTD 1
  __u32 format;
#define IOMMU_SVA_GPASID_VAL (1 << 0)
  __u64 flags;
  __u64 gpgd;
  __u64 hpasid;
  __u64 gpasid;
  __u32 addr_width;
  __u8 padding[12];
  union {
    struct iommu_gpasid_bind_data_vtd vtd;
  };
};
#endif