summaryrefslogtreecommitdiffstats
path: root/sys/powerpc/aim/mmu_oea.c
diff options
context:
space:
mode:
authornwhitehorn <nwhitehorn@FreeBSD.org>2010-09-06 23:07:58 +0000
committernwhitehorn <nwhitehorn@FreeBSD.org>2010-09-06 23:07:58 +0000
commit4701f590b3c86441eea2b3ceb415651be378f742 (patch)
tree9a0310da7a8c6d2997b2b51cbe74e088f309a3fe /sys/powerpc/aim/mmu_oea.c
parent212ac5b8db70b2f6ac06375111176ff30957dade (diff)
downloadFreeBSD-src-4701f590b3c86441eea2b3ceb415651be378f742.zip
FreeBSD-src-4701f590b3c86441eea2b3ceb415651be378f742.tar.gz
Fix the same race condition on 32-bit AIM CPUs that was fixed for 64-bit
ones in r211967 involving VSID allocation.
Diffstat (limited to 'sys/powerpc/aim/mmu_oea.c')
-rw-r--r--sys/powerpc/aim/mmu_oea.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/sys/powerpc/aim/mmu_oea.c b/sys/powerpc/aim/mmu_oea.c
index da83538..d3a2459 100644
--- a/sys/powerpc/aim/mmu_oea.c
+++ b/sys/powerpc/aim/mmu_oea.c
@@ -203,6 +203,7 @@ extern struct pmap ofw_pmap;
* Lock for the pteg and pvo tables.
*/
struct mtx moea_table_mutex;
+struct mtx moea_vsid_mutex;
/* tlbie instruction synchronization */
static struct mtx tlbie_mtx;
@@ -819,6 +820,7 @@ moea_bootstrap(mmu_t mmup, vm_offset_t kernelstart, vm_offset_t kernelend)
*/
mtx_init(&moea_table_mutex, "pmap table", NULL, MTX_DEF |
MTX_RECURSE);
+ mtx_init(&moea_vsid_mutex, "VSID table", NULL, MTX_DEF);
mtx_init(&tlbie_mtx, "tlbie", NULL, MTX_SPIN);
@@ -1589,6 +1591,7 @@ moea_pinit(mmu_t mmu, pmap_t pmap)
}
+ mtx_lock(&moea_vsid_mutex);
/*
* Allocate some segment registers for this pmap.
*/
@@ -1623,9 +1626,11 @@ moea_pinit(mmu_t mmu, pmap_t pmap)
moea_vsid_bitmap[n] |= mask;
for (i = 0; i < 16; i++)
pmap->pm_sr[i] = VSID_MAKE(i, hash);
+ mtx_unlock(&moea_vsid_mutex);
return;
}
+ mtx_unlock(&moea_vsid_mutex);
panic("moea_pinit: out of segments");
}
@@ -1737,10 +1742,12 @@ moea_release(mmu_t mmu, pmap_t pmap)
if (pmap->pm_sr[0] == 0)
panic("moea_release");
+ mtx_lock(&moea_vsid_mutex);
idx = VSID_TO_HASH(pmap->pm_sr[0]) & (NPMAPS-1);
mask = 1 << (idx % VSID_NBPW);
idx /= VSID_NBPW;
moea_vsid_bitmap[idx] &= ~mask;
+ mtx_unlock(&moea_vsid_mutex);
PMAP_LOCK_DESTROY(pmap);
}
OpenPOWER on IntegriCloud