Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 14 Nov 2008 16:44:55 +0100
From:      Hans Petter Selasky <hselasky@c2i.net>
To:        Alexander Motin <mav@freebsd.org>
Cc:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   Re: PERFORCE change 152649 for review - busdma problem
Message-ID:  <200811141644.55773.hselasky@c2i.net>
In-Reply-To: <491D8282.5060506@FreeBSD.org>
References:  <200811080910.mA89AgTZ048172@repoman.freebsd.org> <200811140915.18846.hselasky@c2i.net> <491D8282.5060506@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Hi,

On Friday 14 November 2008, Alexander Motin wrote:
> Hi.
>
> Hans Petter Selasky wrote:
> > I am going to revert this patch and suggest a new one. I am not sure how
> > to best implement it, but will it be Ok if I make the offset adjustment
> > only for alignment <= 1 byte ?
>
> Alignment <= 1 byte means no (any possible) alignment. So busdma may use
> any physical address within permitted range. Adding strict requirement
> that this address should be aligned withing page same as logical address
> will IMHO be too restrictive and as I understand will lead to additional
> physical memory consumption.

No, it won't.

>
> I am not very understand the problem and how are you going to manage it.
> As I understand, the problem is that you can specify offset for
> non-first scatter/gather segment only as page address. Is it correct? 

Yes.

> So 
> which in-page offset used for that segments? If zero, you should just
> specify busdma to align all segments to the page boundary. 

The thing is, you cannot specify how many bytes are on the first page which 
can take a full physical address. It is assumed that after the page offset 
wraps to zero a new page begins.

Example:

xxx: means data

Virtual memory:
  PG0  PG1
| xxx|xxx |

In busdma bounce buffer:

  PG0  PG1
|xxx |xxx |

You see there is a hole just before PG1, and it is impossible to tell the USB 
hardware to skip this hole.

> If it should 
> be the same as after the last sent data, then I can hardly imagine how
> are you going to manage this to implement real scatter/gather for
> misaligned data.
>
> > Is there any documentation or specification that needs to be updated?
>
> Sorry, I am not a busdma expert, I was just digging it several times
> while working on some drivers.

Thanks for your comment about alignment! I didn't see that in the first place.

--HPS



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