From owner-svn-src-all@FreeBSD.ORG Thu May 22 23:38:17 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id AB600F22; Thu, 22 May 2014 23:38:17 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7F8EA273C; Thu, 22 May 2014 23:38:17 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s4MNcHxW066695; Thu, 22 May 2014 23:38:17 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s4MNcHYA066694; Thu, 22 May 2014 23:38:17 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201405222338.s4MNcHYA066694@svn.freebsd.org> From: Ian Lepore Date: Thu, 22 May 2014 23:38:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r266565 - 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.18 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: Thu, 22 May 2014 23:38:17 -0000 Author: ian Date: Thu May 22 23:38:17 2014 New Revision: 266565 URL: http://svnweb.freebsd.org/changeset/base/266565 Log: Map device memory using PTE_DEVICE attributes, and also ensure that the shared flag is set on normal-memory mappings made via pmap_kenter() for SMP. The "shared flag" part of this change isn't obvious from the diff, here's the deal... by using the array of preformatted page table entry templates instead of constructing the PTE from scratch, we automatically get the right attribute bits set for both caching and shared. MFC after: 1 week Modified: head/sys/arm/arm/pmap-v6.c Modified: head/sys/arm/arm/pmap-v6.c ============================================================================== --- head/sys/arm/arm/pmap-v6.c Thu May 22 23:18:17 2014 (r266564) +++ head/sys/arm/arm/pmap-v6.c Thu May 22 23:38:17 2014 (r266565) @@ -381,7 +381,8 @@ struct l2_dtable { /* pmap_kenter_internal flags */ #define KENTER_CACHE 0x1 -#define KENTER_USER 0x2 +#define KENTER_DEVICE 0x2 +#define KENTER_USER 0x4 /* * Given an L1 table index, calculate the corresponding l2_dtable index @@ -2401,12 +2402,17 @@ pmap_kenter_internal(vm_offset_t va, vm_ ptep = &l2b->l2b_kva[l2pte_index(va)]; opte = *ptep; + if (flags & KENTER_CACHE) + *ptep = L2_S_PROTO | l2s_mem_types[PTE_CACHE] | pa | L2_S_REF; + else if (flags & KENTER_DEVICE) + *ptep = L2_S_PROTO |l2s_mem_types[PTE_DEVICE] | pa | L2_S_REF; + else + *ptep =L2_S_PROTO | l2s_mem_types[PTE_NOCACHE] | pa | L2_S_REF; + if (flags & KENTER_CACHE) { - *ptep = L2_S_PROTO | pa | pte_l2_s_cache_mode | L2_S_REF; pmap_set_prot(ptep, VM_PROT_READ | VM_PROT_WRITE, flags & KENTER_USER); } else { - *ptep = L2_S_PROTO | pa | L2_S_REF; pmap_set_prot(ptep, VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE, 0); } @@ -2444,11 +2450,7 @@ void pmap_kenter_device(vm_offset_t va, vm_paddr_t pa) { - /* - * XXX - Need a way for kenter_internal to handle PTE_DEVICE mapping as - * a potentially different thing than PTE_NOCACHE. - */ - pmap_kenter_internal(va, pa, 0); + pmap_kenter_internal(va, pa, KENTER_DEVICE); } void