Date: Thu, 14 Nov 2024 17:18:09 +0000 From: Will Deacon To: joro@8bytes.org Cc: iommu@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, robin.murphy@arm.com, kernel-team@android.com Subject: [GIT PULL] iommu/arm-smmu: Updates for 6.13 Hi Joerg, Please pull these Arm SMMU updates for 6.13. The summary is in the tag, but the highlight is definitely the removal of the complicated block-splitting code from the Arm page-table implementations. It even means that we have a negative diffstat! As with 6.12, I've already pushed this lot to the arm/smmu branch in the iommu tree. Please can you merge that into 'next'? Cheers, Will --->8 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/will/linux.git tags/arm-smmu-updates for you to fetch changes up to a3799717b881aa0f4e722afb70e7b8ba84ae4f36: iommu/tegra241-cmdqv: Fix alignment failure at max_n_shift (2024-11-12 15:09:42 +0000) ---------------------------------------------------------------- Arm SMMU updates for 6.13 - SMMUv2: * Return -EPROBE_DEFER for client devices probing before their SMMU. * Devicetree binding updates for Qualcomm MMU-500 implementations. - SMMUv3: * Minor fixes and cleanup for NVIDIA's virtual command queue driver. - IO-PGTable: * Fix indexing of concatenated PGDs and extend selftest coverage. * Remove unused block-splitting support. ---------------------------------------------------------------- Dmitry Baryshkov (1): dt-bindings: iommu: arm,smmu: Add Qualcomm SAR2130P compatible Jason Gunthorpe (3): iommu/io-pgtable-arm: Remove split on unmap behavior iommu/io-pgtable-arm-v7s: Remove split on unmap behavior iommu: Add a kdoc to iommu_unmap() Mostafa Saleh (2): iommu/io-pgtable-arm: Fix stage-2 map/unmap for concatenated tables iommu/io-pgtable-arm: Add self test for the last page in the IAS Nicolin Chen (2): iommu/tegra241-cmdqv: Staticize cmdqv_debugfs_dir iommu/tegra241-cmdqv: Fix alignment failure at max_n_shift Pratyush Brahma (1): iommu/arm-smmu: Defer probe of clients after smmu device bound Qingqing Zhou (1): dt-bindings: arm-smmu: document QCS615 APPS SMMU Will Deacon (2): iommu/tegra241-cmdqv: Fix unused variable warning Merge branch 'for-joerg/arm-smmu/bindings' into arm/smmu .../devicetree/bindings/iommu/arm,smmu.yaml | 5 + drivers/iommu/arm/arm-smmu-v3/tegra241-cmdqv.c | 7 +- drivers/iommu/arm/arm-smmu/arm-smmu.c | 11 ++ drivers/iommu/io-pgtable-arm-v7s.c | 149 +-------------------- drivers/iommu/io-pgtable-arm.c | 114 +++++----------- drivers/iommu/iommu.c | 14 ++ 6 files changed, 74 insertions(+), 226 deletions(-) . Date: Tue, 19 Nov 2024 18:06:25 +0100 From: Christoph Hellwig To: Linus Torvalds Cc: linux-kernel@vger.kernel.org, iommu@lists.linux.dev Subject: [GIT PULL] dma-mapping updates for Linux 6.13 The following changes since commit e42b1a9a2557aa94fee47f078633677198386a52: Merge tag 'spi-fix-v6.12-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi (2024-10-28 11:16:33 -1000) are available in the Git repository at: git://git.infradead.org/users/hch/dma-mapping.git tags/dma-mapping-6.13-2024-11-19 for you to fetch changes up to 22293c33738c14bb84b9d3e771bc37150e7cf8e7: dma-mapping: save base/size instead of pointer to shared DMA pool (2024-11-14 10:45:09 +0100) ---------------------------------------------------------------- dma-mapping updates for Linux 6.13 - improve the DMA API tracing code (Sean Anderson) - misc cleanups (Christoph Hellwig, Sui Jingfeng) - fix pointer abuse when finding the shared DMA pool (Geert Uytterhoeven) - fix a deadlock in dma-debug (Levi Yun) ---------------------------------------------------------------- Christoph Hellwig (3): dma-debug: store a phys_addr_t in struct dma_debug_entry dma-debug: remove DMA_API_DEBUG_SG dma-mapping: drop unneeded includes from dma-mapping.h Geert Uytterhoeven (1): dma-mapping: save base/size instead of pointer to shared DMA pool Levi Yun (1): dma-debug: fix a possible deadlock on radix_lock Sean Anderson (5): dma-mapping: use macros to define events in a class dma-mapping: trace dma_alloc/free direction dma-mapping: use trace_dma_alloc for dma_alloc* instead of using trace_dma_map dma-mapping: trace more error paths dma-mapping: fix swapped dir/flags arguments to trace_dma_alloc_sgt_err Sui Jingfeng (1): dma-mapping: remove an outdated comment from dma-map-ops.h arch/powerpc/platforms/pseries/svm.c | 1 + include/linux/dma-map-ops.h | 2 +- include/linux/dma-mapping.h | 4 - include/trace/events/dma.h | 213 ++++++++++++++++++++++++++++------- kernel/dma/Kconfig | 17 --- kernel/dma/coherent.c | 14 ++- kernel/dma/debug.c | 89 ++++++--------- kernel/dma/mapping.c | 37 ++++-- 8 files changed, 242 insertions(+), 135 deletions(-) . Date: Wed, 20 Nov 2024 10:53:45 -0400 From: Jason Gunthorpe To: Linus Torvalds Cc: iommu@lists.linux.dev, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Kevin Tian Subject: [GIT PULL] Please pull IOMMUFD subsystem changes --11c9dN1vCblxRVbY Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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@amd.com (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@huawei.com/ - Draft RISCV nesting support: https://lore.kernel.org/all/20240507142600.23844-1-zong.li@sifive.com/ - Grace command queue passthrough iommufd support: https://lore.kernel.org/all/cover.1712978212.git.nicolinc@nvidia.com/ Patches for PASID support in iommufd & vfio: https://lore.kernel.org/r/20241104132513.15890-1-yi.l.liu@intel.com https://lore.kernel.org/r/20241108121742.18889-1-yi.l.liu@intel.com (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 --11c9dN1vCblxRVbY Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYKAB0WIQRRRCHOFoQz/8F5bUaFwuHvBreFYQUCZz339wAKCRCFwuHvBreF YZqJAPwMlQshHsuhWM0G0wH1hxd5EJvT7YN0cE6d5jocdNKlmwEAjMeI8jVCla33 IcL1h3BlWFZI+Khb4+A65whk/I3z5gM= =EV0D -----END PGP SIGNATURE----- --11c9dN1vCblxRVbY-- .