[ofw] [Patch 7/62] Reference implementation of NDv2
Fab Tillier
ftillier at microsoft.com
Wed Feb 20 16:03:57 PST 2013
Add new flag to control whether registered memory is secured. MmSecureVirtualMemory provides the hooking mechanism for registration caches. However, certain types of memory cannot be secured (AWE memory, for example), or applications that don't intend to cache registrations don't want the overhead. Internally, the HCA driver does not secure the CQ and QP ring buffers and uses a separate parameter to control this. Update these call paths to use the new flag.
Signed-off-by: Fab Tillier <ftillier at microsoft.com>
diff -dwup3 -x *svn* -r c:\dev\openib\ofw\gen1\branches\mlx4_30\trunk\hw\mlx4\kernel\bus\ib\cq.c .\hw\mlx4\kernel\bus\ib\cq.c
--- c:\dev\openib\ofw\gen1\branches\mlx4_30\trunk\hw\mlx4\kernel\bus\ib\cq.c Thu Mar 29 00:15:28 2012
+++ .\hw\mlx4\kernel\bus\ib\cq.c Sat Jun 23 14:15:09 2012
@@ -188,7 +188,7 @@ struct ib_cq *mlx4_ib_create_cq_internal
}
cq->umem = ib_umem_get(context, ucmd.buf_addr, buf_size,
- IB_ACCESS_LOCAL_WRITE, FALSE);
+ (ib_access_flags)(IB_ACCESS_LOCAL_WRITE | IB_ACCESS_NO_SECURE));
if (IS_ERR(cq->umem)) {
err = PTR_ERR(cq->umem);
MLX4_PRINT(TRACE_LEVEL_ERROR, MLX4_DBG_DRV,
diff -dwup3 -x *svn* -r c:\dev\openib\ofw\gen1\branches\mlx4_30\trunk\hw\mlx4\kernel\bus\ib\doorbell.c .\hw\mlx4\kernel\bus\ib\doorbell.c
--- c:\dev\openib\ofw\gen1\branches\mlx4_30\trunk\hw\mlx4\kernel\bus\ib\doorbell.c Thu Mar 29 00:15:28 2012
+++ .\hw\mlx4\kernel\bus\ib\doorbell.c Wed May 23 15:14:37 2012
@@ -190,7 +190,7 @@ int mlx4_ib_db_map_user(struct mlx4_ib_u
page->user_virt = virt & (u64)PAGE_MASK;
page->refcnt = 0;
page->umem = ib_umem_get(&context->ibucontext, virt & (u64)PAGE_MASK,
- PAGE_SIZE, (ib_access_flags)0, FALSE);
+ PAGE_SIZE, (ib_access_flags)IB_ACCESS_NO_SECURE );
if (IS_ERR(page->umem)) {
err = PTR_ERR(page->umem);
kfree(page);
diff -dwup3 -x *svn* -r c:\dev\openib\ofw\gen1\branches\mlx4_30\trunk\hw\mlx4\kernel\bus\ib\mr.c .\hw\mlx4\kernel\bus\ib\mr.c
--- c:\dev\openib\ofw\gen1\branches\mlx4_30\trunk\hw\mlx4\kernel\bus\ib\mr.c Thu Mar 29 00:15:28 2012
+++ .\hw\mlx4\kernel\bus\ib\mr.c Wed May 23 15:14:37 2012
@@ -144,7 +141,7 @@ struct ib_mr *mlx4_ib_reg_user_mr(struct
if (!mr)
return (ib_mr *)ERR_PTR(-ENOMEM);
- mr->umem = ib_umem_get(pd->p_uctx, start, (size_t)length, (ib_access_flags)access_flags, TRUE);
+ mr->umem = ib_umem_get(pd->p_uctx, start, (size_t)length, (ib_access_flags)access_flags);
if (IS_ERR(mr->umem)) {
// there can be also second reason of failue - insufficient memory,
// but we can't get awared of that without changing ib_umem_get prototype
diff -dwup3 -x *svn* -r c:\dev\openib\ofw\gen1\branches\mlx4_30\trunk\hw\mlx4\kernel\bus\ib\qp.c .\hw\mlx4\kernel\bus\ib\qp.c
--- c:\dev\openib\ofw\gen1\branches\mlx4_30\trunk\hw\mlx4\kernel\bus\ib\qp.c Thu Mar 29 00:15:28 2012
+++ .\hw\mlx4\kernel\bus\ib\qp.c Thu Jul 26 15:31:14 2012
@@ -582,7 +582,7 @@ static int create_qp_common(struct mlx4_
}
qp->umem = ib_umem_get(pd->p_uctx, ucmd.buf_addr,
- qp->buf_size, (ib_access_flags)0, FALSE);
+ qp->buf_size, IB_ACCESS_NO_SECURE);
if (IS_ERR(qp->umem)) {
err = PTR_ERR(qp->umem);
MLX4_PRINT(TRACE_LEVEL_WARNING, MLX4_DBG_DRV,
diff -dwup3 -x *svn* -r c:\dev\openib\ofw\gen1\branches\mlx4_30\trunk\hw\mlx4\kernel\bus\ib\srq.c .\hw\mlx4\kernel\bus\ib\srq.c
--- c:\dev\openib\ofw\gen1\branches\mlx4_30\trunk\hw\mlx4\kernel\bus\ib\srq.c Thu Mar 29 00:15:28 2012
+++ .\hw\mlx4\kernel\bus\ib\srq.c Thu Jul 26 15:31:14 2012
@@ -145,7 +145,7 @@ struct ib_srq *mlx4_ib_create_srq(struct
}
srq->umem = ib_umem_get(pd->p_uctx, ucmd.buf_addr,
- buf_size, (ib_access_flags)0, FALSE);
+ buf_size, IB_ACCESS_NO_SECURE);
if (IS_ERR(srq->umem)) {
err = PTR_ERR(srq->umem);
MLX4_PRINT(TRACE_LEVEL_WARNING, MLX4_DBG_DRV,
diff -dwup3 -x *svn* -r c:\dev\openib\ofw\gen1\branches\mlx4_30\trunk\hw\mlx4\kernel\bus\inc\ib_verbs.h .\hw\mlx4\kernel\bus\inc\ib_verbs.h
--- c:\dev\openib\ofw\gen1\branches\mlx4_30\trunk\hw\mlx4\kernel\bus\inc\ib_verbs.h Thu May 31 11:22:18 2012
+++ .\hw\mlx4\kernel\bus\inc\ib_verbs.h Thu Jul 26 15:31:14 2012
@@ -783,7 +753,8 @@ enum ib_access_flags {
IB_ACCESS_REMOTE_WRITE = (1<<1),
IB_ACCESS_REMOTE_READ = (1<<2),
IB_ACCESS_REMOTE_ATOMIC = (1<<3),
- IB_ACCESS_MW_BIND = (1<<4)
+ IB_ACCESS_MW_BIND = (1<<4),
+ IB_ACCESS_NO_SECURE = (1<<31)
};
struct ib_phys_buf {
diff -dwup3 -x *svn* -r c:\dev\openib\ofw\gen1\branches\mlx4_30\trunk\hw\mlx4\kernel\hca\data.c .\hw\mlx4\kernel\hca\data.c
--- c:\dev\openib\ofw\gen1\branches\mlx4_30\trunk\hw\mlx4\kernel\hca\data.c Thu May 31 11:22:19 2012
+++ .\hw\mlx4\kernel\hca\data.c Thu Jul 26 15:31:14 2012
@@ -506,6 +506,7 @@ to_qp_acl(
IBAL_ACL(IB_AC_ATOMIC,IB_ACCESS_REMOTE_ATOMIC);
IBAL_ACL(IB_AC_LOCAL_WRITE,IB_ACCESS_LOCAL_WRITE);
IBAL_ACL(IB_AC_MW_BIND,IB_ACCESS_MW_BIND);
+ IBAL_ACL(IB_AC_NOT_CACHABLE,IB_ACCESS_NO_SECURE);
return acc;
}
@@ -522,6 +523,7 @@ from_qp_acl(
IB_ACL(IB_ACCESS_REMOTE_ATOMIC,IB_AC_ATOMIC);
IB_ACL(IB_ACCESS_LOCAL_WRITE,IB_AC_LOCAL_WRITE);
IB_ACL(IB_ACCESS_MW_BIND,IB_AC_MW_BIND);
+ IB_ACL(IB_ACCESS_NO_SECURE,IB_AC_NOT_CACHABLE);
return ibal_acl;
}
diff -dwup3 -x *svn* -r c:\dev\openib\ofw\gen1\branches\mlx4_30\trunk\hw\mlx4\kernel\inc\l2w_umem.h .\hw\mlx4\kernel\inc\l2w_umem.h
--- c:\dev\openib\ofw\gen1\branches\mlx4_30\trunk\hw\mlx4\kernel\inc\l2w_umem.h Thu Mar 29 00:15:29 2012
+++ .\hw\mlx4\kernel\inc\l2w_umem.h Wed May 23 15:14:37 2012
@@ -15,7 +15,7 @@ struct ib_umem {
void ib_umem_release(struct ib_umem *p_ib_umem);
struct ib_umem *ib_umem_get(struct ib_ucontext *context, u64 addr,
- size_t size, enum ib_access_flags access, boolean_t secure);
+ size_t size, enum ib_access_flags access);
int ib_umem_page_count(struct ib_umem *p_ib_umem);
diff -dwup3 -x *svn* -r c:\dev\openib\ofw\gen1\branches\mlx4_30\trunk\hw\mlx4\kernel\l2w\l2w_umem.c .\hw\mlx4\kernel\l2w\l2w_umem.c
--- c:\dev\openib\ofw\gen1\branches\mlx4_30\trunk\hw\mlx4\kernel\l2w\l2w_umem.c Thu Mar 29 00:15:27 2012
+++ .\hw\mlx4\kernel\l2w\l2w_umem.c Thu May 24 13:05:42 2012
@@ -43,7 +43,7 @@ void ib_umem_release(struct ib_umem *p_i
* @access: IB_ACCESS_xxx flags for memory being pinned
*/
struct ib_umem *ib_umem_get(struct ib_ucontext *context, u64 addr,
- size_t size, enum ib_access_flags access, boolean_t secure)
+ size_t size, enum ib_access_flags access)
{
int err;
struct ib_umem *p_ib_umem;
@@ -67,8 +76,11 @@ struct ib_umem *ib_umem_get(struct ib_uc
// TODO: map the memory for DMA
// secure memory
- if (!context || !secure)
+ if (!context || ((access & IB_ACCESS_NO_SECURE) != 0) ) {
+ p_ib_umem->secure_handle = NULL;
goto done;
+ }
+
__try {
p_ib_umem->secure_handle = MmSecureVirtualMemory (
(PVOID)(ULONG_PTR)addr, size,
diff -dwup3 -x *svn* -r c:\dev\openib\ofw\gen1\branches\mlx4_30\trunk\inc\iba\ib_types.h .\inc\iba\ib_types.h
--- c:\dev\openib\ofw\gen1\branches\mlx4_30\trunk\inc\iba\ib_types.h Thu May 31 11:22:18 2012
+++ .\inc\iba\ib_types.h Thu Jul 26 15:31:14 2012
@@ -10467,6 +10467,7 @@ typedef uint32_t ib_access_t;
#define IB_AC_ATOMIC 0x00000004
#define IB_AC_LOCAL_WRITE 0x00000008
#define IB_AC_MW_BIND 0x00000010
+#define IB_AC_NOT_CACHABLE 0x00000020
/*
* NOTES
* Users may combine access rights using a bit-wise or operation to specify
diff -dwup3 -x *svn* -r c:\dev\openib\ofw\gen1\branches\mlx4_30\trunk\inc\user\rdma\winverbs.h .\inc\user\rdma\winverbs.h
--- c:\dev\openib\ofw\gen1\branches\mlx4_30\trunk\inc\user\rdma\winverbs.h Thu Mar 29 00:15:25 2012
+++ .\inc\user\rdma\winverbs.h Wed May 23 15:14:37 2012
@@ -264,7 +264,7 @@ typedef struct _WV_MEMORY_KEYS
#define WV_ACCESS_REMOTE_ATOMIC 0x00000004
#define WV_ACCESS_LOCAL_WRITE 0x00000008
#define WV_ACCESS_MW_BIND 0x00000010
-#define WV_ACCESS_CACHABLE 0x00000020
+#define WV_ACCESS_NON_CACHABLE 0x00000020
// Send queue operation flags
#define WV_SEND_IMMEDIATE 0x00000001
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ndv2.7.patch
Type: application/octet-stream
Size: 7664 bytes
Desc: ndv2.7.patch
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20130221/6163d059/attachment.obj>
More information about the ofw
mailing list