Fix a coherent bus check in the arm64 busdma
In the arm64 busdma we have an internal flag to signal when a tag is for a cache-coherent device. In this case we don't need to adjust the size and alignment of allocated buffers to be within a cache line. The cache line adjustment was incorrectly using the coherent flag passed in to bus_dma_tag_create and not the internal flag. Fix it to use the latter to reduce the memory usage slightly. Reviewed by: bz Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D34763
This commit is contained in:
parent
bcd763b642
commit
3532bcd282
@ -228,6 +228,18 @@ bounce_bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t alignment,
|
||||
|
||||
if ((flags & BUS_DMA_COHERENT) != 0) {
|
||||
newtag->bounce_flags |= BF_COHERENT;
|
||||
}
|
||||
|
||||
if (parent != NULL) {
|
||||
if ((newtag->common.filter != NULL ||
|
||||
(parent->bounce_flags & BF_COULD_BOUNCE) != 0))
|
||||
newtag->bounce_flags |= BF_COULD_BOUNCE;
|
||||
|
||||
/* Copy some flags from the parent */
|
||||
newtag->bounce_flags |= parent->bounce_flags & BF_COHERENT;
|
||||
}
|
||||
|
||||
if ((newtag->bounce_flags & BF_COHERENT) != 0) {
|
||||
newtag->alloc_alignment = newtag->common.alignment;
|
||||
newtag->alloc_size = newtag->common.maxsize;
|
||||
} else {
|
||||
@ -243,15 +255,6 @@ bounce_bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t alignment,
|
||||
dcache_line_size);
|
||||
}
|
||||
|
||||
if (parent != NULL) {
|
||||
if ((newtag->common.filter != NULL ||
|
||||
(parent->bounce_flags & BF_COULD_BOUNCE) != 0))
|
||||
newtag->bounce_flags |= BF_COULD_BOUNCE;
|
||||
|
||||
/* Copy some flags from the parent */
|
||||
newtag->bounce_flags |= parent->bounce_flags & BF_COHERENT;
|
||||
}
|
||||
|
||||
if (newtag->common.lowaddr < ptoa((vm_paddr_t)Maxmem) ||
|
||||
newtag->common.alignment > 1)
|
||||
newtag->bounce_flags |= BF_COULD_BOUNCE;
|
||||
|
Loading…
x
Reference in New Issue
Block a user