Re: [PATCH v2 3/4] iommu/hyperv: Add para-virtualized IOMMU support for Hyper-V guest
From: Jacob Pan
Date: Tue Jul 07 2026 - 11:17:36 EST
Hi Mukesh,
On Mon, 6 Jul 2026 17:08:50 -0700
Mukesh R <mrathor@xxxxxxxxxxxxxxxxxxx> wrote:
> From: Mukesh R <mrathor@xxxxxxxxxxxxxxxxxxx>
> To: Yu Zhang <zhangyu1@xxxxxxxxxxxxxxxxxxx>,
> linux-kernel@xxxxxxxxxxxxxxx, linux-hyperv@xxxxxxxxxxxxxxx,
> iommu@xxxxxxxxxxxxxxx, linux-pci@xxxxxxxxxxxxxxx,
> linux-arch@xxxxxxxxxxxxxxx Cc: wei.liu@xxxxxxxxxx, kys@xxxxxxxxxxxxx,
> haiyangz@xxxxxxxxxxxxx, decui@xxxxxxxxxxxxx, longli@xxxxxxxxxxxxx,
> joro@xxxxxxxxxx, will@xxxxxxxxxx, robin.murphy@xxxxxxx,
> bhelgaas@xxxxxxxxxx, kwilczynski@xxxxxxxxxx, lpieralisi@xxxxxxxxxx,
> mani@xxxxxxxxxx, robh@xxxxxxxxxx, arnd@xxxxxxxx, jgg@xxxxxxxx,
> mhklinux@xxxxxxxxxxx, jacob.pan@xxxxxxxxxxxxxxxxxxx,
> tgopinath@xxxxxxxxxxxxxxxxxxx, easwar.hariharan@xxxxxxxxxxxxxxxxxxx
> Subject: Re: [PATCH v2 3/4] iommu/hyperv: Add para-virtualized IOMMU
> support for Hyper-V guest Date: Mon, 6 Jul 2026 17:08:50 -0700
> User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101
> Thunderbird/91.13.1
>
> On 7/2/26 09:05, Yu Zhang wrote:
> > Add a para-virtualized IOMMU driver for Linux guests running on
> > Hyper-V. This driver implements stage-1 IO translation within the
> > guest OS. It integrates with the Linux IOMMU core, utilizing
> > Hyper-V hypercalls for:
> > - Capability discovery
> > - Domain allocation, configuration, and deallocation
> > - Device attachment and detachment
> > - IOTLB invalidation
> >
> > The driver constructs x86-compatible stage-1 IO page tables in the
> > guest memory using consolidated IO page table helpers. This allows
> > the guest to manage stage-1 translations independently of vendor-
> > specific drivers (like Intel VT-d or AMD IOMMU).
> >
> > Hyper-V consumes this stage-1 IO page table when a device domain is
> > created and configured, and nests it with the host's stage-2 IO page
> > tables, therefore eliminating the VM exits for guest IOMMU mapping
> > operations. For unmapping operations, VM exits to perform the IOTLB
> > flush are still unavoidable.
> >
> > To identify a device in its hypercall interface, the driver looks
> > up the logical device ID prefix registered for the device's PCI
> > domain (see the logical device ID registry in hv_common.c) and
> > combines it with the PCI function number of the endpoint device.
> >
> > Co-developed-by: Wei Liu <wei.liu@xxxxxxxxxx>
> > Signed-off-by: Wei Liu <wei.liu@xxxxxxxxxx>
> > Co-developed-by: Easwar Hariharan
> > <easwar.hariharan@xxxxxxxxxxxxxxxxxxx> Signed-off-by: Easwar
> > Hariharan <easwar.hariharan@xxxxxxxxxxxxxxxxxxx> Signed-off-by: Yu
> > Zhang <zhangyu1@xxxxxxxxxxxxxxxxxxx> ---
> > arch/x86/hyperv/hv_init.c | 4 +
> > arch/x86/include/asm/mshyperv.h | 4 +
> > drivers/iommu/Kconfig | 1 +
> > drivers/iommu/hyperv/Kconfig | 16 +
> > drivers/iommu/hyperv/Makefile | 1 +
> > drivers/iommu/hyperv/iommu.c | 620
> > ++++++++++++++++++++++++++++++++ drivers/iommu/hyperv/iommu.h |
> > 51 +++ 7 files changed, 697 insertions(+)
> > create mode 100644 drivers/iommu/hyperv/Kconfig
> > create mode 100644 drivers/iommu/hyperv/iommu.c
>
> Hey Jacob,
>
> You had suggested I rename iommu.c to iommu-root.c (I called it
> hv-iommu-root.c eventually), so this needs to be renamed also,
> right?
yes, I agree. I feel it is clearer to name it hv-iommu-guest.c since
this is a guest only driver.