Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 20 Sep 2012 16:03:05 +0000 (UTC)
From:      Alan Cox <alc@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
Subject:   svn commit: r240754 - in stable/9/sys: amd64/amd64 i386/i386 i386/xen mips/mips
Message-ID:  <201209201603.q8KG35nY048466@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: alc
Date: Thu Sep 20 16:03:04 2012
New Revision: 240754
URL: http://svn.freebsd.org/changeset/base/240754

Log:
  MFC r240317
    Simplify pmap_unmapdev().
  
    Don't set PTE_W on the page table entry in pmap_kenter{,_attr}() on MIPS.

Modified:
  stable/9/sys/amd64/amd64/pmap.c
  stable/9/sys/i386/i386/pmap.c
  stable/9/sys/i386/xen/pmap.c
  stable/9/sys/mips/mips/pmap.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/amd64/amd64/pmap.c
==============================================================================
--- stable/9/sys/amd64/amd64/pmap.c	Thu Sep 20 15:53:55 2012	(r240753)
+++ stable/9/sys/amd64/amd64/pmap.c	Thu Sep 20 16:03:04 2012	(r240754)
@@ -4998,7 +4998,7 @@ pmap_mapbios(vm_paddr_t pa, vm_size_t si
 void
 pmap_unmapdev(vm_offset_t va, vm_size_t size)
 {
-	vm_offset_t base, offset, tmpva;
+	vm_offset_t base, offset;
 
 	/* If we gave a direct map region in pmap_mapdev, do nothing */
 	if (va >= DMAP_MIN_ADDRESS && va < DMAP_MAX_ADDRESS)
@@ -5006,9 +5006,6 @@ pmap_unmapdev(vm_offset_t va, vm_size_t 
 	base = trunc_page(va);
 	offset = va & PAGE_MASK;
 	size = roundup(offset + size, PAGE_SIZE);
-	for (tmpva = base; tmpva < (base + size); tmpva += PAGE_SIZE)
-		pmap_kremove(tmpva);
-	pmap_invalidate_range(kernel_pmap, va, tmpva);
 	kmem_free(kernel_map, base, size);
 }
 

Modified: stable/9/sys/i386/i386/pmap.c
==============================================================================
--- stable/9/sys/i386/i386/pmap.c	Thu Sep 20 15:53:55 2012	(r240753)
+++ stable/9/sys/i386/i386/pmap.c	Thu Sep 20 16:03:04 2012	(r240754)
@@ -5011,16 +5011,13 @@ pmap_mapbios(vm_paddr_t pa, vm_size_t si
 void
 pmap_unmapdev(vm_offset_t va, vm_size_t size)
 {
-	vm_offset_t base, offset, tmpva;
+	vm_offset_t base, offset;
 
 	if (va >= KERNBASE && va + size <= KERNBASE + KERNLOAD)
 		return;
 	base = trunc_page(va);
 	offset = va & PAGE_MASK;
 	size = roundup(offset + size, PAGE_SIZE);
-	for (tmpva = base; tmpva < (base + size); tmpva += PAGE_SIZE)
-		pmap_kremove(tmpva);
-	pmap_invalidate_range(kernel_pmap, va, tmpva);
 	kmem_free(kernel_map, base, size);
 }
 

Modified: stable/9/sys/i386/xen/pmap.c
==============================================================================
--- stable/9/sys/i386/xen/pmap.c	Thu Sep 20 15:53:55 2012	(r240753)
+++ stable/9/sys/i386/xen/pmap.c	Thu Sep 20 16:03:04 2012	(r240754)
@@ -3992,18 +3992,13 @@ pmap_mapbios(vm_paddr_t pa, vm_size_t si
 void
 pmap_unmapdev(vm_offset_t va, vm_size_t size)
 {
-	vm_offset_t base, offset, tmpva;
+	vm_offset_t base, offset;
 
 	if (va >= KERNBASE && va + size <= KERNBASE + KERNLOAD)
 		return;
 	base = trunc_page(va);
 	offset = va & PAGE_MASK;
 	size = roundup(offset + size, PAGE_SIZE);
-	critical_enter();
-	for (tmpva = base; tmpva < (base + size); tmpva += PAGE_SIZE)
-		pmap_kremove(tmpva);
-	pmap_invalidate_range(kernel_pmap, va, tmpva);
-	critical_exit();
 	kmem_free(kernel_map, base, size);
 }
 

Modified: stable/9/sys/mips/mips/pmap.c
==============================================================================
--- stable/9/sys/mips/mips/pmap.c	Thu Sep 20 15:53:55 2012	(r240753)
+++ stable/9/sys/mips/mips/pmap.c	Thu Sep 20 16:03:04 2012	(r240754)
@@ -837,10 +837,10 @@ pmap_kenter_attr(vm_offset_t va, vm_padd
 #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 | attr;
 
 	pte = pmap_pte(kernel_pmap, va);
 	opte = *pte;
+	npte = TLBLO_PA_TO_PFN(pa) | attr | PTE_D | PTE_V | PTE_G;
 	*pte = npte;
 	if (pte_test(&opte, PTE_V) && opte != npte)
 		pmap_update_page(kernel_pmap, va, npte);
@@ -2877,7 +2877,7 @@ void
 pmap_unmapdev(vm_offset_t va, vm_size_t size)
 {
 #ifndef __mips_n64
-	vm_offset_t base, offset, tmpva;
+	vm_offset_t base, offset;
 
 	/* If the address is within KSEG1 then there is nothing to do */
 	if (va >= MIPS_KSEG1_START && va <= MIPS_KSEG1_END)
@@ -2886,8 +2886,6 @@ pmap_unmapdev(vm_offset_t va, vm_size_t 
 	base = trunc_page(va);
 	offset = va & PAGE_MASK;
 	size = roundup(size + offset, PAGE_SIZE);
-	for (tmpva = base; tmpva < base + size; tmpva += PAGE_SIZE)
-		pmap_kremove(tmpva);
 	kmem_free(kernel_map, base, size);
 #endif
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201209201603.q8KG35nY048466>