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

Vasant Hegde <[email protected]>
Newsgroups dev.linux.lists.iommu,org.kernel.vger.linux-kernel
Message-ID <[email protected]>

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 <[email protected]>
> Signed-off-by: Vasant Hegde <[email protected]>
> Signed-off-by: Suravee Suthikulpanit <[email protected]>
> ---
>  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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.