Re: [PATCH v2 22/26] iommufd: Add hw_queue_init and split queue alloc paths

From: Suthikulpanit, Suravee

Date: Thu Jun 18 2026 - 01:51:54 EST




On 6/1/2026 8:38 PM, Jason Gunthorpe wrote:
On Thu, May 28, 2026 at 05:17:34AM +0000, Suravee Suthikulpanit wrote:
Add iommufd_viommu_ops.hw_queue_init for vIOMMU backends whose
hardware uses a guest physical queue base from hw_queue->base_addr
instead of a host physical address.

Previously, HW queue alloc always went through
iommufd_hw_queue_alloc_phys(), an iommufd_access, and
hw_queue_init_phys(base_pa). AMD vIOMMU instead takes GPA from
userspace in hw_queue->base_addr and programs hardware without host PA
resolution. Splitting helpers and dispatching from the ioctl keeps
one uAPI while making the contract explicit. Each vIOMMU driver should
implement only one of hw_queue_init_phys or hw_queue_init.

Refactor iommufd_hw_queue_alloc_ioctl() so shared validation and
viommu lookup stay in the ioctl, while setup is delegated to
_iommufd_hw_queue_init_phys() or _iommufd_hw_queue_init().

This patch series is getting pretty big, getting the viommu working
alone is enough for one series, I would split getting the direct
assigned queues working to a following series

Jason

Ok. I'll reduce the scope in v3.

Suravee.