Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 11 Mar 2010 21:16:54 +0000 (UTC)
From:      Rafal Jaworowski <raj@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r205028 - head/sys/arm/arm
Message-ID:  <201003112116.o2BLGslX031910@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: raj
Date: Thu Mar 11 21:16:54 2010
New Revision: 205028
URL: http://svn.freebsd.org/changeset/base/205028

Log:
  Fix ARM cache handling yet more.
  
  1) vm_machdep.c: remove the dangling allocations so they do not
     un-necessarily turn off the cache upon consecutive access.
  
  2) busdma_machdep.c: remove the same amount than shadow mapped.
  
  Reported by:	Maks Verver
  Submitted by:	Mark Tinguely
  Reviewed by:	Grzegorz Bernacki
  MFC after:	3 days

Modified:
  head/sys/arm/arm/busdma_machdep.c
  head/sys/arm/arm/vm_machdep.c

Modified: head/sys/arm/arm/busdma_machdep.c
==============================================================================
--- head/sys/arm/arm/busdma_machdep.c	Thu Mar 11 21:04:29 2010	(r205027)
+++ head/sys/arm/arm/busdma_machdep.c	Thu Mar 11 21:16:54 2010	(r205028)
@@ -649,7 +649,8 @@ bus_dmamem_free(bus_dma_tag_t dmat, void
 		KASSERT(map->allocbuffer == vaddr,
 		    ("Trying to freeing the wrong DMA buffer"));
 		vaddr = map->origbuffer;
-		arm_unmap_nocache(map->allocbuffer, dmat->maxsize);
+		arm_unmap_nocache(map->allocbuffer,
+		    dmat->maxsize + ((vm_offset_t)vaddr & PAGE_MASK));
 	}
         if (dmat->maxsize <= PAGE_SIZE &&
 	   dmat->alignment < dmat->maxsize &&

Modified: head/sys/arm/arm/vm_machdep.c
==============================================================================
--- head/sys/arm/arm/vm_machdep.c	Thu Mar 11 21:04:29 2010	(r205027)
+++ head/sys/arm/arm/vm_machdep.c	Thu Mar 11 21:16:54 2010	(r205028)
@@ -171,6 +171,9 @@ sf_buf_free(struct sf_buf *sf)
 	 if (sf->ref_count == 0) {
 		 TAILQ_INSERT_TAIL(&sf_buf_freelist, sf, free_entry);
 		 nsfbufsused--;
+		 pmap_kremove(sf->kva);
+		 sf->m = NULL;
+		 LIST_REMOVE(sf, list_entry);
 		 if (sf_buf_alloc_want > 0)
 			 wakeup_one(&sf_buf_freelist);
 	 }
@@ -502,9 +505,12 @@ arm_unmap_nocache(void *addr, vm_size_t 
 
 	size = round_page(size);
 	i = (raddr - arm_nocache_startaddr) / (PAGE_SIZE);
-	for (; size > 0; size -= PAGE_SIZE, i++)
+	for (; size > 0; size -= PAGE_SIZE, i++) {
 		arm_nocache_allocated[i / BITS_PER_INT] &= ~(1 << (i % 
 		    BITS_PER_INT));
+		pmap_kremove(raddr);
+		raddr += PAGE_SIZE;
+	}
 }
 
 #ifdef ARM_USE_SMALL_ALLOC



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