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. Link: https://patch.msgid.link/r/20250321180143.8468-5-yi.l.liu@intel.com Cc: Bjorn Helgaas <bhelgaas@google.com> Reviewed-by: Kevin Tian <kevin.tian@intel.com> Reviewed-by: Jason Gunthorpe <jgg@nvidia.com> Tested-by: Zhangfei Gao <zhangfei.gao@linaro.org> #aarch64 platform Tested-by: Nicolin Chen <nicolinc@nvidia.com> Signed-off-by: Yi Liu <yi.l.liu@intel.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
This commit is contained in:
@@ -612,9 +612,17 @@ enum iommu_hw_info_type {
|
||||
* IOMMU_HWPT_GET_DIRTY_BITMAP
|
||||
* IOMMU_HWPT_SET_DIRTY_TRACKING
|
||||
*
|
||||
* @IOMMU_HW_CAP_PCI_PASID_EXEC: Execute Permission Supported, user ignores it
|
||||
* when the struct
|
||||
* iommu_hw_info::out_max_pasid_log2 is zero.
|
||||
* @IOMMU_HW_CAP_PCI_PASID_PRIV: Privileged Mode Supported, user ignores it
|
||||
* when the struct
|
||||
* iommu_hw_info::out_max_pasid_log2 is zero.
|
||||
*/
|
||||
enum iommufd_hw_capabilities {
|
||||
IOMMU_HW_CAP_DIRTY_TRACKING = 1 << 0,
|
||||
IOMMU_HW_CAP_PCI_PASID_EXEC = 1 << 1,
|
||||
IOMMU_HW_CAP_PCI_PASID_PRIV = 1 << 2,
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -630,6 +638,9 @@ enum iommufd_hw_capabilities {
|
||||
* iommu_hw_info_type.
|
||||
* @out_capabilities: Output the generic iommu capability info type as defined
|
||||
* in the enum iommu_hw_capabilities.
|
||||
* @out_max_pasid_log2: Output the width of PASIDs. 0 means no PASID support.
|
||||
* PCI devices turn to out_capabilities to check if the
|
||||
* specific capabilities is supported or not.
|
||||
* @__reserved: Must be 0
|
||||
*
|
||||
* Query an iommu type specific hardware information data from an iommu behind
|
||||
@@ -653,7 +664,8 @@ struct iommu_hw_info {
|
||||
__u32 data_len;
|
||||
__aligned_u64 data_uptr;
|
||||
__u32 out_data_type;
|
||||
__u32 __reserved;
|
||||
__u8 out_max_pasid_log2;
|
||||
__u8 __reserved[3];
|
||||
__aligned_u64 out_capabilities;
|
||||
};
|
||||
#define IOMMU_GET_HW_INFO _IO(IOMMUFD_TYPE, IOMMUFD_CMD_GET_HW_INFO)
|
||||
|
||||
Reference in New Issue
Block a user