1 /* 2 * This file is auto-generated. Modifications will be lost. 3 * 4 * See https://android.googlesource.com/platform/bionic/+/master/libc/kernel/ 5 * for more information. 6 */ 7 #ifndef _UAPI_IOMMU_H 8 #define _UAPI_IOMMU_H 9 #include <linux/types.h> 10 #define IOMMU_FAULT_PERM_READ (1 << 0) 11 #define IOMMU_FAULT_PERM_WRITE (1 << 1) 12 #define IOMMU_FAULT_PERM_EXEC (1 << 2) 13 #define IOMMU_FAULT_PERM_PRIV (1 << 3) 14 enum iommu_fault_type { 15 IOMMU_FAULT_DMA_UNRECOV = 1, 16 IOMMU_FAULT_PAGE_REQ, 17 }; 18 enum iommu_fault_reason { 19 IOMMU_FAULT_REASON_UNKNOWN = 0, 20 IOMMU_FAULT_REASON_PASID_FETCH, 21 IOMMU_FAULT_REASON_BAD_PASID_ENTRY, 22 IOMMU_FAULT_REASON_PASID_INVALID, 23 IOMMU_FAULT_REASON_WALK_EABT, 24 IOMMU_FAULT_REASON_PTE_FETCH, 25 IOMMU_FAULT_REASON_PERMISSION, 26 IOMMU_FAULT_REASON_ACCESS, 27 IOMMU_FAULT_REASON_OOR_ADDRESS, 28 }; 29 struct iommu_fault_unrecoverable { 30 __u32 reason; 31 #define IOMMU_FAULT_UNRECOV_PASID_VALID (1 << 0) 32 #define IOMMU_FAULT_UNRECOV_ADDR_VALID (1 << 1) 33 #define IOMMU_FAULT_UNRECOV_FETCH_ADDR_VALID (1 << 2) 34 __u32 flags; 35 __u32 pasid; 36 __u32 perm; 37 __u64 addr; 38 __u64 fetch_addr; 39 }; 40 struct iommu_fault_page_request { 41 #define IOMMU_FAULT_PAGE_REQUEST_PASID_VALID (1 << 0) 42 #define IOMMU_FAULT_PAGE_REQUEST_LAST_PAGE (1 << 1) 43 #define IOMMU_FAULT_PAGE_REQUEST_PRIV_DATA (1 << 2) 44 #define IOMMU_FAULT_PAGE_RESPONSE_NEEDS_PASID (1 << 3) 45 __u32 flags; 46 __u32 pasid; 47 __u32 grpid; 48 __u32 perm; 49 __u64 addr; 50 __u64 private_data[2]; 51 }; 52 struct iommu_fault { 53 __u32 type; 54 __u32 padding; 55 union { 56 struct iommu_fault_unrecoverable event; 57 struct iommu_fault_page_request prm; 58 __u8 padding2[56]; 59 }; 60 }; 61 enum iommu_page_response_code { 62 IOMMU_PAGE_RESP_SUCCESS = 0, 63 IOMMU_PAGE_RESP_INVALID, 64 IOMMU_PAGE_RESP_FAILURE, 65 }; 66 struct iommu_page_response { 67 __u32 argsz; 68 #define IOMMU_PAGE_RESP_VERSION_1 1 69 __u32 version; 70 #define IOMMU_PAGE_RESP_PASID_VALID (1 << 0) 71 __u32 flags; 72 __u32 pasid; 73 __u32 grpid; 74 __u32 code; 75 }; 76 #endif 77