]> git.ipfire.org Git - thirdparty/linux.git/commit
PCI/P2PDMA: Refactor to separate core P2P functionality from memory allocation
authorLeon Romanovsky <leonro@nvidia.com>
Thu, 20 Nov 2025 09:28:22 +0000 (11:28 +0200)
committerAlex Williamson <alex@shazbot.org>
Thu, 20 Nov 2025 19:01:52 +0000 (12:01 -0700)
commit372d6d1b8ae3cdfe6b0638a0a848c6865ec94567
treef2607bae1e226115b662cf94f243c21d8ae50628
parentd4504262f745e48c1739c8b864f779b4b0f9de80
PCI/P2PDMA: Refactor to separate core P2P functionality from memory allocation

Refactor the PCI P2PDMA subsystem to separate the core peer-to-peer DMA
functionality from the optional memory allocation layer. This creates a
two-tier architecture:

The core layer provides P2P mapping functionality for physical addresses
based on PCI device MMIO BARs and integrates with the DMA API for
mapping operations. This layer is required for all P2PDMA users.

The optional upper layer provides memory allocation capabilities
including gen_pool allocator, struct page support, and sysfs interface
for user space access.

This separation allows subsystems like DMABUF to use only the core P2P
mapping functionality without the overhead of memory allocation features
they don't need. The core functionality is now available through the
new pcim_p2pdma_provider() function that returns a p2pdma_provider
structure.

Tested-by: Alex Mastro <amastro@fb.com>
Tested-by: Nicolin Chen <nicolinc@nvidia.com>
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
Acked-by: Ankit Agrawal <ankita@nvidia.com>
Link: https://lore.kernel.org/r/20251120-dmabuf-vfio-v9-3-d7f71607f371@nvidia.com
Signed-off-by: Alex Williamson <alex@shazbot.org>
drivers/pci/p2pdma.c
include/linux/pci-p2pdma.h