iommufd: Disallow allocating nested parent domain with fault ID
PATCH 1/1 iommufd: Disallow allocating nested parent domain with fault ID
Allocating a domain with a fault ID indicates that the domain is faultable. However, there is a gap for the nested parent domain to support PRI. Some hardware lacks the capability to distinguish whether PRI occurs at stage 1 or stage 2. This limitation may require software-based page table walking to resolve. Since no in-tree IOMMU driver currently supports this functionality, it is disallowed. For more details, refer to the related discussion at [1].
[1] https://lore.kernel.org/linux-iommu/[email protected]/
--- drivers/iommu/iommufd/hw_pagetable.c | 3 +++ tools/testing/selftests/iommu/iommufd.c | 4 ++++ 2 files changed, 7 insertions(+)
drivers/iommu/iommufd/hw_pagetable.c +3 -0
@@ -126,6 +126,9 @@ iommufd_hwpt_paging_alloc(struct iommufd_ctx *ictx, struct iommufd_ioas *ioas,if ((flags &IOMMU_HWPT_ALLOC_DIRTY_TRACKING ) && !device_iommu_capable (idev->dev,IOMMU_CAP_DIRTY_TRACKING ))return ERR_PTR (-EOPNOTSUPP ); +if ((flags &IOMMU_HWPT_FAULT_ID_VALID ) && + (flags &IOMMU_HWPT_ALLOC_NEST_PARENT )) +return ERR_PTR (-EOPNOTSUPP ); hwpt_paging =__iommufd_object_alloc ( ictx, hwpt_paging,IOMMUFD_OBJ_HWPT_PAGING , common.obj);
tools/testing/selftests/iommu/iommufd.c +4 -0
@@ -439,6 +439,10 @@ TEST_F(iommufd_ioas, alloc_hwpt_nested) &test_hwpt_id);test_err_hwpt_alloc (EINVAL , self->device_id, self->device_id,0 , &test_hwpt_id); +test_err_hwpt_alloc (EOPNOTSUPP , self->device_id, self->ioas_id, +IOMMU_HWPT_ALLOC_NEST_PARENT | +IOMMU_HWPT_FAULT_ID_VALID , + &test_hwpt_id); test_cmd_hwpt_alloc(self->device_id, self->ioas_id, IOMMU_HWPT_ALLOC_NEST_PARENT,
Signature · 1 line
2.34.1
Quoted 8 lines · Yi Liu
Allocating a domain with a fault ID indicates that the domain is faultable. However, there is a gap for the nested parent domain to support PRI. Some hardware lacks the capability to distinguish whether PRI occurs at stage 1 or stage 2. This limitation may require software-based page table walking to resolve. Since no in-tree IOMMU driver currently supports this functionality, it is disallowed. For more details, refer to the related discussion at [1].
Quoted 4 lines
[1]https://lore.kernel.org/linux-iommu/bd1655c6-8b2f-4cfa-adb1- [email protected]/
Suggested-by Lu Baolu<[email protected]>Signed-off-by Yi Liu<[email protected]>
Quoted 11 lines
From: Yi Liu <[email protected]>
Sent: Wednesday, February 26, 2025 6:40 PMAllocating a domain with a fault ID indicates that the domain is faultable. However, there is a gap for the nested parent domain to support PRI. Some hardware lacks the capability to distinguish whether PRI occurs at stage 1 or stage 2. This limitation may require software-based page table walking to resolve. Since no in-tree IOMMU driver currently supports this functionality, it is disallowed. For more details, refer to the related discussion at [1].
Quoted 5 lines
[1] https://lore.kernel.org/linux-iommu/bd1655c6-8b2f-4cfa-adb1-
[email protected]/Suggested-by Lu Baolu <[email protected]>Signed-off-by Yi Liu <[email protected]>
Quoted 8 lines · Yi Liu
Allocating a domain with a fault ID indicates that the domain is faultable. However, there is a gap for the nested parent domain to support PRI. Some hardware lacks the capability to distinguish whether PRI occurs at stage 1 or stage 2. This limitation may require software-based page table walking to resolve. Since no in-tree IOMMU driver currently supports this functionality, it is disallowed. For more details, refer to the related discussion at [1].
Quoted 8 lines
[1] https://lore.kernel.org/linux-iommu/[email protected]/
Suggested-by Lu Baolu <[email protected]>Signed-off-by Yi Liu <[email protected]>--- drivers/iommu/iommufd/hw_pagetable.c | 3 +++ tools/testing/selftests/iommu/iommufd.c | 4 ++++ 2 files changed, 7 insertions(+)
Applied
Thanks,
Jason