diff options
| -rw-r--r-- | arch/powerpc/kernel/prom.c | 20 | ||||
| -rw-r--r-- | arch/powerpc/mm/hash_utils_64.c | 23 |
2 files changed, 22 insertions, 21 deletions
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c index ce0dff1caa80..c8d288457b4c 100644 --- a/arch/powerpc/kernel/prom.c +++ b/arch/powerpc/kernel/prom.c | |||
| @@ -1323,26 +1323,6 @@ void __init early_init_devtree(void *params) | |||
| 1323 | */ | 1323 | */ |
| 1324 | scan_flat_dt(early_init_dt_scan_cpus, NULL); | 1324 | scan_flat_dt(early_init_dt_scan_cpus, NULL); |
| 1325 | 1325 | ||
| 1326 | #ifdef CONFIG_PPC_PSERIES | ||
| 1327 | /* If hash size wasn't obtained above, we calculate it now based on | ||
| 1328 | * the total RAM size | ||
| 1329 | */ | ||
| 1330 | if (ppc64_pft_size == 0) { | ||
| 1331 | unsigned long rnd_mem_size, pteg_count; | ||
| 1332 | |||
| 1333 | /* round mem_size up to next power of 2 */ | ||
| 1334 | rnd_mem_size = 1UL << __ilog2(systemcfg->physicalMemorySize); | ||
| 1335 | if (rnd_mem_size < systemcfg->physicalMemorySize) | ||
| 1336 | rnd_mem_size <<= 1; | ||
| 1337 | |||
| 1338 | /* # pages / 2 */ | ||
| 1339 | pteg_count = max(rnd_mem_size >> (12 + 1), 1UL << 11); | ||
| 1340 | |||
| 1341 | ppc64_pft_size = __ilog2(pteg_count << 7); | ||
| 1342 | } | ||
| 1343 | |||
| 1344 | DBG("Hash pftSize: %x\n", (int)ppc64_pft_size); | ||
| 1345 | #endif | ||
| 1346 | DBG(" <- early_init_devtree()\n"); | 1326 | DBG(" <- early_init_devtree()\n"); |
| 1347 | } | 1327 | } |
| 1348 | 1328 | ||
diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c index 35dd93eeaf4b..6e9e05cce02c 100644 --- a/arch/powerpc/mm/hash_utils_64.c +++ b/arch/powerpc/mm/hash_utils_64.c | |||
| @@ -155,6 +155,27 @@ static inline void create_pte_mapping(unsigned long start, unsigned long end, | |||
| 155 | } | 155 | } |
| 156 | } | 156 | } |
| 157 | 157 | ||
| 158 | static unsigned long get_hashtable_size(void) | ||
| 159 | { | ||
| 160 | unsigned long rnd_mem_size, pteg_count; | ||
| 161 | |||
| 162 | /* If hash size wasn't obtained in prom.c, we calculate it now based on | ||
| 163 | * the total RAM size | ||
| 164 | */ | ||
| 165 | if (ppc64_pft_size) | ||
| 166 | return 1UL << ppc64_pft_size; | ||
| 167 | |||
| 168 | /* round mem_size up to next power of 2 */ | ||
| 169 | rnd_mem_size = 1UL << __ilog2(systemcfg->physicalMemorySize); | ||
| 170 | if (rnd_mem_size < systemcfg->physicalMemorySize) | ||
| 171 | rnd_mem_size <<= 1; | ||
| 172 | |||
| 173 | /* # pages / 2 */ | ||
| 174 | pteg_count = max(rnd_mem_size >> (12 + 1), 1UL << 11); | ||
| 175 | |||
| 176 | return pteg_count << 7; | ||
| 177 | } | ||
| 178 | |||
| 158 | void __init htab_initialize(void) | 179 | void __init htab_initialize(void) |
| 159 | { | 180 | { |
| 160 | unsigned long table, htab_size_bytes; | 181 | unsigned long table, htab_size_bytes; |
| @@ -170,7 +191,7 @@ void __init htab_initialize(void) | |||
| 170 | * Calculate the required size of the htab. We want the number of | 191 | * Calculate the required size of the htab. We want the number of |
| 171 | * PTEGs to equal one half the number of real pages. | 192 | * PTEGs to equal one half the number of real pages. |
| 172 | */ | 193 | */ |
| 173 | htab_size_bytes = 1UL << ppc64_pft_size; | 194 | htab_size_bytes = get_hashtable_size(); |
| 174 | pteg_count = htab_size_bytes >> 7; | 195 | pteg_count = htab_size_bytes >> 7; |
| 175 | 196 | ||
| 176 | /* For debug, make the HTAB 1/8 as big as it normally would be. */ | 197 | /* For debug, make the HTAB 1/8 as big as it normally would be. */ |
