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

2007-10-02 Thread akepner
On Fri, Sep 28, 2007 at 12:50:00PM -0700, Roland Dreier wrote:

> 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).

Makes sense. 

> 
>  > + * @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)
>

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

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

-- 
Arthur

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


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

2007-10-02 Thread akepner
On Fri, Sep 28, 2007 at 12:50:00PM -0700, Roland Dreier wrote:

 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).

Makes sense. 

 
   + * @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)


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

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

-- 
Arthur

-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


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

2007-09-28 Thread Roland Dreier
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 unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


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

2007-09-28 Thread Roland Dreier
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 unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


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

2007-09-27 Thread akepner

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 <[EMAIL PROTECTED]>

--- 
 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())
return ERR_PTR(-EPERM);
@@ -160,7 +163,7 @@ struct ib_umem *ib_umem_get(struct ib_ucontext *context, 
unsigned long addr,
chunk->nmap = ib_dma_map_sg(context->device,
>page_list[0],
chunk->nents,
-   DMA_BIDIRECTIONAL);
+   flags);
if (chunk->nmap <= 0) {
for (i = 0; i < chunk->nents; ++i)
put_page(chunk->page_list[i].page);
diff --git a/drivers/infiniband/hw/amso1100/c2_provider.c 
b/drivers/infiniband/hw/amso1100/c2_provider.c
index 997cf15..17243b7 100644
--- a/drivers/infiniband/hw/amso1100/c2_provider.c
+++ b/drivers/infiniband/hw/amso1100/c2_provider.c
@@ -449,7 +449,7 @@ static struct ib_mr *c2_reg_user_mr(struct ib_pd *pd, u64 
start, u64 length,
return ERR_PTR(-ENOMEM);
c2mr->pd = c2pd;
 
-   c2mr->umem = ib_umem_get(pd->uobject->context, start, length, acc);
+   c2mr->umem = ib_umem_get(pd->uobject->context, start, length, acc, 0);
if (IS_ERR(c2mr->umem)) {
err = PTR_ERR(c2mr->umem);
kfree(c2mr);
diff --git a/drivers/infiniband/hw/cxgb3/iwch_provider.c 
b/drivers/infiniband/hw/cxgb3/iwch_provider.c
index f0c7775..d0a514c 100644
--- a/drivers/infiniband/hw/cxgb3/iwch_provider.c
+++ b/drivers/infiniband/hw/cxgb3/iwch_provider.c
@@ -601,7 +601,7 @@ static struct ib_mr *iwch_reg_user_mr(struct ib_pd *pd, u64 
start, u64 length,
if (!mhp)
return ERR_PTR(-ENOMEM);
 
-   mhp->umem = ib_umem_get(pd->uobject->context, start, length, acc);
+   mhp->umem = ib_umem_get(pd->uobject->context, start, length, acc, 0);
if (IS_ERR(mhp->umem)) {
err = PTR_ERR(mhp->umem);
kfree(mhp);
diff --git a/drivers/infiniband/hw/ehca/ehca_mrmw.c 
b/drivers/infiniband/hw/ehca/ehca_mrmw.c
index d97eda3..c13c11c 100644
--- a/drivers/infiniband/hw/ehca/ehca_mrmw.c
+++ b/drivers/infiniband/hw/ehca/ehca_mrmw.c
@@ -329,7 +329,7 @@ struct ib_mr *ehca_reg_user_mr(struct ib_pd *pd, u64 start, 
u64 length,
}
 
e_mr->umem = ib_umem_get(pd->uobject->context, start, length,
-mr_access_flags);
+mr_access_flags, 0);
if (IS_ERR(e_mr->umem)) {
ib_mr = (void *)e_mr->umem;
goto reg_user_mr_exit1;
diff --git a/drivers/infiniband/hw/ipath/ipath_mr.c 
b/drivers/infiniband/hw/ipath/ipath_mr.c
index e442470..e351222 100644
--- a/drivers/infiniband/hw/ipath/ipath_mr.c
+++ b/drivers/infiniband/hw/ipath/ipath_mr.c
@@ -195,7 +195,7 @@ struct ib_mr *ipath_reg_user_mr(struct ib_pd *pd, u64 
start, u64 length,
  

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

2007-09-27 Thread akepner

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 [EMAIL PROTECTED]

--- 
 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())
return ERR_PTR(-EPERM);
@@ -160,7 +163,7 @@ struct ib_umem *ib_umem_get(struct ib_ucontext *context, 
unsigned long addr,
chunk-nmap = ib_dma_map_sg(context-device,
chunk-page_list[0],
chunk-nents,
-   DMA_BIDIRECTIONAL);
+   flags);
if (chunk-nmap = 0) {
for (i = 0; i  chunk-nents; ++i)
put_page(chunk-page_list[i].page);
diff --git a/drivers/infiniband/hw/amso1100/c2_provider.c 
b/drivers/infiniband/hw/amso1100/c2_provider.c
index 997cf15..17243b7 100644
--- a/drivers/infiniband/hw/amso1100/c2_provider.c
+++ b/drivers/infiniband/hw/amso1100/c2_provider.c
@@ -449,7 +449,7 @@ static struct ib_mr *c2_reg_user_mr(struct ib_pd *pd, u64 
start, u64 length,
return ERR_PTR(-ENOMEM);
c2mr-pd = c2pd;
 
-   c2mr-umem = ib_umem_get(pd-uobject-context, start, length, acc);
+   c2mr-umem = ib_umem_get(pd-uobject-context, start, length, acc, 0);
if (IS_ERR(c2mr-umem)) {
err = PTR_ERR(c2mr-umem);
kfree(c2mr);
diff --git a/drivers/infiniband/hw/cxgb3/iwch_provider.c 
b/drivers/infiniband/hw/cxgb3/iwch_provider.c
index f0c7775..d0a514c 100644
--- a/drivers/infiniband/hw/cxgb3/iwch_provider.c
+++ b/drivers/infiniband/hw/cxgb3/iwch_provider.c
@@ -601,7 +601,7 @@ static struct ib_mr *iwch_reg_user_mr(struct ib_pd *pd, u64 
start, u64 length,
if (!mhp)
return ERR_PTR(-ENOMEM);
 
-   mhp-umem = ib_umem_get(pd-uobject-context, start, length, acc);
+   mhp-umem = ib_umem_get(pd-uobject-context, start, length, acc, 0);
if (IS_ERR(mhp-umem)) {
err = PTR_ERR(mhp-umem);
kfree(mhp);
diff --git a/drivers/infiniband/hw/ehca/ehca_mrmw.c 
b/drivers/infiniband/hw/ehca/ehca_mrmw.c
index d97eda3..c13c11c 100644
--- a/drivers/infiniband/hw/ehca/ehca_mrmw.c
+++ b/drivers/infiniband/hw/ehca/ehca_mrmw.c
@@ -329,7 +329,7 @@ struct ib_mr *ehca_reg_user_mr(struct ib_pd *pd, u64 start, 
u64 length,
}
 
e_mr-umem = ib_umem_get(pd-uobject-context, start, length,
-mr_access_flags);
+mr_access_flags, 0);
if (IS_ERR(e_mr-umem)) {
ib_mr = (void *)e_mr-umem;
goto reg_user_mr_exit1;
diff --git a/drivers/infiniband/hw/ipath/ipath_mr.c 
b/drivers/infiniband/hw/ipath/ipath_mr.c
index e442470..e351222 100644
--- a/drivers/infiniband/hw/ipath/ipath_mr.c
+++ b/drivers/infiniband/hw/ipath/ipath_mr.c
@@ -195,7 +195,7 @@ struct ib_mr *ipath_reg_user_mr(struct ib_pd *pd, u64 
start, u64 length,
goto bail;
}