lkml.org 
[lkml]   [2023]   [Oct]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH v6 02/10] iommu: Pass in parent domain with user_data to domain_alloc_user op
From
On 2023/10/24 23:56, Joao Martins wrote:
> On 24/10/2023 16:06, Yi Liu wrote:
>> domain_alloc_user op already accepts user flags for domain allocation, add
>> a parent domain pointer and a driver specific user data support as well.
>>
>> Add a struct iommu_user_data as a bundle of data_ptr/data_len/type from an
>> iommufd core uAPI structure. Make the user data opaque to the core, since
>> a userspace driver must match the kernel driver. In the future, if drivers
>> share some common parameter, there would be a generic parameter as well.
>>
>> Define an enum iommu_hwpt_data_type (with IOMMU_HWPT_DATA_NONE type) for
>> iommu drivers to add their own driver specific user data per hw_pagetable.
>>
>> Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
>> Co-developed-by: Nicolin Chen <nicolinc@nvidia.com>
>> Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
>> Signed-off-by: Yi Liu <yi.l.liu@intel.com>
>> ---
>> drivers/iommu/intel/iommu.c | 7 ++++++-
>
> You are sadly missing AMD IOMMU

good catch.

>
> This would fix the build and nack the op should parent or user_data be passed:
>
> diff --git a/drivers/iommu/amd/iommu.c b/drivers/iommu/amd/iommu.c
> index caad10f9cee3..bc747513afcb 100644
> --- a/drivers/iommu/amd/iommu.c
> +++ b/drivers/iommu/amd/iommu.c
> @@ -2220,13 +2220,17 @@ static struct iommu_domain
> *amd_iommu_domain_alloc(unsigned int type)
> }
>
> static struct iommu_domain *amd_iommu_domain_alloc_user(struct device *dev,
> - u32 flags)
> + u32 flags, struct iommu_domain *parent,
> + const struct iommu_user_data *user_data)
> {
> unsigned int type = IOMMU_DOMAIN_UNMANAGED;
>
> if (flags & ~IOMMU_HWPT_ALLOC_DIRTY_TRACKING)
> return ERR_PTR(-EOPNOTSUPP);
>
> + if (parent || user_data)
> + return ERR_PTR(-EOPNOTSUPP);
> +
> return do_iommu_domain_alloc(type, dev, flags);
> }

yes, this should work. @Jason, one more version or just this one with the
above diff from Joao?

--
Regards,
Yi Liu

\
 
 \ /
  Last update: 2023-10-24 18:13    [W:1.528 / U:0.052 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site