diff options
author | cognet <cognet@FreeBSD.org> | 2009-02-09 18:03:31 +0000 |
---|---|---|
committer | cognet <cognet@FreeBSD.org> | 2009-02-09 18:03:31 +0000 |
commit | 80c343b215be744387082981af1857953d59caaa (patch) | |
tree | adfec8c0b329cd78c9ade68562452706b01e85a8 /sys/i386 | |
parent | b885a20f24ffe00abb3c58aabcb468b34ac7cd0b (diff) | |
download | FreeBSD-src-80c343b215be744387082981af1857953d59caaa.zip FreeBSD-src-80c343b215be744387082981af1857953d59caaa.tar.gz |
The bounce zone sees its page number increased if multiple dma maps use it in
the same dma tag. However, it can happen multiple dma tags share the same
bounce zone too, so add a per-bounce zone map counter, and check it instead of
the dma tag map counter, to know if we have to alloc more pages.
Reported by: miwi
Reviewed by: scottl
Diffstat (limited to 'sys/i386')
-rw-r--r-- | sys/i386/i386/busdma_machdep.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/sys/i386/i386/busdma_machdep.c b/sys/i386/i386/busdma_machdep.c index 04844f9..d4aa9b5 100644 --- a/sys/i386/i386/busdma_machdep.c +++ b/sys/i386/i386/busdma_machdep.c @@ -98,6 +98,7 @@ struct bounce_zone { int active_bpages; int total_bounced; int total_deferred; + int map_count; bus_size_t alignment; bus_size_t boundary; bus_addr_t lowaddr; @@ -431,7 +432,7 @@ bus_dmamap_create(bus_dma_tag_t dmat, int flags, bus_dmamap_t *mapp) else maxpages = MIN(MAX_BPAGES, Maxmem -atop(dmat->lowaddr)); if ((dmat->flags & BUS_DMA_MIN_ALLOC_COMP) == 0 - || (dmat->map_count > 0 && bz->total_bpages < maxpages)) { + || (bz->map_count > 0 && bz->total_bpages < maxpages)) { int pages; pages = MAX(atop(dmat->maxsize), 1); @@ -447,6 +448,7 @@ bus_dmamap_create(bus_dma_tag_t dmat, int flags, bus_dmamap_t *mapp) error = 0; } } + bz->map_count++; } else { *mapp = NULL; } @@ -470,6 +472,8 @@ bus_dmamap_destroy(bus_dma_tag_t dmat, bus_dmamap_t map) __func__, dmat, EBUSY); return (EBUSY); } + if (dmat->bounce_zone) + dmat->bounce_zone->map_count--; free(map, M_DEVBUF); } dmat->map_count--; @@ -1007,6 +1011,7 @@ alloc_bounce_zone(bus_dma_tag_t dmat) bz->lowaddr = dmat->lowaddr; bz->alignment = dmat->alignment; bz->boundary = dmat->boundary; + bz->map_count = 0; snprintf(bz->zoneid, 8, "zone%d", busdma_zonecount); busdma_zonecount++; snprintf(bz->lowaddrid, 18, "%#jx", (uintmax_t)bz->lowaddr); |