Skip to content

iommu/vt-d: Add support to hitless replace IOMMU domain

Samiullah Khawaja kvm linux-iommu lkml oe-kbuild-all 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 7 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3iommu/vt-d: Allow replacing no_pasid iommu_domaindrivers/iommu/intel/iommu.c+77 -300 replies
2/3vfio: selftests: Add support of creating iommus from iommufdtools/testing/selftests/vfio/lib/include/libvfio/iommu.h tools/testing/selftests/vfio/lib/include/libvfio/vfio_pci_device.h tools/testing/selftests/vfio/lib/iommu.c +1 more+74 -62 replies
3/3vfio: selftests: Add iommufd hwpt replace testtools/testing/selftests/vfio/Makefile tools/testing/selftests/vfio/vfio_iommufd_hwpt_replace_test.c+152 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/3] iommu/vt-d: Add support to hitless replace IOMMU domain

Intel IOMMU Driver already supports replacing IOMMU domain hitlessly in scalable mode. The support is not available in legacy mode and for NO_PASID in scalable mode. This patch series adds the support for legacy mode and NO_PASID scalable mode.

This is needed for the Live update IOMMU persistence to hotswap the iommu domain after liveupdate:
https://lore.kernel.org/all/[email protected]/

The patch adds the support for scalable mode NO_PASID mode by using the existing replace semantics. This works since in scalable mode the context entries are not updated and only the pasid entries are updated.

The patch series also contains a vfio selftests for the iommu domain replace using iommufd hwpt replace functionality.

Tested on a Host with scalable mode and on Qemu with legacy mode:

tools/testing/selftests/vfio/scripts/setup.sh <dsa_device_bdf> tools/testing/selftests/vfio/vfio_iommufd_hwpt_replace_test <dsa_device_bdf>

TAP version 13
1..2
# Starting 2 tests from 2 test cases.
# RUN vfio_iommufd_replace_hwpt_test.domain_replace.memcpy ...
# OK vfio_iommufd_replace_hwpt_test.domain_replace.memcpy
ok 1 vfio_iommufd_replace_hwpt_test.domain_replace.memcpy
# RUN vfio_iommufd_replace_hwpt_test.noreplace.memcpy ...
# OK vfio_iommufd_replace_hwpt_test.noreplace.memcpy
ok 2 vfio_iommufd_replace_hwpt_test.noreplace.memcpy # PASSED: 2 / 2 tests passed.
# Totals: pass:2 fail:0 xfail:0 xpass:0 skip:0 error:0

Samiullah Khawaja (3):
iommu/vt-d: Allow replacing no_pasid iommu_domain
vfio: selftests: Add support of creating iommus from iommufd
vfio: selftests: Add iommufd hwpt replace test

 drivers/iommu/intel/iommu.c                   | 107 +++++++++----
 tools/testing/selftests/vfio/Makefile         |   1 +
 .../vfio/lib/include/libvfio/iommu.h          |   2 +
 .../lib/include/libvfio/vfio_pci_device.h     |   2 +
 tools/testing/selftests/vfio/lib/iommu.c      |  60 ++++++-
 .../selftests/vfio/lib/vfio_pci_device.c      |  16 +-
 .../vfio/vfio_iommufd_hwpt_replace_test.c     | 151 ++++++++++++++++++
 7 files changed, 303 insertions(+), 36 deletions(-)
 create mode 100644 tools/testing/selftests/vfio/vfio_iommufd_hwpt_replace_test.c

base-commit: 6cd6c12031130a349a098dbeb19d8c3070d2dfbe

Signature · 1 line
2.52.0.351.gbe84eed79e-goog