aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/hw/ehca
diff options
context:
space:
mode:
authorHoang-Nam Nguyen <hnguyen@de.ibm.com>2007-09-11 09:31:06 -0400
committerRoland Dreier <rolandd@cisco.com>2007-10-09 22:59:09 -0400
commite390d3b52f791fcea26312ba4982cda82052727b (patch)
tree399af315b321e57c88cca886cd3a69c05360891b /drivers/infiniband/hw/ehca
parent5281a4b8a0c6bac0c070913ec25868faa06a3115 (diff)
IB/ehca: Use remap_4k_pfn() to map firmware contexts to user space
Use Paul's new remap_4k_pfn() function to map our 4K firmware contexts into user space on 64K-page machines without exposing neighboring firmware contexts. Return the context's offset within a 64K page to user space so it can determine the proper virtual address. For details about remap_4k_pfn(), see commit 721151d0 or http://patchwork.ozlabs.org/linuxppc/patch?id=10281 Signed-off-by: Joachim Fenkes <fenkes@de.ibm.com> Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/infiniband/hw/ehca')
-rw-r--r--drivers/infiniband/hw/ehca/ehca_classes.h4
-rw-r--r--drivers/infiniband/hw/ehca/ehca_cq.c2
-rw-r--r--drivers/infiniband/hw/ehca/ehca_qp.c2
-rw-r--r--drivers/infiniband/hw/ehca/ehca_uverbs.c6
4 files changed, 10 insertions, 4 deletions
diff --git a/drivers/infiniband/hw/ehca/ehca_classes.h b/drivers/infiniband/hw/ehca/ehca_classes.h
index 0d69f0f001d9..0942a173881c 100644
--- a/drivers/infiniband/hw/ehca/ehca_classes.h
+++ b/drivers/infiniband/hw/ehca/ehca_classes.h
@@ -338,6 +338,8 @@ struct ehca_create_cq_resp {
338 u32 cq_number; 338 u32 cq_number;
339 u32 token; 339 u32 token;
340 struct ipzu_queue_resp ipz_queue; 340 struct ipzu_queue_resp ipz_queue;
341 u32 fw_handle_ofs;
342 u32 dummy;
341}; 343};
342 344
343struct ehca_create_qp_resp { 345struct ehca_create_qp_resp {
@@ -348,7 +350,7 @@ struct ehca_create_qp_resp {
348 u32 qkey; 350 u32 qkey;
349 /* qp_num assigned by ehca: sqp0/1 may have got different numbers */ 351 /* qp_num assigned by ehca: sqp0/1 may have got different numbers */
350 u32 real_qp_num; 352 u32 real_qp_num;
351 u32 dummy; /* padding for 8 byte alignment */ 353 u32 fw_handle_ofs;
352 struct ipzu_queue_resp ipz_squeue; 354 struct ipzu_queue_resp ipz_squeue;
353 struct ipzu_queue_resp ipz_rqueue; 355 struct ipzu_queue_resp ipz_rqueue;
354}; 356};
diff --git a/drivers/infiniband/hw/ehca/ehca_cq.c b/drivers/infiniband/hw/ehca/ehca_cq.c
index a6f17e488c77..d68603ddfc2c 100644
--- a/drivers/infiniband/hw/ehca/ehca_cq.c
+++ b/drivers/infiniband/hw/ehca/ehca_cq.c
@@ -281,6 +281,8 @@ struct ib_cq *ehca_create_cq(struct ib_device *device, int cqe, int comp_vector,
281 resp.ipz_queue.queue_length = ipz_queue->queue_length; 281 resp.ipz_queue.queue_length = ipz_queue->queue_length;
282 resp.ipz_queue.pagesize = ipz_queue->pagesize; 282 resp.ipz_queue.pagesize = ipz_queue->pagesize;
283 resp.ipz_queue.toggle_state = ipz_queue->toggle_state; 283 resp.ipz_queue.toggle_state = ipz_queue->toggle_state;
284 resp.fw_handle_ofs = (u32)
285 (my_cq->galpas.user.fw_handle & (PAGE_SIZE - 1));
284 if (ib_copy_to_udata(udata, &resp, sizeof(resp))) { 286 if (ib_copy_to_udata(udata, &resp, sizeof(resp))) {
285 ehca_err(device, "Copy to udata failed."); 287 ehca_err(device, "Copy to udata failed.");
286 goto create_cq_exit4; 288 goto create_cq_exit4;
diff --git a/drivers/infiniband/hw/ehca/ehca_qp.c b/drivers/infiniband/hw/ehca/ehca_qp.c
index bfae1c228b2f..e89fdca7fa19 100644
--- a/drivers/infiniband/hw/ehca/ehca_qp.c
+++ b/drivers/infiniband/hw/ehca/ehca_qp.c
@@ -749,6 +749,8 @@ static struct ehca_qp *internal_create_qp(
749 queue2resp(&resp.ipz_squeue, &my_qp->ipz_squeue); 749 queue2resp(&resp.ipz_squeue, &my_qp->ipz_squeue);
750 if (HAS_RQ(my_qp)) 750 if (HAS_RQ(my_qp))
751 queue2resp(&resp.ipz_rqueue, &my_qp->ipz_rqueue); 751 queue2resp(&resp.ipz_rqueue, &my_qp->ipz_rqueue);
752 resp.fw_handle_ofs = (u32)
753 (my_qp->galpas.user.fw_handle & (PAGE_SIZE - 1));
752 754
753 if (ib_copy_to_udata(udata, &resp, sizeof resp)) { 755 if (ib_copy_to_udata(udata, &resp, sizeof resp)) {
754 ehca_err(pd->device, "Copy to udata failed"); 756 ehca_err(pd->device, "Copy to udata failed");
diff --git a/drivers/infiniband/hw/ehca/ehca_uverbs.c b/drivers/infiniband/hw/ehca/ehca_uverbs.c
index 3340f49f0211..84a16bcfd536 100644
--- a/drivers/infiniband/hw/ehca/ehca_uverbs.c
+++ b/drivers/infiniband/hw/ehca/ehca_uverbs.c
@@ -109,7 +109,7 @@ static int ehca_mmap_fw(struct vm_area_struct *vma, struct h_galpas *galpas,
109 u64 vsize, physical; 109 u64 vsize, physical;
110 110
111 vsize = vma->vm_end - vma->vm_start; 111 vsize = vma->vm_end - vma->vm_start;
112 if (vsize != EHCA_PAGESIZE) { 112 if (vsize < EHCA_PAGESIZE) {
113 ehca_gen_err("invalid vsize=%lx", vma->vm_end - vma->vm_start); 113 ehca_gen_err("invalid vsize=%lx", vma->vm_end - vma->vm_start);
114 return -EINVAL; 114 return -EINVAL;
115 } 115 }
@@ -118,8 +118,8 @@ static int ehca_mmap_fw(struct vm_area_struct *vma, struct h_galpas *galpas,
118 vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); 118 vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
119 ehca_gen_dbg("vsize=%lx physical=%lx", vsize, physical); 119 ehca_gen_dbg("vsize=%lx physical=%lx", vsize, physical);
120 /* VM_IO | VM_RESERVED are set by remap_pfn_range() */ 120 /* VM_IO | VM_RESERVED are set by remap_pfn_range() */
121 ret = remap_pfn_range(vma, vma->vm_start, physical >> PAGE_SHIFT, 121 ret = remap_4k_pfn(vma, vma->vm_start, physical >> EHCA_PAGESHIFT,
122 vsize, vma->vm_page_prot); 122 vma->vm_page_prot);
123 if (unlikely(ret)) { 123 if (unlikely(ret)) {
124 ehca_gen_err("remap_pfn_range() failed ret=%x", ret); 124 ehca_gen_err("remap_pfn_range() failed ret=%x", ret);
125 return -ENOMEM; 125 return -ENOMEM;