aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband
diff options
context:
space:
mode:
authorJoachim Fenkes <fenkes@de.ibm.com>2007-09-13 12:16:20 -0400
committerRoland Dreier <rolandd@cisco.com>2007-10-09 22:59:13 -0400
commit3a31c41901b6bd3937ec36e0e4a930849e270df6 (patch)
tree3ec571ad11f0fe161c38ec2f94840394be7382c1 /drivers/infiniband
parentc8d8beea0383e47c9d65d45f0ca95626ec435fcd (diff)
IB/ehca: Only use MR large pages for hugetlb regions
...because, on virtualized hardware like System p, we can't be sure that the physical pages behind them are contiguous otherwise. Signed-off-by: Joachim Fenkes <fenkes@de.ibm.com> Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/infiniband')
-rw-r--r--drivers/infiniband/hw/ehca/ehca_mrmw.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/drivers/infiniband/hw/ehca/ehca_mrmw.c b/drivers/infiniband/hw/ehca/ehca_mrmw.c
index e925e84c9bc7..da88738265ed 100644
--- a/drivers/infiniband/hw/ehca/ehca_mrmw.c
+++ b/drivers/infiniband/hw/ehca/ehca_mrmw.c
@@ -51,6 +51,7 @@
51 51
52#define NUM_CHUNKS(length, chunk_size) \ 52#define NUM_CHUNKS(length, chunk_size) \
53 (((length) + (chunk_size - 1)) / (chunk_size)) 53 (((length) + (chunk_size - 1)) / (chunk_size))
54
54/* max number of rpages (per hcall register_rpages) */ 55/* max number of rpages (per hcall register_rpages) */
55#define MAX_RPAGES 512 56#define MAX_RPAGES 512
56 57
@@ -64,6 +65,11 @@ enum ehca_mr_pgsize {
64 EHCA_MR_PGSIZE16M = 0x1000000L 65 EHCA_MR_PGSIZE16M = 0x1000000L
65}; 66};
66 67
68#define EHCA_MR_PGSHIFT4K 12
69#define EHCA_MR_PGSHIFT64K 16
70#define EHCA_MR_PGSHIFT1M 20
71#define EHCA_MR_PGSHIFT16M 24
72
67static u32 ehca_encode_hwpage_size(u32 pgsize) 73static u32 ehca_encode_hwpage_size(u32 pgsize)
68{ 74{
69 u32 idx = 0; 75 u32 idx = 0;
@@ -347,17 +353,16 @@ struct ib_mr *ehca_reg_user_mr(struct ib_pd *pd, u64 start, u64 length,
347 /* select proper hw_pgsize */ 353 /* select proper hw_pgsize */
348 if (ehca_mr_largepage && 354 if (ehca_mr_largepage &&
349 (shca->hca_cap_mr_pgsize & HCA_CAP_MR_PGSIZE_16M)) { 355 (shca->hca_cap_mr_pgsize & HCA_CAP_MR_PGSIZE_16M)) {
350 if (length <= EHCA_MR_PGSIZE4K 356 int page_shift = PAGE_SHIFT;
351 && PAGE_SIZE == EHCA_MR_PGSIZE4K) 357 if (e_mr->umem->hugetlb) {
352 hwpage_size = EHCA_MR_PGSIZE4K; 358 /* determine page_shift, clamp between 4K and 16M */
353 else if (length <= EHCA_MR_PGSIZE64K) 359 page_shift = (fls64(length - 1) + 3) & ~3;
354 hwpage_size = EHCA_MR_PGSIZE64K; 360 page_shift = min(max(page_shift, EHCA_MR_PGSHIFT4K),
355 else if (length <= EHCA_MR_PGSIZE1M) 361 EHCA_MR_PGSHIFT16M);
356 hwpage_size = EHCA_MR_PGSIZE1M; 362 }
357 else 363 hwpage_size = 1UL << page_shift;
358 hwpage_size = EHCA_MR_PGSIZE16M;
359 } else 364 } else
360 hwpage_size = EHCA_MR_PGSIZE4K; 365 hwpage_size = EHCA_MR_PGSIZE4K; /* ehca1 only supports 4k */
361 ehca_dbg(pd->device, "hwpage_size=%lx", hwpage_size); 366 ehca_dbg(pd->device, "hwpage_size=%lx", hwpage_size);
362 367
363reg_user_mr_fallback: 368reg_user_mr_fallback: