summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Guralnik <michaelgur@mellanox.com>2020-02-12 09:35:59 +0200
committerJason Gunthorpe <jgg@mellanox.com>2020-02-13 13:38:02 -0400
commitf03d9fadfe13a78ee28fec320d43f7b37574adcb (patch)
tree93e35fb818ea3843ba89a9bbec7bb68e0e85bff8
parentca750d4a9c426854e221ca404fbefeab9800134e (diff)
downloadlinux-stable-f03d9fadfe13a78ee28fec320d43f7b37574adcb.tar.gz
linux-stable-f03d9fadfe13a78ee28fec320d43f7b37574adcb.tar.bz2
linux-stable-f03d9fadfe13a78ee28fec320d43f7b37574adcb.zip
RDMA/core: Add weak ordering dma attr to dma mapping
For memory regions registered with IB_ACCESS_RELAXED_ORDERING will be dma mapped with the DMA_ATTR_WEAK_ORDERING. This will allow reads and writes to the mapping to be weakly ordered, such change can enhance performance on some supporting architectures. Link: https://lore.kernel.org/r/20200212073559.684139-1-leon@kernel.org Signed-off-by: Michael Guralnik <michaelgur@mellanox.com> Signed-off-by: Leon Romanovsky <leonro@mellanox.com> Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
-rw-r--r--drivers/infiniband/core/umem.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/infiniband/core/umem.c b/drivers/infiniband/core/umem.c
index 06b6125b5ae1..82455a1392f1 100644
--- a/drivers/infiniband/core/umem.c
+++ b/drivers/infiniband/core/umem.c
@@ -197,6 +197,7 @@ struct ib_umem *ib_umem_get(struct ib_device *device, unsigned long addr,
unsigned long lock_limit;
unsigned long new_pinned;
unsigned long cur_base;
+ unsigned long dma_attr = 0;
struct mm_struct *mm;
unsigned long npages;
int ret;
@@ -278,10 +279,12 @@ struct ib_umem *ib_umem_get(struct ib_device *device, unsigned long addr,
sg_mark_end(sg);
- umem->nmap = ib_dma_map_sg(device,
- umem->sg_head.sgl,
- umem->sg_nents,
- DMA_BIDIRECTIONAL);
+ if (access & IB_ACCESS_RELAXED_ORDERING)
+ dma_attr |= DMA_ATTR_WEAK_ORDERING;
+
+ umem->nmap =
+ ib_dma_map_sg_attrs(device, umem->sg_head.sgl, umem->sg_nents,
+ DMA_BIDIRECTIONAL, dma_attr);
if (!umem->nmap) {
ret = -ENOMEM;