mbox series

[v3,0/4] iommu: Support IOMMU_RESV_SW_MSI with nesting

Message ID cover.1723056910.git.nicolinc@nvidia.com
Headers show
Series iommu: Support IOMMU_RESV_SW_MSI with nesting | expand

Message

Nicolin Chen Aug. 7, 2024, 7 p.m. UTC
The dma-iommu needs to find the correct domain for MSI mapping. With an
IOMMU_DOMAIN_NESTED, the mapping resides in its parent paging domain.

Add a get_msi_mapping_domain op for drivers to return paging domains.

Add an iommufd selftest coverage for that, by doing a loopback test.

Add arm_smmu_get_msi_mapping_domain in the SMMUv3 driver so its nesting
feature could work with MSI correctly.

This is based on top of the reserved-IOVA change:
https://lore.kernel.org/all/20240802053458.2754673-1-nicolinc@nvidia.com/
And Jason's SMMUv3 nesting series:
https://lore.kernel.org/all/0-v1-54e734311a7f+14f72-smmuv3_nesting_jgg@nvidia.com/

This series is on Github:
https://github.com/nicolinc/iommufd/commits/iommufd_nesting_sw_msi/

[changelog]
v3:
 * Refined PATCH-2 commit message
 * Added domain->ops check in PATCH-2
 * Added PATCH-4 to implement in SMMUv3 driver
v2:
 https://lore.kernel.org/all/cover.1722644866.git.nicolinc@nvidia.com/
 * Resent with a proper bug fix.

Thanks
Nicolin

Nicolin Chen (3):
  iommufd: Reorder include files
  iommufd/selftest: Add coverage for IOMMU_RESV_SW_MSI
  iommu/arm-smmu-v3: Implement arm_smmu_get_msi_mapping_domain

Robin Murphy (1):
  iommu/dma: Support MSIs through nested domains

 drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c   | 10 ++
 drivers/iommu/dma-iommu.c                     | 18 +++-
 drivers/iommu/iommufd/device.c                |  4 +-
 drivers/iommu/iommufd/fault.c                 |  4 +-
 drivers/iommu/iommufd/io_pagetable.c          |  8 +-
 drivers/iommu/iommufd/io_pagetable.h          |  2 +-
 drivers/iommu/iommufd/ioas.c                  |  2 +-
 drivers/iommu/iommufd/iommufd_private.h       |  9 +-
 drivers/iommu/iommufd/iommufd_test.h          |  6 +-
 drivers/iommu/iommufd/iova_bitmap.c           |  2 +-
 drivers/iommu/iommufd/main.c                  |  8 +-
 drivers/iommu/iommufd/pages.c                 | 10 +-
 drivers/iommu/iommufd/selftest.c              | 92 ++++++++++++++++++-
 include/linux/iommu.h                         |  4 +
 include/linux/iommufd.h                       |  4 +-
 include/uapi/linux/iommufd.h                  |  2 +-
 tools/testing/selftests/iommu/iommufd_utils.h |  9 ++
 17 files changed, 160 insertions(+), 34 deletions(-)