[PATCH] export htab value for kexec on non-lpar - cleaned up patch

R Sharada sharada at in.ibm.com
Thu Aug 25 04:39:44 EST 2005


Hello,
	Thanks for the comments. Here is the revised patch, cleaned up as per 
the review comments. 
	Please review and consider for acceptance

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


diff -puN include/asm-ppc64/mmu.h~kexec-export-htab-value include/asm-ppc64/mmu.h
--- linux-2.6.13-rc6-org/include/asm-ppc64/mmu.h~kexec-export-htab-value	2005-08-25 05:27:35.000000000 +0530
+++ linux-2.6.13-rc6-org-sharada/include/asm-ppc64/mmu.h	2005-08-25 05:28:12.000000000 +0530
@@ -57,7 +57,7 @@
 /*
  * Hash table
  */
-
+#define HASH_GROUP_SIZE 0x80    /* size of each hash group */
 #define HPTES_PER_GROUP 8
 
 #define HPTE_V_AVPN_SHIFT	7
diff -puN ./arch/ppc64/kernel/setup.c~kexec-export-htab-value ./arch/ppc64/kernel/setup.c
--- linux-2.6.13-rc6-org/./arch/ppc64/kernel/setup.c~kexec-export-htab-value	2005-08-25 05:27:35.000000000 +0530
+++ linux-2.6.13-rc6-org-sharada/./arch/ppc64/kernel/setup.c	2005-08-25 05:36:41.000000000 +0530
@@ -103,6 +103,10 @@ extern void unflatten_device_tree(void);
 
 extern void smp_release_cpus(void);
 
+/* required for kexec on non-lpar - htab_export_value */
+unsigned long htab_base, htab_size;
+struct property newprop1, newprop2;
+
 int have_of = 1;
 int boot_cpuid = 0;
 int boot_cpuid_phys = 0;
@@ -1033,6 +1037,29 @@ void __init setup_syscall_map(void)
 	       count32, count64);
 }
 
+static void __init export_htab_value(void)
+{
+	struct device_node *node;
+
+	if (systemcfg->platform == PLATFORM_PSERIES_LPAR)
+		return;
+
+	node = of_find_node_by_path("/chosen");
+	if (!node)
+		return;
+	newprop1.name = "htab_base";
+	newprop1.length = sizeof(unsigned long);
+	htab_base = __pa(htab_address);
+	newprop1.value = &htab_base;
+	prom_add_property(node, &newprop1);
+	newprop2.name = "htab_size";
+	newprop2.length = sizeof(unsigned long);
+	htab_size = (htab_hash_mask + 1) * HASH_GROUP_SIZE;
+	newprop2.value = &htab_size;
+	prom_add_property(node, &newprop2);
+	of_node_put(node);
+}
+
 /*
  * Called into from start_kernel, after lock_kernel has been called.
  * Initializes bootmem, which is unsed to manage page allocation until
@@ -1086,6 +1113,8 @@ void __init setup_arch(char **cmdline_p)
 	}
 
 	paging_init();
+	/* export htab value into /proc/device-tree/chosen for kexec */
+	export_htab_value();
 	ppc64_boot_msg(0x15, "Setup Done");
 }
 
Thanks and Regards,
Sharada
_

On Wed, Aug 24, 2005 at 08:34:23AM -0500, Nathan Lynch wrote:
> > @@ -1086,6 +1093,9 @@ void __init setup_arch(char **cmdline_p)
> >  	}
> >  
> >  	paging_init();
> > +#ifdef CONFIG_KEXEC
> > +	export_htab_value();
> > +#endif
> >  	ppc64_boot_msg(0x15, "Setup Done");
> >  }
> >  
> > @@ -1358,3 +1368,39 @@ void cpu_die(void)
> >  	if (ppc_md.cpu_die)
> >  		ppc_md.cpu_die();
> >  }
> > +
> > +#ifdef CONFIG_KEXEC
> > +void export_htab_value()
> > +{
> 
> Can export_htab_value not be marked __init since it is called only
> from setup_arch?



More information about the Linuxppc64-dev mailing list