Module Name:    src
Committed By:   mrg
Date:           Thu Jun 17 06:48:46 UTC 2010

Modified Files:
        src/sys/arch/sparc64/dev: iommu.c

Log Message:
in iommu_remove() don't invalidate the IOMMU mapping.  for reasons not
yet determined, some PCI devices (at least fxp(4) and re(4)) sometimes
appear to perform DMA operations while this is happening, and we get
uncorrectable DMA errors.  ideally, this "shouldn't happen", but none
of the investigation so far has reveal the problem, and my source
investigation of both opensolaris and linux show that their perform
the invaliation when unmapping.

"handles" PR#43274 as well as other issues...

XXX: candidate for netbsd-5


To generate a diff of this commit:
cvs rdiff -u -r1.98 -r1.99 src/sys/arch/sparc64/dev/iommu.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/sparc64/dev/iommu.c
diff -u src/sys/arch/sparc64/dev/iommu.c:1.98 src/sys/arch/sparc64/dev/iommu.c:1.99
--- src/sys/arch/sparc64/dev/iommu.c:1.98	Thu Mar 11 03:54:56 2010
+++ src/sys/arch/sparc64/dev/iommu.c	Thu Jun 17 06:48:46 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: iommu.c,v 1.98 2010/03/11 03:54:56 mrg Exp $	*/
+/*	$NetBSD: iommu.c,v 1.99 2010/06/17 06:48:46 mrg Exp $	*/
 
 /*
  * Copyright (c) 1999, 2000 Matthew R. Green
@@ -59,7 +59,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: iommu.c,v 1.98 2010/03/11 03:54:56 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: iommu.c,v 1.99 2010/06/17 06:48:46 mrg Exp $");
 
 #include "opt_ddb.h"
 
@@ -213,6 +213,7 @@
 	is->is_dvmamap = extent_create(name,
 	    is->is_dvmabase, is->is_dvmaend,
 	    M_DEVBUF, 0, 0, EX_NOWAIT);
+	/* XXXMRG Check is_dvmamap is valid. */
 }
 
 /*
@@ -349,6 +350,7 @@
 		else
 			len -= PAGE_SIZE;
 
+#if 0
 		/*
 		 * XXX Zero-ing the entry would not require RMW
 		 *
@@ -360,6 +362,7 @@
 		 */
 		is->is_tsb[IOTSBSLOT(va,is->is_tsbsize)] &= ~IOTTE_V;
 		membar_storestore();
+#endif
 		bus_space_write_8(is->is_bustag, is->is_iommu,
 			IOMMUREG(iommu_flush), va);
 		va += PAGE_SIZE;
@@ -639,10 +642,6 @@
 	/* Flush the caches */
 	bus_dmamap_unload(t->_parent, map);
 
-	/* Mark the mappings as invalid. */
-	map->dm_mapsize = 0;
-	map->dm_nsegs = 0;
-
 	s = splhigh();
 	error = extent_free(is->is_dvmamap, map->_dm_dvmastart,
 		map->_dm_dvmasize, EX_NOWAIT);

Reply via email to