summaryrefslogtreecommitdiff
path: root/usr/src
diff options
context:
space:
mode:
authordanice <none@none>2007-10-24 19:08:06 -0700
committerdanice <none@none>2007-10-24 19:08:06 -0700
commit1f7be8d9c56cac9b6eeebaed96fe8763d1e90dd6 (patch)
treea9070c1d28a4c6e0d4b02dcf97220eb4a4d319a2 /usr/src
parent25f476773dea2a0ee593dcf662a38d5f02487196 (diff)
downloadillumos-gate-1f7be8d9c56cac9b6eeebaed96fe8763d1e90dd6.tar.gz
6377121 virtual-dma property should be removed on attach failure.
6532510 system panic when vmem_xalloc cannot satisfy mandatory allocation during dr testing.
Diffstat (limited to 'usr/src')
-rw-r--r--usr/src/uts/sun4/io/px/px_dma.c13
-rw-r--r--usr/src/uts/sun4/io/px/px_mmu.c31
-rw-r--r--usr/src/uts/sun4/io/px/px_space.c9
-rw-r--r--usr/src/uts/sun4/io/px/px_space.h3
-rw-r--r--usr/src/uts/sun4u/io/px/px_lib4u.c7
5 files changed, 38 insertions, 25 deletions
diff --git a/usr/src/uts/sun4/io/px/px_dma.c b/usr/src/uts/sun4/io/px/px_dma.c
index 48adba2a2e..74a91735b6 100644
--- a/usr/src/uts/sun4/io/px/px_dma.c
+++ b/usr/src/uts/sun4/io/px/px_dma.c
@@ -19,7 +19,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -1506,9 +1506,14 @@ px_dvma_debug_fini(px_mmu_t *mmu_p)
uint64_t mask = ~(1ull << mmu_p->mmu_inst);
cmn_err(CE_NOTE, "PCI Express DVMA %p stat OFF", mmu_p);
- kmem_free(mmu_p->dvma_alloc_rec, sz);
- kmem_free(mmu_p->dvma_free_rec, sz);
- mmu_p->dvma_alloc_rec = mmu_p->dvma_free_rec = NULL;
+ if (mmu_p->dvma_alloc_rec) {
+ kmem_free(mmu_p->dvma_alloc_rec, sz);
+ mmu_p->dvma_alloc_rec = NULL;
+ }
+ if (mmu_p->dvma_free_rec) {
+ kmem_free(mmu_p->dvma_free_rec, sz);
+ mmu_p->dvma_free_rec = NULL;
+ }
prev = mmu_p->dvma_active_list;
if (!prev)
diff --git a/usr/src/uts/sun4/io/px/px_mmu.c b/usr/src/uts/sun4/io/px/px_mmu.c
index c3ef404350..7fbe21f45c 100644
--- a/usr/src/uts/sun4/io/px/px_mmu.c
+++ b/usr/src/uts/sun4/io/px/px_mmu.c
@@ -19,7 +19,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -44,7 +44,7 @@ px_mmu_attach(px_t *px_p)
{
dev_info_t *dip = px_p->px_dip;
px_mmu_t *mmu_p;
- uint32_t base_pg_index, i = 0;
+ uint32_t tsb_i = 0;
char map_name[32];
px_dvma_range_prop_t *dvma_prop;
int dvma_prop_len;
@@ -114,16 +114,31 @@ px_mmu_attach(px_t *px_p)
mutex_init(&mmu_p->dvma_debug_lock, NULL, MUTEX_DRIVER, NULL);
- base_pg_index = MMU_BTOP(mmu_p->mmu_dvma_end) - tsb_entries + 1;
-
- for (i = 0; i < tsb_entries; i++) {
+ for (tsb_i = 0; tsb_i < tsb_entries; tsb_i++) {
r_addr_t ra = 0;
io_attributes_t attr;
caddr_t va;
- if (px_lib_iommu_getmap(px_p->px_dip, PCI_TSBID(0, i),
- &attr, &ra) == DDI_SUCCESS) {
- va = (caddr_t)(MMU_PTOB(base_pg_index + i));
+ if (px_lib_iommu_getmap(px_p->px_dip, PCI_TSBID(0, tsb_i),
+ &attr, &ra) != DDI_SUCCESS)
+ continue;
+
+ va = (caddr_t)(MMU_PTOB(mmu_p->dvma_base_pg + tsb_i));
+
+ if (va <= (caddr_t)mmu_p->mmu_dvma_fast_end) {
+ uint32_t cache_i;
+
+ /*
+ * the va is within the *fast* dvma range; therefore,
+ * lock its fast dvma page cache cluster in order to
+ * both preserve the TTE and prevent the use of this
+ * fast dvma page cache cluster by px_dvma_map_fast().
+ * the lock value 0xFF comes from ldstub().
+ */
+ cache_i = tsb_i / px_dvma_page_cache_clustsz;
+ ASSERT(cache_i < px_dvma_page_cache_entries);
+ mmu_p->mmu_dvma_cache_locks[cache_i] = 0xFF;
+ } else {
(void) vmem_xalloc(mmu_p->mmu_dvma_map, MMU_PAGE_SIZE,
MMU_PAGE_SIZE, 0, 0, va, va + MMU_PAGE_SIZE,
VM_NOSLEEP | VM_BESTFIT | VM_PANIC);
diff --git a/usr/src/uts/sun4/io/px/px_space.c b/usr/src/uts/sun4/io/px/px_space.c
index 8fc809d4d5..838fc9ffe0 100644
--- a/usr/src/uts/sun4/io/px/px_space.c
+++ b/usr/src/uts/sun4/io/px/px_space.c
@@ -19,7 +19,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -141,13 +141,6 @@ uint_t px_disable_fdvma = 0;
uint_t px_mmu_ctx_lock_failure = 0;
/*
- * This flag preserves prom MMU settings by copying prom TSB entries
- * to corresponding kernel TSB entry locations. It should be removed
- * after the interface properties from obp have become default.
- */
-uint_t px_preserve_mmu_tsb = 1;
-
-/*
* memory callback list id callback list for kmem_alloc failure clients
*/
uintptr_t px_kmem_clid = 0;
diff --git a/usr/src/uts/sun4/io/px/px_space.h b/usr/src/uts/sun4/io/px/px_space.h
index 5b6b51afa0..e49e2adb84 100644
--- a/usr/src/uts/sun4/io/px/px_space.h
+++ b/usr/src/uts/sun4/io/px/px_space.h
@@ -19,7 +19,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -93,7 +93,6 @@ extern uint_t px_dvma_vmem_xfree;
extern uint_t px_disable_fdvma;
extern uint_t px_iommu_ctx_lock_failure;
-extern uint_t px_preserve_iommu_tsb;
extern uintptr_t px_kmem_clid;
/* timeout length in micro seconds */
diff --git a/usr/src/uts/sun4u/io/px/px_lib4u.c b/usr/src/uts/sun4u/io/px/px_lib4u.c
index 52a5d94524..b587d5336e 100644
--- a/usr/src/uts/sun4u/io/px/px_lib4u.c
+++ b/usr/src/uts/sun4u/io/px/px_lib4u.c
@@ -209,9 +209,9 @@ px_lib_dev_init(dev_info_t *dip, devhandle_t *dev_hdl)
px_dvma_range.dvma_len = (uint32_t)
px_mmu_dvma_end - px_dvma_range.dvma_base + 1;
- (void) ddi_prop_create(DDI_DEV_T_NONE, dip, DDI_PROP_CANSLEEP,
- "virtual-dma", (caddr_t)&px_dvma_range,
- sizeof (px_dvma_range_prop_t));
+ (void) ddi_prop_update_int_array(DDI_DEV_T_NONE, dip,
+ "virtual-dma", (int *)&px_dvma_range,
+ sizeof (px_dvma_range_prop_t) / sizeof (int));
/*
* Initilize all fire hardware specific blocks.
*/
@@ -294,6 +294,7 @@ px_lib_dev_fini(dev_info_t *dip)
px_lib_unmap_regs((pxu_t *)px_p->px_plat_p);
kmem_free(px_p->px_plat_p, sizeof (pxu_t));
px_p->px_plat_p = NULL;
+ (void) ddi_prop_remove(DDI_DEV_T_NONE, dip, "virtual-dma");
return (DDI_SUCCESS);
}