summaryrefslogtreecommitdiffstats
path: root/sys/arm
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2009-04-23 20:24:19 +0000
committerjhb <jhb@FreeBSD.org>2009-04-23 20:24:19 +0000
commit3ca2800ae4db8531b31eb052801d061025449202 (patch)
tree822eebc54a19f18b2df6fee943753f0126a09617 /sys/arm
parent2ce08798fb7a0029e369c277e5b9028c71b3d295 (diff)
downloadFreeBSD-src-3ca2800ae4db8531b31eb052801d061025449202.zip
FreeBSD-src-3ca2800ae4db8531b31eb052801d061025449202.tar.gz
Reduce the number of bounce zones (and thus the number of bounce pages
used in some cases): - Ignore DMA tag boundaries when allocating bounce pages. The boundaries don't determine whether or not parts of a DMA request bounce. Instead, they are just used to carve up segments. - Allow tags with sub-page alignment to share bounce pages since bounce pages are always page aligned. Reviewed by: scottl (amd64) MFC after: 1 month
Diffstat (limited to 'sys/arm')
-rw-r--r--sys/arm/arm/busdma_machdep.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/sys/arm/arm/busdma_machdep.c b/sys/arm/arm/busdma_machdep.c
index fb3afee..f35840e 100644
--- a/sys/arm/arm/busdma_machdep.c
+++ b/sys/arm/arm/busdma_machdep.c
@@ -114,7 +114,6 @@ struct bounce_zone {
int total_deferred;
int map_count;
bus_size_t alignment;
- bus_size_t boundary;
bus_addr_t lowaddr;
char zoneid[8];
char lowaddrid[20];
@@ -689,10 +688,10 @@ _bus_dmamap_count_pages(bus_dma_tag_t dmat, bus_dmamap_t map, pmap_t pmap,
vendaddr = (vm_offset_t)buf + buflen;
while (vaddr < vendaddr) {
- if (pmap != NULL)
- paddr = pmap_extract(pmap, vaddr);
- else
+ if (__predict_true(pmap == pmap_kernel()))
paddr = pmap_kextract(vaddr);
+ else
+ paddr = pmap_extract(pmap, vaddr);
if (((dmat->flags & BUS_DMA_COULD_BOUNCE) != 0) &&
run_filter(dmat, paddr) != 0)
map->pagesneeded++;
@@ -1267,7 +1266,6 @@ alloc_bounce_zone(bus_dma_tag_t dmat)
/* Check to see if we already have a suitable zone */
STAILQ_FOREACH(bz, &bounce_zone_list, links) {
if ((dmat->alignment <= bz->alignment)
- && (dmat->boundary <= bz->boundary)
&& (dmat->lowaddr >= bz->lowaddr)) {
dmat->bounce_zone = bz;
return (0);
@@ -1283,8 +1281,7 @@ alloc_bounce_zone(bus_dma_tag_t dmat)
bz->reserved_bpages = 0;
bz->active_bpages = 0;
bz->lowaddr = dmat->lowaddr;
- bz->alignment = dmat->alignment;
- bz->boundary = dmat->boundary;
+ bz->alignment = MAX(dmat->alignment, PAGE_SIZE);
bz->map_count = 0;
snprintf(bz->zoneid, 8, "zone%d", busdma_zonecount);
busdma_zonecount++;
@@ -1331,9 +1328,6 @@ alloc_bounce_zone(bus_dma_tag_t dmat)
SYSCTL_ADD_INT(busdma_sysctl_tree(bz),
SYSCTL_CHILDREN(busdma_sysctl_tree_top(bz)), OID_AUTO,
"alignment", CTLFLAG_RD, &bz->alignment, 0, "");
- SYSCTL_ADD_INT(busdma_sysctl_tree(bz),
- SYSCTL_CHILDREN(busdma_sysctl_tree_top(bz)), OID_AUTO,
- "boundary", CTLFLAG_RD, &bz->boundary, 0, "");
return (0);
}
@@ -1358,7 +1352,7 @@ alloc_bounce_pages(bus_dma_tag_t dmat, u_int numpages)
M_NOWAIT, 0ul,
bz->lowaddr,
PAGE_SIZE,
- bz->boundary);
+ 0);
if (bpage->vaddr == 0) {
free(bpage, M_DEVBUF);
break;
OpenPOWER on IntegriCloud