]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/commit
MFC r289618, r290316:
authorian <ian@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Sun, 24 Jan 2016 19:21:53 +0000 (19:21 +0000)
committerian <ian@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Sun, 24 Jan 2016 19:21:53 +0000 (19:21 +0000)
commita8ccc142dea61bfa25c6ae8fa6839be577e74c74
treef942af14f01fe26be62f9e0538420a01c60aab8e
parent4bedf2664ebd6a35ed1d4a1ed5499305cbb0c262
MFC r289618, r290316:

  Fix printf format to allow for bus_size_t not being u_long on all platforms.

  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.

git-svn-id: svn://svn.freebsd.org/base/stable/10@294677 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
sys/kern/subr_busdma_bufalloc.c
sys/powerpc/powerpc/busdma_machdep.c
sys/sparc64/sparc64/bus_machdep.c
sys/x86/x86/busdma_bounce.c