]> Gentwo Git Trees - linux/.git/commitdiff
Merge tag 'for-linus-iommufd' of git://git.kernel.org/pub/scm/linux/kernel/git/jgg...
authorLinus Torvalds <torvalds@linux-foundation.org>
Fri, 5 Dec 2025 02:50:11 +0000 (18:50 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 5 Dec 2025 02:50:11 +0000 (18:50 -0800)
Pull iommufd updates from Jason Gunthorpe:
 "This is a pretty consequential cycle for iommufd, though this pull is
  not too big. It is based on a shared branch with VFIO that introduces
  VFIO_DEVICE_FEATURE_DMA_BUF a DMABUF exporter for VFIO device's MMIO
  PCI BARs. This was a large multiple series journey over the last year
  and a half.

  Based on that work IOMMUFD gains support for VFIO DMABUF's in its
  existing IOMMU_IOAS_MAP_FILE, which closes the last major gap to
  support PCI peer to peer transfers within VMs.

  In Joerg's iommu tree we have the "generic page table" work which aims
  to consolidate all the duplicated page table code in every iommu
  driver into a single algorithm. This will be used by iommufd to
  implement unique page table operations to start adding new features
  and improve performance.

  In here:

   - Expand IOMMU_IOAS_MAP_FILE to accept a DMABUF exported from VFIO.
     This is the first step to broader DMABUF support in iommufd, right
     now it only works with VFIO. This closes the last functional gap
     with classic VFIO type 1 to safely support PCI peer to peer DMA by
     mapping the VFIO device's MMIO into the IOMMU.

   - Relax SMMUv3 restrictions on nesting domains to better support
     qemu's sequence to have an identity mapping before the vSID is
     established"

* tag 'for-linus-iommufd' of git://git.kernel.org/pub/scm/linux/kernel/git/jgg/iommufd:
  iommu/arm-smmu-v3-iommufd: Allow attaching nested domain for GBPA cases
  iommufd/selftest: Add some tests for the dmabuf flow
  iommufd: Accept a DMABUF through IOMMU_IOAS_MAP_FILE
  iommufd: Have iopt_map_file_pages convert the fd to a file
  iommufd: Have pfn_reader process DMABUF iopt_pages
  iommufd: Allow MMIO pages in a batch
  iommufd: Allow a DMABUF to be revoked
  iommufd: Do not map/unmap revoked DMABUFs
  iommufd: Add DMABUF to iopt_pages
  vfio/pci: Add vfio_pci_dma_buf_iommufd_map()

1  2 
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-iommufd.c
drivers/iommu/iommufd/iommufd_private.h
drivers/iommu/iommufd/iommufd_test.h
drivers/iommu/iommufd/selftest.c
include/linux/vfio_pci_core.h
tools/testing/selftests/iommu/iommufd.c
tools/testing/selftests/iommu/iommufd_utils.h

index 781a75c79eeaec9390f073786959356bb0d3f124,9166c39eb0c8b261ed263463d2962b49cca6c40c..73e73e1ec1583706990562eed2e2fb8ce1f5dae2
@@@ -29,15 -29,10 +29,17 @@@ enum 
        IOMMU_TEST_OP_PASID_REPLACE,
        IOMMU_TEST_OP_PASID_DETACH,
        IOMMU_TEST_OP_PASID_CHECK_HWPT,
+       IOMMU_TEST_OP_DMABUF_GET,
+       IOMMU_TEST_OP_DMABUF_REVOKE,
  };
  
 +enum {
 +      MOCK_IOMMUPT_DEFAULT = 0,
 +      MOCK_IOMMUPT_HUGE,
 +      MOCK_IOMMUPT_AMDV1,
 +};
 +
 +/* These values are true for MOCK_IOMMUPT_DEFAULT */
  enum {
        MOCK_APERTURE_START = 1UL << 24,
        MOCK_APERTURE_LAST = (1UL << 31) - 1,
Simple merge
index 336a0e58b4432f63b02c39721cfe5ad3ee6cda35,6a3074f2cf1ceab88268173925bfeeafd533c660..706877f998ff37f42e2c302ef31211aff330d76f
@@@ -29,12 -28,8 +29,13 @@@ struct vfio_pci_core_device
  struct vfio_pci_region;
  struct p2pdma_provider;
  struct dma_buf_phys_vec;
+ struct dma_buf_attachment;
  
 +struct vfio_pci_eventfd {
 +      struct eventfd_ctx      *ctx;
 +      struct rcu_head         rcu;
 +};
 +
  struct vfio_pci_regops {
        ssize_t (*rw)(struct vfio_pci_core_device *vdev, char __user *buf,
                      size_t count, loff_t *ppos, bool iswrite);
@@@ -216,14 -204,7 +217,17 @@@ VFIO_IOREAD_DECLARATION(32
  VFIO_IOREAD_DECLARATION(64)
  #endif
  
 +static inline bool is_aligned_for_order(struct vm_area_struct *vma,
 +                                      unsigned long addr,
 +                                      unsigned long pfn,
 +                                      unsigned int order)
 +{
 +      return !(order && (addr < vma->vm_start ||
 +                         addr + (PAGE_SIZE << order) > vma->vm_end ||
 +                         !IS_ALIGNED(pfn, 1 << order)));
 +}
 +
+ int vfio_pci_dma_buf_iommufd_map(struct dma_buf_attachment *attachment,
+                                struct dma_buf_phys_vec *phys);
  #endif /* VFIO_PCI_CORE_H */