From owner-svn-src-stable@FreeBSD.ORG Mon Jun 17 23:21:18 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id CC0EC6CA; Mon, 17 Jun 2013 23:21:18 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id AEC371766; Mon, 17 Jun 2013 23:21:18 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5HNLIw6086003; Mon, 17 Jun 2013 23:21:18 GMT (envelope-from scottl@svn.freebsd.org) Received: (from scottl@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5HNLIr7086002; Mon, 17 Jun 2013 23:21:18 GMT (envelope-from scottl@svn.freebsd.org) Message-Id: <201306172321.r5HNLIr7086002@svn.freebsd.org> From: Scott Long Date: Mon, 17 Jun 2013 23:21:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r251873 - stable/9/sys/arm/arm X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Jun 2013 23:21:19 -0000 Author: scottl Date: Mon Jun 17 23:21:18 2013 New Revision: 251873 URL: http://svnweb.freebsd.org/changeset/base/251873 Log: MFC r244575: The manpage states that bus_dmamap_create(9) returns ENOMEM if it can't allocate a map or mapping resources. That seems to imply that any memory allocations it does must use M_NOWAIT and check for NULL. MFC 246158: Use pmap_kextract() instead of inlining the page table walk. Remove the comment referencing non-existing code. Submitted by: kib, cognet Approved by: marius Obtained from: Netflix Modified: stable/9/sys/arm/arm/busdma_machdep.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/arm/arm/busdma_machdep.c ============================================================================== --- stable/9/sys/arm/arm/busdma_machdep.c Mon Jun 17 22:59:47 2013 (r251872) +++ stable/9/sys/arm/arm/busdma_machdep.c Mon Jun 17 23:21:18 2013 (r251873) @@ -567,16 +567,24 @@ bus_dmamap_create(bus_dma_tag_t dmat, in bus_dmamap_t map; int error = 0; - map = uma_zalloc_arg(dmamap_zone, dmat, M_WAITOK); + map = uma_zalloc_arg(dmamap_zone, dmat, M_NOWAIT); *mapp = map; + if (map == NULL) + return (ENOMEM); /* * If the tag's segments haven't been allocated yet we need to do it * now, because we can't sleep for resources at map load time. */ - if (dmat->segments == NULL) + if (dmat->segments == NULL) { dmat->segments = malloc(dmat->nsegments * - sizeof(*dmat->segments), M_DEVBUF, M_WAITOK); + sizeof(*dmat->segments), M_DEVBUF, M_NOWAIT); + if (dmat->segments == NULL) { + uma_zfree(dmamap_zone, map); + *mapp = NULL; + return (ENOMEM); + } + } /* * Bouncing might be required if the driver asks for an active @@ -841,9 +849,6 @@ bus_dmamap_load_buffer(bus_dma_tag_t dma vm_offset_t vaddr = (vm_offset_t)buf; int seg; int error = 0; - pd_entry_t *pde; - pt_entry_t pte; - pt_entry_t *ptep; lastaddr = *lastaddrp; bmask = ~(dmat->boundary - 1); @@ -860,34 +865,9 @@ bus_dmamap_load_buffer(bus_dma_tag_t dma for (seg = *segp; buflen > 0 ; ) { /* * Get the physical address for this segment. - * - * XXX Don't support checking for coherent mappings - * XXX in user address space. */ if (__predict_true(pmap == pmap_kernel())) { - if (pmap_get_pde_pte(pmap, vaddr, &pde, &ptep) == FALSE) - return (EFAULT); - - if (__predict_false(pmap_pde_section(pde))) { - if (*pde & L1_S_SUPERSEC) - curaddr = (*pde & L1_SUP_FRAME) | - (vaddr & L1_SUP_OFFSET); - else - curaddr = (*pde & L1_S_FRAME) | - (vaddr & L1_S_OFFSET); - } else { - pte = *ptep; - KASSERT((pte & L2_TYPE_MASK) != L2_TYPE_INV, - ("INV type")); - if (__predict_false((pte & L2_TYPE_MASK) - == L2_TYPE_L)) { - curaddr = (pte & L2_L_FRAME) | - (vaddr & L2_L_OFFSET); - } else { - curaddr = (pte & L2_S_FRAME) | - (vaddr & L2_S_OFFSET); - } - } + curaddr = pmap_kextract(vaddr); } else { curaddr = pmap_extract(pmap, vaddr); map->flags &= ~DMAMAP_COHERENT;