svn commit: r350819 - stable/12/sys/arm/arm
Michal Meloun
mmel at FreeBSD.org
Fri Aug 9 10:28:21 UTC 2019
Author: mmel
Date: Fri Aug 9 10:28:20 2019
New Revision: 350819
URL: https://svnweb.freebsd.org/changeset/base/350819
Log:
MFC r343962,r343965:
r343962:
Properly handle alignment requests bigger that page size.
- for now, alignments bigger that page size is allowed only for buffers
allocated by bus_dmamem_alloc(), cover this fact by KASSERT.
- never bounce buffers allocated by bus_dmamem_alloc(), these always
comply
with the required rules (alignment, boundary, address range).
r343965:
Fix bug introduced by r343962. DMAMAP_DMAMEM_ALLOC is property of dmamap,
not dmatag.
Modified:
stable/12/sys/arm/arm/busdma_machdep-v6.c
Directory Properties:
stable/12/ (props changed)
Modified: stable/12/sys/arm/arm/busdma_machdep-v6.c
==============================================================================
--- stable/12/sys/arm/arm/busdma_machdep-v6.c Fri Aug 9 10:00:11 2019 (r350818)
+++ stable/12/sys/arm/arm/busdma_machdep-v6.c Fri Aug 9 10:28:20 2019 (r350819)
@@ -339,16 +339,27 @@ cacheline_bounce(bus_dmamap_t map, bus_addr_t addr, bu
*
* Note that the addr argument might be either virtual or physical. It doesn't
* matter because we only look at the low-order bits, which are the same in both
- * address spaces.
+ * address spaces and maximum alignment of generic buffer is limited up to page
+ * size.
+ * Bouncing of buffers allocated by bus_dmamem_alloc()is not necessary, these
+ * always comply with the required rules (alignment, boundary, and address
+ * range).
*/
static __inline int
might_bounce(bus_dma_tag_t dmat, bus_dmamap_t map, bus_addr_t addr,
bus_size_t size)
{
- return ((dmat->flags & BUS_DMA_EXCL_BOUNCE) ||
+ KASSERT(map->flags & DMAMAP_DMAMEM_ALLOC ||
+ dmat->alignment <= PAGE_SIZE,
+ ("%s: unsupported alignment (0x%08lx) for buffer not "
+ "allocated by bus_dmamem_alloc()",
+ __func__, dmat->alignment));
+
+ return (!(map->flags & DMAMAP_DMAMEM_ALLOC) &&
+ ((dmat->flags & BUS_DMA_EXCL_BOUNCE) ||
alignment_bounce(dmat, addr) ||
- cacheline_bounce(map, addr, size));
+ cacheline_bounce(map, addr, size)));
}
/*
More information about the svn-src-stable
mailing list