From owner-svn-src-all@FreeBSD.ORG Tue Sep 14 01:27:54 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 07084106564A; Tue, 14 Sep 2010 01:27:54 +0000 (UTC) (envelope-from neel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EA58C8FC0C; Tue, 14 Sep 2010 01:27:53 +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 o8E1Rro9051805; Tue, 14 Sep 2010 01:27:53 GMT (envelope-from neel@svn.freebsd.org) Received: (from neel@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8E1RroP051803; Tue, 14 Sep 2010 01:27:53 GMT (envelope-from neel@svn.freebsd.org) Message-Id: <201009140127.o8E1RroP051803@svn.freebsd.org> From: Neel Natu Date: Tue, 14 Sep 2010 01:27:53 +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: r212589 - head/sys/mips/mips 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, 14 Sep 2010 01:27:54 -0000 Author: neel Date: Tue Sep 14 01:27:53 2010 New Revision: 212589 URL: http://svn.freebsd.org/changeset/base/212589 Log: Enforce that pmap_mapdev() always returns uncacheable mappings. Reviewed by: imp, jchandra, jmallett Modified: head/sys/mips/mips/pmap.c Modified: head/sys/mips/mips/pmap.c ============================================================================== --- head/sys/mips/mips/pmap.c Tue Sep 14 01:10:30 2010 (r212588) +++ head/sys/mips/mips/pmap.c Tue Sep 14 01:27:53 2010 (r212589) @@ -828,8 +828,8 @@ retry: /* * add a wired page to the kva */ - /* PMAP_INLINE */ void -pmap_kenter(vm_offset_t va, vm_paddr_t pa) +static void +pmap_kenter_attr(vm_offset_t va, vm_paddr_t pa, int attr) { pt_entry_t *pte; pt_entry_t opte, npte; @@ -837,12 +837,7 @@ pmap_kenter(vm_offset_t va, vm_paddr_t p #ifdef PMAP_DEBUG printf("pmap_kenter: va: %p -> pa: %p\n", (void *)va, (void *)pa); #endif - npte = TLBLO_PA_TO_PFN(pa) | PTE_D | PTE_V | PTE_G | PTE_W; - - if (is_cacheable_mem(pa)) - npte |= PTE_C_CACHE; - else - npte |= PTE_C_UNCACHED; + npte = TLBLO_PA_TO_PFN(pa) | PTE_D | PTE_V | PTE_G | PTE_W | attr; pte = pmap_pte(kernel_pmap, va); opte = *pte; @@ -851,6 +846,19 @@ pmap_kenter(vm_offset_t va, vm_paddr_t p pmap_update_page(kernel_pmap, va, npte); } +void +pmap_kenter(vm_offset_t va, vm_paddr_t pa) +{ + int attr; + + if (is_cacheable_mem(pa)) + attr = PTE_C_CACHE; + else + attr = PTE_C_UNCACHED; + + pmap_kenter_attr(va, pa, attr); +} + /* * remove a page from the kernel pagetables */ @@ -2863,7 +2871,7 @@ pmap_mapdev(vm_offset_t pa, vm_size_t si panic("pmap_mapdev: Couldn't alloc kernel virtual memory"); pa = trunc_page(pa); for (tmpva = va; size > 0;) { - pmap_kenter(tmpva, pa); + pmap_kenter_attr(tmpva, pa, PTE_C_UNCACHED); size -= PAGE_SIZE; tmpva += PAGE_SIZE; pa += PAGE_SIZE;