History

iommufd: Extend IOMMU_GET_HW_INFO to report PASID capability

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.

Yi Liu committed 1 year ago

Commit 803f9721 parent ad744ed4 files · +82 −2Browse files

Showing the changes to include/uapi/linux (1 of 4 files). Show all

Unified · Split

include/uapi/linux/iommufd.h+13−1
@@ -612,9 +612,17 @@ enum iommu_hw_info_type { · 611 unmodified lines
612612 * IOMMU_HWPT_GET_DIRTY_BITMAP
613613 * IOMMU_HWPT_SET_DIRTY_TRACKING
614614 *
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.
615621 */
616622 enum iommufd_hw_capabilities {
617623 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,
618626 };
619627
620628 /**
@@ -630,6 +638,9 @@ enum iommufd_hw_capabilities { · 9 unmodified lines
630638 * iommu_hw_info_type.
631639 * @out_capabilities: Output the generic iommu capability info type as defined
632640 * 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.
633644 * @__reserved: Must be 0
634645 *
635646 * Query an iommu type specific hardware information data from an iommu behind
@@ -653,7 +664,8 @@ struct iommu_hw_info { · 17 unmodified lines
653664 __u32 data_len;
654665 __aligned_u64 data_uptr;
655666 __u32 out_data_type;
656− __u32 __reserved;
667+ __u8 out_max_pasid_log2;
668+ __u8 __reserved[3];
657669 __aligned_u64 out_capabilities;
658670 };
659671 #define IOMMU_GET_HW_INFO _IO(IOMMUFD_TYPE, IOMMUFD_CMD_GET_HW_INFO)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t