[RHEL9.8] Backport Two-Step DMA Mapping API

Merge Request Required Information

JIRA: https://issues.redhat.com/browse/RHEL-113839
Upstream Status: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git

Summary of Changes

This is a backport of a new upstream API for DMA mapping. It involves drivers pre-allocating a range of the iova address space of their domain that they think they will need. Then from the point of view of the iova management code that address range is in use until it gets returned by the driver. At this point the driver then uses other functions in the new API to manage the linking and unlinking of addresses within the range for DMA operations and syncing to the iotlb. This, among other things, will allow drivers that use it to avoid issues with contention for the lock guarding the rbtree for the iova address space when the system is under a heavy i/o load to that domain, which has been a recurring issue as cpu counts continue to grow.

The backport required 2 changes for RHEL9 that should be examined closely:

  • The use of page->pgmap directly instead of using the page_pgmap helper that hasn't been backported to RHEL9.
  • Passing the iommu_dma_cookie pointer to iommu_dma_free_iova() as the code that changed that upstream to pass the iommu_domain pointer has not been backported to RHEL9.

Resolves: RHEL-113839
Signed-off-by: Jerry Snitselaar jsnitsel@redhat.com

Edited by Jerry Snitselaar

Merge request reports

Loading