Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 26 Apr 2015 22:08:31 +0200
From:      Svatopluk Kraus <onwahe@gmail.com>
To:        Konstantin Belousov <kostikbel@gmail.com>
Cc:        Jason Harmening <jason.harmening@gmail.com>, FreeBSD Arch <freebsd-arch@freebsd.org>
Subject:   Re: bus_dmamap_sync() for bounced client buffers from user address space
Message-ID:  <CAFHCsPVnkuhEQkFFOS3_RvBs=1LZwCbAKGRAuatQJ0Xo5bWeww@mail.gmail.com>
In-Reply-To: <20150425172833.GM2390@kib.kiev.ua>
References:  <CAFHCsPXMjge84AR2cR8KXMXWP4kH2YvuV_uqtPKUvn5C3ygknw@mail.gmail.com> <CAM=8qan-4SbKJaddrfkv=HG3n%2BHaOPDL5MEPS9DoaTvnhrJPZQ@mail.gmail.com> <20150425094152.GE2390@kib.kiev.ua> <553B9E64.8030907@gmail.com> <20150425163444.GL2390@kib.kiev.ua> <553BC9D1.1070502@gmail.com> <20150425172833.GM2390@kib.kiev.ua>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, Apr 25, 2015 at 7:28 PM, Konstantin Belousov
<kostikbel@gmail.com> wrote:
> On Sat, Apr 25, 2015 at 12:07:29PM -0500, Jason Harmening wrote:
>>
>> On 04/25/15 11:34, Konstantin Belousov wrote:
>> > I believe UIO_USERSPACE is almost unused, it might be there for some
>> > obscure (and buggy) driver.
>> It may be nearly unused, but we still document it in busdma.9, and we
>> still explicitly check for it when setting the pmap in
>> _bus_dmamap_load_uio.  If it's not safe to use, then it's not OK for us
>> to do that.
>> We need to either a) remove support for it by adding a failure/KASSERT
>> on UIO_USERSPACE in _busdmamap_load_uio() and remove the paragraph on it
>> from busdma.9, or b) make it safe.
>>
>> I'd be in favor of b), because I think it is still valid to support some
>> non-painful way of using DMA with userspace buffers.  Right now, the
>> only safe way to do that seems to be:
>> 1) vm_fault_quick_hold_pages
>> 2) kva_alloc
>> 3) pmap_qenter
>> 4) bus_dmamap_load
> 1. vm_fault_quick_hold
> 2. bus_dmamap_load_ma
>
>>
>> That seems both unnecessarily complex and wasteful of KVA space.
>>
> The above sequence does not need a KVA allocation.
>
>

But if the buffer bounces, then some KVA must be allocated temporarily
for physcopyin/physcopyout.

FYI, we are in the following situation in ARM arch. (1) The DMA in not
cache coherent, and (2) cache maintainance operations are done on
virtual addresses. It means that cache maintainance must be done for
cached memory. Moreover, it must be done even for unmapped buffers and
they must be mapped for that.

Thus it could be of much help if we can used UVA for that if context is correct.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAFHCsPVnkuhEQkFFOS3_RvBs=1LZwCbAKGRAuatQJ0Xo5bWeww>