]> err.no Git - linux-2.6/blobdiff - drivers/infiniband/hw/mthca/mthca_profile.c
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc
[linux-2.6] / drivers / infiniband / hw / mthca / mthca_profile.c
index 08a909371b0a1060634526b53819314497fcd04a..605a8d57fac6764c97a7029b887e7517dbdadb9f 100644 (file)
@@ -63,7 +63,7 @@ enum {
        MTHCA_NUM_PDS = 1 << 15
 };
 
-u64 mthca_make_profile(struct mthca_dev *dev,
+s64 mthca_make_profile(struct mthca_dev *dev,
                       struct mthca_profile *request,
                       struct mthca_dev_lim *dev_lim,
                       struct mthca_init_hca_param *init_hca)
@@ -77,7 +77,7 @@ u64 mthca_make_profile(struct mthca_dev *dev,
        };
 
        u64 mem_base, mem_avail;
-       u64 total_size = 0;
+       s64 total_size = 0;
        struct mthca_resource *profile;
        struct mthca_resource tmp;
        int i, j;
@@ -152,7 +152,7 @@ u64 mthca_make_profile(struct mthca_dev *dev,
                }
                if (total_size > mem_avail) {
                        mthca_err(dev, "Profile requires 0x%llx bytes; "
-                                 "won't in 0x%llx bytes of context memory.\n",
+                                 "won't fit in 0x%llx bytes of context memory.\n",
                                  (unsigned long long) total_size,
                                  (unsigned long long) mem_avail);
                        kfree(profile);
@@ -262,6 +262,14 @@ u64 mthca_make_profile(struct mthca_dev *dev,
         */
        dev->limits.num_pds = MTHCA_NUM_PDS;
 
+       if (dev->mthca_flags & MTHCA_FLAG_SINAI_OPT &&
+           init_hca->log_mpt_sz > 23) {
+               mthca_warn(dev, "MPT table too large (requested size 2^%d >= 2^24)\n",
+                          init_hca->log_mpt_sz);
+               mthca_warn(dev, "Disabling memory key throughput optimization.\n");
+               dev->mthca_flags &= ~MTHCA_FLAG_SINAI_OPT;
+       }
+
        /*
         * For Tavor, FMRs use ioremapped PCI memory. For 32 bit
         * systems it may use too much vmalloc space to map all MTT
@@ -269,7 +277,7 @@ u64 mthca_make_profile(struct mthca_dev *dev,
         * out of the MR pool. They don't use additional memory, but
         * we assign them as part of the HCA profile anyway.
         */
-       if (mthca_is_memfree(dev))
+       if (mthca_is_memfree(dev) || BITS_PER_LONG == 64)
                dev->limits.fmr_reserved_mtts = 0;
        else
                dev->limits.fmr_reserved_mtts = request->fmr_reserved_mtts;