linux-kselftest.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/14] Add iommufd physical device operations for replace and alloc hwpt
@ 2023-02-25  0:27 Jason Gunthorpe
  2023-02-25  0:27 ` [PATCH 01/14] iommufd: Move isolated msi enforcement to iommufd_device_bind() Jason Gunthorpe
                   ` (14 more replies)
  0 siblings, 15 replies; 64+ messages in thread
From: Jason Gunthorpe @ 2023-02-25  0:27 UTC (permalink / raw)
  To: iommu, Kevin Tian, linux-kselftest; +Cc: kvm, Nicolin Chen, Yi Liu

This is the basic functionality for iommufd to support
iommufd_device_replace() and IOMMU_HWPT_ALLOC for physical devices.

iommufd_device_replace() allows changing the HWPT associated with the
device to a new IOAS or HWPT. Replace does this in way that failure leaves
things unchanged, and utilizes the iommu iommu_group_replace_domain() API
to allow the iommu driver to perform an optional non-disruptive change.

IOMMU_HWPT_ALLOC allows HWPTs to be explicitly allocated by the user and
used by attach or replace. At this point it isn't very useful since the
HWPT is the same as the automatically managed HWPT from the IOAS. However
a following series will allow userspace to customize the created HWPT.

The implementation is complicated because we have to introduce some
per-iommu_group memory in iommufd and redo how we think about multi-device
groups to be more explicit. This solves all the locking problems in the
prior attempts.

This series is infrastructure work for the following series which:
 - Add replace for attach
 - Expose replace through VFIO APIs
 - Implement driver parameters for HWPT creation (nesting)

Once review of this is complete I will keep it on a side branch and
accumulate the following series when they are ready so we can have a
stable base and make more incremental progress. When we have all the parts
together to get a full implementation it can go to Linus.

I have this on github:

https://github.com/jgunthorpe/linux/commits/iommufd_hwpt

Jason Gunthorpe (12):
  iommufd: Move isolated msi enforcement to iommufd_device_bind()
  iommufd: Add iommufd_group
  iommufd: Replace the hwpt->devices list with iommufd_group
  iommufd: Use the iommufd_group to avoid duplicate reserved groups and
    msi setup
  iommufd: Make sw_msi_start a group global
  iommufd: Move putting a hwpt to a helper function
  iommufd: Add enforced_cache_coherency to iommufd_hw_pagetable_alloc()
  iommufd: Add iommufd_device_replace()
  iommufd: Make destroy_rwsem use a lock class per object type
  iommufd: Add IOMMU_HWPT_ALLOC
  iommufd/selftest: Return the real idev id from selftest mock_domain
  iommufd/selftest: Add a selftest for IOMMU_HWPT_ALLOC

Nicolin Chen (2):
  iommu: Introduce a new iommu_group_replace_domain() API
  iommufd/selftest: Test iommufd_device_replace()

 drivers/iommu/iommu-priv.h                    |  10 +
 drivers/iommu/iommu.c                         |  30 ++
 drivers/iommu/iommufd/device.c                | 482 +++++++++++++-----
 drivers/iommu/iommufd/hw_pagetable.c          |  96 +++-
 drivers/iommu/iommufd/io_pagetable.c          |   5 +-
 drivers/iommu/iommufd/iommufd_private.h       |  44 +-
 drivers/iommu/iommufd/iommufd_test.h          |   7 +
 drivers/iommu/iommufd/main.c                  |  17 +-
 drivers/iommu/iommufd/selftest.c              |  40 ++
 include/linux/iommufd.h                       |   1 +
 include/uapi/linux/iommufd.h                  |  26 +
 tools/testing/selftests/iommu/iommufd.c       |  64 ++-
 .../selftests/iommu/iommufd_fail_nth.c        |  57 ++-
 tools/testing/selftests/iommu/iommufd_utils.h |  59 ++-
 14 files changed, 758 insertions(+), 180 deletions(-)
 create mode 100644 drivers/iommu/iommu-priv.h


base-commit: ac395958f9156733246b5bc3a481c6d38c321a7a
-- 
2.39.1


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

end of thread, other threads:[~2023-03-21 17:16 UTC | newest]

Thread overview: 64+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-25  0:27 [PATCH 00/14] Add iommufd physical device operations for replace and alloc hwpt Jason Gunthorpe
2023-02-25  0:27 ` [PATCH 01/14] iommufd: Move isolated msi enforcement to iommufd_device_bind() Jason Gunthorpe
2023-03-02  7:45   ` Tian, Kevin
2023-02-25  0:27 ` [PATCH 02/14] iommufd: Add iommufd_group Jason Gunthorpe
2023-03-02  7:55   ` Tian, Kevin
2023-03-02 12:51     ` Jason Gunthorpe
2023-03-03  2:13       ` Tian, Kevin
2023-03-06 19:16         ` Jason Gunthorpe
2023-03-07  2:32           ` Tian, Kevin
2023-02-25  0:27 ` [PATCH 03/14] iommufd: Replace the hwpt->devices list with iommufd_group Jason Gunthorpe
2023-03-02  8:01   ` Tian, Kevin
2023-03-06 20:22     ` Jason Gunthorpe
2023-03-07  2:38       ` Tian, Kevin
2023-03-07 13:53         ` Jason Gunthorpe
2023-03-08  7:29           ` Tian, Kevin
2023-03-08 19:00             ` Jason Gunthorpe
2023-02-25  0:27 ` [PATCH 04/14] iommufd: Use the iommufd_group to avoid duplicate reserved groups and msi setup Jason Gunthorpe
2023-03-02  8:06   ` Tian, Kevin
2023-03-02 12:55     ` Jason Gunthorpe
2023-03-03  2:16       ` Tian, Kevin
2023-02-25  0:27 ` [PATCH 05/14] iommufd: Make sw_msi_start a group global Jason Gunthorpe
2023-03-02  8:09   ` Tian, Kevin
2023-03-06 20:27     ` Jason Gunthorpe
2023-02-25  0:27 ` [PATCH 06/14] iommufd: Move putting a hwpt to a helper function Jason Gunthorpe
2023-03-02  8:12   ` Tian, Kevin
2023-03-06 20:29     ` Jason Gunthorpe
2023-02-25  0:27 ` [PATCH 07/14] iommufd: Add enforced_cache_coherency to iommufd_hw_pagetable_alloc() Jason Gunthorpe
2023-03-02  8:14   ` Tian, Kevin
2023-02-25  0:27 ` [PATCH 08/14] iommu: Introduce a new iommu_group_replace_domain() API Jason Gunthorpe
2023-03-02  8:16   ` Tian, Kevin
2023-02-25  0:27 ` [PATCH 09/14] iommufd: Add iommufd_device_replace() Jason Gunthorpe
2023-02-26  3:01   ` Baolu Lu
2023-02-27 13:58     ` Jason Gunthorpe
2023-02-28  1:50       ` Baolu Lu
2023-02-28 13:51         ` Jason Gunthorpe
2023-03-01  1:55           ` Baolu Lu
2023-02-26  3:13   ` Baolu Lu
2023-02-27 14:00     ` Jason Gunthorpe
2023-02-28  2:10       ` Baolu Lu
2023-02-28 13:52         ` Jason Gunthorpe
2023-03-01  2:23           ` Baolu Lu
2023-03-02  8:20   ` Tian, Kevin
2023-03-06 20:44     ` Jason Gunthorpe
2023-03-07  2:42       ` Tian, Kevin
2023-03-07 13:54         ` Jason Gunthorpe
2023-02-25  0:27 ` [PATCH 10/14] iommufd: Make destroy_rwsem use a lock class per object type Jason Gunthorpe
2023-02-25  0:27 ` [PATCH 11/14] iommufd/selftest: Test iommufd_device_replace() Jason Gunthorpe
2023-02-25  0:27 ` [PATCH 12/14] iommufd: Add IOMMU_HWPT_ALLOC Jason Gunthorpe
2023-03-06  1:42   ` Nicolin Chen
2023-03-06 20:31     ` Jason Gunthorpe
2023-03-17  3:02   ` Tian, Kevin
2023-03-17  4:02     ` Nicolin Chen
2023-03-17 10:20       ` Tian, Kevin
2023-03-21 17:16     ` Jason Gunthorpe
2023-02-25  0:27 ` [PATCH 13/14] iommufd/selftest: Return the real idev id from selftest mock_domain Jason Gunthorpe
2023-02-25  0:27 ` [PATCH 14/14] iommufd/selftest: Add a selftest for IOMMU_HWPT_ALLOC Jason Gunthorpe
2023-02-26 19:29   ` Nicolin Chen
2023-02-27 15:02     ` Jason Gunthorpe
2023-02-28  0:17       ` Nicolin Chen
2023-03-07  8:42 ` [PATCH 00/14] Add iommufd physical device operations for replace and alloc hwpt Tian, Kevin
2023-03-07 12:46   ` Jason Gunthorpe
2023-03-08  2:08     ` Baolu Lu
2023-03-08  7:38       ` Tian, Kevin
2023-03-08 18:59         ` 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).