diff options
author | Michael Ellerman <michael@ellerman.id.au> | 2006-02-21 01:22:55 -0500 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2006-02-23 19:36:18 -0500 |
commit | 337a7128dbe68ebe7627b6f954cb32d30d7b11c6 (patch) | |
tree | 6189f61386f3be72cffab14ed1b42a508ef1793c /arch | |
parent | bd6ef57e08d6cce32e93f9fc7b93d361b6a7884f (diff) |
[PATCH] powerpc: Only calculate htab_size in one place for kexec
For kexec we need to know the size of the MMU hash table.
Currently we calculate the size once in the htab code, and then twice more in
the kexec code, once using htab_hash_mask and once using ppc64_pft_size.
On some machines the ppc64_pft_size calculation is broken because
ppc64_pft_size is not set.
So we need to fix the second calculation, but better still we should just
calculate the size once and use it everywhere else.
Tested on Power5 LPAR, Power4 non-LPAR and Power3.
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/powerpc/kernel/machine_kexec_64.c | 10 | ||||
-rw-r--r-- | arch/powerpc/mm/hash_utils_64.c | 3 |
2 files changed, 5 insertions, 8 deletions
diff --git a/arch/powerpc/kernel/machine_kexec_64.c b/arch/powerpc/kernel/machine_kexec_64.c index d6431440c54f..ee166c586642 100644 --- a/arch/powerpc/kernel/machine_kexec_64.c +++ b/arch/powerpc/kernel/machine_kexec_64.c | |||
@@ -26,8 +26,6 @@ | |||
26 | #include <asm/prom.h> | 26 | #include <asm/prom.h> |
27 | #include <asm/smp.h> | 27 | #include <asm/smp.h> |
28 | 28 | ||
29 | #define HASH_GROUP_SIZE 0x80 /* size of each hash group, asm/mmu.h */ | ||
30 | |||
31 | int default_machine_kexec_prepare(struct kimage *image) | 29 | int default_machine_kexec_prepare(struct kimage *image) |
32 | { | 30 | { |
33 | int i; | 31 | int i; |
@@ -61,7 +59,7 @@ int default_machine_kexec_prepare(struct kimage *image) | |||
61 | */ | 59 | */ |
62 | if (htab_address) { | 60 | if (htab_address) { |
63 | low = __pa(htab_address); | 61 | low = __pa(htab_address); |
64 | high = low + (htab_hash_mask + 1) * HASH_GROUP_SIZE; | 62 | high = low + htab_size_bytes; |
65 | 63 | ||
66 | for (i = 0; i < image->nr_segments; i++) { | 64 | for (i = 0; i < image->nr_segments; i++) { |
67 | begin = image->segment[i].mem; | 65 | begin = image->segment[i].mem; |
@@ -294,7 +292,7 @@ void default_machine_kexec(struct kimage *image) | |||
294 | } | 292 | } |
295 | 293 | ||
296 | /* Values we need to export to the second kernel via the device tree. */ | 294 | /* Values we need to export to the second kernel via the device tree. */ |
297 | static unsigned long htab_base, htab_size, kernel_end; | 295 | static unsigned long htab_base, kernel_end; |
298 | 296 | ||
299 | static struct property htab_base_prop = { | 297 | static struct property htab_base_prop = { |
300 | .name = "linux,htab-base", | 298 | .name = "linux,htab-base", |
@@ -305,7 +303,7 @@ static struct property htab_base_prop = { | |||
305 | static struct property htab_size_prop = { | 303 | static struct property htab_size_prop = { |
306 | .name = "linux,htab-size", | 304 | .name = "linux,htab-size", |
307 | .length = sizeof(unsigned long), | 305 | .length = sizeof(unsigned long), |
308 | .value = (unsigned char *)&htab_size, | 306 | .value = (unsigned char *)&htab_size_bytes, |
309 | }; | 307 | }; |
310 | 308 | ||
311 | static struct property kernel_end_prop = { | 309 | static struct property kernel_end_prop = { |
@@ -331,8 +329,6 @@ static void __init export_htab_values(void) | |||
331 | 329 | ||
332 | htab_base = __pa(htab_address); | 330 | htab_base = __pa(htab_address); |
333 | prom_add_property(node, &htab_base_prop); | 331 | prom_add_property(node, &htab_base_prop); |
334 | |||
335 | htab_size = 1UL << ppc64_pft_size; | ||
336 | prom_add_property(node, &htab_size_prop); | 332 | prom_add_property(node, &htab_size_prop); |
337 | 333 | ||
338 | out: | 334 | out: |
diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c index 149351a84b94..b1f614c612dd 100644 --- a/arch/powerpc/mm/hash_utils_64.c +++ b/arch/powerpc/mm/hash_utils_64.c | |||
@@ -88,6 +88,7 @@ static unsigned long _SDR1; | |||
88 | struct mmu_psize_def mmu_psize_defs[MMU_PAGE_COUNT]; | 88 | struct mmu_psize_def mmu_psize_defs[MMU_PAGE_COUNT]; |
89 | 89 | ||
90 | hpte_t *htab_address; | 90 | hpte_t *htab_address; |
91 | unsigned long htab_size_bytes; | ||
91 | unsigned long htab_hash_mask; | 92 | unsigned long htab_hash_mask; |
92 | int mmu_linear_psize = MMU_PAGE_4K; | 93 | int mmu_linear_psize = MMU_PAGE_4K; |
93 | int mmu_virtual_psize = MMU_PAGE_4K; | 94 | int mmu_virtual_psize = MMU_PAGE_4K; |
@@ -399,7 +400,7 @@ void create_section_mapping(unsigned long start, unsigned long end) | |||
399 | 400 | ||
400 | void __init htab_initialize(void) | 401 | void __init htab_initialize(void) |
401 | { | 402 | { |
402 | unsigned long table, htab_size_bytes; | 403 | unsigned long table; |
403 | unsigned long pteg_count; | 404 | unsigned long pteg_count; |
404 | unsigned long mode_rw; | 405 | unsigned long mode_rw; |
405 | unsigned long base = 0, size = 0; | 406 | unsigned long base = 0, size = 0; |