PERFORCE change 100408 for review

John Birrell jb at FreeBSD.org
Sat Jul 1 21:04:07 UTC 2006


http://perforce.freebsd.org/chv.cgi?CH=100408

Change 100408 by jb at jb_freebsd2 on 2006/07/01 20:35:00

	IFsun4v_stable

Affected files ...

.. //depot/projects/dtrace/src/sys/boot/sun4v/Makefile#1 branch
.. //depot/projects/dtrace/src/sys/boot/sun4v/Makefile.inc#1 branch
.. //depot/projects/dtrace/src/sys/boot/sun4v/boot1/Makefile#1 branch
.. //depot/projects/dtrace/src/sys/boot/sun4v/boot1/_start.s#1 branch
.. //depot/projects/dtrace/src/sys/boot/sun4v/boot1/boot1#1 branch
.. //depot/projects/dtrace/src/sys/boot/sun4v/boot1/boot1.c#1 branch
.. //depot/projects/dtrace/src/sys/boot/sun4v/loader/Makefile#1 branch
.. //depot/projects/dtrace/src/sys/boot/sun4v/loader/hcall.S#1 branch
.. //depot/projects/dtrace/src/sys/boot/sun4v/loader/help.sparc64#1 branch
.. //depot/projects/dtrace/src/sys/boot/sun4v/loader/locore.S#1 branch
.. //depot/projects/dtrace/src/sys/boot/sun4v/loader/main.c#1 branch
.. //depot/projects/dtrace/src/sys/boot/sun4v/loader/metadata.c#1 branch
.. //depot/projects/dtrace/src/sys/boot/sun4v/loader/version#1 branch
.. //depot/projects/dtrace/src/sys/sun4v/sun4v/pmap.c#3 integrate

Differences ...

==== //depot/projects/dtrace/src/sys/sun4v/sun4v/pmap.c#3 (text+ko) ====

@@ -432,7 +432,7 @@
 	vm_size_t physsz, virtsz, kernel_hash_size;
 	ihandle_t pmem, vmem;
 	int i, sz, j;
-	uint64_t tsb_8k_size, tsb_4m_size, error;
+	uint64_t tsb_8k_size, tsb_4m_size, error, physmem_tunable;
 
 	/*
 	 * Find out what physical memory is available from the prom and
@@ -456,20 +456,22 @@
 
 	qsort(mra, sz, sizeof (*mra), mr_cmp);
 	physsz = 0;
-	getenv_quad("hw.physmem", &physmem);
-	physmem = ctob(physmem);
+
+        if (TUNABLE_ULONG_FETCH("hw.physmem", &physmem_tunable))
+                physmem = atop(physmem_tunable);
 
+	printf("desired physmem=0x%lx\n", physmem_tunable);
 	for (i = 0, j = 0; i < sz; i++, j += 2) {
 		CTR2(KTR_PMAP, "start=%#lx size=%#lx\n", mra[i].mr_start,
 		    mra[i].mr_size);
 		KDPRINTF("start=%#lx size=%#lx\n", mra[i].mr_start,
 		    mra[i].mr_size);
-		if (physmem != 0 && btoc(physsz + mra[i].mr_size) >= physmem) {
-			if (btoc(physsz) < physmem) {
+		if (physmem_tunable != 0 && (physsz + mra[i].mr_size) >= physmem_tunable) {
+			if (physsz < physmem_tunable) {
 				phys_avail[j] = mra[i].mr_start;
 				phys_avail[j + 1] = mra[i].mr_start +
-				    (ctob(physmem) - physsz);
-				physsz = ctob(physmem);
+				    (physmem_tunable - physsz);
+				physsz = physmem_tunable;
 			}
 			break;
 		}
@@ -611,7 +613,7 @@
 	 * currently (not by design) used for permanent mappings
 	 */
 	
-	tsb_4m_size = virtsz >> (PAGE_SHIFT_4M - TTE_SHIFT);
+	tsb_4m_size = (virtsz >> (PAGE_SHIFT_4M - TTE_SHIFT));
 	pa = pmap_bootstrap_alloc(tsb_4m_size);
 
 	KDPRINTF("tsb_4m_pa is 0x%lx tsb_4m_size is 0x%lx\n", pa, tsb_4m_size);
@@ -692,12 +694,17 @@
 	 * 
 	 */
 	pa = PAGE_SIZE_4M;
-	for (i = 0; phys_avail[i + 2] != 0; i += 2) 
-		for (; pa < phys_avail[i + 1]; pa += PAGE_SIZE_4M) {
-		tsb_set_tte_real(&kernel_td[TSB4M_INDEX], TLB_PHYS_TO_DIRECT(pa), 
-			    pa | TTE_KERNEL | VTD_4M, 0);
-		}
+	for (i = 0; phys_avail[i] != 0; i += 2) 
+		for (; pa < phys_avail[i + 1]; pa += PAGE_SIZE_4M) 
+			tsb_set_tte_real(&kernel_td[TSB4M_INDEX], TLB_PHYS_TO_DIRECT(pa), 
+					 pa | TTE_KERNEL | VTD_4M, 0);
+	
+        for (i = 0; i < 2; i++) {
+                pa = nucleus_mappings[i];
+                tsb_set_tte_real(&kernel_td[TSB4M_INDEX], TLB_PHYS_TO_DIRECT(pa),
+				 pa | TTE_KERNEL | VTD_4M, 0);
 
+	}
 	/*
 	 * Get the available physical memory ranges from /memory/reg. These
 	 * are only used for kernel dumps, but it may not be wise to do prom
@@ -749,6 +756,9 @@
 			pa = TTE_GET_PA(translations[i].om_tte) + off;
 			tte_hash_insert(pm->pm_hash, va, pa | TTE_KERNEL | VTD_8K);
 		}
+		KDPRINTF("set om_size=%ld om_start=%lx om_tte=%lx\n", 
+		       translations[i].om_size, translations[i].om_start, 
+		       translations[i].om_tte);
 	}
 	for (i = 0; i < KSTACK_PAGES; i++) {
 		pa = kstack0_phys + i * PAGE_SIZE;
@@ -765,6 +775,11 @@
 		tte_hash_insert(pm->pm_hash, TLB_PHYS_TO_DIRECT(pa), 
 				pa | TTE_KERNEL | VTD_4M);
 #endif
+        /* XXX relies on the fact that memory ranges only get smaller */
+        for (i = 0; phys_avail[i + 2] != 0; i += 2)
+                if (phys_avail[i + 1] - phys_avail[i] < PAGE_SIZE_4M)
+                        phys_avail[i] = phys_avail[i+1] = 0;
+
 }
 
 


More information about the p4-projects mailing list