[Midnightbsd-cvs] src [8181] trunk/sys/x86/x86/busdma_machdep.c: Allow static DMA allocations that allow for enough segments to do page-sized
laffer1 at midnightbsd.org
laffer1 at midnightbsd.org
Fri Sep 16 22:51:42 EDT 2016
Revision: 8181
http://svnweb.midnightbsd.org/src/?rev=8181
Author: laffer1
Date: 2016-09-16 22:51:41 -0400 (Fri, 16 Sep 2016)
Log Message:
-----------
Allow static DMA allocations that allow for enough segments to do page-sized
segments for the entire allocation to use kmem_alloc_attr() to allocate
KVM rather than using kmem_alloc_contig(). This avoids requiring
a single physically contiguous chunk in this case.
Modified Paths:
--------------
trunk/sys/x86/x86/busdma_machdep.c
Modified: trunk/sys/x86/x86/busdma_machdep.c
===================================================================
--- trunk/sys/x86/x86/busdma_machdep.c 2016-09-17 02:50:30 UTC (rev 8180)
+++ trunk/sys/x86/x86/busdma_machdep.c 2016-09-17 02:51:41 UTC (rev 8181)
@@ -541,13 +541,14 @@
dmat->lowaddr >= ptoa((vm_paddr_t)Maxmem) &&
attr == VM_MEMATTR_DEFAULT) {
*vaddr = malloc(dmat->maxsize, M_DEVBUF, mflags);
+ } else if (dmat->nsegments >= btoc(dmat->maxsize) &&
+ dmat->alignment <= PAGE_SIZE &&
+ (dmat->boundary == 0 || dmat->boundary >= dmat->lowaddr)) {
+ /* Page-based multi-segment allocations allowed */
+ *vaddr = (void *)kmem_alloc_attr(kernel_map, dmat->maxsize,
+ mflags, 0ul, dmat->lowaddr, attr);
+ *mapp = &contig_dmamap;
} else {
- /*
- * XXX Use Contigmalloc until it is merged into this facility
- * and handles multi-seg allocations. Nobody is doing
- * multi-seg allocations yet though.
- * XXX Certain AGP hardware does.
- */
*vaddr = (void *)kmem_alloc_contig(kernel_map, dmat->maxsize,
mflags, 0ul, dmat->lowaddr, dmat->alignment ?
dmat->alignment : 1ul, dmat->boundary, attr);
More information about the Midnightbsd-cvs
mailing list