From owner-svn-src-all@FreeBSD.ORG Sun Oct 7 18:47:53 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D72BD106575F; Sun, 7 Oct 2012 18:47:53 +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 C179E8FC08; Sun, 7 Oct 2012 18:47:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q97IlrOG051078; Sun, 7 Oct 2012 18:47:53 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q97Ilrp5051076; Sun, 7 Oct 2012 18:47:53 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201210071847.q97Ilrp5051076@svn.freebsd.org> From: John Baldwin Date: Sun, 7 Oct 2012 18:47:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r241326 - stable/9/sys/x86/x86 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: Sun, 07 Oct 2012 18:47:54 -0000 Author: jhb Date: Sun Oct 7 18:47:53 2012 New Revision: 241326 URL: http://svn.freebsd.org/changeset/base/241326 Log: MFC 239354: Allow static DMA allocations that allow for enough segments to do page-sized segments for the entire allocation to use kmem_alloc_attr() to allocate KVM rather than using kmem_alloc_contig(). This avoids requiring a single physically contiguous chunk in this case. Modified: stable/9/sys/x86/x86/busdma_machdep.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/x86/x86/busdma_machdep.c ============================================================================== --- stable/9/sys/x86/x86/busdma_machdep.c Sun Oct 7 18:42:02 2012 (r241325) +++ stable/9/sys/x86/x86/busdma_machdep.c Sun Oct 7 18:47:53 2012 (r241326) @@ -541,13 +541,14 @@ bus_dmamem_alloc(bus_dma_tag_t dmat, voi dmat->lowaddr >= ptoa((vm_paddr_t)Maxmem) && attr == VM_MEMATTR_DEFAULT) { *vaddr = malloc(dmat->maxsize, M_DEVBUF, mflags); + } else if (dmat->nsegments >= btoc(dmat->maxsize) && + dmat->alignment <= PAGE_SIZE && + (dmat->boundary == 0 || dmat->boundary >= dmat->lowaddr)) { + /* Page-based multi-segment allocations allowed */ + *vaddr = (void *)kmem_alloc_attr(kernel_map, dmat->maxsize, + mflags, 0ul, dmat->lowaddr, attr); + *mapp = &contig_dmamap; } else { - /* - * XXX Use Contigmalloc until it is merged into this facility - * and handles multi-seg allocations. Nobody is doing - * multi-seg allocations yet though. - * XXX Certain AGP hardware does. - */ *vaddr = (void *)kmem_alloc_contig(kernel_map, dmat->maxsize, mflags, 0ul, dmat->lowaddr, dmat->alignment ? dmat->alignment : 1ul, dmat->boundary, attr);