Skip to content
Snippets Groups Projects
  1. Apr 22, 2024
    • Vivek Kasireddy's avatar
      vfio/pci: Allow MMIO regions to be exported through dma-buf · 5ef225e9
      Vivek Kasireddy authored
      
      From Jason Gunthorpe:
      "dma-buf has become a way to safely acquire a handle to non-struct page
      memory that can still have lifetime controlled by the exporter. Notably
      RDMA can now import dma-buf FDs and build them into MRs which allows for
      PCI P2P operations. Extend this to allow vfio-pci to export MMIO memory
      from PCI device BARs.
      
      The patch design loosely follows the pattern in commit
      db1a8dd9 ("habanalabs: add support for dma-buf exporter") except this
      does not support pinning.
      
      Instead, this implements what, in the past, we've called a revocable
      attachment using move. In normal situations the attachment is pinned, as a
      BAR does not change physical address. However when the VFIO device is
      closed, or a PCI reset is issued, access to the MMIO memory is revoked.
      
      Revoked means that move occurs, but an attempt to immediately re-map the
      memory will fail. In the reset case a future move will be triggered when
      MMIO access returns. As both close and reset are under userspace control
      it is expected that userspace will suspend use of the dma-buf before doing
      these operations, the revoke is purely for kernel self-defense against a
      hostile userspace."
      
      Following enhancements are made to the original patch:
      - Use P2P DMA APIs to create pages (ZONE_DEVICE) instead of DMA addrs
      - Add a mmap handler to provide CPU access to the dmabuf
      - Add support for creating dmabuf from multiple areas (or ranges)
      
      Original-patch-by: default avatarJason Gunthorpe <jgg@nvidia.com>
      Signed-off-by: default avatarVivek Kasireddy <vivek.kasireddy@intel.com>
      5ef225e9
    • Vivek Kasireddy's avatar
      vfio: Export vfio device get and put registration helpers · 510f8ac8
      Vivek Kasireddy authored
      
      These helpers are useful for managing additional references taken
      on the device from other associated VFIO modules.
      
      Original-patch-by: default avatarJason Gunthorpe <jgg@nvidia.com>
      Signed-off-by: default avatarVivek Kasireddy <vivek.kasireddy@intel.com>
      510f8ac8
  2. Apr 18, 2024
  3. Apr 17, 2024
Loading