[PATCH v2 08/14] iommufd/selftest: Drop parent domain from mock_iommu_domain_nested

Nicolin Chen posted 14 patches 3 months, 4 weeks ago
[PATCH v2 08/14] iommufd/selftest: Drop parent domain from mock_iommu_domain_nested
Posted by Nicolin Chen 3 months, 4 weeks ago
There is no use of this parent domain. Delete the dead code.

Note that the s2_parent in struct mock_viommu will be a deadcode too. Yet,
keep it because it will be soon used by HW queue objects, i.e. no point in
adding it back and forth in such a short window. Besides, keeping it could
cover the majority of vIOMMU use cases where a driver-level structure will
be larger in size than the core structure.

Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
---
 drivers/iommu/iommufd/selftest.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/iommu/iommufd/selftest.c b/drivers/iommu/iommufd/selftest.c
index 4d5dca8027b1..f9cfb3a20860 100644
--- a/drivers/iommu/iommufd/selftest.c
+++ b/drivers/iommu/iommufd/selftest.c
@@ -138,7 +138,6 @@ to_mock_domain(struct iommu_domain *domain)
 struct mock_iommu_domain_nested {
 	struct iommu_domain domain;
 	struct mock_viommu *mock_viommu;
-	struct mock_iommu_domain *parent;
 	u32 iotlb[MOCK_NESTED_DOMAIN_IOTLB_NUM];
 };
 
@@ -434,7 +433,6 @@ mock_domain_alloc_nested(struct device *dev, struct iommu_domain *parent,
 	mock_nested = __mock_domain_alloc_nested(user_data);
 	if (IS_ERR(mock_nested))
 		return ERR_CAST(mock_nested);
-	mock_nested->parent = mock_parent;
 	return &mock_nested->domain;
 }
 
@@ -692,7 +690,6 @@ mock_viommu_alloc_domain_nested(struct iommufd_viommu *viommu, u32 flags,
 	if (IS_ERR(mock_nested))
 		return ERR_CAST(mock_nested);
 	mock_nested->mock_viommu = mock_viommu;
-	mock_nested->parent = mock_viommu->s2_parent;
 	return &mock_nested->domain;
 }
 
-- 
2.43.0
RE: [PATCH v2 08/14] iommufd/selftest: Drop parent domain from mock_iommu_domain_nested
Posted by Tian, Kevin 3 months, 3 weeks ago
> From: Nicolin Chen <nicolinc@nvidia.com>
> Sent: Saturday, June 14, 2025 2:35 PM
> 
> There is no use of this parent domain. Delete the dead code.
> 
> Note that the s2_parent in struct mock_viommu will be a deadcode too. Yet,
> keep it because it will be soon used by HW queue objects, i.e. no point in
> adding it back and forth in such a short window. Besides, keeping it could
> cover the majority of vIOMMU use cases where a driver-level structure will
> be larger in size than the core structure.
> 
> Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>

Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Re: [PATCH v2 08/14] iommufd/selftest: Drop parent domain from mock_iommu_domain_nested
Posted by Jason Gunthorpe 3 months, 3 weeks ago
On Fri, Jun 13, 2025 at 11:35:20PM -0700, Nicolin Chen wrote:
> There is no use of this parent domain. Delete the dead code.
> 
> Note that the s2_parent in struct mock_viommu will be a deadcode too. Yet,
> keep it because it will be soon used by HW queue objects, i.e. no point in
> adding it back and forth in such a short window. Besides, keeping it could
> cover the majority of vIOMMU use cases where a driver-level structure will
> be larger in size than the core structure.
> 
> Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
> ---
>  drivers/iommu/iommufd/selftest.c | 3 ---
>  1 file changed, 3 deletions(-)

Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>

Jason