* [PATCH] iommufd: Disallow allocating nested parent domain with fault ID
@ 2025-02-26 10:40 Yi Liu
2025-02-26 13:49 ` Baolu Lu
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Yi Liu @ 2025-02-26 10:40 UTC (permalink / raw)
To: kevin.tian, jgg
Cc: baolu.lu, yi.l.liu, iommu, robin.murphy, nicolinc, will, joro,
vasant.hegde
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/bd1655c6-8b2f-4cfa-adb1-badc00d01811@intel.com/
Suggested-by: Lu Baolu <baolu.lu@linux.intel.com>
Signed-off-by: Yi Liu <yi.l.liu@intel.com>
---
drivers/iommu/iommufd/hw_pagetable.c | 3 +++
tools/testing/selftests/iommu/iommufd.c | 4 ++++
2 files changed, 7 insertions(+)
diff --git a/drivers/iommu/iommufd/hw_pagetable.c b/drivers/iommu/iommufd/hw_pagetable.c
index 598be26a14e2..9b5b0b852229 100644
--- a/drivers/iommu/iommufd/hw_pagetable.c
+++ b/drivers/iommu/iommufd/hw_pagetable.c
@@ -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);
diff --git a/tools/testing/selftests/iommu/iommufd.c b/tools/testing/selftests/iommu/iommufd.c
index 8d8ce97b53ee..35c5f1ad482a 100644
--- a/tools/testing/selftests/iommu/iommufd.c
+++ b/tools/testing/selftests/iommu/iommufd.c
@@ -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,
--
2.34.1
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] iommufd: Disallow allocating nested parent domain with fault ID
2025-02-26 10:40 [PATCH] iommufd: Disallow allocating nested parent domain with fault ID Yi Liu
@ 2025-02-26 13:49 ` Baolu Lu
2025-03-04 8:39 ` Tian, Kevin
2025-03-04 13:36 ` Jason Gunthorpe
2 siblings, 0 replies; 4+ messages in thread
From: Baolu Lu @ 2025-02-26 13:49 UTC (permalink / raw)
To: Yi Liu, kevin.tian, jgg
Cc: baolu.lu, iommu, robin.murphy, nicolinc, will, joro, vasant.hegde
On 2025/2/26 18:40, Yi Liu wrote:
> 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/bd1655c6-8b2f-4cfa-adb1-
> badc00d01811@intel.com/
>
> Suggested-by: Lu Baolu<baolu.lu@linux.intel.com>
> Signed-off-by: Yi Liu<yi.l.liu@intel.com>
Reviewed-by: Lu Baolu <baolu.lu@linux.intel.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [PATCH] iommufd: Disallow allocating nested parent domain with fault ID
2025-02-26 10:40 [PATCH] iommufd: Disallow allocating nested parent domain with fault ID Yi Liu
2025-02-26 13:49 ` Baolu Lu
@ 2025-03-04 8:39 ` Tian, Kevin
2025-03-04 13:36 ` Jason Gunthorpe
2 siblings, 0 replies; 4+ messages in thread
From: Tian, Kevin @ 2025-03-04 8:39 UTC (permalink / raw)
To: Liu, Yi L, jgg@nvidia.com
Cc: baolu.lu@linux.intel.com, Liu, Yi L, iommu@lists.linux.dev,
robin.murphy@arm.com, nicolinc@nvidia.com, will@kernel.org,
joro@8bytes.org, vasant.hegde@amd.com
> From: Yi Liu <yi.l.liu@intel.com>
> Sent: Wednesday, February 26, 2025 6:40 PM
>
> 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/bd1655c6-8b2f-4cfa-adb1-
> badc00d01811@intel.com/
>
> Suggested-by: Lu Baolu <baolu.lu@linux.intel.com>
> Signed-off-by: Yi Liu <yi.l.liu@intel.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] iommufd: Disallow allocating nested parent domain with fault ID
2025-02-26 10:40 [PATCH] iommufd: Disallow allocating nested parent domain with fault ID Yi Liu
2025-02-26 13:49 ` Baolu Lu
2025-03-04 8:39 ` Tian, Kevin
@ 2025-03-04 13:36 ` Jason Gunthorpe
2 siblings, 0 replies; 4+ messages in thread
From: Jason Gunthorpe @ 2025-03-04 13:36 UTC (permalink / raw)
To: Yi Liu
Cc: kevin.tian, baolu.lu, iommu, robin.murphy, nicolinc, will, joro,
vasant.hegde
On Wed, Feb 26, 2025 at 02:40:12AM -0800, Yi Liu wrote:
> 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/bd1655c6-8b2f-4cfa-adb1-badc00d01811@intel.com/
>
> Suggested-by: Lu Baolu <baolu.lu@linux.intel.com>
> Signed-off-by: Yi Liu <yi.l.liu@intel.com>
> ---
> drivers/iommu/iommufd/hw_pagetable.c | 3 +++
> tools/testing/selftests/iommu/iommufd.c | 4 ++++
> 2 files changed, 7 insertions(+)
Applied
Thanks,
Jason
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-03-04 13:36 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-26 10:40 [PATCH] iommufd: Disallow allocating nested parent domain with fault ID Yi Liu
2025-02-26 13:49 ` Baolu Lu
2025-03-04 8:39 ` Tian, Kevin
2025-03-04 13:36 ` Jason Gunthorpe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox