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 __u32 flags; 57 __u32 pasid; 58 __u32 grpid; 59 __u32 perm; 60 __u64 addr; 61 __u64 private_data[2]; 62 }; 63 struct iommu_fault { 64 __u32 type; 65 __u32 padding; 66 union { 67 struct iommu_fault_unrecoverable event; 68 struct iommu_fault_page_request prm; 69 __u8 padding2[56]; 70 }; 71 }; 72 enum iommu_page_response_code { 73 IOMMU_PAGE_RESP_SUCCESS = 0, 74 IOMMU_PAGE_RESP_INVALID, 75 IOMMU_PAGE_RESP_FAILURE, 76 }; 77 struct iommu_page_response { 78 #define IOMMU_PAGE_RESP_VERSION_1 1 79 __u32 version; 80 #define IOMMU_PAGE_RESP_PASID_VALID (1 << 0) 81 __u32 flags; 82 __u32 pasid; 83 __u32 grpid; 84 __u32 code; 85 }; 86 enum iommu_inv_granularity { 87 IOMMU_INV_GRANU_DOMAIN, 88 IOMMU_INV_GRANU_PASID, 89 IOMMU_INV_GRANU_ADDR, 90 IOMMU_INV_GRANU_NR, 91 }; 92 struct iommu_inv_addr_info { 93 #define IOMMU_INV_ADDR_FLAGS_PASID (1 << 0) 94 #define IOMMU_INV_ADDR_FLAGS_ARCHID (1 << 1) 95 #define IOMMU_INV_ADDR_FLAGS_LEAF (1 << 2) 96 __u32 flags; 97 __u32 archid; 98 __u64 pasid; 99 __u64 addr; 100 __u64 granule_size; 101 __u64 nb_granules; 102 }; 103 struct iommu_inv_pasid_info { 104 #define IOMMU_INV_PASID_FLAGS_PASID (1 << 0) 105 #define IOMMU_INV_PASID_FLAGS_ARCHID (1 << 1) 106 __u32 flags; 107 __u32 archid; 108 __u64 pasid; 109 }; 110 struct iommu_cache_invalidate_info { 111 #define IOMMU_CACHE_INVALIDATE_INFO_VERSION_1 1 112 __u32 version; 113 #define IOMMU_CACHE_INV_TYPE_IOTLB (1 << 0) 114 #define IOMMU_CACHE_INV_TYPE_DEV_IOTLB (1 << 1) 115 #define IOMMU_CACHE_INV_TYPE_PASID (1 << 2) 116 #define IOMMU_CACHE_INV_TYPE_NR (3) 117 __u8 cache; 118 __u8 granularity; 119 __u8 padding[2]; 120 union { 121 struct iommu_inv_pasid_info pasid_info; 122 struct iommu_inv_addr_info addr_info; 123 }; 124 }; 125 struct iommu_gpasid_bind_data_vtd { 126 #define IOMMU_SVA_VTD_GPASID_SRE (1 << 0) 127 #define IOMMU_SVA_VTD_GPASID_EAFE (1 << 1) 128 #define IOMMU_SVA_VTD_GPASID_PCD (1 << 2) 129 #define IOMMU_SVA_VTD_GPASID_PWT (1 << 3) 130 #define IOMMU_SVA_VTD_GPASID_EMTE (1 << 4) 131 #define IOMMU_SVA_VTD_GPASID_CD (1 << 5) 132 __u64 flags; 133 __u32 pat; 134 __u32 emt; 135 }; 136 struct iommu_gpasid_bind_data { 137 #define IOMMU_GPASID_BIND_VERSION_1 1 138 __u32 version; 139 #define IOMMU_PASID_FORMAT_INTEL_VTD 1 140 __u32 format; 141 #define IOMMU_SVA_GPASID_VAL (1 << 0) 142 __u64 flags; 143 __u64 gpgd; 144 __u64 hpasid; 145 __u64 gpasid; 146 __u32 addr_width; 147 __u8 padding[12]; 148 union { 149 struct iommu_gpasid_bind_data_vtd vtd; 150 }; 151 }; 152 #endif 153