2023-09-28 16:22:22

by Yi Liu

[permalink] [raw]
Subject: [PATCH v2 4/6] iommufd/hw_pagetable: Support allocating nested parent domain

This extends IOMMU_HWPT_ALLOC to allocate domains used as parent (stage-2)
in nested translation.

Signed-off-by: Yi Liu <[email protected]>
---
drivers/iommu/iommufd/hw_pagetable.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/iommu/iommufd/hw_pagetable.c b/drivers/iommu/iommufd/hw_pagetable.c
index 5be7a31cbd9c..8b3d2875d642 100644
--- a/drivers/iommu/iommufd/hw_pagetable.c
+++ b/drivers/iommu/iommufd/hw_pagetable.c
@@ -83,6 +83,9 @@ iommufd_hw_pagetable_alloc(struct iommufd_ctx *ictx, struct iommufd_ioas *ioas,

lockdep_assert_held(&ioas->mutex);

+ if (flags && !ops->domain_alloc_user)
+ return ERR_PTR(-EOPNOTSUPP);
+
hwpt = iommufd_object_alloc(ictx, hwpt, IOMMUFD_OBJ_HW_PAGETABLE);
if (IS_ERR(hwpt))
return hwpt;
@@ -154,7 +157,7 @@ int iommufd_hwpt_alloc(struct iommufd_ucmd *ucmd)
struct iommufd_ioas *ioas;
int rc;

- if (cmd->flags || cmd->__reserved)
+ if ((cmd->flags & (~IOMMU_HWPT_ALLOC_NEST_PARENT)) || cmd->__reserved)
return -EOPNOTSUPP;

idev = iommufd_get_device(ucmd, cmd->dev_id);
--
2.34.1


2023-09-29 10:47:24

by Lu Baolu

[permalink] [raw]
Subject: Re: [PATCH v2 4/6] iommufd/hw_pagetable: Support allocating nested parent domain

On 9/28/23 3:15 PM, Yi Liu wrote:
> This extends IOMMU_HWPT_ALLOC to allocate domains used as parent (stage-2)
> in nested translation.
>
> Signed-off-by: Yi Liu<[email protected]>
> ---
> drivers/iommu/iommufd/hw_pagetable.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)

Reviewed-by: Lu Baolu <[email protected]>

Best regards,
baolu

2023-10-09 01:10:45

by Tian, Kevin

[permalink] [raw]
Subject: RE: [PATCH v2 4/6] iommufd/hw_pagetable: Support allocating nested parent domain

> From: Liu, Yi L <[email protected]>
> Sent: Thursday, September 28, 2023 3:15 PM
>
> This extends IOMMU_HWPT_ALLOC to allocate domains used as parent
> (stage-2)
> in nested translation.
>
> Signed-off-by: Yi Liu <[email protected]>

Reviewed-by: Kevin Tian <[email protected]>