Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 25 Apr 2015 08:04:27 +0200
From:      Hans Petter Selasky <hps@selasky.org>
To:        Ian Lepore <ian@freebsd.org>, Svatopluk Kraus <onwahe@gmail.com>
Cc:        freebsd-current@freebsd.org
Subject:   Re: [patch] fix add_bounce_page() for BUS_DMA_KEEP_PG_OFFSET
Message-ID:  <553B2E6B.20406@selasky.org>
In-Reply-To: <553B2D56.1000405@selasky.org>
References:  <CAFHCsPVgYHL0OyMnn1b2DcNiQO-20k1aDvJNvFjwU21YxB29Cw@mail.gmail.com> <1429882188.1157.2.camel@freebsd.org> <553B2D56.1000405@selasky.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On 04/25/15 07:59, Hans Petter Selasky wrote:
> On 04/24/15 15:29, Ian Lepore wrote:
>> On Fri, 2015-04-24 at 13:34 +0200, Svatopluk Kraus wrote:
>>> The add_bounce_page() can be called from _bus_dmamap_load_phys().
>>> Client virtual address is zero (not valid) in that case. So, client
>>> physical address must be used to get an offset when
>>> BUS_DMA_KEEP_PG_OFFSET flag is set. Note that client physical address
>>> is always valid.
>>>
>>> Svatopluk Kraus
>>
>> The only user of BUS_DMA_KEEP_PG_OFFSET in the system is USB.  If the
>> flag didn't exist, we could do bouncing with a whole lot more
>> efficiency, at least in the ARM world.  I wonder if it would be possible
>> to just eliminate the flag (and of course, USB's need for it, which I
>> fully admit I don't understand even a little bit).
>>
>
> Hi,
>
> USB (EHCI/UHCI/OHCI) needs this flag when computing scatter/gather
> lists. Please ensure it works like expected. The good news is XHCI needs
> it less than the EHCI.
>
> Ian: The patch looks good - will you commit it?
>

The reason is that the EHCI/UHCI/OHCI doesn't have separate length 
fields for each data chunk and somtimes use the "0x1000 - (addr & 
0xFFF)" formula to compute how many bytes are left of a transfer when a 
transfer wraps around 0x1000. Thank you for you understanding this is 
not a USB problem in general.

--HPS




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?553B2E6B.20406>