![]() |
|
|||
0001 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 0002 /* 0003 * IOMMU user API definitions 0004 */ 0005 0006 #ifndef _UAPI_IOMMU_H 0007 #define _UAPI_IOMMU_H 0008 0009 #include <linux/types.h> 0010 0011 #define IOMMU_FAULT_PERM_READ (1 << 0) /* read */ 0012 #define IOMMU_FAULT_PERM_WRITE (1 << 1) /* write */ 0013 #define IOMMU_FAULT_PERM_EXEC (1 << 2) /* exec */ 0014 #define IOMMU_FAULT_PERM_PRIV (1 << 3) /* privileged */ 0015 0016 /* Generic fault types, can be expanded IRQ remapping fault */ 0017 enum iommu_fault_type { 0018 IOMMU_FAULT_DMA_UNRECOV = 1, /* unrecoverable fault */ 0019 IOMMU_FAULT_PAGE_REQ, /* page request fault */ 0020 }; 0021 0022 enum iommu_fault_reason { 0023 IOMMU_FAULT_REASON_UNKNOWN = 0, 0024 0025 /* Could not access the PASID table (fetch caused external abort) */ 0026 IOMMU_FAULT_REASON_PASID_FETCH, 0027 0028 /* PASID entry is invalid or has configuration errors */ 0029 IOMMU_FAULT_REASON_BAD_PASID_ENTRY, 0030 0031 /* 0032 * PASID is out of range (e.g. exceeds the maximum PASID 0033 * supported by the IOMMU) or disabled. 0034 */ 0035 IOMMU_FAULT_REASON_PASID_INVALID, 0036 0037 /* 0038 * An external abort occurred fetching (or updating) a translation 0039 * table descriptor 0040 */ 0041 IOMMU_FAULT_REASON_WALK_EABT, 0042 0043 /* 0044 * Could not access the page table entry (Bad address), 0045 * actual translation fault 0046 */ 0047 IOMMU_FAULT_REASON_PTE_FETCH, 0048 0049 /* Protection flag check failed */ 0050 IOMMU_FAULT_REASON_PERMISSION, 0051 0052 /* access flag check failed */ 0053 IOMMU_FAULT_REASON_ACCESS, 0054 0055 /* Output address of a translation stage caused Address Size fault */ 0056 IOMMU_FAULT_REASON_OOR_ADDRESS, 0057 }; 0058 0059 /** 0060 * struct iommu_fault_unrecoverable - Unrecoverable fault data 0061 * @reason: reason of the fault, from &enum iommu_fault_reason 0062 * @flags: parameters of this fault (IOMMU_FAULT_UNRECOV_* values) 0063 * @pasid: Process Address Space ID 0064 * @perm: requested permission access using by the incoming transaction 0065 * (IOMMU_FAULT_PERM_* values) 0066 * @addr: offending page address 0067 * @fetch_addr: address that caused a fetch abort, if any 0068 */ 0069 struct iommu_fault_unrecoverable { 0070 __u32 reason; 0071 #define IOMMU_FAULT_UNRECOV_PASID_VALID (1 << 0) 0072 #define IOMMU_FAULT_UNRECOV_ADDR_VALID (1 << 1) 0073 #define IOMMU_FAULT_UNRECOV_FETCH_ADDR_VALID (1 << 2) 0074 __u32 flags; 0075 __u32 pasid; 0076 __u32 perm; 0077 __u64 addr; 0078 __u64 fetch_addr; 0079 }; 0080 0081 /** 0082 * struct iommu_fault_page_request - Page Request data 0083 * @flags: encodes whether the corresponding fields are valid and whether this 0084 * is the last page in group (IOMMU_FAULT_PAGE_REQUEST_* values). 0085 * When IOMMU_FAULT_PAGE_RESPONSE_NEEDS_PASID is set, the page response 0086 * must have the same PASID value as the page request. When it is clear, 0087 * the page response should not have a PASID. 0088 * @pasid: Process Address Space ID 0089 * @grpid: Page Request Group Index 0090 * @perm: requested page permissions (IOMMU_FAULT_PERM_* values) 0091 * @addr: page address 0092 * @private_data: device-specific private information 0093 */ 0094 struct iommu_fault_page_request { 0095 #define IOMMU_FAULT_PAGE_REQUEST_PASID_VALID (1 << 0) 0096 #define IOMMU_FAULT_PAGE_REQUEST_LAST_PAGE (1 << 1) 0097 #define IOMMU_FAULT_PAGE_REQUEST_PRIV_DATA (1 << 2) 0098 #define IOMMU_FAULT_PAGE_RESPONSE_NEEDS_PASID (1 << 3) 0099 __u32 flags; 0100 __u32 pasid; 0101 __u32 grpid; 0102 __u32 perm; 0103 __u64 addr; 0104 __u64 private_data[2]; 0105 }; 0106 0107 /** 0108 * struct iommu_fault - Generic fault data 0109 * @type: fault type from &enum iommu_fault_type 0110 * @padding: reserved for future use (should be zero) 0111 * @event: fault event, when @type is %IOMMU_FAULT_DMA_UNRECOV 0112 * @prm: Page Request message, when @type is %IOMMU_FAULT_PAGE_REQ 0113 * @padding2: sets the fault size to allow for future extensions 0114 */ 0115 struct iommu_fault { 0116 __u32 type; 0117 __u32 padding; 0118 union { 0119 struct iommu_fault_unrecoverable event; 0120 struct iommu_fault_page_request prm; 0121 __u8 padding2[56]; 0122 }; 0123 }; 0124 0125 /** 0126 * enum iommu_page_response_code - Return status of fault handlers 0127 * @IOMMU_PAGE_RESP_SUCCESS: Fault has been handled and the page tables 0128 * populated, retry the access. This is "Success" in PCI PRI. 0129 * @IOMMU_PAGE_RESP_FAILURE: General error. Drop all subsequent faults from 0130 * this device if possible. This is "Response Failure" in PCI PRI. 0131 * @IOMMU_PAGE_RESP_INVALID: Could not handle this fault, don't retry the 0132 * access. This is "Invalid Request" in PCI PRI. 0133 */ 0134 enum iommu_page_response_code { 0135 IOMMU_PAGE_RESP_SUCCESS = 0, 0136 IOMMU_PAGE_RESP_INVALID, 0137 IOMMU_PAGE_RESP_FAILURE, 0138 }; 0139 0140 /** 0141 * struct iommu_page_response - Generic page response information 0142 * @argsz: User filled size of this data 0143 * @version: API version of this structure 0144 * @flags: encodes whether the corresponding fields are valid 0145 * (IOMMU_FAULT_PAGE_RESPONSE_* values) 0146 * @pasid: Process Address Space ID 0147 * @grpid: Page Request Group Index 0148 * @code: response code from &enum iommu_page_response_code 0149 */ 0150 struct iommu_page_response { 0151 __u32 argsz; 0152 #define IOMMU_PAGE_RESP_VERSION_1 1 0153 __u32 version; 0154 #define IOMMU_PAGE_RESP_PASID_VALID (1 << 0) 0155 __u32 flags; 0156 __u32 pasid; 0157 __u32 grpid; 0158 __u32 code; 0159 }; 0160 0161 #endif /* _UAPI_IOMMU_H */
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.1.0 LXR engine. The LXR team |
![]() ![]() |