[PATCH] kdump ppc64: fix htab-size for non-lpar

R Sharada sharada at in.ibm.com
Fri Feb 17 01:15:06 EST 2006


Hello,
	The htab-size calculated for kexec/kdump on 2.6 kernels was broken,
leading to wrong value being exported to /proc/device-tree
Here is a patch fixing it up.

This has been tested on 2.6.16-rc2

Thanks and Regards,
Sharada

We export a value linux,htab-size to /proc/device-tree so that kexec-tools
can use that to exclude the htab region when trying to make space for the
kexec segments. htab-size was earlier calculated in export_htab_values using
ppc64_pft_size. ppc64_pft_size no longer holds a valid size for all machines.
So, define a new variable htab_size in hash_utils_64.c which is initialized
to the htab size value obtained in htab_initialize. Use this variable to set
the htab-size in export_htab_values()

Signed-off-by: R Sharada <sharada at in.ibm.com>
---


diff -puN arch/powerpc/mm/hash_utils_64.c~kdump-save-htab-size arch/powerpc/mm/hash_utils_64.c
--- linux-2.6.16-rc2-htab/arch/powerpc/mm/hash_utils_64.c~kdump-save-htab-size	2006-02-16 18:29:54.000000000 +0530
+++ linux-2.6.16-rc2-htab-sharada/arch/powerpc/mm/hash_utils_64.c	2006-02-16 19:21:57.000000000 +0530
@@ -95,6 +95,10 @@ int mmu_virtual_psize = MMU_PAGE_4K;
 int mmu_huge_psize = MMU_PAGE_16M;
 unsigned int HPAGE_SHIFT;
 #endif
+#ifdef CONFIG_KEXEC
+#define HASH_GROUP_SIZE 0x80    /* size of each hash group, asm/mmu.h */
+unsigned long htab_size;
+#endif
 
 /* There are definitions of page sizes arrays to be used when none
  * is provided by the firmware.
@@ -445,6 +449,9 @@ void __init htab_initialize(void)
 
 		/* Set SDR1 */
 		mtspr(SPRN_SDR1, _SDR1);
+#ifdef CONFIG_KEXEC
+		htab_size = (htab_hash_mask + 1) * HASH_GROUP_SIZE;
+#endif
 	}
 
 	mode_rw = _PAGE_ACCESSED | _PAGE_DIRTY | _PAGE_COHERENT | PP_RWXX;
diff -puN arch/powerpc/kernel/machine_kexec_64.c~kdump-save-htab-size arch/powerpc/kernel/machine_kexec_64.c
--- linux-2.6.16-rc2-htab/arch/powerpc/kernel/machine_kexec_64.c~kdump-save-htab-size	2006-02-16 18:29:54.000000000 +0530
+++ linux-2.6.16-rc2-htab-sharada/arch/powerpc/kernel/machine_kexec_64.c	2006-02-16 18:53:06.000000000 +0530
@@ -26,8 +26,6 @@
 #include <asm/prom.h>
 #include <asm/smp.h>
 
-#define HASH_GROUP_SIZE 0x80	/* size of each hash group, asm/mmu.h */
-
 int default_machine_kexec_prepare(struct kimage *image)
 {
 	int i;
@@ -61,7 +59,7 @@ int default_machine_kexec_prepare(struct
 	 */
 	if (htab_address) {
 		low = __pa(htab_address);
-		high = low + (htab_hash_mask + 1) * HASH_GROUP_SIZE;
+		high = low + htab_size;
 
 		for (i = 0; i < image->nr_segments; i++) {
 			begin = image->segment[i].mem;
@@ -294,7 +292,7 @@ void default_machine_kexec(struct kimage
 }
 
 /* Values we need to export to the second kernel via the device tree. */
-static unsigned long htab_base, htab_size, kernel_end;
+static unsigned long htab_base, kernel_end;
 
 static struct property htab_base_prop = {
 	.name = "linux,htab-base",
@@ -332,7 +330,6 @@ static void __init export_htab_values(vo
 	htab_base = __pa(htab_address);
 	prom_add_property(node, &htab_base_prop);
 
-	htab_size = 1UL << ppc64_pft_size;
 	prom_add_property(node, &htab_size_prop);
 
  out:
--- linux-2.6.16-rc2-htab/include/asm-powerpc/mmu.h~kdump-save-htab-size	2006-02-16 18:57:43.000000000 +0530
+++ linux-2.6.16-rc2-htab-sharada/include/asm-powerpc/mmu.h	2006-02-16 19:21:29.000000000 +0530
@@ -113,6 +113,9 @@ typedef struct {
 
 extern hpte_t *htab_address;
 extern unsigned long htab_hash_mask;
+#ifdef CONFIG_KEXEC
+extern unsigned long htab_size;
+#endif
 
 /*
  * Page size definition
_



More information about the Linuxppc64-dev mailing list