Now a vIOMMU holds a shareable nesting parent HWPT. So, it can act like that nesting parent HWPT to allocate a nested HWPT. Support that in the IOMMU_HWPT_ALLOC ioctl handler, and update its kdoc. Also, add an iommufd_viommu_alloc_hwpt_nested helper to allocate a nested HWPT for a vIOMMU object. Since a vIOMMU object holds the parent hwpt's refcount already, increase the refcount of the vIOMMU only.
Showing the changes to include/uapi (1 of 3 files). Show all
Unified · Split
| @@ -435,7 +435,7 @@ enum iommu_hwpt_data_type { · 434 unmodified lines | ||
| 435 | 435 | * @size: sizeof(struct iommu_hwpt_alloc) |
| 436 | 436 | * @flags: Combination of enum iommufd_hwpt_alloc_flags |
| 437 | 437 | * @dev_id: The device to allocate this HWPT for |
| 438 | − * @pt_id: The IOAS or HWPT to connect this HWPT to | |
| 438 | + * @pt_id: The IOAS or HWPT or vIOMMU to connect this HWPT to | |
| 439 | 439 | * @out_hwpt_id: The ID of the new HWPT |
| 440 | 440 | * @__reserved: Must be 0 |
| 441 | 441 | * @data_type: One of enum iommu_hwpt_data_type |
| @@ -454,11 +454,13 @@ enum iommu_hwpt_data_type { · 12 unmodified lines | ||
| 454 | 454 | * IOMMU_HWPT_DATA_NONE. The HWPT can be allocated as a parent HWPT for a |
| 455 | 455 | * nesting configuration by passing IOMMU_HWPT_ALLOC_NEST_PARENT via @flags. |
| 456 | 456 | * |
| 457 | − * A user-managed nested HWPT will be created from a given parent HWPT via | |
| 458 | − * @pt_id, in which the parent HWPT must be allocated previously via the | |
| 459 | − * same ioctl from a given IOAS (@pt_id). In this case, the @data_type | |
| 460 | − * must be set to a pre-defined type corresponding to an I/O page table | |
| 461 | − * type supported by the underlying IOMMU hardware. | |
| 457 | + * A user-managed nested HWPT will be created from a given vIOMMU (wrapping a | |
| 458 | + * parent HWPT) or a parent HWPT via @pt_id, in which the parent HWPT must be | |
| 459 | + * allocated previously via the same ioctl from a given IOAS (@pt_id). In this | |
| 460 | + * case, the @data_type must be set to a pre-defined type corresponding to an | |
| 461 | + * I/O page table type supported by the underlying IOMMU hardware. The device | |
| 462 | + * via @dev_id and the vIOMMU via @pt_id must be associated to the same IOMMU | |
| 463 | + * instance. | |
| 462 | 464 | * |
| 463 | 465 | * If the @data_type is set to IOMMU_HWPT_DATA_NONE, @data_len and |
| 464 | 466 | * @data_uptr should be zero. Otherwise, both @data_len and @data_uptr |