Re: [PATCH 07/24] iommu/amd: Add support for AMD vIOMMU VF MMIO region
From: Vasant Hegde
Date: Mon Aug 10 2026 - 06:54:04 EST
On 7/27/2026 6:58 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().
>
> Co-developed-by: Vasant Hegde <Vasant.Hegde@xxxxxxx>
> Signed-off-by: Vasant Hegde <Vasant.Hegde@xxxxxxx>
> Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit@xxxxxxx>
> ---
> drivers/iommu/amd/amd_iommu_types.h | 3 +++
> drivers/iommu/amd/amd_viommu.h | 7 +++++++
> drivers/iommu/amd/iommufd.c | 17 ++++++++++++++++-
> drivers/iommu/amd/viommu.c | 10 ++++++++++
> 4 files changed, 36 insertions(+), 1 deletion(-)
>
.../...
>
> diff --git a/drivers/iommu/amd/viommu.c b/drivers/iommu/amd/viommu.c
> index 014ae16bf58b..ee8c09f13035 100644
> --- a/drivers/iommu/amd/viommu.c
> +++ b/drivers/iommu/amd/viommu.c
> @@ -131,6 +131,16 @@ static int __init viommu_vf_vfcntl_init(struct amd_iommu *iommu)
> return -ENOMEM;
> }
>
> +/*
> + * Returns VF MMIO BAR offset for the give guest ID which will be
> + * mapped to guest vIOMMU 3rd 4K MMIO address
> + */
> +u64 amd_viommu_get_vfmmio_addr(struct amd_iommu *iommu, u16 gid)
> +{
> + /* TODO: Add check for sVIOMMU and set gid[bit 15] */
We can remove this statement. For secure vIOMMU we should be fixing GID
allocation path.
-Vasant