tech-kern archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: bus_dmamap_sync: bug?
max%m00nbsd.net@localhost (Maxime Villard) writes:
>Seems to me there is a bug in x86's bus_dmamap_sync(). When the DMA buffer
>is an UIO, and we bounce, the 'offset' argument is not taken into account
>properly.
>We should do
> copy uio+off into bouncebuf+off
>but we do
> copy uio+0 into bouncebuf+off
>A quick glance shows that other architectures have the same problem, like
>ARM32's _bus_dma_uiomove().
Yes, uio and offset != 0 doesn't work. The function is modelled after
uiomove() which doesn't support offsets into the scatter/gather buffers.
We can either change bus_dma_uiomove to take an extra offset
argument and calculate the beginning of the transfer, or assert
that uio DMA buffers aren't used with an offset != 0.
N.B. the uio->uio_offset field tracks position of the scatter/gather
buffers in a larger object and corresponds to uio->uio_iov[0]->iov_base.
The real uiomove() adjusts it to reflect the completed I/O operation,
for bus_dma_uiomove() it has no meaning.
--
--
Michael van Elst
Internet: mlelstv%serpens.de@localhost
"A potential Snark may lurk in every tree."
Home |
Main Index |
Thread Index |
Old Index