From owner-svn-src-all@FreeBSD.ORG Sat Jan 4 21:38:41 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CB23DFB8; Sat, 4 Jan 2014 21:38:41 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id B7AAB131F; Sat, 4 Jan 2014 21:38:41 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s04LcfbY013505; Sat, 4 Jan 2014 21:38:41 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s04Lcfh2013504; Sat, 4 Jan 2014 21:38:41 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201401042138.s04Lcfh2013504@svn.freebsd.org> From: Ian Lepore Date: Sat, 4 Jan 2014 21:38:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260288 - head/sys/arm/arm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.17 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: Sat, 04 Jan 2014 21:38:41 -0000 Author: ian Date: Sat Jan 4 21:38:41 2014 New Revision: 260288 URL: http://svnweb.freebsd.org/changeset/base/260288 Log: In pmap_mapdev(), first check whether a static mapping exists, and if so use it rather than allocating kva space and making another mapping. In pmap_unmapdev(), don't unmap/free if the mapping is static. Modified: head/sys/arm/arm/devmap.c Modified: head/sys/arm/arm/devmap.c ============================================================================== --- head/sys/arm/arm/devmap.c Sat Jan 4 21:32:53 2014 (r260287) +++ head/sys/arm/arm/devmap.c Sat Jan 4 21:38:41 2014 (r260288) @@ -207,13 +207,23 @@ arm_devmap_vtop(void * vpva, vm_size_t s /* * Map a set of physical memory pages into the kernel virtual address space. - * Return a pointer to where it is mapped. This routine is intended to be used - * for mapping device memory, NOT real memory. + * Return a pointer to where it is mapped. + * + * This uses a pre-established static mapping if one exists for the requested + * range, otherwise it allocates kva space and maps the physical pages into it. + * + * This routine is intended to be used for mapping device memory, NOT real + * memory; the mapping type is inherently PTE_DEVICE in pmap_kenter_device(). */ void * pmap_mapdev(vm_offset_t pa, vm_size_t size) { vm_offset_t va, tmpva, offset; + void * rva; + + /* First look in the static mapping table. */ + if ((rva = arm_devmap_ptov(pa, size)) != NULL) + return (rva); offset = pa & PAGE_MASK; pa = trunc_page(pa); @@ -240,8 +250,13 @@ void pmap_unmapdev(vm_offset_t va, vm_size_t size) { vm_offset_t tmpva, offset; - vm_size_t origsize = size; - + vm_size_t origsize; + + /* Nothing to do if we find the mapping in the static table. */ + if (arm_devmap_vtop((void*)va, size) != DEVMAP_PADDR_NOTFOUND) + return; + + origsize = size; offset = va & PAGE_MASK; va = trunc_page(va); size = round_page(size + offset);