svn commit: r223578 - in projects/pseries/powerpc: aim pseries
Andreas Tobler
andreast at FreeBSD.org
Sun Jun 26 19:02:34 UTC 2011
Author: andreast
Date: Sun Jun 26 19:02:34 2011
New Revision: 223578
URL: http://svn.freebsd.org/changeset/base/223578
Log:
Set the default large page to 16MB on PowerMac's.
Add a property scan for PAPR compatible machines to get the large page
information from there.
Modified:
projects/pseries/powerpc/aim/mmu_oea64.c
projects/pseries/powerpc/aim/mmu_oea64.h
projects/pseries/powerpc/pseries/mmu_phyp.c
Modified: projects/pseries/powerpc/aim/mmu_oea64.c
==============================================================================
--- projects/pseries/powerpc/aim/mmu_oea64.c Sun Jun 26 18:44:00 2011 (r223577)
+++ projects/pseries/powerpc/aim/mmu_oea64.c Sun Jun 26 19:02:34 2011 (r223578)
@@ -257,7 +257,7 @@ uintptr_t moea64_scratchpage_pte[2];
struct mtx moea64_scratchpage_mtx;
uint64_t moea64_large_page_mask = 0;
-int moea64_large_page_size = 0;
+uint64_t moea64_large_page_size = 0;
int moea64_large_page_shift = 0;
/*
@@ -554,6 +554,9 @@ moea64_probe_large_page(void)
uint16_t pvr = mfpvr() >> 16;
switch (pvr) {
+ case IBMPOWER7:
+ moea64_large_page_size = 0;
+ break;
case IBM970:
case IBM970FX:
case IBM970MP:
@@ -562,12 +565,9 @@ moea64_probe_large_page(void)
powerpc_sync(); isync();
/* FALLTHROUGH */
- case IBMCELLBE:
+ default:
moea64_large_page_size = 0x1000000; /* 16 MB */
moea64_large_page_shift = 24;
- break;
- default:
- moea64_large_page_size = 0;
}
moea64_large_page_mask = moea64_large_page_size - 1;
Modified: projects/pseries/powerpc/aim/mmu_oea64.h
==============================================================================
--- projects/pseries/powerpc/aim/mmu_oea64.h Sun Jun 26 18:44:00 2011 (r223577)
+++ projects/pseries/powerpc/aim/mmu_oea64.h Sun Jun 26 19:02:34 2011 (r223578)
@@ -70,6 +70,7 @@ extern u_int moea64_pte_overflow;
extern struct pvo_head *moea64_pvo_table;
extern int moea64_large_page_shift;
+extern uint64_t moea64_large_page_size;
extern u_int moea64_pteg_count;
extern u_int moea64_pteg_mask;
Modified: projects/pseries/powerpc/pseries/mmu_phyp.c
==============================================================================
--- projects/pseries/powerpc/pseries/mmu_phyp.c Sun Jun 26 18:44:00 2011 (r223577)
+++ projects/pseries/powerpc/pseries/mmu_phyp.c Sun Jun 26 19:02:34 2011 (r223578)
@@ -99,8 +99,9 @@ mphyp_bootstrap(mmu_t mmup, vm_offset_t
uint64_t final_pteg_count = 0;
char buf[8];
uint32_t prop[2];
+ uint32_t nptlp, shift = 0, slb_encoding = 0;
phandle_t dev, node, root;
- int res;
+ int idx, len, res;
moea64_early_bootstrap(mmup, kernelstart, kernelend);
@@ -133,6 +134,37 @@ mphyp_bootstrap(mmu_t mmup, vm_offset_t
moea64_pteg_count = final_pteg_count / sizeof(struct lpteg);
+ /* Scan the large page size property for PAPR compatible machines.
+ See PAPR D.5 Changes to Section 5.1.4, 'CPU Node Properties'
+ for the encoding of the property.
+ */
+
+ len = OF_getproplen(node, "ibm,segment-page-sizes");
+ if (len > 0) {
+ /* We have to use a variable length array on the stack
+ since we have very limited stack space.
+ */
+ cell_t arr[len/sizeof(cell_t)];
+ res = OF_getprop(node, "ibm,segment-page-sizes", &arr,
+ sizeof(arr));
+ len /= 4;
+ idx = 0;
+ while (len > 0) {
+ shift = arr[idx];
+ slb_encoding = arr[idx + 1];
+ nptlp = arr[idx + 2];
+ idx += 3;
+ len -= 3;
+ while (len > 0 && nptlp) {
+ idx += 2;
+ len -= 2;
+ nptlp--;
+ }
+ }
+ moea64_large_page_shift = shift;
+ moea64_large_page_size = 1 << shift;
+ }
+
moea64_mid_bootstrap(mmup, kernelstart, kernelend);
moea64_late_bootstrap(mmup, kernelstart, kernelend);
}
@@ -208,7 +240,7 @@ mphyp_pte_change(mmu_t mmu, uintptr_t sl
if (result != H_SUCCESS)
panic("mphyp_pte_change() invalidation failure: %ld\n", result);
result = phyp_pft_hcall(H_ENTER, H_EXACT, slot, pvo_pt->pte_hi,
- pvo_pt->pte_lo, &index, &evicted.pte_lo, &junk);
+ pvo_pt->pte_lo, &index, &evicted.pte_lo, &junk);
if (result != H_SUCCESS)
panic("mphyp_pte_change() insertion failure: %ld\n", result);
}
More information about the svn-src-projects
mailing list