[PATCH 6/6] RDMA/umem: add support for P2P RDMA

Martin Oliveira posted 6 patches 1 year, 8 months ago
There is a newer version of this series
[PATCH 6/6] RDMA/umem: add support for P2P RDMA
Posted by Martin Oliveira 1 year, 8 months ago
If the device supports P2PDMA, add the FOLL_PCI_P2PDMA flag

This allows ibv_reg_mr() and friends to use P2PDMA memory that has been
mmaped into userspace for MRs in IB and RDMA transactions.

Co-developed-by: Logan Gunthorpe <logang@deltatee.com>
Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
Signed-off-by: Martin Oliveira <martin.oliveira@eideticom.com>
---
 drivers/infiniband/core/umem.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/infiniband/core/umem.c b/drivers/infiniband/core/umem.c
index 07c571c7b699..b59bb6e1475e 100644
--- a/drivers/infiniband/core/umem.c
+++ b/drivers/infiniband/core/umem.c
@@ -208,6 +208,9 @@ struct ib_umem *ib_umem_get(struct ib_device *device, unsigned long addr,
 	if (umem->writable)
 		gup_flags |= FOLL_WRITE;
 
+	if (ib_dma_pci_p2p_dma_supported(device))
+		gup_flags |= FOLL_PCI_P2PDMA;
+
 	while (npages) {
 		cond_resched();
 		pinned = pin_user_pages_fast(cur_base,
-- 
2.34.1
Re: [PATCH 6/6] RDMA/umem: add support for P2P RDMA
Posted by Jason Gunthorpe 1 year, 8 months ago
On Wed, Jun 05, 2024 at 01:29:34PM -0600, Martin Oliveira wrote:
> If the device supports P2PDMA, add the FOLL_PCI_P2PDMA flag
> 
> This allows ibv_reg_mr() and friends to use P2PDMA memory that has been
> mmaped into userspace for MRs in IB and RDMA transactions.
> 
> Co-developed-by: Logan Gunthorpe <logang@deltatee.com>
> Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
> Signed-off-by: Martin Oliveira <martin.oliveira@eideticom.com>
> ---
>  drivers/infiniband/core/umem.c | 3 +++
>  1 file changed, 3 insertions(+)

Acked-by: Jason Gunthorpe <jgg@nvidia.com>

Jason