Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/ic Zero DMA memory after load, and add PREREAD sync ...



details:   https://anonhg.NetBSD.org/src/rev/687c463fe238
branches:  trunk
changeset: 948347:687c463fe238
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Sun Dec 27 16:52:01 2020 +0000

description:
Zero DMA memory after load, and add PREREAD sync op after to ensure it is visible

diffstat:

 sys/dev/ic/nvme.c |  8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diffs (34 lines):

diff -r 4af57db98e6b -r 687c463fe238 sys/dev/ic/nvme.c
--- a/sys/dev/ic/nvme.c Sun Dec 27 16:31:58 2020 +0000
+++ b/sys/dev/ic/nvme.c Sun Dec 27 16:52:01 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nvme.c,v 1.53 2020/12/04 23:03:11 kardel Exp $ */
+/*     $NetBSD: nvme.c,v 1.54 2020/12/27 16:52:01 jmcneill Exp $       */
 /*     $OpenBSD: nvme.c,v 1.49 2016/04/18 05:59:50 dlg Exp $ */
 
 /*
@@ -18,7 +18,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nvme.c,v 1.53 2020/12/04 23:03:11 kardel Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nvme.c,v 1.54 2020/12/27 16:52:01 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -1925,12 +1925,14 @@
        if (bus_dmamem_map(sc->sc_dmat, &ndm->ndm_seg, nsegs, size,
            &ndm->ndm_kva, BUS_DMA_WAITOK) != 0)
                goto free;
-       memset(ndm->ndm_kva, 0, size);
 
        if (bus_dmamap_load(sc->sc_dmat, ndm->ndm_map, ndm->ndm_kva, size,
            NULL, BUS_DMA_WAITOK) != 0)
                goto unmap;
 
+       memset(ndm->ndm_kva, 0, size);
+       bus_dmamap_sync(sc->sc_dmat, ndm->ndm_map, 0, size, BUS_DMASYNC_PREREAD);
+
        return ndm;
 
 unmap:



Home | Main Index | Thread Index | Old Index