From owner-svn-src-all@FreeBSD.ORG Fri Aug 6 14:18:37 2010 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 839831065675; Fri, 6 Aug 2010 14:18:37 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 573AD8FC18; Fri, 6 Aug 2010 14:18:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o76EIbFI038829; Fri, 6 Aug 2010 14:18:37 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o76EIbj0038826; Fri, 6 Aug 2010 14:18:37 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201008061418.o76EIbj0038826@svn.freebsd.org> From: John Baldwin Date: Fri, 6 Aug 2010 14:18:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-6@freebsd.org X-SVN-Group: stable-6 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r210932 - in stable/6/sys: amd64/amd64 i386/i386 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: Fri, 06 Aug 2010 14:18:37 -0000 Author: jhb Date: Fri Aug 6 14:18:37 2010 New Revision: 210932 URL: http://svn.freebsd.org/changeset/base/210932 Log: MFC 170866,176206: If busdma is being used to realign dynamic buffers and the alignment is set to PAGE_SIZE or less, the bounce page counting logic was flawed and wouldn't reserve any pages. Adjust to be correct. Modified: stable/6/sys/amd64/amd64/busdma_machdep.c stable/6/sys/i386/i386/busdma_machdep.c Directory Properties: stable/6/sys/ (props changed) stable/6/sys/contrib/pf/ (props changed) stable/6/sys/dev/cxgb/ (props changed) Modified: stable/6/sys/amd64/amd64/busdma_machdep.c ============================================================================== --- stable/6/sys/amd64/amd64/busdma_machdep.c Fri Aug 6 13:45:16 2010 (r210931) +++ stable/6/sys/amd64/amd64/busdma_machdep.c Fri Aug 6 14:18:37 2010 (r210932) @@ -594,14 +594,14 @@ _bus_dmamap_load_buffer(bus_dma_tag_t dm * Count the number of bounce pages * needed in order to complete this transfer */ - vaddr = trunc_page((vm_offset_t)buf); + vaddr = (vm_offset_t)buf; vendaddr = (vm_offset_t)buf + buflen; while (vaddr < vendaddr) { paddr = pmap_kextract(vaddr); if (run_filter(dmat, paddr) != 0) map->pagesneeded++; - vaddr += PAGE_SIZE; + vaddr += (PAGE_SIZE - ((vm_offset_t)vaddr & PAGE_MASK)); } CTR1(KTR_BUSDMA, "pagesneeded= %d\n", map->pagesneeded); } @@ -832,7 +832,7 @@ bus_dmamap_load_uio(bus_dma_tag_t dmat, bus_dmamap_callback2_t *callback, void *callback_arg, int flags) { - bus_addr_t lastaddr; + bus_addr_t lastaddr = 0; int nsegs, error, first, i; bus_size_t resid; struct iovec *iov; Modified: stable/6/sys/i386/i386/busdma_machdep.c ============================================================================== --- stable/6/sys/i386/i386/busdma_machdep.c Fri Aug 6 13:45:16 2010 (r210931) +++ stable/6/sys/i386/i386/busdma_machdep.c Fri Aug 6 14:18:37 2010 (r210932) @@ -597,14 +597,14 @@ _bus_dmamap_load_buffer(bus_dma_tag_t dm * Count the number of bounce pages * needed in order to complete this transfer */ - vaddr = trunc_page((vm_offset_t)buf); + vaddr = (vm_offset_t)buf; vendaddr = (vm_offset_t)buf + buflen; while (vaddr < vendaddr) { paddr = pmap_kextract(vaddr); if (run_filter(dmat, paddr) != 0) map->pagesneeded++; - vaddr += PAGE_SIZE; + vaddr += (PAGE_SIZE - ((vm_offset_t)vaddr & PAGE_MASK)); } CTR1(KTR_BUSDMA, "pagesneeded= %d\n", map->pagesneeded); }