naca cleanups

Stephen Rothwell sfr at canb.auug.org.au
Thu Dec 9 02:38:08 EST 2004


Another one for comment.  This one takes usage of pftSize out of the naca.
I couldn't see any reason it should not become a global vaiable. Again,
the field is left there in case someone uses it from /proc/ppc64/naca.

This applies on top of the previous patch.
-- 
Cheers,
Stephen Rothwell                    sfr at canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

diff -ruN linus-bk-naca.1/arch/ppc64/kernel/pSeries_lpar.c linus-bk-naca.2/arch/ppc64/kernel/pSeries_lpar.c
--- linus-bk-naca.1/arch/ppc64/kernel/pSeries_lpar.c	2004-10-28 16:57:54.000000000 +1000
+++ linus-bk-naca.2/arch/ppc64/kernel/pSeries_lpar.c	2004-12-09 02:19:32.000000000 +1100
@@ -352,7 +352,7 @@
 
 static void pSeries_lpar_hptab_clear(void)
 {
-	unsigned long size_bytes = 1UL << naca->pftSize;
+	unsigned long size_bytes = 1UL << ppc64_pft_size;
 	unsigned long hpte_count = size_bytes >> 4;
 	unsigned long dummy1, dummy2;
 	int i;
diff -ruN linus-bk-naca.1/arch/ppc64/kernel/prom.c linus-bk-naca.2/arch/ppc64/kernel/prom.c
--- linus-bk-naca.1/arch/ppc64/kernel/prom.c	2004-11-26 12:08:51.000000000 +1100
+++ linus-bk-naca.2/arch/ppc64/kernel/prom.c	2004-12-09 02:28:29.000000000 +1100
@@ -844,12 +844,12 @@
 
 	/* On LPAR, look for the first ibm,pft-size property for the  hash table size
 	 */
-	if (systemcfg->platform == PLATFORM_PSERIES_LPAR && naca->pftSize == 0) {
+	if (systemcfg->platform == PLATFORM_PSERIES_LPAR && ppc64_pft_size == 0) {
 		u32 *pft_size;
 		pft_size = (u32 *)get_flat_dt_prop(node, "ibm,pft-size", NULL);
 		if (pft_size != NULL) {
 			/* pft_size[0] is the NUMA CEC cookie */
-			naca->pftSize = pft_size[1];
+			naca->pftSize = ppc64_pft_size = pft_size[1];
 		}
 	}
 
@@ -1018,7 +1018,7 @@
 	initial_boot_params = params;
 
 	/* By default, hash size is not set */
-	naca->pftSize = 0;
+	naca->pftSize = ppc64_pft_size = 0;
 
 	/* Retreive various informations from the /chosen node of the
 	 * device-tree, including the platform type, initrd location and
@@ -1047,7 +1047,7 @@
 	/* If hash size wasn't obtained above, we calculate it now based on
 	 * the total RAM size
 	 */
-	if (naca->pftSize == 0) {
+	if (ppc64_pft_size == 0) {
 		unsigned long rnd_mem_size, pteg_count;
 
 		/* round mem_size up to next power of 2 */
@@ -1058,10 +1058,10 @@
 		/* # pages / 2 */
 		pteg_count = (rnd_mem_size >> (12 + 1));
 
-		naca->pftSize = __ilog2(pteg_count << 7);
+		naca->pftSize = ppc64_pft_size = __ilog2(pteg_count << 7);
 	}
 
-	DBG("Hash pftSize: %x\n", (int)naca->pftSize);
+	DBG("Hash pftSize: %x\n", (int)ppc64_pft_size);
 	DBG(" <- early_init_devtree()\n");
 }
 
diff -ruN linus-bk-naca.1/arch/ppc64/kernel/setup.c linus-bk-naca.2/arch/ppc64/kernel/setup.c
--- linus-bk-naca.1/arch/ppc64/kernel/setup.c	2004-12-09 00:57:58.000000000 +1100
+++ linus-bk-naca.2/arch/ppc64/kernel/setup.c	2004-12-09 02:26:30.000000000 +1100
@@ -110,6 +110,7 @@
 int boot_cpuid = 0;
 int boot_cpuid_phys = 0;
 dev_t boot_dev;
+u64 ppc64_pft_size;
 
 /*
  * These are used in binfmt_elf.c to put aux entries on the stack
@@ -661,7 +662,7 @@
 
 	printk("-----------------------------------------------------\n");
 	printk("naca                          = 0x%p\n", naca);
-	printk("naca->pftSize                 = 0x%lx\n", naca->pftSize);
+	printk("ppc64_pft_size                = 0x%lx\n", ppc64_pft_size);
 	printk("naca->debug_switch            = 0x%lx\n", naca->debug_switch);
 	printk("naca->interrupt_controller    = 0x%ld\n", naca->interrupt_controller);
 	printk("systemcfg                     = 0x%p\n", systemcfg);
diff -ruN linus-bk-naca.1/arch/ppc64/mm/hash_utils.c linus-bk-naca.2/arch/ppc64/mm/hash_utils.c
--- linus-bk-naca.1/arch/ppc64/mm/hash_utils.c	2004-10-29 07:03:21.000000000 +1000
+++ linus-bk-naca.2/arch/ppc64/mm/hash_utils.c	2004-12-09 02:16:21.000000000 +1100
@@ -147,7 +147,7 @@
 	 * 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 << naca->pftSize;
+	htab_size_bytes = 1UL << ppc64_pft_size;
 	pteg_count = htab_size_bytes >> 7;
 
 	/* For debug, make the HTAB 1/8 as big as it normally would be. */
diff -ruN linus-bk-naca.1/include/asm-ppc64/naca.h linus-bk-naca.2/include/asm-ppc64/naca.h
--- linus-bk-naca.1/include/asm-ppc64/naca.h	2004-09-16 21:51:58.000000000 +1000
+++ linus-bk-naca.2/include/asm-ppc64/naca.h	2004-12-09 02:14:59.000000000 +1100
@@ -11,7 +11,8 @@
  */
 
 #include <asm/types.h>
-#include <asm/systemcfg.h>
+#include <asm/page.h>	/* for PAGE_SHIFT and KERNELBASE */
+#include <asm/paca.h>
 
 #ifndef __ASSEMBLY__
 
@@ -31,16 +32,17 @@
 	u64 serialPortAddr;		/* Phy addr of serial port   0x38 */
 	u64 interrupt_controller;	/* Type of int controller    0x40 */ 
 	u64 unused1;			/* was SLB size in entries   0x48 */
+/* The fields below here are unused */
 	u64 pftSize;			/* Log 2 of page table size  0x50 */
 	void *systemcfg;		/* Pointer to systemcfg data 0x58 */
 	u32 dCacheL1LogLineSize;	/* L1 d-cache line size Log2 0x60 */
 	u32 dCacheL1LinesPerPage;	/* L1 d-cache lines / page   0x64 */
 	u32 iCacheL1LogLineSize;	/* L1 i-cache line size Log2 0x68 */
 	u32 iCacheL1LinesPerPage;	/* L1 i-cache lines / page   0x6c */
-	u8  resv0[15];                  /* Reserved           0x71 - 0x7F */
 };
 
 extern struct naca_struct *naca;
+extern u64 ppc64_pft_size;
 
 #endif /* __ASSEMBLY__ */
 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://ozlabs.org/pipermail/linuxppc64-dev/attachments/20041209/41ad074d/attachment.pgp 


More information about the Linuxppc64-dev mailing list