Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 21 Dec 2012 17:58:14 -0700
From:      Ian Lepore <freebsd@damnhippie.dyndns.org>
To:        Hans Petter Selasky <hselasky@c2i.net>
Cc:        freebsd-arm@freebsd.org
Subject:   Re: Fwd: Re: EHCI on armv6 with Write-Back caches
Message-ID:  <1356137894.1198.454.camel@revolution.hippie.lan>
In-Reply-To: <201212210843.33147.hselasky@c2i.net>
References:  <201212201956.47884.hselasky@c2i.net> <50D3AAF1.80609@bluezbox.com>  <201212210843.33147.hselasky@c2i.net>

next in thread | previous in thread | raw e-mail | index | archive | help
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@c2i.net>
> > > To: Warner Losh <imp@bsdimp.com>
> > > CC: Andrew Turner <andrew@fubar.geek.nz>, Oleksandr Tymoshenko
> > > <gonzo@freebsd.org>, freebsd-usb@freebsd.org, alfred@freebsd.org,
> > > freebsd- wireless@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







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