[4/4] mthca: allow setting "dmabarrier" on user-allocated memory

Previous thread: [3/4] dma: document dma_flags_set_dmabarrier() by akepner on Thursday, September 27, 2007 - 9:13 pm. (2 messages)

Next thread: iwl4965 and driver merging policy by Benjamin Herrenschmidt on Thursday, September 27, 2007 - 9:39 pm. (7 messages)
To: Grant Grundler <grundler@...>, Jesse Barnes <jbarnes@...>, Jes Sorensen <jes@...>, Randy Dunlap <randy.dunlap@...>, RolandDreier <rdreier@...>, James Bottomley <James.Bottomley@...>
Cc: <linux-kernel@...>
Date: Thursday, September 27, 2007 - 9:13 pm

Use the dma_flags_set_dmabarrier() interface to allow a "dmabarrier"
attribute to be associated with user-allocated memory. (For now,
it's only implemented for mthca.)

Signed-off-by: Arthur Kepner <akepner@sgi.com>

---
drivers/infiniband/core/umem.c | 7 +++++--
drivers/infiniband/hw/amso1100/c2_provider.c | 2 +-
drivers/infiniband/hw/cxgb3/iwch_provider.c | 2 +-
drivers/infiniband/hw/ehca/ehca_mrmw.c | 2 +-
drivers/infiniband/hw/ipath/ipath_mr.c | 2 +-
drivers/infiniband/hw/mlx4/cq.c | 2 +-
drivers/infiniband/hw/mlx4/doorbell.c | 2 +-
drivers/infiniband/hw/mlx4/mr.c | 3 ++-
drivers/infiniband/hw/mlx4/qp.c | 2 +-
drivers/infiniband/hw/mlx4/srq.c | 2 +-
drivers/infiniband/hw/mthca/mthca_provider.c | 7 ++++++-
drivers/infiniband/hw/mthca/mthca_user.h | 10 +++++++++-
include/rdma/ib_umem.h | 4 ++--
13 files changed, 32 insertions(+), 15 deletions(-)

diff --git a/drivers/infiniband/core/umem.c b/drivers/infiniband/core/umem.c
index 664d2fa..5b30b0c 100644
--- a/drivers/infiniband/core/umem.c
+++ b/drivers/infiniband/core/umem.c
@@ -69,9 +69,10 @@ static void __ib_umem_release(struct ib_device *dev, struct ib_umem *umem, int d
* @addr: userspace virtual address to start at
* @size: length of region to pin
* @access: IB_ACCESS_xxx flags for memory being pinned
+ * @dmabarrier: set "dmabarrier" attribute on this memory, if necessary
*/
struct ib_umem *ib_umem_get(struct ib_ucontext *context, unsigned long addr,
- size_t size, int access)
+ size_t size, int access, int dmabarrier)
{
struct ib_umem *umem;
struct page **page_list;
@@ -83,6 +84,8 @@ struct ib_umem *ib_umem_get(struct ib_ucontext *context, unsigned long addr,
int ret;
int off;
int i;
+ int flags = dmabarrier ? dma_flags_set_dmabarrier(DMA_BIDIRECTIONAL):
+ DMA_BIDIRECTIONAL;

if (!can_do_mlock())
retu...

To: <akepner@...>
Cc: Grant Grundler <grundler@...>, Jesse Barnes <jbarnes@...>, Jes Sorensen <jes@...>, Randy Dunlap <randy.dunlap@...>, James Bottomley <James.Bottomley@...>, <linux-kernel@...>
Date: Friday, September 28, 2007 - 3:50 pm

Sorry for not mentioning this earlier, but this patch should really be
two (or more) patches: one to add dmabarrier support to the core user
memory stuff in drivers/infiniband, and a second one to add support to
mthca (and more patches to add support to mlx4, cxgb3, etc, etc).

> + * @dmabarrier: set "dmabarrier" attribute on this memory, if necessary

Nit: just delete the "if necessary" since I don't think it makes
things clearer (and actually doesn't make much sense in this context)

Other than that this look fine to me, and I'm ready to merge it once
the necessary core DMA stuff is settled.

- R.
-

To: Roland Dreier <rdreier@...>
Cc: Grant Grundler <grundler@...>, Jesse Barnes <jbarnes@...>, Jes Sorensen <jes@...>, Randy Dunlap <randy.dunlap@...>, James Bottomley <James.Bottomley@...>, <linux-kernel@...>
Date: Tuesday, October 2, 2007 - 9:02 pm

Great. A new version of the patchset is on the way.

--
Arthur

-

Previous thread: [3/4] dma: document dma_flags_set_dmabarrier() by akepner on Thursday, September 27, 2007 - 9:13 pm. (2 messages)

Next thread: iwl4965 and driver merging policy by Benjamin Herrenschmidt on Thursday, September 27, 2007 - 9:39 pm. (7 messages)