From owner-svn-src-all@FreeBSD.ORG Tue Feb 10 21:51:34 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 07DBC106566B; Tue, 10 Feb 2009 21:51:34 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E83BE8FC19; Tue, 10 Feb 2009 21:51:33 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n1ALpXKL005269; Tue, 10 Feb 2009 21:51:33 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n1ALpXgE005267; Tue, 10 Feb 2009 21:51:33 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <200902102151.n1ALpXgE005267@svn.freebsd.org> From: Marius Strobl Date: Tue, 10 Feb 2009 21:51:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r188456 - in head/sys/sparc64: include sparc64 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Feb 2009 21:51:34 -0000 Author: marius Date: Tue Feb 10 21:51:33 2009 New Revision: 188456 URL: http://svn.freebsd.org/changeset/base/188456 Log: Improve r185008 so the streaming cache is only flushed when a mapping actually met the threshold. Modified: head/sys/sparc64/include/bus_private.h head/sys/sparc64/sparc64/iommu.c Modified: head/sys/sparc64/include/bus_private.h ============================================================================== --- head/sys/sparc64/include/bus_private.h Tue Feb 10 21:48:42 2009 (r188455) +++ head/sys/sparc64/include/bus_private.h Tue Feb 10 21:51:33 2009 (r188456) @@ -66,9 +66,10 @@ struct bus_dmamap { int dm_flags; /* (p) */ }; -/* Flag values. */ -#define DMF_LOADED 1 /* Map is loaded */ -#define DMF_COHERENT 2 /* Coherent mapping requested */ +/* Flag values */ +#define DMF_LOADED (1 << 0) /* Map is loaded. */ +#define DMF_COHERENT (1 << 1) /* Coherent mapping requested. */ +#define DMF_STREAMED (1 << 2) /* Streaming cache used. */ int sparc64_dma_alloc_map(bus_dma_tag_t dmat, bus_dmamap_t *mapp); void sparc64_dma_free_map(bus_dma_tag_t dmat, bus_dmamap_t map); Modified: head/sys/sparc64/sparc64/iommu.c ============================================================================== --- head/sys/sparc64/sparc64/iommu.c Tue Feb 10 21:48:42 2009 (r188455) +++ head/sys/sparc64/sparc64/iommu.c Tue Feb 10 21:51:33 2009 (r188456) @@ -822,7 +822,7 @@ iommu_dvmamap_destroy(bus_dma_tag_t dt, } /* - * IOMMU DVMA operations, common to PCI and SBus. + * IOMMU DVMA operations, common to PCI and SBus */ static int iommu_dvmamap_load_buffer(bus_dma_tag_t dt, struct iommu_state *is, @@ -833,8 +833,8 @@ iommu_dvmamap_load_buffer(bus_dma_tag_t bus_size_t sgsize, esize; vm_offset_t vaddr, voffs; vm_paddr_t curaddr; - int error, sgcnt, firstpg, stream; pmap_t pmap = NULL; + int error, firstpg, sgcnt; KASSERT(buflen != 0, ("%s: buflen == 0!", __func__)); if (buflen > dt->dt_maxsize) @@ -855,7 +855,9 @@ iommu_dvmamap_load_buffer(bus_dma_tag_t sgcnt = *segp; firstpg = 1; - stream = iommu_use_streaming(is, map, buflen); + map->dm_flags &= ~DMF_STREAMED; + map->dm_flags |= iommu_use_streaming(is, map, buflen) != 0 ? + DMF_STREAMED : 0; for (; buflen > 0; ) { /* * Get the physical address for this page. @@ -876,7 +878,7 @@ iommu_dvmamap_load_buffer(bus_dma_tag_t vaddr += sgsize; iommu_enter(is, trunc_io_page(dvmaddr), trunc_io_page(curaddr), - stream, flags); + (map->dm_flags & DMF_STREAMED) != 0, flags); /* * Chop the chunk up into segments of at most maxsegsz, but try @@ -1141,7 +1143,7 @@ iommu_dvmamap_sync(bus_dma_tag_t dt, bus /* XXX This is probably bogus. */ if ((op & BUS_DMASYNC_PREREAD) != 0) membar(Sync); - if ((map->dm_flags & DMF_COHERENT) == 0 && IOMMU_HAS_SB(is) && + if ((map->dm_flags & DMF_STREAMED) != 0 && ((op & BUS_DMASYNC_POSTREAD) != 0 || (op & BUS_DMASYNC_PREWRITE) != 0)) { IS_LOCK(is);