Christopher Ferris | b8a95e2 | 2019-10-02 18:29:20 -0700 | [diff] [blame^] | 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 | #endif |