[PATCH] Add membar to bus dma PREWRITE operations

John Baldwin jhb at FreeBSD.org
Fri Sep 2 10:31:52 PDT 2005


The patch below adds a memory barrier to bus_dma PREWRITE operations to ensure 
that writes by the CPU to populate a buffer before it is read via DMA by a 
device will be completed before later writes by the CPU (later as in program 
order) to trigger the DMA.  Please test!  Patch should apply to 5.x and 
later.  Thanks.

--- //depot/vendor/freebsd/src/sys/alpha/alpha/busdma_machdep.c	2005/05/25 
07:26:16
+++ //depot/user/jhb/acpipci/alpha/alpha/busdma_machdep.c	2005/08/18 17:55:22
@@ -891,6 +891,10 @@
 			}
 		}
 	}
+
+	/* Ensure any pending writes have drained. */
+	if (op & (BUS_DMASYNC_PREWRITE))
+		alpha_mb();
 }
 
 static void

-- 
John Baldwin <jhb at FreeBSD.org>  <><  http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve"  =  http://www.FreeBSD.org


More information about the freebsd-alpha mailing list