When allocating a user iommufd_hw_pagetable, the user space is allowed to associate a fault object with the hw_pagetable by specifying the fault object ID in the page table allocation data and setting the IOMMU_HWPT_FAULT_ID_VALID flag bit. On a successful return of hwpt allocation, the user can retrieve and respond to page faults by reading and writing the file interface of the fault object. Once a fault object has been associated with a hwpt, the hwpt is iopf-capable, indicated by hwpt->fault is non NULL. Attaching, detaching, or replacing an iopf-capable hwpt to an RID or PASID will differ from those that are not iopf-capable.
Showing the changes to include/uapi (1 of 4 files). Show all
Unified · Split
| @@ -357,10 +357,13 @@ struct iommu_vfio_ioas { · 356 unmodified lines | ||
| 357 | 357 | * the parent HWPT in a nesting configuration. |
| 358 | 358 | * @IOMMU_HWPT_ALLOC_DIRTY_TRACKING: Dirty tracking support for device IOMMU is |
| 359 | 359 | * enforced on device attachment |
| 360 | + * @IOMMU_HWPT_FAULT_ID_VALID: The fault_id field of hwpt allocation data is | |
| 361 | + * valid. | |
| 360 | 362 | */ |
| 361 | 363 | enum iommufd_hwpt_alloc_flags { |
| 362 | 364 | IOMMU_HWPT_ALLOC_NEST_PARENT = 1 << 0, |
| 363 | 365 | IOMMU_HWPT_ALLOC_DIRTY_TRACKING = 1 << 1, |
| 366 | + IOMMU_HWPT_FAULT_ID_VALID = 1 << 2, | |
| 364 | 367 | }; |
| 365 | 368 | |
| 366 | 369 | /** |
| @@ -412,6 +415,9 @@ enum iommu_hwpt_data_type { · 45 unmodified lines | ||
| 412 | 415 | * @data_type: One of enum iommu_hwpt_data_type |
| 413 | 416 | * @data_len: Length of the type specific data |
| 414 | 417 | * @data_uptr: User pointer to the type specific data |
| 418 | + * @fault_id: The ID of IOMMUFD_FAULT object. Valid only if flags field of | |
| 419 | + * IOMMU_HWPT_FAULT_ID_VALID is set. | |
| 420 | + * @__reserved2: Padding to 64-bit alignment. Must be 0. | |
| 415 | 421 | * |
| 416 | 422 | * Explicitly allocate a hardware page table object. This is the same object |
| 417 | 423 | * type that is returned by iommufd_device_attach() and represents the |
| @@ -442,6 +448,8 @@ struct iommu_hwpt_alloc { · 24 unmodified lines | ||
| 442 | 448 | __u32 data_type; |
| 443 | 449 | __u32 data_len; |
| 444 | 450 | __aligned_u64 data_uptr; |
| 451 | + __u32 fault_id; | |
| 452 | + __u32 __reserved2; | |
| 445 | 453 | }; |
| 446 | 454 | #define IOMMU_HWPT_ALLOC _IO(IOMMUFD_TYPE, IOMMUFD_CMD_HWPT_ALLOC) |
| 447 | 455 | |