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

From: Vasant Hegde

Date: Mon Oct 19 2026 - 07:41:58 EST




On 9/30/2026 2:53 PM, Suravee Suthikulpanit wrote:
> The AMD vIOMMU virtualizes guest MMIO registers at the 3rd 4K region.
> This is achieved using the iommufd_viommu_alloc_mmap().
>
> Copy struct iommu_viommu_amd from and to userspace so the VF-MMIO
> mmap offset is validated and returned on vIOMMU alloc.
>
> Return -EINVAL if the VF-MMIO page_base is zero so mmap is not
> registered at physical address 0.
>
> Reviewed-by: Jason Gunthorpe <jgg@xxxxxxxxxx>
> Co-developed-by: Vasant Hegde <Vasant.Hegde@xxxxxxx>
> Signed-off-by: Vasant Hegde <Vasant.Hegde@xxxxxxx>
> Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit@xxxxxxx>
> ---


.../...

> /*
> diff --git a/drivers/iommu/amd/amd_viommu.h b/drivers/iommu/amd/amd_viommu.h
> index e5fbea666e01..276f2126290f 100644
> --- a/drivers/iommu/amd/amd_viommu.h
> +++ b/drivers/iommu/amd/amd_viommu.h
> @@ -14,6 +14,8 @@ int amd_viommu_init(struct amd_iommu *iommu);
>
> void __init amd_viommu_uninit(struct amd_iommu *iommu);
>
> +u64 amd_viommu_get_vfmmio_addr(struct amd_iommu *iommu, u16 gid);
> +
> #else
>
> /*
> @@ -30,6 +32,11 @@ static inline void amd_viommu_uninit(struct amd_iommu *iommu)
> {
> }
>
> +static inline u64 amd_viommu_get_vfmmio_addr(struct amd_iommu *iommu, u16 gid)
> +{
> + return 0;
> +}
> +


Do we really needs this? amd_viommu_get_vfmmio_addr() will be called from vIOMMU
code path only.

-Vasant