On 4/26/25 13:58, Nicolin Chen wrote:
Add a new IOMMUFD_OBJ_VCMDQ with an iommufd_vcmdq structure, representing
a command queue type of physical HW passed to a user space VM. This vCMDQ
object, is a subset of vIOMMU resources of a physical IOMMU's, such as:
- NVIDIA's virtual command queue
- AMD vIOMMU's command buffer
Inroduce a struct iommufd_vcmdq and its allocator iommufd_vcmdq_alloc().
Also add a pair of viommu ops for iommufd to forward user space ioctls to
IOMMU drivers.
Signed-off-by: Nicolin Chen<nicolinc@xxxxxxxxxx>
Reviewed-by: Lu Baolu <baolu.lu@xxxxxxxxxxxxxxx>
with a small nit below ...
---
include/linux/iommufd.h | 35 +++++++++++++++++++++++++++++++++++
1 file changed, 35 insertions(+)
diff --git a/include/linux/iommufd.h b/include/linux/iommufd.h
index ef0d3c4765cf..e91381aaec5a 100644
--- a/include/linux/iommufd.h
+++ b/include/linux/iommufd.h
@@ -37,6 +37,7 @@ enum iommufd_object_type {
IOMMUFD_OBJ_VIOMMU,
IOMMUFD_OBJ_VDEVICE,
IOMMUFD_OBJ_VEVENTQ,
+ IOMMUFD_OBJ_VCMDQ,
#ifdef CONFIG_IOMMUFD_TEST
IOMMUFD_OBJ_SELFTEST,
#endif
@@ -112,6 +113,14 @@ struct iommufd_vdevice {
u64 id; /* per-vIOMMU virtual ID */
};
+struct iommufd_vcmdq {
+ struct iommufd_object obj;
+ struct iommufd_ctx *ictx;
+ struct iommufd_viommu *viommu;
+ dma_addr_t addr;
It's better to add a comment to state that @addr is a guest physical
address. Or not?
+ size_t length;
+};
Thanks,
baolu