Re: [PATCH 07/22] iommu/amd: Add support for AMD vIOMMU VF MMIO region

Suthikulpanit, Suravee
2026-04-06T09:04:01Z

On 3/31/2026 12:55 PM, Weinan Liu wrote:
>
> 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 6fba5d9b1310..5dcd3fc3ba99 100644
>> --- a/drivers/iommu/amd/iommufd.c
>> +++ b/drivers/iommu/amd/iommufd.c
>> @@ -66,11 +69,21 @@ int amd_iommufd_viommu_init(struct iommufd_viommu *viommu, struct iommu_domain *
>> return aviommu->gid;
>> pr_debug("%s: gid=%#x", __func__, aviommu->gid);
>>
>> + page_base = amd_viommu_get_vfmmio_addr(iommu, aviommu->gid);
> According to the below implementation and prototype, amd_viommu_get_vfmmio_addr() won't return negative value.

Good point. I will remove the check below.

>> + if (page_base <= 0)
>> + return -ENODEV;
> goto err_out here as well to avoid leaking the gid allocated above.

This should no longer be needed.

Thanks,
Suravee