Re: [PATCH 4/22] iommu/amd: Introduce IOMMUFD vIOMMU support for AMD

Weinan Liu
2026-04-07T06:46:09Z

On Mon, Mar 30, 2026 at 1:43 AM Suravee Suthikulpanit <suravee.suthikulpanit@amd.com> wrote:

> diff --git a/drivers/iommu/amd/iommufd.c b/drivers/iommu/amd/iommufd.c
> index ad627fd5ccc7..e7ffa7e8915b 100644
> --- a/drivers/iommu/amd/iommufd.c
> +++ b/drivers/iommu/amd/iommufd.c
> @@ -34,6 +34,9 @@ void *amd_iommufd_hw_info(struct device *dev, u32 *length, u32 *type)
>
> size_t amd_iommufd_get_viommu_size(struct device *dev, enum iommu_viommu_type viommu_type)
> {
> + if (viommu_type != IOMMU_VIOMMU_TYPE_AMD)
> + return 0;
> +

It should also return 0 here if amd_viommu_init() fails or if amd_iommu_viommu is false.