Re: [PATCH v7 13/16] iommufd/viommu: Select vIOMMU operations before allocation
From: Aneesh Kumar K . V
Date: Thu Oct 29 2026 - 04:22:49 EST
Jason Gunthorpe <jgg@xxxxxxxxxx> writes:
>> [ ... 62 lines skipped ... ]
>> --- a/drivers/iommu/amd/iommufd.c
>> +++ b/drivers/iommu/amd/iommufd.c
>> @@ -32,13 +32,21 @@ void *amd_iommufd_hw_info(struct device *dev, u32 *length, enum iommu_hw_info_ty
>> return hwinfo;
>> }
>>
>> -size_t amd_iommufd_get_viommu_size(struct device *dev, enum iommu_viommu_type viommu_type)
>> +static size_t amd_iommufd_get_viommu_size(struct device *dev,
>> + enum iommu_viommu_type viommu_type)
>> {
>> return VIOMMU_STRUCT_SIZE(struct amd_iommu_viommu, core);
>> }
>>
>> -int amd_iommufd_viommu_init(struct iommufd_viommu *viommu, struct iommu_domain *parent,
>> - const struct iommu_user_data *user_data)
>> +const struct iommufd_viommu_ops *
>> +amd_iommufd_get_viommu_ops(struct device *dev, enum iommu_viommu_type viommu_type)
>> +{
>> + return &amd_viommu_ops;
>> +}
>
> This needs to fail not retain the broken behavior if this is getting
> touched..
>
Do you mean return NULL until we add an AMD-specific type equivalent to
IOMMU_VIOMMU_TYPE_ARM_SMMUV3?
modified drivers/iommu/amd/iommufd.c
@@ -41,7 +41,7 @@ static size_t amd_iommufd_get_viommu_size(struct device *dev,
const struct iommufd_viommu_ops *
amd_iommufd_get_viommu_ops(struct device *dev, enum iommu_viommu_type viommu_type)
{
- return &amd_viommu_ops;
+ return NULL:
}
int amd_iommufd_viommu_init(struct iommufd_viommu *viommu,
Alexey,
Could you look at this and suggest the AMD equivalent of
arm_smmu_get_viommu_ops()? We could add it as part of this patch.
-aneesh