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

R Sharada sharada at in.ibm.com
Thu Aug 25 14:42:06 EST 2005


Nathan,
	Thanks for the comments. It makes sense to make then static and more
appropriately named.
	Have done the same and re-posting the patch with those minor changes

Thanks and Regards,
Sharada

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 15:40:38.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 */
+static unsigned long htab_base, htab_size;
+static struct property htab_base_prop, htab_size_prop;
+
 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;
+	htab_base_prop.name = "htab_base";
+	htab_base_prop.length = sizeof(unsigned long);
+	htab_base = __pa(htab_address);
+	htab_base_prop.value = &htab_base;
+	prom_add_property(node, &htab_base_prop);
+	htab_size_prop.name = "htab_size";
+	htab_size_prop.length = sizeof(unsigned long);
+	htab_size = (htab_hash_mask + 1) * HASH_GROUP_SIZE;
+	htab_size_prop.value = &htab_size;
+	prom_add_property(node, &htab_size_prop);
+	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");
 }
 
-
On Wed, Aug 24, 2005 at 02:06:52PM -0500, Nathan Lynch wrote:
> R Sharada wrote:
> > +/* required for kexec on non-lpar - htab_export_value */
> > +unsigned long htab_base, htab_size;
> > +struct property newprop1, newprop2;
> 
> All of these could be static, right?
> 
> I also suggest that the struct property variables need better names so
> that their intended use is more clear.  Perhaps htab_base_prop and
> htab_size_prop.



More information about the Linuxppc64-dev mailing list