freebsd-skq/sys/x86
royger 8877774b9d x86/dma_bounce: rework _bus_dmamap_load_ma implementation
The implementation of bus_dmamap_load_ma_triv currently calls
_bus_dmamap_load_phys on each page that is part of the passed in buffer.
Since each page is treated as an individual buffer, the resulting behaviour
is different from the behaviour of _bus_dmamap_load_buffer. This breaks
certain drivers, like Xen blkfront.

If an unmapped buffer of size 4096 that starts at offset 13 into the first
page is passed to the current _bus_dmamap_load_ma implementation (so the ma
array contains two pages), the result is that two segments are created, one
with a size of 4083 and the other with size 13 (because two independant
calls to _bus_dmamap_load_phys are performed, one for each physical page).
If the same is done with a mapped buffer and calling _bus_dmamap_load_buffer
the result is that only one segment is created, with a size of 4096.

This patch relegates the usage of bus_dmamap_load_ma_triv in x86 bounce
buffer code to drivers requesting BUS_DMA_KEEP_PG_OFFSET and implements
_bus_dmamap_load_ma so that it's behaviour is the same as the mapped version
(_bus_dmamap_load_buffer). This patch only modifies the x86 bounce buffer
code, other arches are left untouched.

Sponsored by:		Citrix Systems R&D
Reviewed by:		kib, jah (previous version)
MFC after:		2 weeks
Differential Revision:	https://reviews.freebsd.org/D888
2015-11-09 12:19:58 +00:00
..
acpica Add ASUS Sandybridge laptops to the similar x2apic disable logic 2015-09-16 01:44:11 +00:00
bios Add missing header needed by free(9). 2012-09-30 15:42:20 +00:00
cpufreq Pull in r267961 and r267973 again. Fix for issues reported will follow. 2014-06-28 03:56:17 +00:00
include xen: Code cleanup and small bug fixes 2015-10-21 10:44:07 +00:00
iommu dmar_ctx_dtr() does not exist since r284869. Remove the static function 2015-09-22 16:50:59 +00:00
isa Set the initial system time to a sane (as in: not end of 21st century) value when 2015-06-29 17:02:09 +00:00
pci Add domain support to PCI bus allocation 2015-09-16 23:34:51 +00:00
x86 x86/dma_bounce: rework _bus_dmamap_load_ma implementation 2015-11-09 12:19:58 +00:00
xen xen/intr: fix the event channel enabled per-cpu mask 2015-11-05 14:33:46 +00:00