Fwd: Re: EHCI on armv6 with Write-Back caches

Ian Lepore freebsd at damnhippie.dyndns.org
Sat Dec 22 00:58:25 UTC 2012


On Fri, 2012-12-21 at 08:43 +0100, Hans Petter Selasky wrote:
> On Friday 21 December 2012 01:18:57 Oleksandr Tymoshenko wrote:
> > On 12/20/2012 10:56 AM, Hans Petter Selasky wrote:
> > > FYI - please test!
> > > 
> > > ----------  Forwarded Message  ----------
> > > 
> > > Subject: Re: EHCI on armv6 with Write-Back caches
> > > Date: Thursday 20 December 2012, 19:46:34
> > > From: Hans Petter Selasky <hselasky at c2i.net>
> > > To: Warner Losh <imp at bsdimp.com>
> > > CC: Andrew Turner <andrew at fubar.geek.nz>, Oleksandr Tymoshenko
> > > <gonzo at freebsd.org>, freebsd-usb at freebsd.org, alfred at freebsd.org,
> > > freebsd- wireless at freebsd.org
> > > 
> > > Hi,
> > > 
> > > I've run some basic tests over here (x86) which passed after some patch
> > > modifications. Please test and verify for your ARM targets:
> > > 
> > > http://svnweb.freebsd.org/changeset/base/244500
> > > http://svnweb.freebsd.org/changeset/base/244503
> > > 
> > > Please also verify that upgt and uwrt and uath still works like expected.
> > > 
> > > --HPS
> > 
> > if_smsc fails with following diagnostics:
> > smsc0: error: allocating USB transfers failed
> > 
> > The problem is that Bulk-In transfer buffer is 5 pages long but tag's
> > boundary limitation is
> > a page and it's impossible to allocate 5 pages without crossing page
> > boundary
> 
> Hi,
> 
> In the tag "nsegments" is 2 + size/PAGE_SIZE, so this is a bug in busdma!
> 
> The boundary only tells where the segments should be split.

I think you're right.  It looks like the arm busdma implemenation would
try (and fail) to allocate multiple pages that don't cross a page
boundary instead of allocating what I think your tags ask for if I'm
reading the usb code correctly: a collection of segments that are each a
maximum of one page long and don't cross a page boundary.  

When I reworked the arm allocation logic I closely modeled it after what
jhb@ recently did to the x86 busdma; it looks like it would behave the
same.  The powerpc and mips implementations look more like the historic
arm code, and look like they would get it wrong using different logic.

The manpage says that the tag passed to bus_dmamem_alloc() contains the
mapping (not the allocation) constraints.  It also says that all
allocations are done as a single segment -- a statement I've always
considered to be just out of date, not as establishing part of the usage
contract for the function.

The question now is whether the code can always do the right thing with
every possible combination of memattr, alignment, exclusion window,
numsegs, maxsegsize, and boundary.  Maybe that's why the manpage doesn't
explicitly nail down the requirement to honor the tag for allocation.

-- Ian






More information about the freebsd-arm mailing list