[PATCH 0/2] iommufd: Add AMD vIOMMU HW queue support

From: Suravee Suthikulpanit

Date: Tue Jul 07 2026 - 21:57:17 EST


Notes:

* This series depends on the "[PATCH v3 00/22] iommu/amd: Introduce
AMD Hardware-accelerated Virtualized IOMMU (vIOMMU) Support"
(https://lore.kernel.org/linux-iommu/20260629153535.15775-1-suravee.suthikulpanit@xxxxxxx/)

* Previously, this series was part of the AMD HW vIOMMU series,
and now is being split into its own series to make it easier to
review.

Overview:

AMD HW-accelerated Virtualized IOMMU (vIOMMU) guests own command, event,
and PPR queues in guest physical address space. The existing iommufd
HW queue path pins host pages and passes a physical address to the driver
via hw_queue_init_phys(). vIOMMU hardware instead consumes guest queue
GPAs supplied by userspace through IOMMU_HW_QUEUE_ALLOC.

This series adds a guest-address initialization path in the iommufd
core and wires AMD vIOMMU VFCTRL programming for command, event, and
PPR queues.

Patch 1 factors HW queue allocation into _iommufd_hw_queue_init()
and introduces hw_queue_init in iommufd_viommu_ops. Drivers that
implement hw_queue_init receive the queue GPA in hw_queue->base_addr
without the core pinning host backing pages.

Patch 2 extends the IOMMU_HW_QUEUE_ALLOC UAPI with AMD queue types
and per-queue enable flags, stores flags on iommufd_hw_queue, and
programs guest command, event, and PPR control registers in VFCTRL
during _amd_viommu_hw_queue_init().

* In this version, the CommandBuf, EventLog, and PPRLog are expected
to be allocated when the corresponding enable bits in the guest
IOMMU Control MMIO register are set, which is different from the
previous version where the HW queue is allocated when the buffers
base-address/size are programmed.

Thanks,
Suravee

Suravee Suthikulpanit (2):
iommufd: add hw_queue_init for guest-address queue setup
iommu/amd: add vIOMMU HW queue initialization

drivers/iommu/amd/amd_iommu_types.h | 8 ++
drivers/iommu/amd/iommufd.c | 129 ++++++++++++++++++++++++++++
drivers/iommu/iommufd/viommu.c | 95 +++++++++++---------
include/linux/iommufd.h | 6 +-
include/uapi/linux/iommufd.h | 31 ++++++-
5 files changed, 228 insertions(+), 41 deletions(-)

--
2.34.1