]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
powerpc: Move default hash table size calculation to hash_utils_64.c
authorPaul Mackerras <paulus@samba.org>
Wed, 12 Oct 2005 06:58:53 +0000 (16:58 +1000)
committerPaul Mackerras <paulus@samba.org>
Wed, 12 Oct 2005 06:58:53 +0000 (16:58 +1000)
We weren't computing the size of the hash table correctly on iSeries
because the relevant code in prom.c was #ifdef CONFIG_PPC_PSERIES.
This moves the code to hash_utils_64.c, makes it unconditional, and
cleans it up a bit.

Signed-off-by: Paul Mackerras <paulus@samba.org>
arch/powerpc/kernel/prom.c
arch/powerpc/mm/hash_utils_64.c

index ce0dff1caa80790e72c8c50a009217eaf2f8b560..c8d288457b4c966b0a9b0376ba24caa3b459c423 100644 (file)
@@ -1323,26 +1323,6 @@ void __init early_init_devtree(void *params)
         */
        scan_flat_dt(early_init_dt_scan_cpus, NULL);
 
-#ifdef CONFIG_PPC_PSERIES
-       /* If hash size wasn't obtained above, we calculate it now based on
-        * the total RAM size
-        */
-       if (ppc64_pft_size == 0) {
-               unsigned long rnd_mem_size, pteg_count;
-
-               /* round mem_size up to next power of 2 */
-               rnd_mem_size = 1UL << __ilog2(systemcfg->physicalMemorySize);
-               if (rnd_mem_size < systemcfg->physicalMemorySize)
-                       rnd_mem_size <<= 1;
-
-               /* # pages / 2 */
-               pteg_count = max(rnd_mem_size >> (12 + 1), 1UL << 11);
-
-               ppc64_pft_size = __ilog2(pteg_count << 7);
-       }
-
-       DBG("Hash pftSize: %x\n", (int)ppc64_pft_size);
-#endif
        DBG(" <- early_init_devtree()\n");
 }
 
index 35dd93eeaf4b01cae970778cd94a71ffe194b928..6e9e05cce02c8448e207a782f3ebc4cdb53f6556 100644 (file)
@@ -155,6 +155,27 @@ static inline void create_pte_mapping(unsigned long start, unsigned long end,
        }
 }
 
+static unsigned long get_hashtable_size(void)
+{
+       unsigned long rnd_mem_size, pteg_count;
+
+       /* If hash size wasn't obtained in prom.c, we calculate it now based on
+        * the total RAM size
+        */
+       if (ppc64_pft_size)
+               return 1UL << ppc64_pft_size;
+
+       /* round mem_size up to next power of 2 */
+       rnd_mem_size = 1UL << __ilog2(systemcfg->physicalMemorySize);
+       if (rnd_mem_size < systemcfg->physicalMemorySize)
+               rnd_mem_size <<= 1;
+
+       /* # pages / 2 */
+       pteg_count = max(rnd_mem_size >> (12 + 1), 1UL << 11);
+
+       return pteg_count << 7;
+}
+
 void __init htab_initialize(void)
 {
        unsigned long table, htab_size_bytes;
@@ -170,7 +191,7 @@ void __init htab_initialize(void)
         * Calculate the required size of the htab.  We want the number of
         * PTEGs to equal one half the number of real pages.
         */ 
-       htab_size_bytes = 1UL << ppc64_pft_size;
+       htab_size_bytes = get_hashtable_size();
        pteg_count = htab_size_bytes >> 7;
 
        /* For debug, make the HTAB 1/8 as big as it normally would be. */