Hi Linus, This is a bigger PR that principally includes ARM SMMUv3 support for nested translation. There are still additional series needed to solve problems with IRQs, but this is the iommufd side of the work. For those following, these series are still progressing: - Draft AMD IOMMU nested translation: https://lore.kernel.org/linux-iommu/20240112000646.98001-1-suravee.suthikulpanit@xxxxxxx (and many other AMD patches to prepare for this) - Draft vBTM support for SMMUv3: https://lore.kernel.org/linux-iommu/20240208151837.35068-1-shameerali.kolothum.thodi@xxxxxxxxxx/ - Draft RISCV nesting support: https://lore.kernel.org/all/20240507142600.23844-1-zong.li@xxxxxxxxxx/ - Grace command queue passthrough iommufd support: https://lore.kernel.org/all/cover.1712978212.git.nicolinc@xxxxxxxxxx/ Patches for PASID support in iommufd & vfio: https://lore.kernel.org/r/20241104132513.15890-1-yi.l.liu@xxxxxxxxx https://lore.kernel.org/r/20241108121742.18889-1-yi.l.liu@xxxxxxxxx (Several precursor series were merged this cycle so I hope this to go next cycle) A lot of the iommufd support has now been merged to qemu, with more progressing. This has a shared branch Will created for some of the SMMUv3 code. I have two patches renaming a function that I would like to get merged in this window as well to simplify next cycle. They need both iommufd and iommu trees to be merged together so I think there will be another tiny pull request. Thanks, Jason The following changes since commit 8e929cb546ee42c9a61d24fae60605e9e3192354: Linux 6.12-rc3 (2024-10-13 14:33:32 -0700) are available in the Git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/jgg/iommufd.git tags/for-linus-iommufd for you to fetch changes up to 6d026e6d48cd2a95407c8fdd8d6187b871401c23: iommu/arm-smmu-v3: Import IOMMUFD module namespace (2024-11-14 21:07:15 -0400) ---------------------------------------------------------------- iommufd 6.13 merge window pull Several new features and uAPI for iommufd: - IOMMU_IOAS_MAP_FILE allows passing in a file descriptor as the backing memory for an iommu mapping. To date VFIO/iommufd have used VMA's and pin_user_pages(), this now allows using memfds and memfd_pin_folios(). Notably this creates a pure folio path from the memfd to the iommu page table where memory is never broken down to PAGE_SIZE. - IOMMU_IOAS_CHANGE_PROCESS moves the pinned page accounting between two processes. Combined with the above this allows iommufd to support a VMM re-start using exec() where something like qemu would exec() a new version of itself and fd pass the memfds/iommufd/etc to the new process. The memfd allows DMA access to the memory to continue while the new process is getting setup, and the CHANGE_PROCESS updates all the accounting. - Support for fault reporting to userspace on non-PRI HW, such as ARM stall-mode embedded devices. - IOMMU_VIOMMU_ALLOC introduces the concept of a HW/driver backed virtual iommu. This will be used by VMMs to access hardware features that are contained with in a VM. The first use is to inform the kernel of the virtual SID to physical SID mapping when issuing SID based invalidation on ARM. Further uses will tie HW features that are directly accessed by the VM, such as invalidation queue assignment and others. - IOMMU_VDEVICE_ALLOC informs the kernel about the mapping of virtual device to physical device within a VIOMMU. Minimially this is used to translate VM issued cache invalidation commands from virtual to physical device IDs. - Enhancements to IOMMU_HWPT_INVALIDATE and IOMMU_HWPT_ALLOC to work with the VIOMMU - ARM SMMuv3 support for nested translation. Using the VIOMMU and VDEVICE the driver can model this HW's behavior for nested translation. This includes a shared branch from Will. ---------------------------------------------------------------- Jason Gunthorpe (9): vfio: Remove VFIO_TYPE1_NESTING_IOMMU iommu/arm-smmu-v3: Report IOMMU_CAP_ENFORCE_CACHE_COHERENCY for CANWBS iommu/arm-smmu-v3: Implement IOMMU_HWPT_ALLOC_NEST_PARENT iommu/arm-smmu-v3: Expose the arm_smmu_attach interface iommu: Add iommu_copy_struct_from_full_user_array helper Merge branch 'iommufd/arm-smmuv3-nested' of iommu/linux into iommufd for-next iommu/arm-smmu-v3: Support IOMMU_DOMAIN_NESTED iommu/arm-smmu-v3: Use S2FWB for NESTED domains iommu/arm-smmu-v3: Allow ATS for IOMMU_DOMAIN_NESTED Nathan Chancellor (1): iommu/arm-smmu-v3: Import IOMMUFD module namespace Nicolin Chen (28): Documentation: userspace-api: iommufd: Update HWPT_PAGING and HWPT_NESTED ACPICA: IORT: Update for revision E.f ACPI/IORT: Support CANWBS memory access flag iommu/arm-smmu-v3: Support IOMMU_GET_HW_INFO via struct arm_smmu_hw_info iommufd: Move struct iommufd_object to public iommufd header iommufd: Move _iommufd_object_alloc helper to a sharable file iommufd: Introduce IOMMUFD_OBJ_VIOMMU and its related struct iommufd: Verify object in iommufd_object_finalize/abort() iommufd/viommu: Add IOMMU_VIOMMU_ALLOC ioctl iommufd: Add alloc_domain_nested op to iommufd_viommu_ops iommufd: Allow pt_id to carry viommu_id for IOMMU_HWPT_ALLOC iommufd/selftest: Add container_of helpers iommufd/selftest: Prepare for mock_viommu_alloc_domain_nested() iommufd/selftest: Add refcount to mock_iommu_device iommufd/selftest: Add IOMMU_VIOMMU_TYPE_SELFTEST iommufd/selftest: Add IOMMU_VIOMMU_ALLOC test coverage Documentation: userspace-api: iommufd: Update vIOMMU iommufd/viommu: Add IOMMUFD_OBJ_VDEVICE and IOMMU_VDEVICE_ALLOC ioctl iommufd/selftest: Add IOMMU_VDEVICE_ALLOC test coverage iommu/viommu: Add cache_invalidate to iommufd_viommu_ops iommufd: Allow hwpt_id to carry viommu_id for IOMMU_HWPT_INVALIDATE iommufd/viommu: Add iommufd_viommu_find_dev helper iommufd/selftest: Add mock_viommu_cache_invalidate iommufd/selftest: Add IOMMU_TEST_OP_DEV_CHECK_CACHE test command iommufd/selftest: Add vIOMMU coverage for IOMMU_HWPT_INVALIDATE ioctl Documentation: userspace-api: iommufd: Update vDEVICE iommu/arm-smmu-v3: Support IOMMU_VIOMMU_ALLOC iommu/arm-smmu-v3: Support IOMMU_HWPT_INVALIDATE using a VIOMMU object Steve Sistare (13): mm/gup: Add folio_add_pins() iommufd: Rename uptr in iopt_alloc_iova() iommufd: Generalize iopt_pages address iommufd: pfn_reader local variables iommufd: Folio subroutines iommufd: pfn_reader for file mappings iommufd: Add IOMMU_IOAS_MAP_FILE iommufd: File mappings for mdev iommufd: Selftest coverage for IOMMU_IOAS_MAP_FILE iommufd: Export do_update_pinned iommufd: Lock all IOAS objects iommufd: Add IOMMU_IOAS_CHANGE_PROCESS iommufd: IOMMU_IOAS_CHANGE_PROCESS selftest Zhangfei Gao (1): iommufd: Allow fault reporting for non-PRI PCI devices Documentation/userspace-api/iommufd.rst | 226 ++++++-- drivers/acpi/arm64/iort.c | 13 + drivers/iommu/Kconfig | 9 + drivers/iommu/arm/arm-smmu-v3/Makefile | 1 + .../iommu/arm/arm-smmu-v3/arm-smmu-v3-iommufd.c | 401 ++++++++++++++ drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 139 +++-- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h | 92 +++- drivers/iommu/arm/arm-smmu/arm-smmu.c | 16 - drivers/iommu/io-pgtable-arm.c | 27 +- drivers/iommu/iommu.c | 10 - drivers/iommu/iommufd/Kconfig | 4 + drivers/iommu/iommufd/Makefile | 6 +- drivers/iommu/iommufd/driver.c | 53 ++ drivers/iommu/iommufd/fault.c | 9 +- drivers/iommu/iommufd/hw_pagetable.c | 113 +++- drivers/iommu/iommufd/io_pagetable.c | 105 +++- drivers/iommu/iommufd/io_pagetable.h | 26 +- drivers/iommu/iommufd/ioas.c | 259 +++++++++ drivers/iommu/iommufd/iommufd_private.h | 58 +- drivers/iommu/iommufd/iommufd_test.h | 32 ++ drivers/iommu/iommufd/main.c | 65 +-- drivers/iommu/iommufd/pages.c | 319 ++++++++--- drivers/iommu/iommufd/selftest.c | 364 ++++++++++--- drivers/iommu/iommufd/vfio_compat.c | 7 +- drivers/iommu/iommufd/viommu.c | 157 ++++++ drivers/vfio/vfio_iommu_type1.c | 12 +- include/acpi/actbl2.h | 3 +- include/linux/io-pgtable.h | 2 + include/linux/iommu.h | 67 ++- include/linux/iommufd.h | 108 ++++ include/linux/mm.h | 1 + include/uapi/linux/iommufd.h | 216 +++++++- include/uapi/linux/vfio.h | 2 +- mm/gup.c | 24 + tools/testing/selftests/iommu/Makefile | 1 + tools/testing/selftests/iommu/iommufd.c | 606 ++++++++++++++++++++- tools/testing/selftests/iommu/iommufd_fail_nth.c | 54 ++ tools/testing/selftests/iommu/iommufd_utils.h | 174 ++++++ 38 files changed, 3354 insertions(+), 427 deletions(-) create mode 100644 drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-iommufd.c create mode 100644 drivers/iommu/iommufd/driver.c create mode 100644 drivers/iommu/iommufd/viommu.c
Attachment:
signature.asc
Description: PGP signature