Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/sparc64/dev on tomatillo unload the map before flus...



details:   https://anonhg.NetBSD.org/src/rev/5bc346a2d7b4
branches:  trunk
changeset: 996833:5bc346a2d7b4
user:      mrg <mrg%NetBSD.org@localhost>
date:      Sat Feb 09 11:27:05 2019 +0000

description:
on tomatillo unload the map before flushing the iommu, instead of
the reverse.  from opensolaris.

diffstat:

 sys/arch/sparc64/dev/iommu.c    |  21 ++++++++++++++++-----
 sys/arch/sparc64/dev/iommuvar.h |   3 ++-
 sys/arch/sparc64/dev/schizo.c   |   6 ++++--
 3 files changed, 22 insertions(+), 8 deletions(-)

diffs (87 lines):

diff -r acc85d489bc3 -r 5bc346a2d7b4 sys/arch/sparc64/dev/iommu.c
--- a/sys/arch/sparc64/dev/iommu.c      Sat Feb 09 09:50:31 2019 +0000
+++ b/sys/arch/sparc64/dev/iommu.c      Sat Feb 09 11:27:05 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: iommu.c,v 1.114 2018/09/03 16:29:27 riastradh Exp $    */
+/*     $NetBSD: iommu.c,v 1.115 2019/02/09 11:27:05 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.114 2018/09/03 16:29:27 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: iommu.c,v 1.115 2019/02/09 11:27:05 mrg Exp $");
 
 #include "opt_ddb.h"
 
@@ -748,10 +748,21 @@
        /* Flush the iommu */
        if (!map->_dm_dvmastart)
                panic("%s: error dvmastart is zero!\n", __func__);
-       iommu_remove(is, map->_dm_dvmastart, map->_dm_dvmasize);
+
+       if (is->is_flags & IOMMU_SYNC_BEFORE_UNMAP) {
+
+               /* Flush the caches */
+               bus_dmamap_unload(t->_parent, map);
+
+               iommu_remove(is, map->_dm_dvmastart, map->_dm_dvmasize);
 
-       /* Flush the caches */
-       bus_dmamap_unload(t->_parent, map);
+       } else {
+
+               iommu_remove(is, map->_dm_dvmastart, map->_dm_dvmasize);
+
+               /* Flush the caches */
+               bus_dmamap_unload(t->_parent, map);
+       }
 
        mutex_enter(&is->is_lock);
        error = extent_free(is->is_dvmamap, map->_dm_dvmastart,
diff -r acc85d489bc3 -r 5bc346a2d7b4 sys/arch/sparc64/dev/iommuvar.h
--- a/sys/arch/sparc64/dev/iommuvar.h   Sat Feb 09 09:50:31 2019 +0000
+++ b/sys/arch/sparc64/dev/iommuvar.h   Sat Feb 09 11:27:05 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: iommuvar.h,v 1.22 2015/09/03 19:43:35 palle Exp $      */
+/*     $NetBSD: iommuvar.h,v 1.23 2019/02/09 11:27:05 mrg Exp $        */
 
 /*
  * Copyright (c) 1999 Matthew R. Green
@@ -59,6 +59,7 @@
        int                     is_flags;
 #define IOMMU_FLUSH_CACHE      0x00000001
 #define IOMMU_TSBSIZE_IN_PTSB  0x00000002      /* PCIe */
+#define IOMMU_SYNC_BEFORE_UNMAP        0x00000004
 
        struct strbuf_ctl       *is_sb[2];      /* Streaming buffers if any */
 
diff -r acc85d489bc3 -r 5bc346a2d7b4 sys/arch/sparc64/dev/schizo.c
--- a/sys/arch/sparc64/dev/schizo.c     Sat Feb 09 09:50:31 2019 +0000
+++ b/sys/arch/sparc64/dev/schizo.c     Sat Feb 09 11:27:05 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: schizo.c,v 1.40 2019/02/05 06:10:53 mrg Exp $  */
+/*     $NetBSD: schizo.c,v 1.41 2019/02/09 11:27:05 mrg Exp $  */
 /*     $OpenBSD: schizo.c,v 1.55 2008/08/18 20:29:37 brad Exp $        */
 
 /*
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: schizo.c,v 1.40 2019/02/05 06:10:53 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: schizo.c,v 1.41 2019/02/09 11:27:05 mrg Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -263,6 +263,8 @@
        }
 
        aprint_normal_dev(sc->sc_dev, " ");
+       if (sc->sc_tomatillo)
+               is->is_flags |= IOMMU_SYNC_BEFORE_UNMAP;
        schizo_init_iommu(sc, pbm);
 
        pbm->sp_memt = schizo_alloc_mem_tag(pbm);



Home | Main Index | Thread Index | Old Index