linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 00/14] iommufd: Prepare for IOMMUFD_OBJ_HW_QUEUE
@ 2025-06-14  6:35 Nicolin Chen
  2025-06-14  6:35 ` [PATCH v2 01/14] iommufd: Apply obvious cosmetic fixes Nicolin Chen
                   ` (14 more replies)
  0 siblings, 15 replies; 52+ messages in thread
From: Nicolin Chen @ 2025-06-14  6:35 UTC (permalink / raw)
  To: jgg, kevin.tian
  Cc: will, robin.murphy, joro, praan, yi.l.liu, peterz, jsnitsel,
	linux-arm-kernel, iommu, linux-kernel, patches, baolu.lu

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



^ permalink raw reply	[flat|nested] 52+ messages in thread

end of thread, other threads:[~2025-07-10 19:57 UTC | newest]

Thread overview: 52+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-14  6:35 [PATCH v2 00/14] iommufd: Prepare for IOMMUFD_OBJ_HW_QUEUE Nicolin Chen
2025-06-14  6:35 ` [PATCH v2 01/14] iommufd: Apply obvious cosmetic fixes Nicolin Chen
2025-06-16  3:23   ` Baolu Lu
2025-06-14  6:35 ` [PATCH v2 02/14] iommufd: Drop unused ictx in struct iommufd_vdevice Nicolin Chen
2025-06-16  3:23   ` Baolu Lu
2025-06-14  6:35 ` [PATCH v2 03/14] iommufd: Use enum iommu_viommu_type for type in struct iommufd_viommu Nicolin Chen
2025-06-16  3:24   ` Baolu Lu
2025-06-16 21:45   ` Pranjal Shrivastava
2025-06-14  6:35 ` [PATCH v2 04/14] iommufd: Use enum iommu_veventq_type for type in struct iommufd_veventq Nicolin Chen
2025-06-16  3:24   ` Baolu Lu
2025-06-16 21:47   ` Pranjal Shrivastava
2025-06-14  6:35 ` [PATCH v2 05/14] iommufd: Return EOPNOTSUPP for failures due to driver bugs Nicolin Chen
2025-06-16  3:25   ` Baolu Lu
2025-06-16 12:28   ` Jason Gunthorpe
2025-06-16 21:49   ` Pranjal Shrivastava
2025-06-19  5:40   ` Tian, Kevin
2025-06-14  6:35 ` [PATCH v2 06/14] iommu: Introduce get_viommu_size and viommu_init ops Nicolin Chen
2025-06-16  3:25   ` Baolu Lu
2025-06-16 12:43   ` Jason Gunthorpe
2025-06-16 22:10   ` Pranjal Shrivastava
2025-06-19  5:42   ` Tian, Kevin
2025-06-14  6:35 ` [PATCH v2 07/14] iommufd/viommu: Support " Nicolin Chen
2025-06-16  3:26   ` Baolu Lu
2025-06-16 12:45   ` Jason Gunthorpe
2025-06-19  5:45   ` Tian, Kevin
2025-06-14  6:35 ` [PATCH v2 08/14] iommufd/selftest: Drop parent domain from mock_iommu_domain_nested Nicolin Chen
2025-06-16 12:46   ` Jason Gunthorpe
2025-06-19  5:46   ` Tian, Kevin
2025-06-14  6:35 ` [PATCH v2 09/14] iommufd/selftest: Replace mock_viommu_alloc with mock_viommu_init Nicolin Chen
2025-06-16 12:46   ` Jason Gunthorpe
2025-06-14  6:35 ` [PATCH v2 10/14] iommu/arm-smmu-v3: Replace arm_vsmmu_alloc with arm_vsmmu_init Nicolin Chen
2025-06-16 10:03   ` Will Deacon
2025-06-16 12:49   ` Jason Gunthorpe
2025-06-16 22:43   ` Pranjal Shrivastava
2025-06-17  2:15     ` Nicolin Chen
2025-06-17  5:43       ` Pranjal Shrivastava
2025-06-14  6:35 ` [PATCH v2 11/14] iommu: Deprecate viommu_alloc op Nicolin Chen
2025-06-16  3:26   ` Baolu Lu
2025-06-16 12:49   ` Jason Gunthorpe
2025-06-16 22:46   ` Pranjal Shrivastava
2025-06-14  6:35 ` [PATCH v2 12/14] iommufd: Move _iommufd_object_alloc out of driver.c Nicolin Chen
2025-06-16  3:26   ` Baolu Lu
2025-06-14  6:35 ` [PATCH v2 13/14] iommufd: Introduce iommufd_object_alloc_ucmd helper Nicolin Chen
2025-06-16  3:27   ` Baolu Lu
2025-06-16 22:52   ` [PATCH v2 13/14] iommufd: Introduce iommufd_object_alloc_ucmd helpery Pranjal Shrivastava
2025-07-09  5:31   ` [PATCH v2 13/14] iommufd: Introduce iommufd_object_alloc_ucmd helper Xu Yilun
2025-07-10  5:32     ` Tian, Kevin
2025-07-10 18:21       ` Nicolin Chen
2025-06-14  6:35 ` [PATCH v2 14/14] iommufd: Apply the new " Nicolin Chen
2025-06-16  3:27   ` Baolu Lu
2025-06-19  5:49   ` Tian, Kevin
2025-06-19 18:46 ` [PATCH v2 00/14] iommufd: Prepare for IOMMUFD_OBJ_HW_QUEUE Jason Gunthorpe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).