Some IOMMU hardware features, for example PCI PRI and Arm SMMU Stall, enable recoverable I/O page faults. Allow IOMMU drivers to report PRI Page Requests and Stall events through the new fault reporting API. The consumer of the fault can be either an I/O page fault handler in the host, or a guest OS. Once handled, the fault must be completed by sending a page response back to the IOMMU. Add an iommu_page_response() function to complete a page fault. There are two ways to extend the userspace API: * Add a field to iommu_page_response and a flag to iommu_page_response::flags describing the validity of this field. * Introduce a new iommu_page_response_X structure with a different version number. The kernel must then support both versions.
Showing the changes to include/uapi/linux (1 of 3 files). Show all
Unified · Split
| @@ -115,4 +115,39 @@ struct iommu_fault { · 114 unmodified lines | |||
| 115 | struct iommu_fault_page_request prm; | 115 | struct iommu_fault_page_request prm; |
| 116 | }; | 116 | }; |
| 117 | }; | 117 | }; |
| 118 | |||
| 119 | /** | ||
| 120 | * enum iommu_page_response_code - Return status of fault handlers | ||
| 121 | * @IOMMU_PAGE_RESP_SUCCESS: Fault has been handled and the page tables | ||
| 122 | * populated, retry the access. This is "Success" in PCI PRI. | ||
| 123 | * @IOMMU_PAGE_RESP_FAILURE: General error. Drop all subsequent faults from | ||
| 124 | * this device if possible. This is "Response Failure" in PCI PRI. | ||
| 125 | * @IOMMU_PAGE_RESP_INVALID: Could not handle this fault, don't retry the | ||
| 126 | * access. This is "Invalid Request" in PCI PRI. | ||
| 127 | */ | ||
| 128 | enum iommu_page_response_code { | ||
| 129 | IOMMU_PAGE_RESP_SUCCESS = 0, | ||
| 130 | IOMMU_PAGE_RESP_INVALID, | ||
| 131 | IOMMU_PAGE_RESP_FAILURE, | ||
| 132 | }; | ||
| 133 | |||
| 134 | /** | ||
| 135 | * struct iommu_page_response - Generic page response information | ||
| 136 | * @version: API version of this structure | ||
| 137 | * @flags: encodes whether the corresponding fields are valid | ||
| 138 | * (IOMMU_FAULT_PAGE_RESPONSE_* values) | ||
| 139 | * @pasid: Process Address Space ID | ||
| 140 | * @grpid: Page Request Group Index | ||
| 141 | * @code: response code from &enum iommu_page_response_code | ||
| 142 | */ | ||
| 143 | struct iommu_page_response { | ||
| 144 | #define IOMMU_PAGE_RESP_VERSION_1 1 | ||
| 145 | __u32 version; | ||
| 146 | #define IOMMU_PAGE_RESP_PASID_VALID (1 << 0) | ||
| 147 | __u32 flags; | ||
| 148 | __u32 pasid; | ||
| 149 | __u32 grpid; | ||
| 150 | __u32 code; | ||
| 151 | }; | ||
| 152 | |||
| 118 | #endif /* _UAPI_IOMMU_H */ | 153 | #endif /* _UAPI_IOMMU_H */ |