Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 5 May 2009 09:08:37 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
Subject:   svn commit: r191809 - in stable/7/sys: . amd64/amd64 arm/arm contrib/pf dev/ath/ath_hal dev/cxgb i386/i386 ia64/ia64
Message-ID:  <200905050908.n4598bHc072718@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Tue May  5 09:08:37 2009
New Revision: 191809
URL: http://svn.freebsd.org/changeset/base/191809

Log:
  MFC r191011:
  The bus_dmamap_load_uio(9) shall use pmap of the thread recorded in the
  uio_td to extract pages from, instead of unconditionally use kernel
  pmap.

Modified:
  stable/7/sys/   (props changed)
  stable/7/sys/amd64/amd64/busdma_machdep.c
  stable/7/sys/arm/arm/busdma_machdep.c
  stable/7/sys/contrib/pf/   (props changed)
  stable/7/sys/dev/ath/ath_hal/   (props changed)
  stable/7/sys/dev/cxgb/   (props changed)
  stable/7/sys/i386/i386/busdma_machdep.c
  stable/7/sys/ia64/ia64/busdma_machdep.c

Modified: stable/7/sys/amd64/amd64/busdma_machdep.c
==============================================================================
--- stable/7/sys/amd64/amd64/busdma_machdep.c	Tue May  5 08:30:38 2009	(r191808)
+++ stable/7/sys/amd64/amd64/busdma_machdep.c	Tue May  5 09:08:37 2009	(r191809)
@@ -602,7 +602,10 @@ _bus_dmamap_load_buffer(bus_dma_tag_t dm
 		vendaddr = (vm_offset_t)buf + buflen;
 
 		while (vaddr < vendaddr) {
-			paddr = pmap_kextract(vaddr);
+			if (pmap)
+				paddr = pmap_extract(pmap, vaddr);
+			else
+				paddr = pmap_kextract(vaddr);
 			if (run_filter(dmat, paddr) != 0)
 				map->pagesneeded++;
 			vaddr += PAGE_SIZE;

Modified: stable/7/sys/arm/arm/busdma_machdep.c
==============================================================================
--- stable/7/sys/arm/arm/busdma_machdep.c	Tue May  5 08:30:38 2009	(r191808)
+++ stable/7/sys/arm/arm/busdma_machdep.c	Tue May  5 09:08:37 2009	(r191809)
@@ -663,8 +663,8 @@ bus_dmamem_free(bus_dma_tag_t dmat, void
 }
 
 static int
-_bus_dmamap_count_pages(bus_dma_tag_t dmat, bus_dmamap_t map, void *buf,
-			bus_size_t buflen, int flags)
+_bus_dmamap_count_pages(bus_dma_tag_t dmat, bus_dmamap_t map, pmap_t pmap,
+    void *buf, bus_size_t buflen, int flags)
 {
 	vm_offset_t vaddr;
 	vm_offset_t vendaddr;
@@ -683,7 +683,10 @@ _bus_dmamap_count_pages(bus_dma_tag_t dm
 		vendaddr = (vm_offset_t)buf + buflen;
 
 		while (vaddr < vendaddr) {
-			paddr = pmap_kextract(vaddr);
+			if (pmap != NULL)
+				paddr = pmap_extract(pmap, vaddr);
+			else
+				paddr = pmap_kextract(vaddr);
 			if (((dmat->flags & BUS_DMA_COULD_BOUNCE) != 0) &&
 			    run_filter(dmat, paddr) != 0)
 				map->pagesneeded++;
@@ -739,7 +742,8 @@ bus_dmamap_load_buffer(bus_dma_tag_t dma
 	bmask = ~(dmat->boundary - 1);
 
 	if ((dmat->flags & BUS_DMA_COULD_BOUNCE) != 0) {
-		error = _bus_dmamap_count_pages(dmat, map, buf, buflen, flags);
+		error = _bus_dmamap_count_pages(dmat, map, pmap, buf, buflen,
+		    flags);
 		if (error)
 			return (error);
 	}

Modified: stable/7/sys/i386/i386/busdma_machdep.c
==============================================================================
--- stable/7/sys/i386/i386/busdma_machdep.c	Tue May  5 08:30:38 2009	(r191808)
+++ stable/7/sys/i386/i386/busdma_machdep.c	Tue May  5 09:08:37 2009	(r191809)
@@ -141,8 +141,8 @@ static bus_addr_t add_bounce_page(bus_dm
 				   vm_offset_t vaddr, bus_size_t size);
 static void free_bounce_page(bus_dma_tag_t dmat, struct bounce_page *bpage);
 int run_filter(bus_dma_tag_t dmat, bus_addr_t paddr);
-int _bus_dmamap_count_pages(bus_dma_tag_t dmat, bus_dmamap_t map, void *buf,
-			    bus_size_t buflen, int flags);
+int _bus_dmamap_count_pages(bus_dma_tag_t dmat, bus_dmamap_t map, pmap_t pmap,
+    void *buf, bus_size_t buflen, int flags);
 
 /*
  * Return true if a match is made.
@@ -568,8 +568,8 @@ bus_dmamem_free(bus_dma_tag_t dmat, void
 }
 
 int
-_bus_dmamap_count_pages(bus_dma_tag_t dmat, bus_dmamap_t map, void *buf,
-			bus_size_t buflen, int flags)
+_bus_dmamap_count_pages(bus_dma_tag_t dmat, bus_dmamap_t map, pmap_t pmap,
+    void *buf, bus_size_t buflen, int flags)
 {
 	vm_offset_t vaddr;
 	vm_offset_t vendaddr;
@@ -589,7 +589,10 @@ _bus_dmamap_count_pages(bus_dma_tag_t dm
 		vendaddr = (vm_offset_t)buf + buflen;
 
 		while (vaddr < vendaddr) {
-			paddr = pmap_kextract(vaddr);
+			if (pmap)
+				paddr = pmap_extract(pmap, vaddr);
+			else
+				paddr = pmap_kextract(vaddr);
 			if (((dmat->flags & BUS_DMA_COULD_BOUNCE) != 0) &&
 			    run_filter(dmat, paddr) != 0) {
 				map->pagesneeded++;
@@ -651,7 +654,7 @@ _bus_dmamap_load_buffer(bus_dma_tag_t dm
 		map = &nobounce_dmamap;
 
 	if ((dmat->flags & BUS_DMA_COULD_BOUNCE) != 0) {
-		error = _bus_dmamap_count_pages(dmat, map, buf, buflen, flags);
+		error = _bus_dmamap_count_pages(dmat, map, pmap, buf, buflen, flags);
 		if (error)
 			return (error);
 	}

Modified: stable/7/sys/ia64/ia64/busdma_machdep.c
==============================================================================
--- stable/7/sys/ia64/ia64/busdma_machdep.c	Tue May  5 08:30:38 2009	(r191808)
+++ stable/7/sys/ia64/ia64/busdma_machdep.c	Tue May  5 09:08:37 2009	(r191809)
@@ -527,7 +527,10 @@ _bus_dmamap_load_buffer(bus_dma_tag_t dm
 		vendaddr = (vm_offset_t)buf + buflen;
 
 		while (vaddr < vendaddr) {
-			paddr = pmap_kextract(vaddr);
+			if (pmap != NULL)
+				paddr = pmap_extract(pmap, vaddr);
+			else
+				paddr = pmap_kextract(vaddr);
 			if (run_filter(dmat, paddr, 0) != 0)
 				map->pagesneeded++;
 			vaddr += PAGE_SIZE;



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