PASID usage requires PASID support in both device and IOMMU. Since the iommu drivers always enable the PASID capability for the device if it is supported, this extends the IOMMU_GET_HW_INFO to report the PASID capability to userspace. Also, enhances the selftest accordingly.
Showing the changes to include/uapi/linux (1 of 4 files). Show all
Unified · Split
| @@ -612,9 +612,17 @@ enum iommu_hw_info_type { · 611 unmodified lines | ||
| 612 | 612 | * IOMMU_HWPT_GET_DIRTY_BITMAP |
| 613 | 613 | * IOMMU_HWPT_SET_DIRTY_TRACKING |
| 614 | 614 | * |
| 615 | + * @IOMMU_HW_CAP_PCI_PASID_EXEC: Execute Permission Supported, user ignores it | |
| 616 | + * when the struct | |
| 617 | + * iommu_hw_info::out_max_pasid_log2 is zero. | |
| 618 | + * @IOMMU_HW_CAP_PCI_PASID_PRIV: Privileged Mode Supported, user ignores it | |
| 619 | + * when the struct | |
| 620 | + * iommu_hw_info::out_max_pasid_log2 is zero. | |
| 615 | 621 | */ |
| 616 | 622 | enum iommufd_hw_capabilities { |
| 617 | 623 | IOMMU_HW_CAP_DIRTY_TRACKING = 1 << 0, |
| 624 | + IOMMU_HW_CAP_PCI_PASID_EXEC = 1 << 1, | |
| 625 | + IOMMU_HW_CAP_PCI_PASID_PRIV = 1 << 2, | |
| 618 | 626 | }; |
| 619 | 627 | |
| 620 | 628 | /** |
| @@ -630,6 +638,9 @@ enum iommufd_hw_capabilities { · 9 unmodified lines | ||
| 630 | 638 | * iommu_hw_info_type. |
| 631 | 639 | * @out_capabilities: Output the generic iommu capability info type as defined |
| 632 | 640 | * in the enum iommu_hw_capabilities. |
| 641 | + * @out_max_pasid_log2: Output the width of PASIDs. 0 means no PASID support. | |
| 642 | + * PCI devices turn to out_capabilities to check if the | |
| 643 | + * specific capabilities is supported or not. | |
| 633 | 644 | * @__reserved: Must be 0 |
| 634 | 645 | * |
| 635 | 646 | * Query an iommu type specific hardware information data from an iommu behind |
| @@ -653,7 +664,8 @@ struct iommu_hw_info { · 17 unmodified lines | ||
| 653 | 664 | __u32 data_len; |
| 654 | 665 | __aligned_u64 data_uptr; |
| 655 | 666 | __u32 out_data_type; |
| 656 | − __u32 __reserved; | |
| 667 | + __u8 out_max_pasid_log2; | |
| 668 | + __u8 __reserved[3]; | |
| 657 | 669 | __aligned_u64 out_capabilities; |
| 658 | 670 | }; |
| 659 | 671 | #define IOMMU_GET_HW_INFO _IO(IOMMUFD_TYPE, IOMMUFD_CMD_GET_HW_INFO) |