freebsd-dev/sys/sparc64
Ian Lepore 53f93ed3ff Fix an alignment check that is wrong in half the busdma implementations.
This will enable the elimination of a workaround in the USB driver that
artifically allocates buffers twice as big as they need to be (which
actually saves memory for very small buffers on the buggy platforms).

When deciding how to allocate a dma buffer, armv4, armv6, mips, and
x86/iommu all correctly check for the tag alignment <= maxsize as enabling
simple uma/malloc based allocation.  Powerpc, sparc64, x86/bounce, and
arm64/bounce were all checking for alignment < maxsize; on those platforms
when alignment was equal to the max size it would fall back to page-based
allocators even for very small buffers.

This change makes all platforms use the <= check.  It should be noted that
on all platforms other than arm[v6] and mips, this check is relying on
undocumented behavior in malloc(9) that if you allocate a block of a given
size it will be aligned to the next larger power-of-2 boundary.  There is
nothing in the malloc(9) man page that makes that explicit promise (but the
busdma code has been relying on this behavior all along so I guess it works).

Arm and mips code uses the allocator in kern/subr_busdma_buffalloc.c, which
does explicitly implement this promise about size and alignment.  Other
platforms probably should switch to the aligned allocator.
2015-11-02 23:37:19 +00:00
..
central
conf Spell crypto correctly. 2015-07-14 10:47:56 +00:00
ebus - Sanity check that the parent ranges given in the "ranges" property 2015-09-13 21:59:56 +00:00
fhc
include Merge r286374 from x86: 2015-09-13 00:08:04 +00:00
isa Remove more superfluous const specifiers. 2014-02-23 18:36:45 +00:00
pci - Factor out the common and generic parts of the sparc64 host-PCI-bridge 2015-09-12 22:49:32 +00:00
sbus Move the implementation of bus_space_barrier(9) to the inline function in 2013-10-24 17:06:41 +00:00
sparc64 Fix an alignment check that is wrong in half the busdma implementations. 2015-11-02 23:37:19 +00:00