[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <cover.1749882255.git.nicolinc@nvidia.com>
Date: Fri, 13 Jun 2025 23:35:12 -0700
From: Nicolin Chen <nicolinc@...dia.com>
To: <jgg@...dia.com>, <kevin.tian@...el.com>
CC: <will@...nel.org>, <robin.murphy@....com>, <joro@...tes.org>,
<praan@...gle.com>, <yi.l.liu@...el.com>, <peterz@...radead.org>,
<jsnitsel@...hat.com>, <linux-arm-kernel@...ts.infradead.org>,
<iommu@...ts.linux.dev>, <linux-kernel@...r.kernel.org>,
<patches@...ts.linux.dev>, <baolu.lu@...ux.intel.com>
Subject: [PATCH v2 00/14] iommufd: Prepare for IOMMUFD_OBJ_HW_QUEUE
The new HW Queue object will require more interactions with IOMMU drivers,
with a few more for-driver APIs. This will complicate the driver-allocated
structure design like the viommu_alloc op: since the core structure is not
initialized during the driver allocation stage, a new for-driver API can't
reference any member in the core vIOMMU structure.
[before]
core: viommu = ops->viommu_alloc();
driver: // my_viommu is successfully allocated
driver: my_viommu = iommufd_viommu_alloc(...);
driver: // This may crash if it reads viommu->ictx
driver: new = iommufd_new_viommu_helper(my_viommu->core ...);
core: viommu->ictx = ucmd->ictx;
core: ...
Make a preparatory series doing:
1 Replace viommu_alloc design with get_viommu_size + viommu_init
2 Add a new iommufd_object_alloc_ucmd
3 Cosmetic fixes and clean ups
[after 1]
core: viommu = ops->get_viommu_size();
driver: return VIOMMU_STRUCT_SIZE();
core: viommu->ictx = ucmd->ictx; // and others
core: rc = ops->viommu_init();
driver: // This is safe now as viommu->ictx is inited
driver: new = iommufd_new_viommu_helper(my_viommu->core ...);
core: ...
Some of the patches are included from:
[PATCH v5 00/29] iommufd: Add vIOMMU infrastructure (Part-4 HW QUEUE)
https://lore.kernel.org/all/cover.1747537752.git.nicolinc@nvidia.com/
This is on Github:
https://github.com/nicolinc/iommufd/commits/iommufd_hw_queue-prep-v2
Changelog
v2
* Add Reviewed-by from Kevin and Jason
* Drop unused mock_nested->parent
* Revise commit messages and kdocs
* Add WARN_ON if new_obj is already set
* Re-organize the patches replacing viommu_alloc
* Use EOPNOTSUPP for failures due to driver bugs
* Return size_t for get_viommu_size op (0 means EOPNOTSUPP)
v1
https://lore.kernel.org/all/cover.1749488870.git.nicolinc@nvidia.com/
Thanks
Nicolin
Nicolin Chen (14):
iommufd: Apply obvious cosmetic fixes
iommufd: Drop unused ictx in struct iommufd_vdevice
iommufd: Use enum iommu_viommu_type for type in struct iommufd_viommu
iommufd: Use enum iommu_veventq_type for type in struct
iommufd_veventq
iommufd: Return EOPNOTSUPP for failures due to driver bugs
iommu: Introduce get_viommu_size and viommu_init ops
iommufd/viommu: Support get_viommu_size and viommu_init ops
iommufd/selftest: Drop parent domain from mock_iommu_domain_nested
iommufd/selftest: Replace mock_viommu_alloc with mock_viommu_init
iommu/arm-smmu-v3: Replace arm_vsmmu_alloc with arm_vsmmu_init
iommu: Deprecate viommu_alloc op
iommufd: Move _iommufd_object_alloc out of driver.c
iommufd: Introduce iommufd_object_alloc_ucmd helper
iommufd: Apply the new iommufd_object_alloc_ucmd helper
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h | 11 ++--
drivers/iommu/iommufd/io_pagetable.h | 2 +-
drivers/iommu/iommufd/iommufd_private.h | 42 ++++++++++---
include/linux/iommu.h | 26 ++++----
include/linux/iommufd.h | 39 +++---------
.../arm/arm-smmu-v3/arm-smmu-v3-iommufd.c | 46 +++++++-------
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 3 +-
drivers/iommu/iommufd/device.c | 5 +-
drivers/iommu/iommufd/driver.c | 33 ----------
drivers/iommu/iommufd/eventq.c | 14 ++---
drivers/iommu/iommufd/hw_pagetable.c | 10 ++-
drivers/iommu/iommufd/io_pagetable.c | 3 +-
drivers/iommu/iommufd/iova_bitmap.c | 1 -
drivers/iommu/iommufd/main.c | 63 +++++++++++++++++--
drivers/iommu/iommufd/pages.c | 9 ++-
drivers/iommu/iommufd/selftest.c | 56 ++++++++---------
drivers/iommu/iommufd/viommu.c | 48 +++++++++-----
17 files changed, 222 insertions(+), 189 deletions(-)
--
2.43.0
Powered by blists - more mailing lists