Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 20 Jul 2009 07:53:07 +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: r195779 - head/sys/arm/arm
Message-ID:  <200907200753.n6K7r7gb070133@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: raj
Date: Mon Jul 20 07:53:07 2009
New Revision: 195779
URL: http://svn.freebsd.org/changeset/base/195779

Log:
  ARM pmap fixes.
  
  a)  nocache-remap problem
  
     When a page is remapped into a non-cacheable virtual memory region there
     was no associated write-back invalidate operation performed. We remove
     writeback of the original buffer size from bus_dmamem_alloc() and add
     appropriate L1/L2 flush operation.
  
  b) missing write-back invalidate operation
  
     In pmap_kremove a page is removed so we must do a write-back
     invalidate operation aligned to the page virtual address.
  
  Submitted by:	Michal Hajduk
  Reviewed by:	Mark Tinguely, rpaulo, stas
  Approved by:	re (kib)
  Obtained from:	Semihalf

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

Modified: head/sys/arm/arm/busdma_machdep.c
==============================================================================
--- head/sys/arm/arm/busdma_machdep.c	Mon Jul 20 07:50:50 2009	(r195778)
+++ head/sys/arm/arm/busdma_machdep.c	Mon Jul 20 07:53:07 2009	(r195779)
@@ -630,10 +630,6 @@ bus_dmamem_alloc(bus_dma_tag_t dmat, voi
 			    ((vm_offset_t)*vaddr & PAGE_MASK));
 			newmap->origbuffer = *vaddr;
 			newmap->allocbuffer = tmpaddr;
-			cpu_idcache_wbinv_range((vm_offset_t)*vaddr, 
-			    dmat->maxsize);
-			cpu_l2cache_wbinv_range((vm_offset_t)*vaddr,
-			    dmat->maxsize);
 			*vaddr = tmpaddr;
 		} else
 			newmap->origbuffer = newmap->allocbuffer = NULL;

Modified: head/sys/arm/arm/pmap.c
==============================================================================
--- head/sys/arm/arm/pmap.c	Mon Jul 20 07:50:50 2009	(r195778)
+++ head/sys/arm/arm/pmap.c	Mon Jul 20 07:53:07 2009	(r195779)
@@ -2984,6 +2984,7 @@ pmap_kremove(vm_offset_t va)
 			pmap_free_pv_entry(pve); 
 		PMAP_UNLOCK(pmap_kernel());
 		vm_page_unlock_queues();
+		va = va & ~PAGE_MASK;
 		cpu_dcache_wbinv_range(va, PAGE_SIZE);
 		cpu_l2cache_wbinv_range(va, PAGE_SIZE);
 		cpu_tlb_flushD_SE(va);

Modified: head/sys/arm/arm/vm_machdep.c
==============================================================================
--- head/sys/arm/arm/vm_machdep.c	Mon Jul 20 07:50:50 2009	(r195778)
+++ head/sys/arm/arm/vm_machdep.c	Mon Jul 20 07:53:07 2009	(r195779)
@@ -426,10 +426,15 @@ arm_remap_nocache(void *addr, vm_size_t 
 		vm_offset_t tomap = arm_nocache_startaddr + i * PAGE_SIZE;
 		void *ret = (void *)tomap;
 		vm_paddr_t physaddr = vtophys((vm_offset_t)addr);
+		vm_offset_t vaddr = (vm_offset_t) addr;
 		
+		vaddr = vaddr & ~PAGE_MASK;
 		for (; tomap < (vm_offset_t)ret + size; tomap += PAGE_SIZE,
-		    physaddr += PAGE_SIZE, i++) {
+		    vaddr += PAGE_SIZE, physaddr += PAGE_SIZE, i++) {
+			cpu_idcache_wbinv_range(vaddr, PAGE_SIZE);
+			cpu_l2cache_wbinv_range(vaddr, PAGE_SIZE);
 			pmap_kenter_nocache(tomap, physaddr);
+			cpu_tlb_flushID_SE(vaddr);
 			arm_nocache_allocated[i / BITS_PER_INT] |= 1 << (i % 
 			    BITS_PER_INT);
 		}



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