[ofa-general] [PATCH 3/3] ofed-1.3-rc3 IB/ehca: backport patch for rhel4.6

Hoang-Nam Nguyen hnguyen at linux.vnet.ibm.com
Wed Jan 23 09:47:45 PST 2008


IB/ehca: backport ehca's mmap-to-user-space for 2.6.9_U6

This patch is required since previous version is not patchable due to
many changes in source code. That means no functional changes were
made by this new version.

Signed-off-by: Hoang-Nam Nguyen <hnguyen at de.ibm.com>
---
 .../2.6.9_U6/backport_ehca_2_rhel45_umap.patch     |  120 ++++++++++----------
 1 files changed, 58 insertions(+), 62 deletions(-)

diff --git a/kernel_patches/backport/2.6.9_U6/backport_ehca_2_rhel45_umap.patch b/kernel_patches/backport/2.6.9_U6/backport_ehca_2_rhel45_umap.patch
index fccef72..ff9b9e3 100644
--- a/kernel_patches/backport/2.6.9_U6/backport_ehca_2_rhel45_umap.patch
+++ b/kernel_patches/backport/2.6.9_U6/backport_ehca_2_rhel45_umap.patch
@@ -1,25 +1,22 @@
-diff -Nurp ofa_kernel-1.3/drivers/infiniband/hw/ehca/ehca_classes.h rhel4u5_ofa_kernel-1.3/drivers/infiniband/hw/ehca/ehca_classes.h
---- ofa_kernel-1.3/drivers/infiniband/hw/ehca/ehca_classes.h	2007-09-26 09:45:25.000000000 -0700
-+++ rhel4u5_ofa_kernel-1.3/drivers/infiniband/hw/ehca/ehca_classes.h	2007-09-26 03:41:13.000000000 -0700
-@@ -161,14 +161,13 @@ struct ehca_qp {
- 	struct ipz_qp_handle ipz_qp_handle;
- 	struct ehca_pfqp pf;
- 	struct ib_qp_init_attr init_attr;
-+	u64 uspace_squeue;
-+	u64 uspace_rqueue;
-+	u64 uspace_fwh;
- 	struct ehca_cq *send_cq;
- 	struct ehca_cq *recv_cq;
- 	unsigned int sqerr_purgeflag;
- 	struct hlist_node list_entries;
+diff -Nurp a/drivers/infiniband/hw/ehca/ehca_classes.h b/drivers/infiniband/hw/ehca/ehca_classes.h
+--- a/drivers/infiniband/hw/ehca/ehca_classes.h	2008-01-23 15:30:42.000000000 +0100
++++ b/drivers/infiniband/hw/ehca/ehca_classes.h	2008-01-23 15:38:37.000000000 +0100
+@@ -179,10 +179,10 @@ struct ehca_qp {
+ 	/* array to cache modify_qp()'s parms for GSI/SMI qp */
+ 	struct ehca_mod_qp_parm *mod_qp_parm;
+ 	int mod_qp_parm_idx;
 -	/* mmap counter for resources mapped into user space */
 -	u32 mm_count_squeue;
 -	u32 mm_count_rqueue;
 -	u32 mm_count_galpa;
- };
- 
- #define IS_SRQ(qp) (qp->ext_type == EQPT_SRQ)
-@@ -189,6 +188,8 @@ struct ehca_cq {
++	/* mmap addr */
++	u64 uspace_squeue;
++	u64 uspace_rqueue;
++	u64 uspace_fwh;
+ 	/* unsolicited ack circumvention */
+ 	int unsol_ack_circ;
+ 	int mtu_shift;
+@@ -208,6 +208,8 @@ struct ehca_cq {
  	struct ipz_cq_handle ipz_cq_handle;
  	struct ehca_pfcq pf;
  	spinlock_t cb_lock;
@@ -28,7 +25,7 @@ diff -Nurp ofa_kernel-1.3/drivers/infiniband/hw/ehca/ehca_classes.h rhel4u5_ofa_
  	struct hlist_head qp_hashtab[QP_HASHTAB_LEN];
  	struct list_head entry;
  	u32 nr_callbacks;   /* #events assigned to cpu by scaling code */
-@@ -196,9 +197,6 @@ struct ehca_cq {
+@@ -215,9 +217,6 @@ struct ehca_cq {
  	wait_queue_head_t wait_completion;
  	spinlock_t task_lock;
  	u32 ownpid;
@@ -38,7 +35,7 @@ diff -Nurp ofa_kernel-1.3/drivers/infiniband/hw/ehca/ehca_classes.h rhel4u5_ofa_
  };
  
  enum ehca_mr_flag {
-@@ -301,6 +299,20 @@ struct ehca_ucontext {
+@@ -320,6 +319,20 @@ struct ehca_ucontext {
  	struct ib_ucontext ib_ucontext;
  };
  
@@ -59,15 +56,15 @@ diff -Nurp ofa_kernel-1.3/drivers/infiniband/hw/ehca/ehca_classes.h rhel4u5_ofa_
  int ehca_init_pd_cache(void);
  void ehca_cleanup_pd_cache(void);
  int ehca_init_cq_cache(void);
-@@ -326,6 +338,7 @@ extern int ehca_scaling_code;
- extern int ehca_mr_largepage;
+@@ -345,6 +358,7 @@ extern int ehca_scaling_code;
+ extern int ehca_nr_ports;
  
  struct ipzu_queue_resp {
 +	u64 queue;        /* points to first queue entry */
  	u32 qe_size;      /* queue entry size */
  	u32 act_nr_of_sg;
  	u32 queue_length; /* queue length allocated in bytes */
-@@ -338,6 +351,7 @@ struct ehca_create_cq_resp {
+@@ -357,6 +371,7 @@ struct ehca_create_cq_resp {
  	u32 cq_number;
  	u32 token;
  	struct ipzu_queue_resp ipz_queue;
@@ -75,17 +72,17 @@ diff -Nurp ofa_kernel-1.3/drivers/infiniband/hw/ehca/ehca_classes.h rhel4u5_ofa_
  	u32 fw_handle_ofs;
  	u32 dummy;
  };
-@@ -353,6 +367,7 @@ struct ehca_create_qp_resp {
- 	u32 fw_handle_ofs;
+@@ -373,6 +388,7 @@ struct ehca_create_qp_resp {
+ 	u32 dummy;
  	struct ipzu_queue_resp ipz_squeue;
  	struct ipzu_queue_resp ipz_rqueue;
 +	struct h_galpas galpas;
  };
  
  struct ehca_alloc_cq_parms {
-diff -Nurp ofa_kernel-1.3/drivers/infiniband/hw/ehca/ehca_cq.c rhel4u5_ofa_kernel-1.3/drivers/infiniband/hw/ehca/ehca_cq.c
---- ofa_kernel-1.3/drivers/infiniband/hw/ehca/ehca_cq.c	2007-09-26 09:45:25.000000000 -0700
-+++ rhel4u5_ofa_kernel-1.3/drivers/infiniband/hw/ehca/ehca_cq.c	2007-09-26 03:46:28.000000000 -0700
+diff -Nurp a/drivers/infiniband/hw/ehca/ehca_cq.c b/drivers/infiniband/hw/ehca/ehca_cq.c
+--- a/drivers/infiniband/hw/ehca/ehca_cq.c	2008-01-23 15:30:42.000000000 +0100
++++ b/drivers/infiniband/hw/ehca/ehca_cq.c	2008-01-23 15:38:37.000000000 +0100
 @@ -273,6 +273,7 @@ struct ib_cq *ehca_create_cq(struct ib_d
  	if (context) {
  		struct ipz_queue *ipz_queue = &my_cq->ipz_queue;
@@ -203,12 +200,12 @@ diff -Nurp ofa_kernel-1.3/drivers/infiniband/hw/ehca/ehca_cq.c rhel4u5_ofa_kerne
  		ehca_err(cq->device, "Invalid caller pid=%x ownpid=%x",
  			 cur_pid, my_cq->ownpid);
  		return -EINVAL;
-diff -Nurp ofa_kernel-1.3/drivers/infiniband/hw/ehca/ehca_iverbs.h rhel4u5_ofa_kernel-1.3/drivers/infiniband/hw/ehca/ehca_iverbs.h
---- ofa_kernel-1.3/drivers/infiniband/hw/ehca/ehca_iverbs.h	2007-09-24 06:02:36.000000000 -0700
-+++ rhel4u5_ofa_kernel-1.3/drivers/infiniband/hw/ehca/ehca_iverbs.h	2007-09-26 03:25:27.000000000 -0700
-@@ -189,6 +189,14 @@ int ehca_mmap(struct ib_ucontext *contex
- 
- void ehca_poll_eqs(unsigned long data);
+diff -Nurp a/drivers/infiniband/hw/ehca/ehca_iverbs.h b/drivers/infiniband/hw/ehca/ehca_iverbs.h
+--- a/drivers/infiniband/hw/ehca/ehca_iverbs.h	2008-01-23 15:30:42.000000000 +0100
++++ b/drivers/infiniband/hw/ehca/ehca_iverbs.h	2008-01-23 15:38:37.000000000 +0100
+@@ -192,6 +192,14 @@ void ehca_poll_eqs(unsigned long data);
+ int ehca_calc_ipd(struct ehca_shca *shca, int port,
+ 		  enum ib_rate path_rate, u32 *ipd);
  
 +int ehca_mmap_nopage(u64 foffset,u64 length,void **mapped,
 +		     struct vm_area_struct **vma);
@@ -221,10 +218,10 @@ diff -Nurp ofa_kernel-1.3/drivers/infiniband/hw/ehca/ehca_iverbs.h rhel4u5_ofa_k
  #ifdef CONFIG_PPC_64K_PAGES
  void *ehca_alloc_fw_ctrlblock(gfp_t flags);
  void ehca_free_fw_ctrlblock(void *ptr);
-diff -Nurp ofa_kernel-1.3/drivers/infiniband/hw/ehca/ehca_main.c rhel4u5_ofa_kernel-1.3/drivers/infiniband/hw/ehca/ehca_main.c
---- ofa_kernel-1.3/drivers/infiniband/hw/ehca/ehca_main.c	2007-09-26 09:45:25.000000000 -0700
-+++ rhel4u5_ofa_kernel-1.3/drivers/infiniband/hw/ehca/ehca_main.c	2007-09-27 03:14:39.000000000 -0700
-@@ -382,7 +382,7 @@ int ehca_init_device(struct ehca_shca *s
+diff -Nurp a/drivers/infiniband/hw/ehca/ehca_main.c b/drivers/infiniband/hw/ehca/ehca_main.c
+--- a/drivers/infiniband/hw/ehca/ehca_main.c	2008-01-23 15:30:42.000000000 +0100
++++ b/drivers/infiniband/hw/ehca/ehca_main.c	2008-01-23 15:38:37.000000000 +0100
+@@ -394,7 +394,7 @@ int ehca_init_device(struct ehca_shca *s
  	strlcpy(shca->ib_device.name, "ehca%d", IB_DEVICE_NAME_MAX);
  	shca->ib_device.owner               = THIS_MODULE;
  
@@ -233,9 +230,9 @@ diff -Nurp ofa_kernel-1.3/drivers/infiniband/hw/ehca/ehca_main.c rhel4u5_ofa_ker
  	shca->ib_device.uverbs_cmd_mask	    =
  		(1ull << IB_USER_VERBS_CMD_GET_CONTEXT)		|
  		(1ull << IB_USER_VERBS_CMD_QUERY_DEVICE)	|
-diff -Nurp ofa_kernel-1.3/drivers/infiniband/hw/ehca/ehca_qp.c rhel4u5_ofa_kernel-1.3/drivers/infiniband/hw/ehca/ehca_qp.c
---- ofa_kernel-1.3/drivers/infiniband/hw/ehca/ehca_qp.c	2007-09-26 09:45:25.000000000 -0700
-+++ rhel4u5_ofa_kernel-1.3/drivers/infiniband/hw/ehca/ehca_qp.c	2007-09-26 10:29:16.000000000 -0700
+diff -Nurp a/drivers/infiniband/hw/ehca/ehca_qp.c b/drivers/infiniband/hw/ehca/ehca_qp.c
+--- a/drivers/infiniband/hw/ehca/ehca_qp.c	2008-01-23 15:30:42.000000000 +0100
++++ b/drivers/infiniband/hw/ehca/ehca_qp.c	2008-01-23 15:38:37.000000000 +0100
 @@ -265,15 +265,19 @@ static inline int ibqptype2servicetype(e
  /*
   * init userspace queue info from ipz_queue data
@@ -258,7 +255,7 @@ diff -Nurp ofa_kernel-1.3/drivers/infiniband/hw/ehca/ehca_qp.c rhel4u5_ofa_kerne
  }
  
  /*
-@@ -748,6 +752,7 @@ static struct ehca_qp *internal_create_q
+@@ -773,6 +777,7 @@ static struct ehca_qp *internal_create_q
  	/* copy queues, galpa data to user space */
  	if (context && udata) {
  		struct ehca_create_qp_resp resp;
@@ -266,11 +263,10 @@ diff -Nurp ofa_kernel-1.3/drivers/infiniband/hw/ehca/ehca_qp.c rhel4u5_ofa_kerne
  		memset(&resp, 0, sizeof(resp));
  
  		resp.qp_num = my_qp->real_qp_num;
-@@ -756,23 +761,55 @@ static struct ehca_qp *internal_create_q
- 		resp.ext_type = my_qp->ext_type;
+@@ -782,22 +787,55 @@ static struct ehca_qp *internal_create_q
  		resp.qkey = my_qp->qkey;
  		resp.real_qp_num = my_qp->real_qp_num;
--
+ 
 -		if (HAS_SQ(my_qp))
 -			queue2resp(&resp.ipz_squeue, &my_qp->ipz_squeue);
 -		if (HAS_RQ(my_qp))
@@ -284,7 +280,7 @@ diff -Nurp ofa_kernel-1.3/drivers/infiniband/hw/ehca/ehca_qp.c rhel4u5_ofa_kerne
 +			if (ret) {
 +				ehca_err(pd->device,
 +					 "Could not mmap squeue pages");
-+				goto create_qp_exit4;
++				goto create_qp_exit6;
 +			}
 +		}
 +		if (HAS_RQ(my_qp)) {
@@ -294,7 +290,7 @@ diff -Nurp ofa_kernel-1.3/drivers/infiniband/hw/ehca/ehca_qp.c rhel4u5_ofa_kerne
 +			if (ret) {
 +				ehca_err(pd->device,
 +					 "Could not mmap rqueue pages");
-+				goto create_qp_exit5;
++				goto create_qp_exit7;
 +			}
 +		}
 +		/* fw_handle */
@@ -304,33 +300,33 @@ diff -Nurp ofa_kernel-1.3/drivers/infiniband/hw/ehca/ehca_qp.c rhel4u5_ofa_kerne
 +					 &vma);
 +		if (ret) {
 +			ehca_err(pd->device, "Could not mmap fw_handle");
-+			goto create_qp_exit6;
++			goto create_qp_exit8;
 +		}
 +		my_qp->uspace_fwh = (u64)resp.galpas.kernel.fw_handle;
  
  		if (ib_copy_to_udata(udata, &resp, sizeof resp)) {
  			ehca_err(pd->device, "Copy to udata failed");
  			ret = -EINVAL;
--			goto create_qp_exit4;
-+			goto create_qp_exit7;
+-			goto create_qp_exit6;
++			goto create_qp_exit9;
  		}
  	}
  
  	return my_qp;
  
-+create_qp_exit7:
++create_qp_exit9:
 +	ehca_munmap(my_qp->uspace_fwh, EHCA_PAGESIZE);
 +
-+create_qp_exit6:
++create_qp_exit8:
 +	ehca_munmap(my_qp->uspace_rqueue, my_qp->ipz_rqueue.queue_length);
 +
-+create_qp_exit5:
++create_qp_exit7:
 +	ehca_munmap(my_qp->uspace_squeue, my_qp->ipz_squeue.queue_length);
 +
- create_qp_exit4:
- 	if (HAS_RQ(my_qp))
- 		ipz_queue_dtor(my_pd, &my_qp->ipz_rqueue);
-@@ -1124,7 +1161,7 @@ static int internal_modify_qp(struct ib_
+ create_qp_exit6:
+ 	ehca_cq_unassign_qp(my_qp->send_cq, my_qp->real_qp_num);
+ 
+@@ -1157,7 +1195,7 @@ static int internal_modify_qp(struct ib_
  	     my_qp->qp_type == IB_QPT_SMI) &&
  	    statetrans == IB_QPST_SQE2RTS) {
  		/* mark next free wqe if kernel */
@@ -339,7 +335,7 @@ diff -Nurp ofa_kernel-1.3/drivers/infiniband/hw/ehca/ehca_qp.c rhel4u5_ofa_kerne
  			struct ehca_wqe *wqe;
  			/* lock send queue */
  			spin_lock_irqsave(&my_qp->spinlock_s, flags);
-@@ -1777,18 +1814,11 @@ static int internal_destroy_qp(struct ib
+@@ -1927,18 +1965,11 @@ static int internal_destroy_qp(struct ib
  	enum ib_qp_type	qp_type;
  	unsigned long flags;
  
@@ -363,7 +359,7 @@ diff -Nurp ofa_kernel-1.3/drivers/infiniband/hw/ehca/ehca_qp.c rhel4u5_ofa_kerne
  	}
  
  	if (my_qp->send_cq) {
-@@ -1805,6 +1835,24 @@ static int internal_destroy_qp(struct ib
+@@ -1955,6 +1986,24 @@ static int internal_destroy_qp(struct ib
  	idr_remove(&ehca_qp_idr, my_qp->token);
  	write_unlock_irqrestore(&ehca_qp_idr_lock, flags);
  
@@ -388,9 +384,9 @@ diff -Nurp ofa_kernel-1.3/drivers/infiniband/hw/ehca/ehca_qp.c rhel4u5_ofa_kerne
  	h_ret = hipz_h_destroy_qp(shca->ipz_hca_handle, my_qp);
  	if (h_ret != H_SUCCESS) {
  		ehca_err(dev, "hipz_h_destroy_qp() failed h_ret=%li "
-diff -Nurp ofa_kernel-1.3/drivers/infiniband/hw/ehca/ehca_uverbs.c rhel4u5_ofa_kernel-1.3/drivers/infiniband/hw/ehca/ehca_uverbs.c
---- ofa_kernel-1.3/drivers/infiniband/hw/ehca/ehca_uverbs.c	2007-09-26 09:45:25.000000000 -0700
-+++ rhel4u5_ofa_kernel-1.3/drivers/infiniband/hw/ehca/ehca_uverbs.c	2007-09-26 06:42:19.000000000 -0700
+diff -Nurp a/drivers/infiniband/hw/ehca/ehca_uverbs.c b/drivers/infiniband/hw/ehca/ehca_uverbs.c
+--- a/drivers/infiniband/hw/ehca/ehca_uverbs.c	2008-01-23 15:30:42.000000000 +0100
++++ b/drivers/infiniband/hw/ehca/ehca_uverbs.c	2008-01-23 15:38:37.000000000 +0100
 @@ -68,184 +68,104 @@ int ehca_dealloc_ucontext(struct ib_ucon
  	return 0;
  }
-- 
1.5.2






More information about the general mailing list