Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 11565
b: refs/heads/master
c: 3eac8c6
h: refs/heads/master
i:
  11563: f157ef1
v: v3
  • Loading branch information
Paul Mackerras committed Oct 12, 2005
1 parent 42a6f6d commit e2cf90a
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 22 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: b6ec995a21a9428aef620b5adf46d047a18d88b8
refs/heads/master: 3eac8c69d1ac1266327f4e29deb23716a12c6d30
20 changes: 0 additions & 20 deletions trunk/arch/powerpc/kernel/prom.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}

Expand Down
23 changes: 22 additions & 1 deletion trunk/arch/powerpc/mm/hash_utils_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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. */
Expand Down

0 comments on commit e2cf90a

Please sign in to comment.