Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/x86/x86 x86: Move lfence into _bus_dmamap_sync and ...
details: https://anonhg.NetBSD.org/src/rev/52935f6cd238
branches: trunk
changeset: 368462:52935f6cd238
user: riastradh <riastradh%NetBSD.org@localhost>
date: Wed Jul 13 00:12:20 2022 +0000
description:
x86: Move lfence into _bus_dmamap_sync and comment it.
No functional change intended. This just keeps the bus_dma_* and
_bus_dma_* functions organized more consistently.
diffstat:
sys/arch/x86/x86/bus_dma.c | 17 ++++++++++++-----
1 files changed, 12 insertions(+), 5 deletions(-)
diffs (45 lines):
diff -r 5881000febea -r 52935f6cd238 sys/arch/x86/x86/bus_dma.c
--- a/sys/arch/x86/x86/bus_dma.c Tue Jul 12 23:47:00 2022 +0000
+++ b/sys/arch/x86/x86/bus_dma.c Wed Jul 13 00:12:20 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bus_dma.c,v 1.84 2022/01/22 15:10:32 skrll Exp $ */
+/* $NetBSD: bus_dma.c,v 1.85 2022/07/13 00:12:20 riastradh Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998, 2007, 2020 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.84 2022/01/22 15:10:32 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.85 2022/07/13 00:12:20 riastradh Exp $");
/*
* The following is included because _bus_dma_uiomove is derived from
@@ -816,6 +816,16 @@
#endif
/*
+ * The caller has been alerted to DMA completion by reading a
+ * register or DMA descriptor, and is about to read out of the
+ * DMA memory buffer that the device filled. LFENCE ensures
+ * that these happen in order, so that the caller doesn't
+ * proceed to read any stale data from cache or speculation.
+ */
+ if (ops & BUS_DMASYNC_POSTREAD)
+ x86_lfence();
+
+ /*
* If we're not bouncing, just return; nothing to do.
*/
if (len == 0 || cookie == NULL ||
@@ -1340,9 +1350,6 @@
return;
}
- if (ops & BUS_DMASYNC_POSTREAD)
- x86_lfence();
-
_bus_dmamap_sync(t, p, o, l, ops);
}
Home |
Main Index |
Thread Index |
Old Index