• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /****************************************************************************
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)
26 enum iommu_fault_type {
27   IOMMU_FAULT_DMA_UNRECOV = 1,
28   IOMMU_FAULT_PAGE_REQ,
29 };
30 enum 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 };
41 struct 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 };
52 struct 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 };
64 struct 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 };
73 enum iommu_page_response_code {
74   IOMMU_PAGE_RESP_SUCCESS = 0,
75   IOMMU_PAGE_RESP_INVALID,
76   IOMMU_PAGE_RESP_FAILURE,
77 };
78 struct 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 };
88 #endif
89